basic: introduce our own sys/mount.h implementation
To resolve conflict with sys/mount.h and linux/mount.h or linux/fs.h. The conflict between sys/mount.h and linux/mount.h is resolved in glibc-2.37 (774058d72942249f71d74e7f2b639f77184160a6), but our baseline is still glibc-2.31. Also, even with the version or newer, still sys/mount.h conflicts with linux/fs.h, which is included by linux/btrfs.h. This introduces our own implementation of sys/mount.h, that can be simultaneously included with linux/mount.h and linux/fs.h. This also imports linux/fs.h, linux/mount.h, and several other dependent headers. The introduced sys/mount.h header itself may not be enough simple, but by using the header, we can drop most of workarounds in other source files.
This commit is contained in:
+40
-72
@@ -1,81 +1,49 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
#include <linux/types.h>
|
||||
/* temporary undef definitions in bits/uio-ext.h, which is included by sys/uio.h */
|
||||
#include <sys/uio.h>
|
||||
|
||||
#define __RWF_HIPRI_SAVED__ RWF_HIPRI
|
||||
#undef RWF_HIPRI
|
||||
#define __RWF_DSYNC_SAVED__ RWF_DSYNC
|
||||
#undef RWF_DSYNC
|
||||
#define __RWF_SYNC_SAVED__ RWF_SYNC
|
||||
#undef RWF_SYNC
|
||||
#define __RWF_NOWAIT_SAVED__ RWF_NOWAIT
|
||||
#undef RWF_NOWAIT
|
||||
#define __RWF_APPEND_SAVED__ RWF_APPEND
|
||||
#undef RWF_APPEND
|
||||
#define __RWF_NOAPPEND_SAVED__ RWF_NOAPPEND
|
||||
#undef RWF_NOAPPEND
|
||||
#if defined(RWF_ATOMIC)
|
||||
#define __RWF_ATOMIC_SAVED__ RWF_ATOMIC
|
||||
#undef RWF_ATOMIC
|
||||
#else
|
||||
#define __RWF_ATOMIC_SAVED__ 0x00000040
|
||||
#endif
|
||||
#if defined(RWF_DONTCACHE)
|
||||
#define __RWF_DONTCACHE_SAVED__ RWF_DONTCACHE
|
||||
#undef RWF_DONTCACHE
|
||||
#else
|
||||
#define __RWF_DONTCACHE_SAVED__ 0x00000080
|
||||
#endif
|
||||
|
||||
#include <linux/btrfs.h>
|
||||
#include <linux/btrfs_tree.h>
|
||||
#include <linux/fs.h>
|
||||
|
||||
#include "macro.h"
|
||||
|
||||
/* linux/fs.h */
|
||||
#ifndef BLKGETDISKSEQ /* 7957d93bf32bc211415827e44fdd9cdf1388df59 (5.15) */
|
||||
#define BLKGETDISKSEQ _IOR(0x12,128,__u64)
|
||||
#endif
|
||||
|
||||
/* linux/fs.h or sys/mount.h */
|
||||
#ifndef MS_MOVE
|
||||
# define MS_MOVE 8192
|
||||
#else
|
||||
assert_cc(MS_MOVE == 8192);
|
||||
#endif
|
||||
|
||||
#ifndef MS_REC
|
||||
# define MS_REC 16384
|
||||
#else
|
||||
assert_cc(MS_REC == 16384);
|
||||
#endif
|
||||
|
||||
#ifndef MS_PRIVATE
|
||||
# define MS_PRIVATE (1<<18)
|
||||
#else
|
||||
assert_cc(MS_PRIVATE == (1<<18));
|
||||
#endif
|
||||
|
||||
#ifndef MS_SLAVE
|
||||
# define MS_SLAVE (1<<19)
|
||||
#else
|
||||
assert_cc(MS_SLAVE == (1<<19));
|
||||
#endif
|
||||
|
||||
#ifndef MS_SHARED
|
||||
# define MS_SHARED (1<<20)
|
||||
#else
|
||||
assert_cc(MS_SHARED == (1<<20));
|
||||
#endif
|
||||
|
||||
#ifndef MS_RELATIME
|
||||
# define MS_RELATIME (1<<21)
|
||||
#else
|
||||
assert_cc(MS_RELATIME == (1<<21));
|
||||
#endif
|
||||
|
||||
#ifndef MS_KERNMOUNT
|
||||
# define MS_KERNMOUNT (1<<22)
|
||||
#else
|
||||
assert_cc(MS_KERNMOUNT == (1<<22));
|
||||
#endif
|
||||
|
||||
#ifndef MS_I_VERSION
|
||||
# define MS_I_VERSION (1<<23)
|
||||
#else
|
||||
assert_cc(MS_I_VERSION == (1<<23));
|
||||
#endif
|
||||
|
||||
#ifndef MS_STRICTATIME
|
||||
# define MS_STRICTATIME (1<<24)
|
||||
#else
|
||||
assert_cc(MS_STRICTATIME == (1 << 24));
|
||||
#endif
|
||||
|
||||
#ifndef MS_LAZYTIME
|
||||
# define MS_LAZYTIME (1<<25)
|
||||
#else
|
||||
assert_cc(MS_LAZYTIME == (1<<25));
|
||||
#endif
|
||||
|
||||
#ifndef FS_PROJINHERIT_FL
|
||||
# define FS_PROJINHERIT_FL 0x20000000
|
||||
#else
|
||||
assert_cc(FS_PROJINHERIT_FL == 0x20000000);
|
||||
#endif
|
||||
/* check RWF_xyz are redefined by linux/fs.h */
|
||||
assert_cc(RWF_HIPRI == __RWF_HIPRI_SAVED__);
|
||||
assert_cc(RWF_DSYNC == __RWF_DSYNC_SAVED__);
|
||||
assert_cc(RWF_SYNC == __RWF_SYNC_SAVED__);
|
||||
assert_cc(RWF_NOWAIT == __RWF_NOWAIT_SAVED__);
|
||||
assert_cc(RWF_APPEND == __RWF_APPEND_SAVED__);
|
||||
assert_cc(RWF_NOAPPEND == __RWF_NOAPPEND_SAVED__);
|
||||
assert_cc(RWF_ATOMIC == __RWF_ATOMIC_SAVED__);
|
||||
assert_cc(RWF_DONTCACHE == __RWF_DONTCACHE_SAVED__);
|
||||
|
||||
/* Not exposed yet. Defined at fs/ext4/ext4.h */
|
||||
#ifndef EXT4_IOC_RESIZE_FS
|
||||
|
||||
Reference in New Issue
Block a user