Skip to content

Commit 3d09b9f

Browse files
committed
Declare statfs MAGIC constants as c_uint on s390x
Previously, statfs MAGIC constants like EXT4_SUPER_MAGIC were defined as c_long for linux-gnu, whereas a statfs f_type is a c_uint on s390x. This commit exempts these definitions from s390x and instead defines these constants as c_uint on s390x. This is safe as none of these constants are wider than 32bit. Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
1 parent f26757a commit 3d09b9f

File tree

1 file changed

+105
-50
lines changed
  • src/unix/linux_like/linux/gnu

1 file changed

+105
-50
lines changed

src/unix/linux_like/linux/gnu/mod.rs

Lines changed: 105 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -724,56 +724,111 @@ pub const O_ACCMODE: ::c_int = 3;
724724
pub const ST_RELATIME: ::c_ulong = 4096;
725725
pub const NI_MAXHOST: ::socklen_t = 1025;
726726

727-
pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5;
728-
pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff;
729-
pub const AFS_SUPER_MAGIC: ::c_long = 0x5346414f;
730-
pub const AUTOFS_SUPER_MAGIC: ::c_long = 0x0187;
731-
pub const BINDERFS_SUPER_MAGIC: ::c_long = 0x6c6f6f70;
732-
pub const BPF_FS_MAGIC: ::c_long = 0xcafe4a11;
733-
pub const BTRFS_SUPER_MAGIC: ::c_long = 0x9123683e;
734-
pub const CGROUP2_SUPER_MAGIC: ::c_long = 0x63677270;
735-
pub const CGROUP_SUPER_MAGIC: ::c_long = 0x27e0eb;
736-
pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245;
737-
pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45;
738-
pub const DEBUGFS_MAGIC: ::c_long = 0x64626720;
739-
pub const DEVPTS_SUPER_MAGIC: ::c_long = 0x1cd1;
740-
pub const ECRYPTFS_SUPER_MAGIC: ::c_long = 0xf15f;
741-
pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53;
742-
pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53;
743-
pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53;
744-
pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53;
745-
pub const F2FS_SUPER_MAGIC: ::c_long = 0xf2f52010;
746-
pub const FUTEXFS_SUPER_MAGIC: ::c_long = 0xbad1dea;
747-
pub const HOSTFS_SUPER_MAGIC: ::c_long = 0x00c0ffee;
748-
pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849;
749-
pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6;
750-
pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660;
751-
pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6;
752-
pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478;
753-
pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468;
754-
pub const MINIX3_SUPER_MAGIC: ::c_long = 0x4d5a;
755-
pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f;
756-
pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f;
757-
pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44;
758-
pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c;
759-
pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969;
760-
pub const NILFS_SUPER_MAGIC: ::c_long = 0x3434;
761-
pub const OCFS2_SUPER_MAGIC: ::c_long = 0x7461636f;
762-
pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1;
763-
pub const OVERLAYFS_SUPER_MAGIC: ::c_long = 0x794c7630;
764-
pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0;
765-
pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f;
766-
pub const QNX6_SUPER_MAGIC: ::c_long = 0x68191122;
767-
pub const RDTGROUP_SUPER_MAGIC: ::c_long = 0x7655821;
768-
pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973;
769-
pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b;
770-
pub const SYSFS_MAGIC: ::c_long = 0x62656572;
771-
pub const TMPFS_MAGIC: ::c_long = 0x01021994;
772-
pub const TRACEFS_MAGIC: ::c_long = 0x74726163;
773-
pub const UDF_SUPER_MAGIC: ::c_long = 0x15013346;
774-
pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2;
775-
pub const XENFS_SUPER_MAGIC: ::c_long = 0xabba1974;
776-
pub const XFS_SUPER_MAGIC: ::c_long = 0x58465342;
727+
cfg_if! {
728+
if #[cfg(not(target_arch = "s390x"))] {
729+
pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5;
730+
pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff;
731+
pub const AFS_SUPER_MAGIC: ::c_long = 0x5346414f;
732+
pub const AUTOFS_SUPER_MAGIC: ::c_long = 0x0187;
733+
pub const BINDERFS_SUPER_MAGIC: ::c_long = 0x6c6f6f70;
734+
pub const BPF_FS_MAGIC: ::c_long = 0xcafe4a11;
735+
pub const BTRFS_SUPER_MAGIC: ::c_long = 0x9123683e;
736+
pub const CGROUP2_SUPER_MAGIC: ::c_long = 0x63677270;
737+
pub const CGROUP_SUPER_MAGIC: ::c_long = 0x27e0eb;
738+
pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245;
739+
pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45;
740+
pub const DEBUGFS_MAGIC: ::c_long = 0x64626720;
741+
pub const DEVPTS_SUPER_MAGIC: ::c_long = 0x1cd1;
742+
pub const ECRYPTFS_SUPER_MAGIC: ::c_long = 0xf15f;
743+
pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53;
744+
pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53;
745+
pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53;
746+
pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53;
747+
pub const F2FS_SUPER_MAGIC: ::c_long = 0xf2f52010;
748+
pub const FUTEXFS_SUPER_MAGIC: ::c_long = 0xbad1dea;
749+
pub const HOSTFS_SUPER_MAGIC: ::c_long = 0x00c0ffee;
750+
pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849;
751+
pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6;
752+
pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660;
753+
pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6;
754+
pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478;
755+
pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468;
756+
pub const MINIX3_SUPER_MAGIC: ::c_long = 0x4d5a;
757+
pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f;
758+
pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f;
759+
pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44;
760+
pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c;
761+
pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969;
762+
pub const NILFS_SUPER_MAGIC: ::c_long = 0x3434;
763+
pub const OCFS2_SUPER_MAGIC: ::c_long = 0x7461636f;
764+
pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1;
765+
pub const OVERLAYFS_SUPER_MAGIC: ::c_long = 0x794c7630;
766+
pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0;
767+
pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f;
768+
pub const QNX6_SUPER_MAGIC: ::c_long = 0x68191122;
769+
pub const RDTGROUP_SUPER_MAGIC: ::c_long = 0x7655821;
770+
pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973;
771+
pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b;
772+
pub const SYSFS_MAGIC: ::c_long = 0x62656572;
773+
pub const TMPFS_MAGIC: ::c_long = 0x01021994;
774+
pub const TRACEFS_MAGIC: ::c_long = 0x74726163;
775+
pub const UDF_SUPER_MAGIC: ::c_long = 0x15013346;
776+
pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2;
777+
pub const XENFS_SUPER_MAGIC: ::c_long = 0xabba1974;
778+
pub const XFS_SUPER_MAGIC: ::c_long = 0x58465342;
779+
} else if #[cfg(target_arch = "s390x")] {
780+
pub const ADFS_SUPER_MAGIC: ::c_uint = 0x0000adf5;
781+
pub const AFFS_SUPER_MAGIC: ::c_uint = 0x0000adff;
782+
pub const AFS_SUPER_MAGIC: ::c_uint = 0x5346414f;
783+
pub const AUTOFS_SUPER_MAGIC: ::c_uint = 0x0187;
784+
pub const BINDERFS_SUPER_MAGIC: ::c_uint = 0x6c6f6f70;
785+
pub const BPF_FS_MAGIC: ::c_uint = 0xcafe4a11;
786+
pub const BTRFS_SUPER_MAGIC: ::c_uint = 0x9123683e;
787+
pub const CGROUP2_SUPER_MAGIC: ::c_uint = 0x63677270;
788+
pub const CGROUP_SUPER_MAGIC: ::c_uint = 0x27e0eb;
789+
pub const CODA_SUPER_MAGIC: ::c_uint = 0x73757245;
790+
pub const CRAMFS_MAGIC: ::c_uint = 0x28cd3d45;
791+
pub const DEBUGFS_MAGIC: ::c_uint = 0x64626720;
792+
pub const DEVPTS_SUPER_MAGIC: ::c_uint = 0x1cd1;
793+
pub const ECRYPTFS_SUPER_MAGIC: ::c_uint = 0xf15f;
794+
pub const EFS_SUPER_MAGIC: ::c_uint = 0x00414a53;
795+
pub const EXT2_SUPER_MAGIC: ::c_uint = 0x0000ef53;
796+
pub const EXT3_SUPER_MAGIC: ::c_uint = 0x0000ef53;
797+
pub const EXT4_SUPER_MAGIC: ::c_uint = 0x0000ef53;
798+
pub const F2FS_SUPER_MAGIC: ::c_uint = 0xf2f52010;
799+
pub const FUTEXFS_SUPER_MAGIC: ::c_uint = 0xbad1dea;
800+
pub const HOSTFS_SUPER_MAGIC: ::c_uint = 0x00c0ffee;
801+
pub const HPFS_SUPER_MAGIC: ::c_uint = 0xf995e849;
802+
pub const HUGETLBFS_MAGIC: ::c_uint = 0x958458f6;
803+
pub const ISOFS_SUPER_MAGIC: ::c_uint = 0x00009660;
804+
pub const JFFS2_SUPER_MAGIC: ::c_uint = 0x000072b6;
805+
pub const MINIX2_SUPER_MAGIC2: ::c_uint = 0x00002478;
806+
pub const MINIX2_SUPER_MAGIC: ::c_uint = 0x00002468;
807+
pub const MINIX3_SUPER_MAGIC: ::c_uint = 0x4d5a;
808+
pub const MINIX_SUPER_MAGIC2: ::c_uint = 0x0000138f;
809+
pub const MINIX_SUPER_MAGIC: ::c_uint = 0x0000137f;
810+
pub const MSDOS_SUPER_MAGIC: ::c_uint = 0x00004d44;
811+
pub const NCP_SUPER_MAGIC: ::c_uint = 0x0000564c;
812+
pub const NFS_SUPER_MAGIC: ::c_uint = 0x00006969;
813+
pub const NILFS_SUPER_MAGIC: ::c_uint = 0x3434;
814+
pub const OCFS2_SUPER_MAGIC: ::c_uint = 0x7461636f;
815+
pub const OPENPROM_SUPER_MAGIC: ::c_uint = 0x00009fa1;
816+
pub const OVERLAYFS_SUPER_MAGIC: ::c_uint = 0x794c7630;
817+
pub const PROC_SUPER_MAGIC: ::c_uint = 0x00009fa0;
818+
pub const QNX4_SUPER_MAGIC: ::c_uint = 0x0000002f;
819+
pub const QNX6_SUPER_MAGIC: ::c_uint = 0x68191122;
820+
pub const RDTGROUP_SUPER_MAGIC: ::c_uint = 0x7655821;
821+
pub const REISERFS_SUPER_MAGIC: ::c_uint = 0x52654973;
822+
pub const SMB_SUPER_MAGIC: ::c_uint = 0x0000517b;
823+
pub const SYSFS_MAGIC: ::c_uint = 0x62656572;
824+
pub const TMPFS_MAGIC: ::c_uint = 0x01021994;
825+
pub const TRACEFS_MAGIC: ::c_uint = 0x74726163;
826+
pub const UDF_SUPER_MAGIC: ::c_uint = 0x15013346;
827+
pub const USBDEVICE_SUPER_MAGIC: ::c_uint = 0x00009fa2;
828+
pub const XENFS_SUPER_MAGIC: ::c_uint = 0xabba1974;
829+
pub const XFS_SUPER_MAGIC: ::c_uint = 0x58465342;
830+
}
831+
}
777832

778833
pub const CPU_SETSIZE: ::c_int = 0x400;
779834

0 commit comments

Comments
 (0)