xref: /openbmc/linux/include/linux/statfs.h (revision 9591c3a3)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
21da177e4SLinus Torvalds #ifndef _LINUX_STATFS_H
31da177e4SLinus Torvalds #define _LINUX_STATFS_H
41da177e4SLinus Torvalds 
51da177e4SLinus Torvalds #include <linux/types.h>
61da177e4SLinus Torvalds #include <asm/statfs.h>
7*9591c3a3SAmir Goldstein #include <asm/byteorder.h>
81da177e4SLinus Torvalds 
91da177e4SLinus Torvalds struct kstatfs {
101da177e4SLinus Torvalds 	long f_type;
111da177e4SLinus Torvalds 	long f_bsize;
12e2d53f95STakashi Sato 	u64 f_blocks;
13e2d53f95STakashi Sato 	u64 f_bfree;
14e2d53f95STakashi Sato 	u64 f_bavail;
15e2d53f95STakashi Sato 	u64 f_files;
16e2d53f95STakashi Sato 	u64 f_ffree;
171da177e4SLinus Torvalds 	__kernel_fsid_t f_fsid;
181da177e4SLinus Torvalds 	long f_namelen;
191da177e4SLinus Torvalds 	long f_frsize;
20365b1818SChristoph Hellwig 	long f_flags;
21365b1818SChristoph Hellwig 	long f_spare[4];
221da177e4SLinus Torvalds };
231da177e4SLinus Torvalds 
24365b1818SChristoph Hellwig /*
25365b1818SChristoph Hellwig  * Definitions for the flag in f_flag.
26365b1818SChristoph Hellwig  *
27365b1818SChristoph Hellwig  * Generally these flags are equivalent to the MS_ flags used in the mount
28365b1818SChristoph Hellwig  * ABI.  The exception is ST_VALID which has the same value as MS_REMOUNT
29365b1818SChristoph Hellwig  * which doesn't make any sense for statfs.
30365b1818SChristoph Hellwig  */
31365b1818SChristoph Hellwig #define ST_RDONLY	0x0001	/* mount read-only */
32365b1818SChristoph Hellwig #define ST_NOSUID	0x0002	/* ignore suid and sgid bits */
33365b1818SChristoph Hellwig #define ST_NODEV	0x0004	/* disallow access to device special files */
34365b1818SChristoph Hellwig #define ST_NOEXEC	0x0008	/* disallow program execution */
35365b1818SChristoph Hellwig #define ST_SYNCHRONOUS	0x0010	/* writes are synced at once */
36365b1818SChristoph Hellwig #define ST_VALID	0x0020	/* f_flags support is implemented */
37365b1818SChristoph Hellwig #define ST_MANDLOCK	0x0040	/* allow mandatory locks on an FS */
38365b1818SChristoph Hellwig /* 0x0080 used for ST_WRITE in glibc */
39365b1818SChristoph Hellwig /* 0x0100 used for ST_APPEND in glibc */
40365b1818SChristoph Hellwig /* 0x0200 used for ST_IMMUTABLE in glibc */
41365b1818SChristoph Hellwig #define ST_NOATIME	0x0400	/* do not update access times */
42365b1818SChristoph Hellwig #define ST_NODIRATIME	0x0800	/* do not update directory access times */
43365b1818SChristoph Hellwig #define ST_RELATIME	0x1000	/* update atime relative to mtime/ctime */
44dab741e0SMattias Nissler #define ST_NOSYMFOLLOW	0x2000	/* do not follow symlinks */
45365b1818SChristoph Hellwig 
46ec86ff56SAmir Goldstein struct dentry;
47ec86ff56SAmir Goldstein extern int vfs_get_fsid(struct dentry *dentry, __kernel_fsid_t *fsid);
48ec86ff56SAmir Goldstein 
u64_to_fsid(u64 v)496d1349c7SAl Viro static inline __kernel_fsid_t u64_to_fsid(u64 v)
506d1349c7SAl Viro {
516d1349c7SAl Viro 	return (__kernel_fsid_t){.val = {(u32)v, (u32)(v>>32)}};
526d1349c7SAl Viro }
536d1349c7SAl Viro 
54*9591c3a3SAmir Goldstein /* Fold 16 bytes uuid to 64 bit fsid */
uuid_to_fsid(__u8 * uuid)55*9591c3a3SAmir Goldstein static inline __kernel_fsid_t uuid_to_fsid(__u8 *uuid)
56*9591c3a3SAmir Goldstein {
57*9591c3a3SAmir Goldstein 	return u64_to_fsid(le64_to_cpup((void *)uuid) ^
58*9591c3a3SAmir Goldstein 		le64_to_cpup((void *)(uuid + sizeof(u64))));
59*9591c3a3SAmir Goldstein }
60*9591c3a3SAmir Goldstein 
611da177e4SLinus Torvalds #endif
62