Stebalien / xattr

Extended attribute library for rust.
Apache License 2.0
58 stars 19 forks source link

Port to use rustix #40

Closed notgull closed 10 months ago

notgull commented 10 months ago

rustix is a safe wrapper around raw system calls on Linux and libc on other platforms. It supports I/O safety out of the box, and using raw system calls makes it faster than libc in many cases. It would be nice if this crate could use rustix.

I can write a PR for this; however since this crate uses AsRawFd instead of AsFd it would be a breaking change. Let me know if this is desired/

Stebalien commented 10 months ago

It should be possible without a breaking change. Basically:

  1. Call self.as_raw_fd().
  2. Call BorrowedFd::borrow_raw(my_fd).
  3. Pass the BorrowedFd into the rustix function (it implements AsFd).

I'd like to consider reworking the extension trait anyways, but that's a larger change.

Stebalien commented 10 months ago

So yes, I'd be interested if you can make it a non-breaking change. Otherwise, I'll still consider it, but I'd probably want to take the chance to make other braking changes at the same time.