xref: /linux/tools/testing/selftests/filesystems/overlayfs/wrappers.h (revision 9cc8d0ecdd2aad42e377e971e3bb114339df609e)
1 // SPDX-License-Identifier: GPL-2.0
2 //
3 #ifndef __SELFTEST_OVERLAYFS_WRAPPERS_H__
4 #define __SELFTEST_OVERLAYFS_WRAPPERS_H__
5 
6 #define _GNU_SOURCE
7 
8 #include <linux/types.h>
9 #include <linux/mount.h>
10 #include <sys/syscall.h>
11 
12 static inline int sys_fsopen(const char *fsname, unsigned int flags)
13 {
14 	return syscall(__NR_fsopen, fsname, flags);
15 }
16 
17 static inline int sys_fsconfig(int fd, unsigned int cmd, const char *key,
18 			       const char *value, int aux)
19 {
20 	return syscall(__NR_fsconfig, fd, cmd, key, value, aux);
21 }
22 
23 static inline int sys_fsmount(int fd, unsigned int flags,
24 			      unsigned int attr_flags)
25 {
26 	return syscall(__NR_fsmount, fd, flags, attr_flags);
27 }
28 
29 static inline int sys_mount(const char *src, const char *tgt, const char *fst,
30 			    unsigned long flags, const void *data)
31 {
32 	return syscall(__NR_mount, src, tgt, fst, flags, data);
33 }
34 
35 #ifndef MOVE_MOUNT_F_EMPTY_PATH
36 #define MOVE_MOUNT_F_EMPTY_PATH 0x00000004 /* Empty from path permitted */
37 #endif
38 
39 static inline int sys_move_mount(int from_dfd, const char *from_pathname,
40 				 int to_dfd, const char *to_pathname,
41 				 unsigned int flags)
42 {
43 	return syscall(__NR_move_mount, from_dfd, from_pathname, to_dfd,
44 		       to_pathname, flags);
45 }
46 
47 #endif
48