Correct the Android stat struct definitions

See https://cs.android.com/android/platform/superproject/+/master:bionic/libc/include/sys/stat.h
for reference.
This commit is contained in:
Chris Wailes 2023-06-20 09:47:12 -07:00
parent 8ca44ef9ca
commit dfcd3226ba
1 changed files with 58 additions and 47 deletions

View File

@ -21,26 +21,26 @@ pub use self::arch::{blkcnt_t, blksize_t, dev_t, ino_t, mode_t, nlink_t, off_t,
#[cfg(any(target_arch = "arm", target_arch = "x86"))]
mod arch {
use crate::os::raw::{c_longlong, c_uchar, c_uint, c_ulong, c_ulonglong};
use crate::os::raw::{c_long, c_longlong, c_uchar, c_uint, c_ulong, c_ulonglong};
use crate::os::unix::raw::{gid_t, uid_t};
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type dev_t = u64;
pub type dev_t = u32;
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type mode_t = u32;
pub type mode_t = c_uint;
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type blkcnt_t = u64;
pub type blkcnt_t = c_ulong;
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type blksize_t = u64;
pub type blksize_t = c_ulong;
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type ino_t = u64;
pub type ino_t = c_ulong;
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type nlink_t = u64;
pub type nlink_t = u32;
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type off_t = u64;
pub type off_t = i32;
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type time_t = i64;
pub type time_t = c_long;
#[repr(C)]
#[derive(Clone)]
@ -70,18 +70,20 @@ mod arch {
pub st_blksize: u32,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_blocks: c_ulonglong,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_atime: c_ulong,
pub st_atime: time_t,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_atime_nsec: c_ulong,
pub st_atime_nsec: c_long,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_mtime: c_ulong,
pub st_mtime: time_t,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_mtime_nsec: c_ulong,
pub st_mtime_nsec: c_long,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_ctime: c_ulong,
pub st_ctime: time_t,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_ctime_nsec: c_ulong,
pub st_ctime_nsec: c_long,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_ino: c_ulonglong,
}
@ -89,26 +91,26 @@ mod arch {
#[cfg(target_arch = "aarch64")]
mod arch {
use crate::os::raw::{c_uchar, c_ulong};
use crate::os::raw::{c_int, c_long, c_uint, c_ulong};
use crate::os::unix::raw::{gid_t, uid_t};
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type dev_t = u64;
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type mode_t = u32;
pub type mode_t = c_uint;
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type blkcnt_t = u64;
pub type blkcnt_t = c_ulong;
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type blksize_t = u64;
pub type blksize_t = c_ulong;
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type ino_t = u64;
pub type ino_t = c_ulong;
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type nlink_t = u64;
pub type nlink_t = u32;
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type off_t = u64;
pub type off_t = i64;
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type time_t = i64;
pub type time_t = c_long;
#[repr(C)]
#[derive(Clone)]
@ -117,9 +119,7 @@ mod arch {
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_dev: dev_t,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub __pad0: [c_uchar; 4],
#[stable(feature = "raw_ext", since = "1.1.0")]
pub __st_ino: ino_t,
pub st_ino: ino_t,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_mode: mode_t,
#[stable(feature = "raw_ext", since = "1.1.0")]
@ -131,27 +131,33 @@ mod arch {
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_rdev: dev_t,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub __pad3: [c_uchar; 4],
pub __pad1: c_ulong,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_size: off_t,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_blksize: blksize_t,
pub st_blksize: c_int,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_blocks: blkcnt_t,
pub __pad2: c_int,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_blocks: c_long,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_atime: time_t,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_atime_nsec: c_ulong,
pub st_atime_nsec: c_long,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_mtime: time_t,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_mtime_nsec: c_ulong,
pub st_mtime_nsec: c_long,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_ctime: time_t,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_ctime_nsec: c_ulong,
pub st_ctime_nsec: c_long,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_ino: ino_t,
pub __unused4: c_uint,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub __unused5: c_uint,
}
}
@ -163,20 +169,20 @@ mod arch {
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type dev_t = u64;
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type mode_t = u32;
pub type mode_t = c_uint;
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type blkcnt_t = u64;
pub type blkcnt_t = c_ulong;
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type blksize_t = u64;
pub type blksize_t = c_ulong;
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type ino_t = u64;
pub type ino_t = c_ulong;
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type nlink_t = u32;
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type off_t = u64;
pub type off_t = i64;
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type time_t = i64;
pub type time_t = c_long;
#[repr(C)]
#[derive(Clone)]
@ -195,25 +201,30 @@ mod arch {
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_gid: gid_t,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub __pad0: c_uint,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_rdev: dev_t,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_size: i64,
pub st_size: off_t,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_blksize: c_long,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_blocks: c_long,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_atime: c_ulong,
pub st_atime: time_t,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_atime_nsec: c_ulong,
pub st_atime_nsec: c_long,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_mtime: c_ulong,
pub st_mtime: time_t,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_mtime_nsec: c_ulong,
pub st_mtime_nsec: c_long,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_ctime: c_ulong,
pub st_ctime: time_t,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub st_ctime_nsec: c_ulong,
__unused: [c_long; 3],
pub st_ctime_nsec: c_long,
#[stable(feature = "raw_ext", since = "1.1.0")]
pub __pad3: [c_long; 3],
}
}