Skip to content

Commit 507af59

Browse files
committed
include/lapi: Move AT_* related macros to fcntl header
These AT* macro is belong to fcntl.h instead of stat.h. So move them. Also, we need to add "lapi/fcntl.h" for these cases that use lapi/stat.h. mount_setattr01.c has include lapi/fsmount.h that includes lapi/fcntl.h in internal, so don't include lapi/fcntl.h again. statx06.c has included "lapi/fcntl.h" before this patch. Reviewed-by: Xiao Yang <[email protected]> Signed-off-by: Yang Xu <[email protected]>
1 parent 1133245 commit 507af59

File tree

11 files changed

+35
-44
lines changed

11 files changed

+35
-44
lines changed

include/lapi/fcntl.h

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,40 @@
8787
# define AT_FDCWD -100
8888
#endif
8989

90+
#ifndef AT_SYMLINK_NOFOLLOW
91+
# define AT_SYMLINK_NOFOLLOW 0x100
92+
#endif
93+
94+
#ifndef AT_REMOVEDIR
95+
# define AT_REMOVEDIR 0x200
96+
#endif
97+
9098
#ifndef AT_SYMLINK_FOLLOW
91-
# define AT_SYMLINK_FOLLOW 0x400
99+
# define AT_SYMLINK_FOLLOW 0x400
92100
#endif
93101

94-
#ifndef AT_SYMLINK_NOFOLLOW
95-
# define AT_SYMLINK_NOFOLLOW 0x100
102+
#ifndef AT_NO_AUTOMOUNT
103+
# define AT_NO_AUTOMOUNT 0x800
96104
#endif
97105

98106
#ifndef AT_EMPTY_PATH
99-
# define AT_EMPTY_PATH 0x1000
107+
# define AT_EMPTY_PATH 0x1000
100108
#endif
101109

102-
#ifndef AT_REMOVEDIR
103-
# define AT_REMOVEDIR 0x200
110+
#ifndef AT_STATX_SYNC_AS_STAT
111+
# define AT_STATX_SYNC_AS_STAT 0x0000
112+
#endif
113+
114+
#ifndef AT_STATX_FORCE_SYNC
115+
# define AT_STATX_FORCE_SYNC 0x2000
116+
#endif
117+
118+
#ifndef AT_STATX_DONT_SYNC
119+
# define AT_STATX_DONT_SYNC 0x4000
120+
#endif
121+
122+
#ifndef AT_STATX_SYNC_TYPE
123+
# define AT_STATX_SYNC_TYPE 0x6000
104124
#endif
105125

106126
#ifndef O_NOATIME

include/lapi/stat.h

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -227,40 +227,4 @@ static inline int statx(int dirfd, const char *pathname, unsigned int flags,
227227
# define STATX_ATTR_VERITY 0x00100000
228228
#endif
229229

230-
#ifndef AT_SYMLINK_NOFOLLOW
231-
# define AT_SYMLINK_NOFOLLOW 0x100
232-
#endif
233-
234-
#ifndef AT_REMOVEDIR
235-
# define AT_REMOVEDIR 0x200
236-
#endif
237-
238-
#ifndef AT_SYMLINK_FOLLOW
239-
# define AT_SYMLINK_FOLLOW 0x400
240-
#endif
241-
242-
#ifndef AT_NO_AUTOMOUNT
243-
# define AT_NO_AUTOMOUNT 0x800
244-
#endif
245-
246-
#ifndef AT_EMPTY_PATH
247-
# define AT_EMPTY_PATH 0x1000
248-
#endif
249-
250-
#ifndef AT_STATX_SYNC_TYPE
251-
# define AT_STATX_SYNC_TYPE 0x6000
252-
#endif
253-
254-
#ifndef AT_STATX_SYNC_AS_STAT
255-
# define AT_STATX_SYNC_AS_STAT 0x0000
256-
#endif
257-
258-
#ifndef AT_STATX_FORCE_SYNC
259-
# define AT_STATX_FORCE_SYNC 0x2000
260-
#endif
261-
262-
#ifndef AT_STATX_DONT_SYNC
263-
# define AT_STATX_DONT_SYNC 0x4000
264-
#endif
265-
266230
#endif /* LAPI_STAT_H__ */

testcases/kernel/syscalls/mount_setattr/mount_setattr01.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#include <sys/statvfs.h>
3333
#include "tst_test.h"
3434
#include "lapi/fsmount.h"
35-
#include "lapi/stat.h"
3635

3736
#define MNTPOINT "mntpoint"
3837
#define OT_MNTPOINT "ot_mntpoint"

testcases/kernel/syscalls/statx/statx01.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "tst_test.h"
3434
#include "tst_safe_macros.h"
3535
#include "lapi/stat.h"
36+
#include "lapi/fcntl.h"
3637
#include "tst_safe_stdio.h"
3738
#include <string.h>
3839
#include <inttypes.h>

testcases/kernel/syscalls/statx/statx02.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "tst_test.h"
2929
#include "tst_safe_macros.h"
3030
#include "lapi/stat.h"
31+
#include "lapi/fcntl.h"
3132

3233
#define TESTFILE "test_temp"
3334
#define LINK_FILE "test_temp_ln"

testcases/kernel/syscalls/statx/statx03.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "tst_safe_macros.h"
2525
#include "tst_get_bad_addr.h"
2626
#include "lapi/stat.h"
27+
#include "lapi/fcntl.h"
2728

2829
#define TESTFILE "test_file"
2930
#define MODE 0644

testcases/kernel/syscalls/statx/statx04.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,11 @@
5252
*/
5353

5454
#define _GNU_SOURCE
55+
#include <stdlib.h>
5556
#include "tst_test.h"
5657
#include "lapi/fs.h"
57-
#include <stdlib.h>
5858
#include "lapi/stat.h"
59+
#include "lapi/fcntl.h"
5960

6061
#define MOUNT_POINT "mntpoint"
6162
#define TESTDIR MOUNT_POINT "/testdir"

testcases/kernel/syscalls/statx/statx05.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "tst_test.h"
2828
#include "lapi/fs.h"
2929
#include "lapi/stat.h"
30+
#include "lapi/fcntl.h"
3031

3132
#define MNTPOINT "mnt_point"
3233
#define TESTDIR_FLAGGED MNTPOINT"/test_dir1"

testcases/kernel/syscalls/statx/statx07.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include <sys/mount.h>
4040
#include "tst_test.h"
4141
#include "lapi/stat.h"
42+
#include "lapi/fcntl.h"
4243

4344
#define MODE(X) (X & (~S_IFMT))
4445
#define FLAG_NAME(x) .flag = x, .flag_name = #x

testcases/kernel/syscalls/statx/statx08.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "lapi/fs.h"
2727
#include <stdlib.h>
2828
#include "lapi/stat.h"
29+
#include "lapi/fcntl.h"
2930

3031
#define MOUNT_POINT "mntpoint"
3132
#define TESTDIR_FLAGGED MOUNT_POINT"/test_dir1"

0 commit comments

Comments
 (0)