From f7f06565f051144b313594672fc32a24635b6e8c Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 20 Jan 2022 16:18:48 -0800 Subject: [PATCH 1/4] Consolodate the Linux `*_SUPER_MAGIC` constants. Move the Linux `*_SUPER_MAGIC` constants out of android/uclibc/gnu-specific directories and into the common `linux_like` directory so that they're available on all Linux-family platforms, and so that that all Linux-family platforms have all the constants. --- src/unix/linux_like/android/mod.rs | 27 ------ src/unix/linux_like/linux/gnu/mod.rs | 114 ------------------------ src/unix/linux_like/linux/uclibc/mod.rs | 51 ----------- src/unix/linux_like/mod.rs | 114 ++++++++++++++++++++++++ 4 files changed, 114 insertions(+), 192 deletions(-) diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index 3c614f5f9bc6f..536f58d9f2d31 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -1269,33 +1269,6 @@ pub const TOSTOP: ::tcflag_t = 0x00000100; pub const FLUSHO: ::tcflag_t = 0x00001000; pub const EXTPROC: ::tcflag_t = 0o200000; -pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5; -pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff; -pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245; -pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45; -pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53; -pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53; -pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53; -pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53; -pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849; -pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6; -pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660; -pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6; -pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f; -pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f; -pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468; -pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478; -pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44; -pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c; -pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969; -pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1; -pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0; -pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f; -pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973; -pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b; -pub const TMPFS_MAGIC: ::c_long = 0x01021994; -pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2; - pub const MAP_HUGETLB: ::c_int = 0x040000; pub const PTRACE_TRACEME: ::c_int = 0; diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs index a0dfb4722680e..9a9843e880952 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -846,120 +846,6 @@ pub const O_ACCMODE: ::c_int = 3; pub const ST_RELATIME: ::c_ulong = 4096; pub const NI_MAXHOST: ::socklen_t = 1025; -cfg_if! { - if #[cfg(not(target_arch = "s390x"))] { - pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5; - pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff; - pub const AFS_SUPER_MAGIC: ::c_long = 0x5346414f; - pub const AUTOFS_SUPER_MAGIC: ::c_long = 0x0187; - pub const BINDERFS_SUPER_MAGIC: ::c_long = 0x6c6f6f70; - pub const BPF_FS_MAGIC: ::c_long = 0xcafe4a11; - pub const BTRFS_SUPER_MAGIC: ::c_long = 0x9123683e; - pub const CGROUP2_SUPER_MAGIC: ::c_long = 0x63677270; - pub const CGROUP_SUPER_MAGIC: ::c_long = 0x27e0eb; - pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245; - pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45; - pub const DEBUGFS_MAGIC: ::c_long = 0x64626720; - pub const DEVPTS_SUPER_MAGIC: ::c_long = 0x1cd1; - pub const ECRYPTFS_SUPER_MAGIC: ::c_long = 0xf15f; - pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53; - pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53; - pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53; - pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53; - pub const F2FS_SUPER_MAGIC: ::c_long = 0xf2f52010; - pub const FUSE_SUPER_MAGIC: ::c_long = 0x65735546; - pub const FUTEXFS_SUPER_MAGIC: ::c_long = 0xbad1dea; - pub const HOSTFS_SUPER_MAGIC: ::c_long = 0x00c0ffee; - pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849; - pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6; - pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660; - pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6; - pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478; - pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468; - pub const MINIX3_SUPER_MAGIC: ::c_long = 0x4d5a; - pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f; - pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f; - pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44; - pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c; - pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969; - pub const NILFS_SUPER_MAGIC: ::c_long = 0x3434; - pub const OCFS2_SUPER_MAGIC: ::c_long = 0x7461636f; - pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1; - pub const OVERLAYFS_SUPER_MAGIC: ::c_long = 0x794c7630; - pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0; - pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f; - pub const QNX6_SUPER_MAGIC: ::c_long = 0x68191122; - pub const RDTGROUP_SUPER_MAGIC: ::c_long = 0x7655821; - pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973; - pub const SECURITYFS_MAGIC: ::c_long = 0x73636673; - pub const SELINUX_MAGIC: ::c_long = 0xf97cff8c; - pub const SMACK_MAGIC: ::c_long = 0x43415d53; - pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b; - pub const SYSFS_MAGIC: ::c_long = 0x62656572; - pub const TMPFS_MAGIC: ::c_long = 0x01021994; - pub const TRACEFS_MAGIC: ::c_long = 0x74726163; - pub const UDF_SUPER_MAGIC: ::c_long = 0x15013346; - pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2; - pub const XENFS_SUPER_MAGIC: ::c_long = 0xabba1974; - pub const XFS_SUPER_MAGIC: ::c_long = 0x58465342; - } else if #[cfg(target_arch = "s390x")] { - pub const ADFS_SUPER_MAGIC: ::c_uint = 0x0000adf5; - pub const AFFS_SUPER_MAGIC: ::c_uint = 0x0000adff; - pub const AFS_SUPER_MAGIC: ::c_uint = 0x5346414f; - pub const AUTOFS_SUPER_MAGIC: ::c_uint = 0x0187; - pub const BINDERFS_SUPER_MAGIC: ::c_uint = 0x6c6f6f70; - pub const BPF_FS_MAGIC: ::c_uint = 0xcafe4a11; - pub const BTRFS_SUPER_MAGIC: ::c_uint = 0x9123683e; - pub const CGROUP2_SUPER_MAGIC: ::c_uint = 0x63677270; - pub const CGROUP_SUPER_MAGIC: ::c_uint = 0x27e0eb; - pub const CODA_SUPER_MAGIC: ::c_uint = 0x73757245; - pub const CRAMFS_MAGIC: ::c_uint = 0x28cd3d45; - pub const DEBUGFS_MAGIC: ::c_uint = 0x64626720; - pub const DEVPTS_SUPER_MAGIC: ::c_uint = 0x1cd1; - pub const ECRYPTFS_SUPER_MAGIC: ::c_uint = 0xf15f; - pub const EFS_SUPER_MAGIC: ::c_uint = 0x00414a53; - pub const EXT2_SUPER_MAGIC: ::c_uint = 0x0000ef53; - pub const EXT3_SUPER_MAGIC: ::c_uint = 0x0000ef53; - pub const EXT4_SUPER_MAGIC: ::c_uint = 0x0000ef53; - pub const F2FS_SUPER_MAGIC: ::c_uint = 0xf2f52010; - pub const FUSE_SUPER_MAGIC: ::c_uint = 0x65735546; - pub const FUTEXFS_SUPER_MAGIC: ::c_uint = 0xbad1dea; - pub const HOSTFS_SUPER_MAGIC: ::c_uint = 0x00c0ffee; - pub const HPFS_SUPER_MAGIC: ::c_uint = 0xf995e849; - pub const HUGETLBFS_MAGIC: ::c_uint = 0x958458f6; - pub const ISOFS_SUPER_MAGIC: ::c_uint = 0x00009660; - pub const JFFS2_SUPER_MAGIC: ::c_uint = 0x000072b6; - pub const MINIX2_SUPER_MAGIC2: ::c_uint = 0x00002478; - pub const MINIX2_SUPER_MAGIC: ::c_uint = 0x00002468; - pub const MINIX3_SUPER_MAGIC: ::c_uint = 0x4d5a; - pub const MINIX_SUPER_MAGIC2: ::c_uint = 0x0000138f; - pub const MINIX_SUPER_MAGIC: ::c_uint = 0x0000137f; - pub const MSDOS_SUPER_MAGIC: ::c_uint = 0x00004d44; - pub const NCP_SUPER_MAGIC: ::c_uint = 0x0000564c; - pub const NFS_SUPER_MAGIC: ::c_uint = 0x00006969; - pub const NILFS_SUPER_MAGIC: ::c_uint = 0x3434; - pub const OCFS2_SUPER_MAGIC: ::c_uint = 0x7461636f; - pub const OPENPROM_SUPER_MAGIC: ::c_uint = 0x00009fa1; - pub const OVERLAYFS_SUPER_MAGIC: ::c_uint = 0x794c7630; - pub const PROC_SUPER_MAGIC: ::c_uint = 0x00009fa0; - pub const QNX4_SUPER_MAGIC: ::c_uint = 0x0000002f; - pub const QNX6_SUPER_MAGIC: ::c_uint = 0x68191122; - pub const RDTGROUP_SUPER_MAGIC: ::c_uint = 0x7655821; - pub const REISERFS_SUPER_MAGIC: ::c_uint = 0x52654973; - pub const SECURITYFS_MAGIC: ::c_uint = 0x73636673; - pub const SELINUX_MAGIC: ::c_uint = 0xf97cff8c; - pub const SMACK_MAGIC: ::c_uint = 0x43415d53; - pub const SMB_SUPER_MAGIC: ::c_uint = 0x0000517b; - pub const SYSFS_MAGIC: ::c_uint = 0x62656572; - pub const TMPFS_MAGIC: ::c_uint = 0x01021994; - pub const TRACEFS_MAGIC: ::c_uint = 0x74726163; - pub const UDF_SUPER_MAGIC: ::c_uint = 0x15013346; - pub const USBDEVICE_SUPER_MAGIC: ::c_uint = 0x00009fa2; - pub const XENFS_SUPER_MAGIC: ::c_uint = 0xabba1974; - pub const XFS_SUPER_MAGIC: ::c_uint = 0x58465342; - } -} - pub const CPU_SETSIZE: ::c_int = 0x400; pub const PTRACE_TRACEME: ::c_uint = 0; diff --git a/src/unix/linux_like/linux/uclibc/mod.rs b/src/unix/linux_like/linux/uclibc/mod.rs index 8f23826f292f8..ae1dd1d692dc1 100644 --- a/src/unix/linux_like/linux/uclibc/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mod.rs @@ -87,57 +87,6 @@ pub const SIGEV_THREAD_ID: ::c_int = 4; pub const AF_VSOCK: ::c_int = 40; -pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5; -pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff; -pub const AFS_SUPER_MAGIC: ::c_long = 0x5346414f; -pub const AUTOFS_SUPER_MAGIC: ::c_long = 0x0187; -pub const BINDERFS_SUPER_MAGIC: ::c_long = 0x6c6f6f70; -pub const BPF_FS_MAGIC: ::c_long = 0xcafe4a11; -pub const BTRFS_SUPER_MAGIC: ::c_long = 0x9123683e; -pub const CGROUP2_SUPER_MAGIC: ::c_long = 0x63677270; -pub const CGROUP_SUPER_MAGIC: ::c_long = 0x27e0eb; -pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245; -pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45; -pub const DEBUGFS_MAGIC: ::c_long = 0x64626720; -pub const DEVPTS_SUPER_MAGIC: ::c_long = 0x1cd1; -pub const ECRYPTFS_SUPER_MAGIC: ::c_long = 0xf15f; -pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53; -pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53; -pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53; -pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53; -pub const F2FS_SUPER_MAGIC: ::c_long = 0xf2f52010; -pub const FUTEXFS_SUPER_MAGIC: ::c_long = 0xbad1dea; -pub const HOSTFS_SUPER_MAGIC: ::c_long = 0x00c0ffee; -pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849; -pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6; -pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660; -pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6; -pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478; -pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468; -pub const MINIX3_SUPER_MAGIC: ::c_long = 0x4d5a; -pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f; -pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f; -pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44; -pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c; -pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969; -pub const NILFS_SUPER_MAGIC: ::c_long = 0x3434; -pub const OCFS2_SUPER_MAGIC: ::c_long = 0x7461636f; -pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1; -pub const OVERLAYFS_SUPER_MAGIC: ::c_long = 0x794c7630; -pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0; -pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f; -pub const QNX6_SUPER_MAGIC: ::c_long = 0x68191122; -pub const RDTGROUP_SUPER_MAGIC: ::c_long = 0x7655821; -pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973; -pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b; -pub const SYSFS_MAGIC: ::c_long = 0x62656572; -pub const TMPFS_MAGIC: ::c_long = 0x01021994; -pub const TRACEFS_MAGIC: ::c_long = 0x74726163; -pub const UDF_SUPER_MAGIC: ::c_long = 0x15013346; -pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2; -pub const XENFS_SUPER_MAGIC: ::c_long = 0xabba1974; -pub const XFS_SUPER_MAGIC: ::c_long = 0x58465342; - pub const PTRACE_TRACEME: ::c_int = 0; pub const PTRACE_PEEKTEXT: ::c_int = 1; pub const PTRACE_PEEKDATA: ::c_int = 2; diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index bdef476aa31cd..586c0812dbf97 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -1365,6 +1365,120 @@ pub const ARPHRD_IEEE802154: u16 = 804; pub const ARPHRD_VOID: u16 = 0xFFFF; pub const ARPHRD_NONE: u16 = 0xFFFE; +cfg_if! { + if #[cfg(not(target_arch = "s390x"))] { + pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5; + pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff; + pub const AFS_SUPER_MAGIC: ::c_long = 0x5346414f; + pub const AUTOFS_SUPER_MAGIC: ::c_long = 0x0187; + pub const BINDERFS_SUPER_MAGIC: ::c_long = 0x6c6f6f70; + pub const BPF_FS_MAGIC: ::c_long = 0xcafe4a11; + pub const BTRFS_SUPER_MAGIC: ::c_long = 0x9123683e; + pub const CGROUP2_SUPER_MAGIC: ::c_long = 0x63677270; + pub const CGROUP_SUPER_MAGIC: ::c_long = 0x27e0eb; + pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245; + pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45; + pub const DEBUGFS_MAGIC: ::c_long = 0x64626720; + pub const DEVPTS_SUPER_MAGIC: ::c_long = 0x1cd1; + pub const ECRYPTFS_SUPER_MAGIC: ::c_long = 0xf15f; + pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53; + pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53; + pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53; + pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53; + pub const F2FS_SUPER_MAGIC: ::c_long = 0xf2f52010; + pub const FUSE_SUPER_MAGIC: ::c_long = 0x65735546; + pub const FUTEXFS_SUPER_MAGIC: ::c_long = 0xbad1dea; + pub const HOSTFS_SUPER_MAGIC: ::c_long = 0x00c0ffee; + pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849; + pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6; + pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660; + pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6; + pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478; + pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468; + pub const MINIX3_SUPER_MAGIC: ::c_long = 0x4d5a; + pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f; + pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f; + pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44; + pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c; + pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969; + pub const NILFS_SUPER_MAGIC: ::c_long = 0x3434; + pub const OCFS2_SUPER_MAGIC: ::c_long = 0x7461636f; + pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1; + pub const OVERLAYFS_SUPER_MAGIC: ::c_long = 0x794c7630; + pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0; + pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f; + pub const QNX6_SUPER_MAGIC: ::c_long = 0x68191122; + pub const RDTGROUP_SUPER_MAGIC: ::c_long = 0x7655821; + pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973; + pub const SECURITYFS_MAGIC: ::c_long = 0x73636673; + pub const SELINUX_MAGIC: ::c_long = 0xf97cff8c; + pub const SMACK_MAGIC: ::c_long = 0x43415d53; + pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b; + pub const SYSFS_MAGIC: ::c_long = 0x62656572; + pub const TMPFS_MAGIC: ::c_long = 0x01021994; + pub const TRACEFS_MAGIC: ::c_long = 0x74726163; + pub const UDF_SUPER_MAGIC: ::c_long = 0x15013346; + pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2; + pub const XENFS_SUPER_MAGIC: ::c_long = 0xabba1974; + pub const XFS_SUPER_MAGIC: ::c_long = 0x58465342; + } else if #[cfg(target_arch = "s390x")] { + pub const ADFS_SUPER_MAGIC: ::c_uint = 0x0000adf5; + pub const AFFS_SUPER_MAGIC: ::c_uint = 0x0000adff; + pub const AFS_SUPER_MAGIC: ::c_uint = 0x5346414f; + pub const AUTOFS_SUPER_MAGIC: ::c_uint = 0x0187; + pub const BINDERFS_SUPER_MAGIC: ::c_uint = 0x6c6f6f70; + pub const BPF_FS_MAGIC: ::c_uint = 0xcafe4a11; + pub const BTRFS_SUPER_MAGIC: ::c_uint = 0x9123683e; + pub const CGROUP2_SUPER_MAGIC: ::c_uint = 0x63677270; + pub const CGROUP_SUPER_MAGIC: ::c_uint = 0x27e0eb; + pub const CODA_SUPER_MAGIC: ::c_uint = 0x73757245; + pub const CRAMFS_MAGIC: ::c_uint = 0x28cd3d45; + pub const DEBUGFS_MAGIC: ::c_uint = 0x64626720; + pub const DEVPTS_SUPER_MAGIC: ::c_uint = 0x1cd1; + pub const ECRYPTFS_SUPER_MAGIC: ::c_uint = 0xf15f; + pub const EFS_SUPER_MAGIC: ::c_uint = 0x00414a53; + pub const EXT2_SUPER_MAGIC: ::c_uint = 0x0000ef53; + pub const EXT3_SUPER_MAGIC: ::c_uint = 0x0000ef53; + pub const EXT4_SUPER_MAGIC: ::c_uint = 0x0000ef53; + pub const F2FS_SUPER_MAGIC: ::c_uint = 0xf2f52010; + pub const FUSE_SUPER_MAGIC: ::c_uint = 0x65735546; + pub const FUTEXFS_SUPER_MAGIC: ::c_uint = 0xbad1dea; + pub const HOSTFS_SUPER_MAGIC: ::c_uint = 0x00c0ffee; + pub const HPFS_SUPER_MAGIC: ::c_uint = 0xf995e849; + pub const HUGETLBFS_MAGIC: ::c_uint = 0x958458f6; + pub const ISOFS_SUPER_MAGIC: ::c_uint = 0x00009660; + pub const JFFS2_SUPER_MAGIC: ::c_uint = 0x000072b6; + pub const MINIX2_SUPER_MAGIC2: ::c_uint = 0x00002478; + pub const MINIX2_SUPER_MAGIC: ::c_uint = 0x00002468; + pub const MINIX3_SUPER_MAGIC: ::c_uint = 0x4d5a; + pub const MINIX_SUPER_MAGIC2: ::c_uint = 0x0000138f; + pub const MINIX_SUPER_MAGIC: ::c_uint = 0x0000137f; + pub const MSDOS_SUPER_MAGIC: ::c_uint = 0x00004d44; + pub const NCP_SUPER_MAGIC: ::c_uint = 0x0000564c; + pub const NFS_SUPER_MAGIC: ::c_uint = 0x00006969; + pub const NILFS_SUPER_MAGIC: ::c_uint = 0x3434; + pub const OCFS2_SUPER_MAGIC: ::c_uint = 0x7461636f; + pub const OPENPROM_SUPER_MAGIC: ::c_uint = 0x00009fa1; + pub const OVERLAYFS_SUPER_MAGIC: ::c_uint = 0x794c7630; + pub const PROC_SUPER_MAGIC: ::c_uint = 0x00009fa0; + pub const QNX4_SUPER_MAGIC: ::c_uint = 0x0000002f; + pub const QNX6_SUPER_MAGIC: ::c_uint = 0x68191122; + pub const RDTGROUP_SUPER_MAGIC: ::c_uint = 0x7655821; + pub const REISERFS_SUPER_MAGIC: ::c_uint = 0x52654973; + pub const SECURITYFS_MAGIC: ::c_uint = 0x73636673; + pub const SELINUX_MAGIC: ::c_uint = 0xf97cff8c; + pub const SMACK_MAGIC: ::c_uint = 0x43415d53; + pub const SMB_SUPER_MAGIC: ::c_uint = 0x0000517b; + pub const SYSFS_MAGIC: ::c_uint = 0x62656572; + pub const TMPFS_MAGIC: ::c_uint = 0x01021994; + pub const TRACEFS_MAGIC: ::c_uint = 0x74726163; + pub const UDF_SUPER_MAGIC: ::c_uint = 0x15013346; + pub const USBDEVICE_SUPER_MAGIC: ::c_uint = 0x00009fa2; + pub const XENFS_SUPER_MAGIC: ::c_uint = 0xabba1974; + pub const XFS_SUPER_MAGIC: ::c_uint = 0x58465342; + } +} + const_fn! { {const} fn CMSG_ALIGN(len: usize) -> usize { len + ::mem::size_of::() - 1 & !(::mem::size_of::() - 1) From d0891d93f27a7631ddb4c0fc19344e6c25229a70 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 24 Jan 2022 13:06:09 -0800 Subject: [PATCH 2/4] Move `BINDERFS_SUPER_MAGIC` and `XFS_SUPER_MAGIC` back into ABI-specific mods. --- src/unix/linux_like/linux/gnu/mod.rs | 13 +++++++++++++ src/unix/linux_like/linux/uclibc/mod.rs | 6 ++++++ src/unix/linux_like/mod.rs | 4 ---- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs index 9a9843e880952..0ae854214aaf7 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -846,6 +846,19 @@ pub const O_ACCMODE: ::c_int = 3; pub const ST_RELATIME: ::c_ulong = 4096; pub const NI_MAXHOST: ::socklen_t = 1025; +// Most `*_SUPER_MAGIC` constants are defined at the `linux_like` level; the +// following are only available on newer Linux versions than the versions +// currently used in CI in some configurations, so we define them here. +cfg_if! { + if #[cfg(not(target_arch = "s390x"))] { + pub const BINDERFS_SUPER_MAGIC: ::c_long = 0x6c6f6f70; + pub const XFS_SUPER_MAGIC: ::c_long = 0x58465342; + } else if #[cfg(target_arch = "s390x")] { + pub const BINDERFS_SUPER_MAGIC: ::c_uint = 0x6c6f6f70; + pub const XFS_SUPER_MAGIC: ::c_uint = 0x58465342; + } +} + pub const CPU_SETSIZE: ::c_int = 0x400; pub const PTRACE_TRACEME: ::c_uint = 0; diff --git a/src/unix/linux_like/linux/uclibc/mod.rs b/src/unix/linux_like/linux/uclibc/mod.rs index ae1dd1d692dc1..912e2aa419bdc 100644 --- a/src/unix/linux_like/linux/uclibc/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mod.rs @@ -87,6 +87,12 @@ pub const SIGEV_THREAD_ID: ::c_int = 4; pub const AF_VSOCK: ::c_int = 40; +// Most `*_SUPER_MAGIC` constants are defined at the `linux_like` level; the +// following are only available on newer Linux versions than the versions +// currently used in CI in some configurations, so we define them here. +pub const BINDERFS_SUPER_MAGIC: ::c_long = 0x6c6f6f70; +pub const XFS_SUPER_MAGIC: ::c_long = 0x58465342; + pub const PTRACE_TRACEME: ::c_int = 0; pub const PTRACE_PEEKTEXT: ::c_int = 1; pub const PTRACE_PEEKDATA: ::c_int = 2; diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index 586c0812dbf97..89d67a6f14114 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -1371,7 +1371,6 @@ cfg_if! { pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff; pub const AFS_SUPER_MAGIC: ::c_long = 0x5346414f; pub const AUTOFS_SUPER_MAGIC: ::c_long = 0x0187; - pub const BINDERFS_SUPER_MAGIC: ::c_long = 0x6c6f6f70; pub const BPF_FS_MAGIC: ::c_long = 0xcafe4a11; pub const BTRFS_SUPER_MAGIC: ::c_long = 0x9123683e; pub const CGROUP2_SUPER_MAGIC: ::c_long = 0x63677270; @@ -1420,13 +1419,11 @@ cfg_if! { pub const UDF_SUPER_MAGIC: ::c_long = 0x15013346; pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2; pub const XENFS_SUPER_MAGIC: ::c_long = 0xabba1974; - pub const XFS_SUPER_MAGIC: ::c_long = 0x58465342; } else if #[cfg(target_arch = "s390x")] { pub const ADFS_SUPER_MAGIC: ::c_uint = 0x0000adf5; pub const AFFS_SUPER_MAGIC: ::c_uint = 0x0000adff; pub const AFS_SUPER_MAGIC: ::c_uint = 0x5346414f; pub const AUTOFS_SUPER_MAGIC: ::c_uint = 0x0187; - pub const BINDERFS_SUPER_MAGIC: ::c_uint = 0x6c6f6f70; pub const BPF_FS_MAGIC: ::c_uint = 0xcafe4a11; pub const BTRFS_SUPER_MAGIC: ::c_uint = 0x9123683e; pub const CGROUP2_SUPER_MAGIC: ::c_uint = 0x63677270; @@ -1475,7 +1472,6 @@ cfg_if! { pub const UDF_SUPER_MAGIC: ::c_uint = 0x15013346; pub const USBDEVICE_SUPER_MAGIC: ::c_uint = 0x00009fa2; pub const XENFS_SUPER_MAGIC: ::c_uint = 0xabba1974; - pub const XFS_SUPER_MAGIC: ::c_uint = 0x58465342; } } From 4875c52f56ade14fe84010488ebebb793271c613 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 24 Jan 2022 14:45:55 -0800 Subject: [PATCH 3/4] Don't define the `*_SUPER_MAGIC` constants on Emscripten. --- src/unix/linux_like/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index 89d67a6f14114..19dfb8f58619d 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -1366,7 +1366,9 @@ pub const ARPHRD_VOID: u16 = 0xFFFF; pub const ARPHRD_NONE: u16 = 0xFFFE; cfg_if! { - if #[cfg(not(target_arch = "s390x"))] { + if #[cfg(target_os = "emscripten")] { + // Emscripten does not define any `*_SUPER_MAGIC` constants. + } else if #[cfg(not(target_arch = "s390x"))] { pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5; pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff; pub const AFS_SUPER_MAGIC: ::c_long = 0x5346414f; From 338ac98a849d94f735e726bc4ca655925b4bce52 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 24 Jan 2022 15:53:19 -0800 Subject: [PATCH 4/4] Give android the same special case for `FUSE_SUPER_MAGIC` that linux has. --- libc-test/build.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libc-test/build.rs b/libc-test/build.rs index 8ceae3d99d5ca..4dcd5a939a478 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -1679,6 +1679,9 @@ fn test_android(target: &str) { "IBSHIFT" => true, "TCGETS2" | "TCSETS2" | "TCSETSW2" | "TCSETSF2" => true, + // is a private value for kernel usage normally + "FUSE_SUPER_MAGIC" => true, + _ => false, } });