Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fcntl: Adding F_TRANSFEREXTENTS fcntl constant for macOs. #2504

Merged
merged 1 commit into from
Nov 18, 2024

Conversation

devnexen
Copy link
Contributor

No description provided.

Copy link
Member

@SteveLauC SteveLauC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, let's wait for that libc PR, though Nix currently uses libc from branch libc-0.2, not main.

/// The other file is specified via a file descriptor as the lone extra argument.
/// Both descriptors must reference regular files in the same volume.
#[cfg(apple_targets)]
F_TRANSFEREXTENTS(RawFd),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, just realized that I missed this type when added I/O safety to this module. 😵‍💫

@devnexen
Copy link
Contributor Author

Yes I planned to keep it as draft as long as it takes :)

@SteveLauC
Copy link
Member

Yes I planned to keep it as draft as long as it takes :)

That's totally fine:)

src/fcntl.rs Outdated
@@ -952,6 +958,12 @@ pub fn fcntl<Fd: std::os::fd::AsFd>(fd: Fd, arg: FcntlArg) -> Result<c_int> {
F_PREALLOCATE(st) => {
libc::fcntl(fd, libc::F_PREALLOCATE, st)
},
#[cfg(apple_targets)]
F_TRANSFEREXTENTS(rawfd) => {
// FIXME: ongoing (PR)[https://github.com/rust-lang/libc/pull/3925/files]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR has been merged and backported to the libc-0.2 branch:)

@devnexen devnexen force-pushed the fcntl_transferextents branch from 96ca676 to 307ccd3 Compare November 18, 2024 09:02
@devnexen devnexen marked this pull request as ready for review November 18, 2024 09:13
src/fcntl.rs Outdated
Comment on lines 963 to 965
// FIXME: ongoing (PR)[https://github.com/rust-lang/libc/pull/3925/files]
const F_TRANSFEREXTENTS: c_int = 110;
libc::fcntl(fd, F_TRANSFEREXTENTS, rawfd)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use the constant from the libc crate:

Suggested change
// FIXME: ongoing (PR)[https://github.com/rust-lang/libc/pull/3925/files]
const F_TRANSFEREXTENTS: c_int = 110;
libc::fcntl(fd, F_TRANSFEREXTENTS, rawfd)
libc::fcntl(fd, libc::F_TRANSFEREXTENTS, rawfd)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I forgot to change in fact..

@devnexen devnexen force-pushed the fcntl_transferextents branch from eafc43e to a6e589a Compare November 18, 2024 10:07
src/fcntl.rs Outdated
@@ -952,6 +958,11 @@ pub fn fcntl<Fd: std::os::fd::AsFd>(fd: Fd, arg: FcntlArg) -> Result<c_int> {
F_PREALLOCATE(st) => {
libc::fcntl(fd, libc::F_PREALLOCATE, st)
},
#[cfg(apple_targets)]
F_TRANSFEREXTENTS(rawfd) => {
// FIXME: ongoing (PR)[https://github.com/rust-lang/libc/pull/3925/files]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still has a comment to remove:)

@devnexen devnexen force-pushed the fcntl_transferextents branch from a6e589a to 00b7adc Compare November 18, 2024 10:20
Copy link
Member

@SteveLauC SteveLauC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@SteveLauC SteveLauC enabled auto-merge November 18, 2024 10:29
@SteveLauC SteveLauC added this pull request to the merge queue Nov 18, 2024
Merged via the queue into nix-rust:master with commit 4b6a5e3 Nov 18, 2024
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants