brintos

brintos / linux-shallow public Read only

0
0
Text · 984 B · f4294ba Raw
47 lines · c
1/* SPDX-License-Identifier: GPL-2.0 */2 3#ifndef __STATMOUNT_H4#define __STATMOUNT_H5 6#include <stdint.h>7#include <linux/mount.h>8#include <asm/unistd.h>9 10static 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 28static 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 */47