Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LINUX_STATFS_H
0003 #define _LINUX_STATFS_H
0004 
0005 #include <linux/types.h>
0006 #include <asm/statfs.h>
0007 #include <asm/byteorder.h>
0008 
0009 struct kstatfs {
0010     long f_type;
0011     long f_bsize;
0012     u64 f_blocks;
0013     u64 f_bfree;
0014     u64 f_bavail;
0015     u64 f_files;
0016     u64 f_ffree;
0017     __kernel_fsid_t f_fsid;
0018     long f_namelen;
0019     long f_frsize;
0020     long f_flags;
0021     long f_spare[4];
0022 };
0023 
0024 /*
0025  * Definitions for the flag in f_flag.
0026  *
0027  * Generally these flags are equivalent to the MS_ flags used in the mount
0028  * ABI.  The exception is ST_VALID which has the same value as MS_REMOUNT
0029  * which doesn't make any sense for statfs.
0030  */
0031 #define ST_RDONLY   0x0001  /* mount read-only */
0032 #define ST_NOSUID   0x0002  /* ignore suid and sgid bits */
0033 #define ST_NODEV    0x0004  /* disallow access to device special files */
0034 #define ST_NOEXEC   0x0008  /* disallow program execution */
0035 #define ST_SYNCHRONOUS  0x0010  /* writes are synced at once */
0036 #define ST_VALID    0x0020  /* f_flags support is implemented */
0037 #define ST_MANDLOCK 0x0040  /* allow mandatory locks on an FS */
0038 /* 0x0080 used for ST_WRITE in glibc */
0039 /* 0x0100 used for ST_APPEND in glibc */
0040 /* 0x0200 used for ST_IMMUTABLE in glibc */
0041 #define ST_NOATIME  0x0400  /* do not update access times */
0042 #define ST_NODIRATIME   0x0800  /* do not update directory access times */
0043 #define ST_RELATIME 0x1000  /* update atime relative to mtime/ctime */
0044 #define ST_NOSYMFOLLOW  0x2000  /* do not follow symlinks */
0045 
0046 struct dentry;
0047 extern int vfs_get_fsid(struct dentry *dentry, __kernel_fsid_t *fsid);
0048 
0049 static inline __kernel_fsid_t u64_to_fsid(u64 v)
0050 {
0051     return (__kernel_fsid_t){.val = {(u32)v, (u32)(v>>32)}};
0052 }
0053 
0054 /* Fold 16 bytes uuid to 64 bit fsid */
0055 static inline __kernel_fsid_t uuid_to_fsid(__u8 *uuid)
0056 {
0057     return u64_to_fsid(le64_to_cpup((void *)uuid) ^
0058         le64_to_cpup((void *)(uuid + sizeof(u64))));
0059 }
0060 
0061 #endif