]> Git Repo - J-linux.git/blob - tools/testing/selftests/filesystems/statmount/statmount.h
Merge tag 'vfs-6.13-rc7.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
[J-linux.git] / tools / testing / selftests / filesystems / statmount / statmount.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2
3 #ifndef __STATMOUNT_H
4 #define __STATMOUNT_H
5
6 #include <stdint.h>
7 #include <linux/mount.h>
8 #include <asm/unistd.h>
9
10 static inline int statmount(uint64_t mnt_id, uint64_t mnt_ns_id, uint64_t mask,
11                             struct statmount *buf, size_t bufsize,
12                             unsigned int flags)
13 {
14         struct mnt_id_req req = {
15                 .size = MNT_ID_REQ_SIZE_VER0,
16                 .mnt_id = mnt_id,
17                 .param = mask,
18         };
19
20         if (mnt_ns_id) {
21                 req.size = MNT_ID_REQ_SIZE_VER1;
22                 req.mnt_ns_id = mnt_ns_id;
23         }
24
25         return syscall(__NR_statmount, &req, buf, bufsize, flags);
26 }
27
28 static ssize_t listmount(uint64_t mnt_id, uint64_t mnt_ns_id,
29                          uint64_t last_mnt_id, uint64_t list[], size_t num,
30                          unsigned int flags)
31 {
32         struct mnt_id_req req = {
33                 .size = MNT_ID_REQ_SIZE_VER0,
34                 .mnt_id = mnt_id,
35                 .param = last_mnt_id,
36         };
37
38         if (mnt_ns_id) {
39                 req.size = MNT_ID_REQ_SIZE_VER1;
40                 req.mnt_ns_id = mnt_ns_id;
41         }
42
43         return syscall(__NR_listmount, &req, list, num, flags);
44 }
45
46 #endif /* __STATMOUNT_H */
This page took 0.029673 seconds and 4 git commands to generate.