include: move trivial kernel header wrappers to src/include/override/

This commit is contained in:
Yu Watanabe
2025-07-11 13:05:46 +09:00
parent 543a48b653
commit 3fc2a44043
40 changed files with 79 additions and 82 deletions
+2 -2
View File
@@ -1,5 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <linux/fs.h>
#include <linux/magic.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/xattr.h>
@@ -18,8 +20,6 @@
#include "fs-util.h"
#include "log.h"
#include "login-util.h"
#include "missing_fs.h"
#include "missing_magic.h"
#include "parse-util.h"
#include "path-util.h"
#include "pidref.h"
+3 -8
View File
@@ -3,19 +3,14 @@
set -eu
set -o pipefail
cpp="$1"
filesystems_gperf="$2"
cpp="${1:?}"
filesystems_gperf="${2:?}"
shift 2
includes=""
for i in "$@"; do
includes="$includes -include $i"
done
error=false
# shellcheck disable=SC2086
for fs in $($cpp -dM $includes - </dev/null | \
for fs in $($cpp -dM -include linux/magic.h "$@" - </dev/null | \
grep -E '_MAGIC' | \
grep -vE 'LINUX_MAGIC' | \
awk '/^#define[ \t]+[A-Z0-9_]+MAGIC[ \t]+/ { print $2; }'); do
-1
View File
@@ -6,7 +6,6 @@ _Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"")
#include <linux/magic.h>
#include "filesystems.h"
#include "missing_magic.h"
#include "stat-util.h"
struct FilesystemMagic {
+3 -9
View File
@@ -119,8 +119,6 @@ basic_sources = files(
sources += basic_sources
missing_audit_h = files('missing_audit.h')
generated_gperf_headers = []
foreach item : [
# name, source, struct name, prefix, headers
@@ -173,17 +171,13 @@ basic_sources += generated_gperf_headers
############################################################
filesystem_includes = files(
'../include/uapi/linux/magic.h',
'missing_magic.h',
)
check_filesystems = find_program('check-filesystems.sh')
r = run_command(
[
'env', '--chdir', meson.project_build_root(),
check_filesystems, cpp, files('filesystems-gperf.gperf')
] + filesystem_includes,
check_filesystems, cpp, files('filesystems-gperf.gperf'),
system_include_args,
],
check: false,
)
if r.returncode() != 0
-31
View File
@@ -1,31 +0,0 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <linux/audit.h> /* IWYU pragma: export */
#if HAVE_AUDIT
# include <libaudit.h> /* IWYU pragma: export */
#endif
/* We use _Static_assert() directly here instead of assert_cc()
* because if we include macro.h in this header, the invocation
* of generate-audit_type-list.sh becomes more complex.
*/
#ifndef AUDIT_SERVICE_START
# define AUDIT_SERVICE_START 1130 /* Service (daemon) start */
#else
_Static_assert(AUDIT_SERVICE_START == 1130, "");
#endif
#ifndef AUDIT_SERVICE_STOP
# define AUDIT_SERVICE_STOP 1131 /* Service (daemon) stop */
#else
_Static_assert(AUDIT_SERVICE_STOP == 1131, "");
#endif
#ifndef MAX_AUDIT_MESSAGE_LENGTH
# define MAX_AUDIT_MESSAGE_LENGTH 8970
#else
_Static_assert(MAX_AUDIT_MESSAGE_LENGTH == 8970, "");
#endif
-14
View File
@@ -1,14 +0,0 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <linux/fs.h> /* IWYU pragma: export */
/* Not exposed yet. Defined at fs/ext4/ext4.h */
#ifndef EXT4_IOC_RESIZE_FS
#define EXT4_IOC_RESIZE_FS _IOW('f', 16, __u64)
#endif
/* linux/exportfs.h (33c5ac9175195c36a0b7005aaf503a2e81f117a1, 5.5) */
#ifndef FILEID_KERNFS
#define FILEID_KERNFS 0xfe
#endif
-102
View File
@@ -1,102 +0,0 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <linux/magic.h> /* IWYU pragma: export */
/* Not exposed yet (4.20). Defined at ipc/mqueue.c */
#ifndef MQUEUE_MAGIC
# define MQUEUE_MAGIC 0x19800202
#else
assert_cc(MQUEUE_MAGIC == 0x19800202);
#endif
/* b1123ea6d3b3da25af5c8a9d843bd07ab63213f4 (4.8), dropped by 68f2736a858324c3ec852f6c2cddd9d1c777357d (v6.0) */
#ifndef BALLOON_KVM_MAGIC
# define BALLOON_KVM_MAGIC 0x13661366
#else
assert_cc(BALLOON_KVM_MAGIC == 0x13661366);
#endif
/* 48b4800a1c6af2cdda344ea4e2c843dcc1f6afc9 (4.8), dropped by 68f2736a858324c3ec852f6c2cddd9d1c777357d (v6.0) */
#ifndef ZSMALLOC_MAGIC
# define ZSMALLOC_MAGIC 0x58295829
#else
assert_cc(ZSMALLOC_MAGIC == 0x58295829);
#endif
/* ea8157ab2ae5e914dd427e5cfab533b6da3819cd (5.3), dropped by 68f2736a858324c3ec852f6c2cddd9d1c777357d (v6.0) */
#ifndef Z3FOLD_MAGIC
# define Z3FOLD_MAGIC 0x33
#else
assert_cc(Z3FOLD_MAGIC == 0x33);
#endif
/* fe030c9b85e6783bc52fe86449c0a4b8aa16c753 (5.5), dropped by 68f2736a858324c3ec852f6c2cddd9d1c777357d (v6.0) */
#ifndef PPC_CMM_MAGIC
# define PPC_CMM_MAGIC 0xc7571590
#else
assert_cc(PPC_CMM_MAGIC == 0xc7571590);
#endif
/* Not in mainline but included in Ubuntu */
#ifndef SHIFTFS_MAGIC
# define SHIFTFS_MAGIC 0x6a656a62
#else
assert_cc(SHIFTFS_MAGIC == 0x6a656a62);
#endif
/* Not exposed yet. Defined at fs/fuse/control.c */
#ifndef FUSE_CTL_SUPER_MAGIC
# define FUSE_CTL_SUPER_MAGIC 0x65735543
#else
assert_cc(FUSE_CTL_SUPER_MAGIC == 0x65735543);
#endif
/* Not exposed yet. Defined at fs/orangefs/orangefs-kernel.h */
#ifndef ORANGEFS_DEVREQ_MAGIC
# define ORANGEFS_DEVREQ_MAGIC 0x20030529
#else
assert_cc(ORANGEFS_DEVREQ_MAGIC == 0x20030529);
#endif
/* linux/gfs2_ondisk.h */
#ifndef GFS2_MAGIC
# define GFS2_MAGIC 0x01161970
#else
assert_cc(GFS2_MAGIC == 0x01161970);
#endif
/* Not exposed yet. Defined at fs/configfs/mount.c */
#ifndef CONFIGFS_MAGIC
# define CONFIGFS_MAGIC 0x62656570
#else
assert_cc(CONFIGFS_MAGIC == 0x62656570);
#endif
/* Not exposed yet. Defined at fs/vboxsf/super.c */
#ifndef VBOXSF_SUPER_MAGIC
# define VBOXSF_SUPER_MAGIC 0x786f4256
#else
assert_cc(VBOXSF_SUPER_MAGIC == 0x786f4256);
#endif
/* Not exposed yet, internally actually called RPCAUTH_GSSMAGIC. Defined in net/sunrpc/rpc_pipe.c */
#ifndef RPC_PIPEFS_SUPER_MAGIC
# define RPC_PIPEFS_SUPER_MAGIC 0x67596969
#else
assert_cc(RPC_PIPEFS_SUPER_MAGIC == 0x67596969);
#endif
/* Not exposed yet, defined at fs/ntfs/ntfs.h */
#ifndef NTFS_SB_MAGIC
# define NTFS_SB_MAGIC 0x5346544e
#else
assert_cc(NTFS_SB_MAGIC == 0x5346544e);
#endif
/* Not exposed yet, encoded literally in fs/ntfs3/super.c. */
#ifndef NTFS3_SUPER_MAGIC
# define NTFS3_SUPER_MAGIC 0x7366746e
#else
assert_cc(NTFS3_SUPER_MAGIC == 0x7366746e);
#endif
-15
View File
@@ -1,15 +0,0 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <linux/nsfs.h> /* IWYU pragma: export */
#include <linux/types.h>
/* Root namespace inode numbers, as per include/linux/proc_ns.h in the kernel source tree, since v3.8:
* https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=98f842e675f96ffac96e6c50315790912b2812be */
#define PROC_IPC_INIT_INO ((ino_t) UINT32_C(0xEFFFFFFF))
#define PROC_UTS_INIT_INO ((ino_t) UINT32_C(0xEFFFFFFE))
#define PROC_USER_INIT_INO ((ino_t) UINT32_C(0xEFFFFFFD))
#define PROC_PID_INIT_INO ((ino_t) UINT32_C(0xEFFFFFFC))
#define PROC_CGROUP_INIT_INO ((ino_t) UINT32_C(0xEFFFFFFB))
#define PROC_TIME_INIT_INO ((ino_t) UINT32_C(0xEFFFFFFA))
-44
View File
@@ -1,44 +0,0 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "forward.h"
/* This is currently not exported in the public kernel headers, but the libxfs library code part of xfsprogs
* defines it as public header */
#ifndef XFS_IOC_FSGEOMETRY
#define XFS_IOC_FSGEOMETRY _IOR ('X', 124, struct xfs_fsop_geom)
typedef struct xfs_fsop_geom {
uint32_t blocksize;
uint32_t rtextsize;
uint32_t agblocks;
uint32_t agcount;
uint32_t logblocks;
uint32_t sectsize;
uint32_t inodesize;
uint32_t imaxpct;
uint64_t datablocks;
uint64_t rtblocks;
uint64_t rtextents;
uint64_t logstart;
unsigned char uuid[16];
uint32_t sunit;
uint32_t swidth;
int32_t version;
uint32_t flags;
uint32_t logsectsize;
uint32_t rtsectsize;
uint32_t dirblocksize;
uint32_t logsunit;
} xfs_fsop_geom_t;
#endif
#ifndef XFS_IOC_FSGROWFSDATA
#define XFS_IOC_FSGROWFSDATA _IOW ('X', 110, struct xfs_growfs_data)
typedef struct xfs_growfs_data {
uint64_t newblocks;
uint32_t imaxpct;
} xfs_growfs_data_t;
#endif
+2 -2
View File
@@ -1,6 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <fcntl.h>
#include <linux/magic.h>
#include <linux/nsfs.h>
#include <sched.h>
#include <sys/ioctl.h>
#include <sys/mount.h>
@@ -10,8 +12,6 @@
#include "fd-util.h"
#include "fileio.h"
#include "log.h"
#include "missing_magic.h"
#include "missing_namespace.h"
#include "mountpoint-util.h"
#include "namespace-util.h"
#include "parse-util.h"
+2 -2
View File
@@ -1,5 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <linux/fs.h>
#include <linux/magic.h>
#include <sys/ioctl.h>
#include <threads.h>
#include <unistd.h>
@@ -7,8 +9,6 @@
#include "errno-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "missing_fs.h"
#include "missing_magic.h"
#include "mountpoint-util.h"
#include "parse-util.h"
#include "pidfd-util.h"
+1 -1
View File
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <fcntl.h>
#include <linux/magic.h>
#include <sys/statvfs.h>
#include <unistd.h>
@@ -13,7 +14,6 @@
#include "fs-util.h"
#include "hash-funcs.h"
#include "log.h"
#include "missing_magic.h"
#include "mountpoint-util.h"
#include "path-util.h"
#include "siphash24.h"
+1 -1
View File
@@ -2,6 +2,7 @@
#include <fcntl.h>
#include <linux/kd.h>
#include <linux/magic.h>
#include <linux/tiocl.h>
#include <linux/vt.h>
#include <poll.h>
@@ -27,7 +28,6 @@
#include "inotify-util.h"
#include "io-util.h"
#include "log.h"
#include "missing_magic.h"
#include "namespace-util.h"
#include "parse-util.h"
#include "path-util.h"