-
Notifications
You must be signed in to change notification settings - Fork 1.1k
android: use proper types for dirent.d_ino, dirent.d_off, stat.st_mode and stat64.st_mode #4216
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,9 @@ use crate::prelude::*; | |
|
||
pub type c_long = i32; | ||
pub type c_ulong = u32; | ||
pub type mode_t = u16; | ||
pub type mode_t = c_ushort; | ||
pub type ino_t = u64; | ||
pub type off_t = i32; | ||
pub type off64_t = c_longlong; | ||
pub type sigset_t = c_ulong; | ||
pub type socklen_t = i32; | ||
|
@@ -30,7 +32,7 @@ s! { | |
pub st_dev: c_ulonglong, | ||
__pad0: [c_uchar; 4], | ||
__st_ino: crate::ino_t, | ||
pub st_mode: c_uint, | ||
pub st_mode: crate::mode_t, | ||
pub st_nlink: crate::nlink_t, | ||
pub st_uid: crate::uid_t, | ||
pub st_gid: crate::gid_t, | ||
|
@@ -52,7 +54,7 @@ s! { | |
pub st_dev: c_ulonglong, | ||
__pad0: [c_uchar; 4], | ||
__st_ino: crate::ino_t, | ||
pub st_mode: c_uint, | ||
pub st_mode: crate::mode_t, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is supposed to be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I made this mode_t to allow code using rust libc to just use the time mode_t to store the type like on other *nix platforms instead of having to deal with Android in other way. |
||
pub st_nlink: crate::nlink_t, | ||
pub st_uid: crate::uid_t, | ||
pub st_gid: crate::gid_t, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ use crate::prelude::*; | |
pub type clock_t = c_long; | ||
pub type time_t = c_long; | ||
pub type suseconds_t = c_long; | ||
pub type off_t = c_long; | ||
pub type blkcnt_t = c_ulong; | ||
pub type blksize_t = c_ulong; | ||
pub type nlink_t = u32; | ||
|
@@ -21,7 +20,6 @@ pub type fsblkcnt_t = c_ulong; | |
pub type nfds_t = c_uint; | ||
pub type rlim_t = c_ulong; | ||
pub type dev_t = c_ulong; | ||
pub type ino_t = c_ulong; | ||
pub type ino64_t = u64; | ||
pub type __CPU_BITTYPE = c_ulong; | ||
pub type idtype_t = c_int; | ||
|
@@ -528,16 +526,16 @@ s_no_extra_traits! { | |
} | ||
|
||
pub struct dirent { | ||
pub d_ino: u64, | ||
pub d_off: i64, | ||
pub d_ino: crate::ino_t, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not correct, In all other cases (mostly 32-bit CPUs), this is an explicit We could split |
||
pub d_off: crate::off_t, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This either needs to remain unmodified or become |
||
pub d_reclen: c_ushort, | ||
pub d_type: c_uchar, | ||
pub d_name: [c_char; 256], | ||
} | ||
|
||
pub struct dirent64 { | ||
pub d_ino: u64, | ||
pub d_off: i64, | ||
pub d_ino: crate::ino64_t, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment applies here - |
||
pub d_off: crate::off_t, | ||
pub d_reclen: c_ushort, | ||
pub d_type: c_uchar, | ||
pub d_name: [c_char; 256], | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is in fact an
unsigned int
and not amode_t
.Note that
stat
andstat64
are actually the same on Android.