Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/tools/testing/selftests/filesystems/statmount/statmount.h
26302 views
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
#ifndef __NR_statmount
11
#if defined __alpha__
12
#define __NR_statmount 567
13
#elif defined _MIPS_SIM
14
#if _MIPS_SIM == _MIPS_SIM_ABI32 /* o32 */
15
#define __NR_statmount 4457
16
#endif
17
#if _MIPS_SIM == _MIPS_SIM_NABI32 /* n32 */
18
#define __NR_statmount 6457
19
#endif
20
#if _MIPS_SIM == _MIPS_SIM_ABI64 /* n64 */
21
#define __NR_statmount 5457
22
#endif
23
#else
24
#define __NR_statmount 457
25
#endif
26
#endif
27
28
#ifndef __NR_listmount
29
#if defined __alpha__
30
#define __NR_listmount 568
31
#elif defined _MIPS_SIM
32
#if _MIPS_SIM == _MIPS_SIM_ABI32 /* o32 */
33
#define __NR_listmount 4458
34
#endif
35
#if _MIPS_SIM == _MIPS_SIM_NABI32 /* n32 */
36
#define __NR_listmount 6458
37
#endif
38
#if _MIPS_SIM == _MIPS_SIM_ABI64 /* n64 */
39
#define __NR_listmount 5458
40
#endif
41
#else
42
#define __NR_listmount 458
43
#endif
44
#endif
45
46
static inline int statmount(uint64_t mnt_id, uint64_t mnt_ns_id, uint64_t mask,
47
struct statmount *buf, size_t bufsize,
48
unsigned int flags)
49
{
50
struct mnt_id_req req = {
51
.size = MNT_ID_REQ_SIZE_VER0,
52
.mnt_id = mnt_id,
53
.param = mask,
54
};
55
56
if (mnt_ns_id) {
57
req.size = MNT_ID_REQ_SIZE_VER1;
58
req.mnt_ns_id = mnt_ns_id;
59
}
60
61
return syscall(__NR_statmount, &req, buf, bufsize, flags);
62
}
63
64
static inline ssize_t listmount(uint64_t mnt_id, uint64_t mnt_ns_id,
65
uint64_t last_mnt_id, uint64_t list[], size_t num,
66
unsigned int flags)
67
{
68
struct mnt_id_req req = {
69
.size = MNT_ID_REQ_SIZE_VER0,
70
.mnt_id = mnt_id,
71
.param = last_mnt_id,
72
};
73
74
if (mnt_ns_id) {
75
req.size = MNT_ID_REQ_SIZE_VER1;
76
req.mnt_ns_id = mnt_ns_id;
77
}
78
79
return syscall(__NR_listmount, &req, list, num, flags);
80
}
81
82
#endif /* __STATMOUNT_H */
83
84