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

safe_io: Improve portability by replacing loff_t type usage with off_t. #9767

Merged
merged 1 commit into from Sep 9, 2016

Conversation

dx9
Copy link
Contributor

@dx9 dx9 commented Jun 17, 2016

No description provided.

64-bit behavior on glibc is enforced with __USE_FILE_OFFSET64 compiler error.

Signed-off-by: John Coyle <dx9err@gmail.com>
@@ -119,7 +119,7 @@ ssize_t safe_pwrite(int fd, const void *buf, size_t count, off_t offset)
}

#ifdef CEPH_HAVE_SPLICE
ssize_t safe_splice(int fd_in, loff_t *off_in, int fd_out, loff_t *off_out,
ssize_t safe_splice(int fd_in, off_t *off_in, int fd_out, off_t *off_out,
Copy link
Contributor

Choose a reason for hiding this comment

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

loff_t is a linux specific type. and is used by underlying splice(2) system call. yeah, it's a 64bit type. but i don't get what you mean by

64-bit behavior on glibc is enforced with __USE_FILE_OFFSET64 compiler error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ya sorry the comment is missing context here.

off_t == loff_t on glibc when _USE_FILE_OFFSET64 is defined. See #6301 (comment)

Musl libc provides linux splice() [1] with POSIX off_t [2].

There is no enforcement of _USE_FILE_OFFSET64 at this level. Maybe we should add a compiler error here similar to https://github.com/dx9/ceph/blob/1ff387047167686331825b592d4d396fc69da4fc/src/include/cephfs/libcephfs.h#L41

We want to make safe_splice() POSIX type compliant and ensure 64-bit usage on glibc.

?

[1] - https://git.musl-libc.org/cgit/musl/tree/include/fcntl.h#n165
[2] - http://pubs.opengroup.org/onlinepubs/009696699/basedefs/sys/types.h.html

@dx9 dx9 changed the title safe_io: Improve portability by replacing loff_t type usage with off_t. [DNM] safe_io: Improve portability by replacing loff_t type usage with off_t. Jul 9, 2016
@dx9 dx9 changed the title [DNM] safe_io: Improve portability by replacing loff_t type usage with off_t. safe_io: Improve portability by replacing loff_t type usage with off_t. Aug 9, 2016
@dx9
Copy link
Contributor Author

dx9 commented Sep 9, 2016

@tchaikov ping

@tchaikov tchaikov merged commit 994712f into ceph:master Sep 9, 2016
@tchaikov
Copy link
Contributor

tchaikov commented Sep 9, 2016

@dx9 sorry for the latency, makes sense. merging.

@tchaikov tchaikov self-assigned this Sep 9, 2016
@dx9
Copy link
Contributor Author

dx9 commented Sep 9, 2016

@tchaikov no worries, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants