xref: /linux/tools/testing/selftests/filesystems/empty_mntns/empty_mntns.h (revision 7c8a4671dc3247a26a702e5f5996e9f453d7070d)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 #ifndef EMPTY_MNTNS_H
3 #define EMPTY_MNTNS_H
4 
5 #include <errno.h>
6 #include <stdlib.h>
7 
8 #include "../statmount/statmount.h"
9 
10 #ifndef UNSHARE_EMPTY_MNTNS
11 #define UNSHARE_EMPTY_MNTNS	0x00100000
12 #endif
13 
14 #ifndef CLONE_EMPTY_MNTNS
15 #define CLONE_EMPTY_MNTNS	(1ULL << 37)
16 #endif
17 
18 static inline ssize_t count_mounts(void)
19 {
20 	uint64_t list[4096];
21 
22 	return listmount(LSMT_ROOT, 0, 0, list, sizeof(list) / sizeof(list[0]), 0);
23 }
24 
25 #endif /* EMPTY_MNTNS_H */
26