Skip to content

Commit 7773a09

Browse files
committed
chore: minor cleanup mode_t usage
`crate::mode_t` is almost never needed because it is part of prelude. Moreover, in many cases `mode_t` was already used without the prefix - thus confusing if they are different or not. Keeping it the same helps readability.
1 parent bf63904 commit 7773a09

File tree

74 files changed

+323
-361
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+323
-361
lines changed

src/fuchsia/aarch64.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ s! {
1010
pub struct stat {
1111
pub st_dev: crate::dev_t,
1212
pub st_ino: crate::ino_t,
13-
pub st_mode: crate::mode_t,
13+
pub st_mode: mode_t,
1414
pub st_nlink: crate::nlink_t,
1515
pub st_uid: crate::uid_t,
1616
pub st_gid: crate::gid_t,
@@ -32,7 +32,7 @@ s! {
3232
pub struct stat64 {
3333
pub st_dev: crate::dev_t,
3434
pub st_ino: crate::ino_t,
35-
pub st_mode: crate::mode_t,
35+
pub st_mode: mode_t,
3636
pub st_nlink: crate::nlink_t,
3737
pub st_uid: crate::uid_t,
3838
pub st_gid: crate::gid_t,
@@ -57,7 +57,7 @@ s! {
5757
pub gid: crate::gid_t,
5858
pub cuid: crate::uid_t,
5959
pub cgid: crate::gid_t,
60-
pub mode: crate::mode_t,
60+
pub mode: mode_t,
6161
pub __seq: c_ushort,
6262
__unused1: c_ulong,
6363
__unused2: c_ulong,

src/fuchsia/mod.rs

+28-34
Original file line numberDiff line numberDiff line change
@@ -1452,9 +1452,9 @@ pub const GRPQUOTA: c_int = 1;
14521452

14531453
pub const SIGIOT: c_int = 6;
14541454

1455-
pub const S_ISUID: crate::mode_t = 0o4000;
1456-
pub const S_ISGID: crate::mode_t = 0o2000;
1457-
pub const S_ISVTX: crate::mode_t = 0o1000;
1455+
pub const S_ISUID: mode_t = 0o4000;
1456+
pub const S_ISGID: mode_t = 0o2000;
1457+
pub const S_ISVTX: mode_t = 0o1000;
14581458

14591459
pub const IF_NAMESIZE: size_t = 16;
14601460
pub const IFNAMSIZ: size_t = IF_NAMESIZE;
@@ -1585,26 +1585,26 @@ pub const O_RDONLY: c_int = 0;
15851585
pub const O_WRONLY: c_int = 1;
15861586
pub const O_RDWR: c_int = 2;
15871587

1588-
pub const S_IFIFO: crate::mode_t = 0o1_0000;
1589-
pub const S_IFCHR: crate::mode_t = 0o2_0000;
1590-
pub const S_IFBLK: crate::mode_t = 0o6_0000;
1591-
pub const S_IFDIR: crate::mode_t = 0o4_0000;
1592-
pub const S_IFREG: crate::mode_t = 0o10_0000;
1593-
pub const S_IFLNK: crate::mode_t = 0o12_0000;
1594-
pub const S_IFSOCK: crate::mode_t = 0o14_0000;
1595-
pub const S_IFMT: crate::mode_t = 0o17_0000;
1596-
pub const S_IRWXU: crate::mode_t = 0o0700;
1597-
pub const S_IXUSR: crate::mode_t = 0o0100;
1598-
pub const S_IWUSR: crate::mode_t = 0o0200;
1599-
pub const S_IRUSR: crate::mode_t = 0o0400;
1600-
pub const S_IRWXG: crate::mode_t = 0o0070;
1601-
pub const S_IXGRP: crate::mode_t = 0o0010;
1602-
pub const S_IWGRP: crate::mode_t = 0o0020;
1603-
pub const S_IRGRP: crate::mode_t = 0o0040;
1604-
pub const S_IRWXO: crate::mode_t = 0o0007;
1605-
pub const S_IXOTH: crate::mode_t = 0o0001;
1606-
pub const S_IWOTH: crate::mode_t = 0o0002;
1607-
pub const S_IROTH: crate::mode_t = 0o0004;
1588+
pub const S_IFIFO: mode_t = 0o1_0000;
1589+
pub const S_IFCHR: mode_t = 0o2_0000;
1590+
pub const S_IFBLK: mode_t = 0o6_0000;
1591+
pub const S_IFDIR: mode_t = 0o4_0000;
1592+
pub const S_IFREG: mode_t = 0o10_0000;
1593+
pub const S_IFLNK: mode_t = 0o12_0000;
1594+
pub const S_IFSOCK: mode_t = 0o14_0000;
1595+
pub const S_IFMT: mode_t = 0o17_0000;
1596+
pub const S_IRWXU: mode_t = 0o0700;
1597+
pub const S_IXUSR: mode_t = 0o0100;
1598+
pub const S_IWUSR: mode_t = 0o0200;
1599+
pub const S_IRUSR: mode_t = 0o0400;
1600+
pub const S_IRWXG: mode_t = 0o0070;
1601+
pub const S_IXGRP: mode_t = 0o0010;
1602+
pub const S_IWGRP: mode_t = 0o0020;
1603+
pub const S_IRGRP: mode_t = 0o0040;
1604+
pub const S_IRWXO: mode_t = 0o0007;
1605+
pub const S_IXOTH: mode_t = 0o0001;
1606+
pub const S_IWOTH: mode_t = 0o0002;
1607+
pub const S_IROTH: mode_t = 0o0004;
16081608
pub const F_OK: c_int = 0;
16091609
pub const R_OK: c_int = 4;
16101610
pub const W_OK: c_int = 2;
@@ -3726,12 +3726,7 @@ extern "C" {
37263726
pub fn rewinddir(dirp: *mut crate::DIR);
37273727

37283728
pub fn openat(dirfd: c_int, pathname: *const c_char, flags: c_int, ...) -> c_int;
3729-
pub fn fchmodat(
3730-
dirfd: c_int,
3731-
pathname: *const c_char,
3732-
mode: crate::mode_t,
3733-
flags: c_int,
3734-
) -> c_int;
3729+
pub fn fchmodat(dirfd: c_int, pathname: *const c_char, mode: mode_t, flags: c_int) -> c_int;
37353730
pub fn fchown(fd: c_int, owner: crate::uid_t, group: crate::gid_t) -> c_int;
37363731
pub fn fchownat(
37373732
dirfd: c_int,
@@ -3748,7 +3743,7 @@ extern "C" {
37483743
newpath: *const c_char,
37493744
flags: c_int,
37503745
) -> c_int;
3751-
pub fn mkdirat(dirfd: c_int, pathname: *const c_char, mode: crate::mode_t) -> c_int;
3746+
pub fn mkdirat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int;
37523747
pub fn readlinkat(
37533748
dirfd: c_int,
37543749
pathname: *const c_char,
@@ -3959,7 +3954,7 @@ extern "C" {
39593954
pub fn gmtime(time_p: *const time_t) -> *mut tm;
39603955
pub fn localtime(time_p: *const time_t) -> *mut tm;
39613956

3962-
pub fn mknod(pathname: *const c_char, mode: crate::mode_t, dev: crate::dev_t) -> c_int;
3957+
pub fn mknod(pathname: *const c_char, mode: mode_t, dev: crate::dev_t) -> c_int;
39633958
pub fn uname(buf: *mut crate::utsname) -> c_int;
39643959
pub fn gethostname(name: *mut c_char, len: size_t) -> c_int;
39653960
pub fn getservbyname(name: *const c_char, proto: *const c_char) -> *mut servent;
@@ -4079,8 +4074,7 @@ extern "C" {
40794074

40804075
pub fn fdopendir(fd: c_int) -> *mut crate::DIR;
40814076

4082-
pub fn mknodat(dirfd: c_int, pathname: *const c_char, mode: crate::mode_t, dev: dev_t)
4083-
-> c_int;
4077+
pub fn mknodat(dirfd: c_int, pathname: *const c_char, mode: mode_t, dev: dev_t) -> c_int;
40844078
pub fn pthread_condattr_getclock(
40854079
attr: *const pthread_condattr_t,
40864080
clock_id: *mut clockid_t,
@@ -4205,7 +4199,7 @@ extern "C" {
42054199
pub fn setfsuid(uid: crate::uid_t) -> c_int;
42064200

42074201
// Not available now on Android
4208-
pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: crate::mode_t) -> c_int;
4202+
pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int;
42094203
pub fn if_nameindex() -> *mut if_nameindex;
42104204
pub fn if_freenameindex(ptr: *mut if_nameindex);
42114205
pub fn sync_file_range(fd: c_int, offset: off64_t, nbytes: off64_t, flags: c_uint) -> c_int;

src/fuchsia/riscv64.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ s! {
1414
pub st_dev: crate::dev_t,
1515
pub st_ino: crate::ino_t,
1616
pub st_nlink: crate::nlink_t,
17-
pub st_mode: crate::mode_t,
17+
pub st_mode: mode_t,
1818
pub st_uid: crate::uid_t,
1919
pub st_gid: crate::gid_t,
2020
__pad0: c_int,
@@ -38,7 +38,7 @@ s! {
3838
pub gid: crate::gid_t,
3939
pub cuid: crate::uid_t,
4040
pub cgid: crate::gid_t,
41-
pub mode: crate::mode_t,
41+
pub mode: mode_t,
4242
pub __seq: c_ushort,
4343
__unused1: c_ulong,
4444
__unused2: c_ulong,

src/fuchsia/x86_64.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ s! {
1111
pub st_dev: crate::dev_t,
1212
pub st_ino: crate::ino_t,
1313
pub st_nlink: crate::nlink_t,
14-
pub st_mode: crate::mode_t,
14+
pub st_mode: mode_t,
1515
pub st_uid: crate::uid_t,
1616
pub st_gid: crate::gid_t,
1717
__pad0: c_int,
@@ -32,7 +32,7 @@ s! {
3232
pub st_dev: crate::dev_t,
3333
pub st_ino: crate::ino64_t,
3434
pub st_nlink: crate::nlink_t,
35-
pub st_mode: crate::mode_t,
35+
pub st_mode: mode_t,
3636
pub st_uid: crate::uid_t,
3737
pub st_gid: crate::gid_t,
3838
__pad0: c_int,
@@ -59,7 +59,7 @@ s! {
5959
pub gid: crate::gid_t,
6060
pub cuid: crate::uid_t,
6161
pub cgid: crate::gid_t,
62-
pub mode: crate::mode_t,
62+
pub mode: mode_t,
6363
pub __seq: c_int,
6464
__unused1: c_long,
6565
__unused2: c_long,

src/unix/aix/mod.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -2877,9 +2877,8 @@ extern "C" {
28772877
) -> *mut c_void;
28782878
pub fn memset_s(s: *mut c_void, smax: size_t, c: c_int, n: size_t) -> c_int;
28792879
pub fn mincore(addr: *const c_void, len: size_t, vec: *mut c_char) -> c_int;
2880-
pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: crate::mode_t) -> c_int;
2881-
pub fn mknodat(dirfd: c_int, pathname: *const c_char, mode: crate::mode_t, dev: dev_t)
2882-
-> c_int;
2880+
pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int;
2881+
pub fn mknodat(dirfd: c_int, pathname: *const c_char, mode: mode_t, dev: dev_t) -> c_int;
28832882
pub fn mount(device: *const c_char, path: *const c_char, flags: c_int) -> c_int;
28842883
pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int;
28852884
pub fn mq_close(mqd: crate::mqd_t) -> c_int;
@@ -2973,7 +2972,7 @@ extern "C" {
29732972
fd: c_int,
29742973
path: *const c_char,
29752974
oflag: c_int,
2976-
mode: crate::mode_t,
2975+
mode: mode_t,
29772976
) -> c_int;
29782977
pub fn posix_spawn_file_actions_destroy(actions: *mut posix_spawn_file_actions_t) -> c_int;
29792978
pub fn posix_spawn_file_actions_init(actions: *mut posix_spawn_file_actions_t) -> c_int;
@@ -3138,7 +3137,7 @@ extern "C" {
31383137
pub fn shmdt(shmaddr: *const c_void) -> c_int;
31393138
pub fn shmctl(shmid: c_int, cmd: c_int, buf: *mut crate::shmid_ds) -> c_int;
31403139
pub fn shmget(key: key_t, size: size_t, shmflg: c_int) -> c_int;
3141-
pub fn shm_open(name: *const c_char, oflag: c_int, mode: crate::mode_t) -> c_int;
3140+
pub fn shm_open(name: *const c_char, oflag: c_int, mode: mode_t) -> c_int;
31423141
pub fn shm_unlink(name: *const c_char) -> c_int;
31433142
pub fn splice(socket1: c_int, socket2: c_int, flags: c_int) -> c_int;
31443143
pub fn srand(seed: c_uint);

src/unix/aix/powerpc64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ s! {
5252
pub struct stat {
5353
pub st_dev: crate::dev_t,
5454
pub st_ino: crate::ino_t,
55-
pub st_mode: crate::mode_t,
55+
pub st_mode: mode_t,
5656
pub st_nlink: crate::nlink_t,
5757
pub st_flag: c_ushort,
5858
pub st_uid: crate::uid_t,

src/unix/bsd/apple/mod.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ s! {
739739
pub gid: crate::gid_t,
740740
pub cuid: crate::uid_t,
741741
pub cgid: crate::gid_t,
742-
pub mode: crate::mode_t,
742+
pub mode: mode_t,
743743
pub _seq: c_ushort,
744744
pub _key: crate::key_t,
745745
}
@@ -6151,7 +6151,7 @@ extern "C" {
61516151
fd: c_int,
61526152
path: *const c_char,
61536153
oflag: c_int,
6154-
mode: crate::mode_t,
6154+
mode: mode_t,
61556155
) -> c_int;
61566156
pub fn posix_spawn_file_actions_addclose(
61576157
actions: *mut posix_spawn_file_actions_t,
@@ -6449,9 +6449,8 @@ extern "C" {
64496449
pub fn dirname(path: *mut c_char) -> *mut c_char;
64506450
pub fn basename(path: *mut c_char) -> *mut c_char;
64516451

6452-
pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: crate::mode_t) -> c_int;
6453-
pub fn mknodat(dirfd: c_int, pathname: *const c_char, mode: crate::mode_t, dev: dev_t)
6454-
-> c_int;
6452+
pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int;
6453+
pub fn mknodat(dirfd: c_int, pathname: *const c_char, mode: mode_t, dev: dev_t) -> c_int;
64556454
pub fn freadlink(fd: c_int, buf: *mut c_char, size: size_t) -> c_int;
64566455
pub fn execvP(
64576456
file: *const c_char,

src/unix/bsd/freebsdlike/dragonfly/mod.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ s! {
141141
pub st_ino: crate::ino_t,
142142
pub st_nlink: crate::nlink_t,
143143
pub st_dev: crate::dev_t,
144-
pub st_mode: crate::mode_t,
144+
pub st_mode: mode_t,
145145
pub st_padding1: u16,
146146
pub st_uid: crate::uid_t,
147147
pub st_gid: crate::gid_t,
@@ -1624,12 +1624,8 @@ extern "C" {
16241624

16251625
pub fn aio_waitcomplete(iocbp: *mut *mut aiocb, timeout: *mut crate::timespec) -> c_int;
16261626

1627-
pub fn devname_r(
1628-
dev: crate::dev_t,
1629-
mode: crate::mode_t,
1630-
buf: *mut c_char,
1631-
len: size_t,
1632-
) -> *mut c_char;
1627+
pub fn devname_r(dev: crate::dev_t, mode: mode_t, buf: *mut c_char, len: size_t)
1628+
-> *mut c_char;
16331629

16341630
pub fn waitid(
16351631
idtype: idtype_t,

src/unix/bsd/freebsdlike/freebsd/freebsd11/b32.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::prelude::*;
66
pub struct stat {
77
pub st_dev: crate::dev_t,
88
pub st_ino: crate::ino_t,
9-
pub st_mode: crate::mode_t,
9+
pub st_mode: mode_t,
1010
pub st_nlink: crate::nlink_t,
1111
pub st_uid: crate::uid_t,
1212
pub st_gid: crate::gid_t,

src/unix/bsd/freebsdlike/freebsd/freebsd11/b64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::prelude::*;
66
pub struct stat {
77
pub st_dev: crate::dev_t,
88
pub st_ino: crate::ino_t,
9-
pub st_mode: crate::mode_t,
9+
pub st_mode: mode_t,
1010
pub st_nlink: crate::nlink_t,
1111
pub st_uid: crate::uid_t,
1212
pub st_gid: crate::gid_t,

src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ s! {
225225
pub st_dev: crate::dev_t,
226226
pub st_ino: crate::ino_t,
227227
pub st_nlink: crate::nlink_t,
228-
pub st_mode: crate::mode_t,
228+
pub st_mode: mode_t,
229229
st_padding0: i16,
230230
pub st_uid: crate::uid_t,
231231
pub st_gid: crate::gid_t,

src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ s! {
238238
pub st_dev: crate::dev_t,
239239
pub st_ino: crate::ino_t,
240240
pub st_nlink: crate::nlink_t,
241-
pub st_mode: crate::mode_t,
241+
pub st_mode: mode_t,
242242
st_padding0: i16,
243243
pub st_uid: crate::uid_t,
244244
pub st_gid: crate::gid_t,

src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ s! {
238238
pub st_dev: crate::dev_t,
239239
pub st_ino: crate::ino_t,
240240
pub st_nlink: crate::nlink_t,
241-
pub st_mode: crate::mode_t,
241+
pub st_mode: mode_t,
242242
st_padding0: i16,
243243
pub st_uid: crate::uid_t,
244244
pub st_gid: crate::gid_t,

src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ s! {
238238
pub st_dev: crate::dev_t,
239239
pub st_ino: crate::ino_t,
240240
pub st_nlink: crate::nlink_t,
241-
pub st_mode: crate::mode_t,
241+
pub st_mode: mode_t,
242242
st_padding0: i16,
243243
pub st_uid: crate::uid_t,
244244
pub st_gid: crate::gid_t,

src/unix/bsd/freebsdlike/freebsd/mod.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -5094,12 +5094,7 @@ extern "C" {
50945094
flags: c_uint,
50955095
) -> ssize_t;
50965096

5097-
pub fn devname_r(
5098-
dev: crate::dev_t,
5099-
mode: crate::mode_t,
5100-
buf: *mut c_char,
5101-
len: c_int,
5102-
) -> *mut c_char;
5097+
pub fn devname_r(dev: crate::dev_t, mode: mode_t, buf: *mut c_char, len: c_int) -> *mut c_char;
51035098

51045099
pub fn extattr_delete_fd(fd: c_int, attrnamespace: c_int, attrname: *const c_char) -> c_int;
51055100
pub fn extattr_delete_file(
@@ -5419,7 +5414,7 @@ extern "C" {
54195414
flags: c_int,
54205415
psind: c_int,
54215416
alloc_policy: c_int,
5422-
mode: crate::mode_t,
5417+
mode: mode_t,
54235418
) -> c_int;
54245419
pub fn shm_rename(path_from: *const c_char, path_to: *const c_char, flags: c_int) -> c_int;
54255420
pub fn memfd_create(name: *const c_char, flags: c_uint) -> c_int;
@@ -5614,7 +5609,7 @@ extern "C" {
56145609

56155610
pub fn pidfile_open(
56165611
path: *const c_char,
5617-
mode: crate::mode_t,
5612+
mode: mode_t,
56185613
pidptr: *mut crate::pid_t,
56195614
) -> *mut crate::pidfh;
56205615
pub fn pidfile_write(path: *mut crate::pidfh) -> c_int;

0 commit comments

Comments
 (0)