From: Karel Zak Date: Tue, 7 Apr 2026 14:45:55 +0000 (+0200) Subject: include/statfs_magic.h: revert portable struct statfs headers X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ccf20d2fd8e45eed70bd1b915c0d16f646bf133;p=thirdparty%2Futil-linux.git include/statfs_magic.h: revert portable struct statfs headers Revert changes from commits 1af964d935 and 5f66e252c1c2. Adding sys/mount.h, sys/vfs.h, and related includes to statfs_magic.h caused build failures on older systems (e.g., Ubuntu) due to a collision between sys/mount.h and linux/fs.h -- both define MS_RDONLY, the first as an enum and the second as a macro. The previous fix (guarding sys/mount.h with !defined(MS_RDONLY)) was insufficient because on some systems linux/fs.h itself chains into sys/mount.h, making the guard unreachable. The correct approach is to keep statfs_magic.h minimal (only magic numbers and sys/statfs.h) and let callers include the necessary struct statfs headers. Currently, all callers of statfs_magic.h are Linux-only (libmount requires sys/vfs.h, hardlink's USE_REFLINK requires HAVE_LINUX_FIEMAP_H), so the Darwin-specific sys/mount.h include is unreachable anyway. Sorry for the mess, and sorry I had not used a PR for this. Fixes: 1af964d935 ("include/statfs_magic.h: add portable struct statfs headers for Darwin") Fixes: 5f66e252c1 ("include/statfs_magic.h: avoid sys/mount.h and linux/fs.h collision") Signed-off-by: Karel Zak --- diff --git a/include/statfs_magic.h b/include/statfs_magic.h index a73bdb926..6921abaa4 100644 --- a/include/statfs_magic.h +++ b/include/statfs_magic.h @@ -5,26 +5,10 @@ #ifndef UTIL_LINUX_STATFS_MAGIC_H #define UTIL_LINUX_STATFS_MAGIC_H -#ifdef HAVE_SYS_TYPES_H -# include -#endif - -#ifdef HAVE_SYS_STAT_H -# include -#endif - #ifdef HAVE_SYS_STATFS_H # include #endif -#ifdef HAVE_SYS_VFS_H -# include -#endif - -#if defined(HAVE_SYS_MOUNT_H) && !defined(MS_RDONLY) -# include -#endif - /* * If possible then don't depend on internal libc __SWORD_TYPE type. */