]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
include/statfs_magic.h: revert portable struct statfs headers
authorKarel Zak <kzak@redhat.com>
Tue, 7 Apr 2026 14:45:55 +0000 (16:45 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 7 Apr 2026 14:45:55 +0000 (16:45 +0200)
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 <kzak@redhat.com>
include/statfs_magic.h

index a73bdb926cf74c373c93a32e96e4d1ee31a728c1..6921abaa4dcefd9dbcb26533ab797f8da0b7b043 100644 (file)
@@ -5,26 +5,10 @@
 #ifndef UTIL_LINUX_STATFS_MAGIC_H
 #define UTIL_LINUX_STATFS_MAGIC_H
 
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#ifdef HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
 #ifdef HAVE_SYS_STATFS_H
 # include <sys/statfs.h>
 #endif
 
-#ifdef HAVE_SYS_VFS_H
-# include <sys/vfs.h>
-#endif
-
-#if defined(HAVE_SYS_MOUNT_H) && !defined(MS_RDONLY)
-# include <sys/mount.h>
-#endif
-
 /*
  * If possible then don't depend on internal libc __SWORD_TYPE type.
  */