![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 0002 #ifndef _UAPI_LINUX_STAT_H 0003 #define _UAPI_LINUX_STAT_H 0004 0005 #include <linux/types.h> 0006 0007 #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) 0008 0009 #define S_IFMT 00170000 0010 #define S_IFSOCK 0140000 0011 #define S_IFLNK 0120000 0012 #define S_IFREG 0100000 0013 #define S_IFBLK 0060000 0014 #define S_IFDIR 0040000 0015 #define S_IFCHR 0020000 0016 #define S_IFIFO 0010000 0017 #define S_ISUID 0004000 0018 #define S_ISGID 0002000 0019 #define S_ISVTX 0001000 0020 0021 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) 0022 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) 0023 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) 0024 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) 0025 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) 0026 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) 0027 #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) 0028 0029 #define S_IRWXU 00700 0030 #define S_IRUSR 00400 0031 #define S_IWUSR 00200 0032 #define S_IXUSR 00100 0033 0034 #define S_IRWXG 00070 0035 #define S_IRGRP 00040 0036 #define S_IWGRP 00020 0037 #define S_IXGRP 00010 0038 0039 #define S_IRWXO 00007 0040 #define S_IROTH 00004 0041 #define S_IWOTH 00002 0042 #define S_IXOTH 00001 0043 0044 #endif 0045 0046 /* 0047 * Timestamp structure for the timestamps in struct statx. 0048 * 0049 * tv_sec holds the number of seconds before (negative) or after (positive) 0050 * 00:00:00 1st January 1970 UTC. 0051 * 0052 * tv_nsec holds a number of nanoseconds (0..999,999,999) after the tv_sec time. 0053 * 0054 * __reserved is held in case we need a yet finer resolution. 0055 */ 0056 struct statx_timestamp { 0057 __s64 tv_sec; 0058 __u32 tv_nsec; 0059 __s32 __reserved; 0060 }; 0061 0062 /* 0063 * Structures for the extended file attribute retrieval system call 0064 * (statx()). 0065 * 0066 * The caller passes a mask of what they're specifically interested in as a 0067 * parameter to statx(). What statx() actually got will be indicated in 0068 * st_mask upon return. 0069 * 0070 * For each bit in the mask argument: 0071 * 0072 * - if the datum is not supported: 0073 * 0074 * - the bit will be cleared, and 0075 * 0076 * - the datum will be set to an appropriate fabricated value if one is 0077 * available (eg. CIFS can take a default uid and gid), otherwise 0078 * 0079 * - the field will be cleared; 0080 * 0081 * - otherwise, if explicitly requested: 0082 * 0083 * - the datum will be synchronised to the server if AT_STATX_FORCE_SYNC is 0084 * set or if the datum is considered out of date, and 0085 * 0086 * - the field will be filled in and the bit will be set; 0087 * 0088 * - otherwise, if not requested, but available in approximate form without any 0089 * effort, it will be filled in anyway, and the bit will be set upon return 0090 * (it might not be up to date, however, and no attempt will be made to 0091 * synchronise the internal state first); 0092 * 0093 * - otherwise the field and the bit will be cleared before returning. 0094 * 0095 * Items in STATX_BASIC_STATS may be marked unavailable on return, but they 0096 * will have values installed for compatibility purposes so that stat() and 0097 * co. can be emulated in userspace. 0098 */ 0099 struct statx { 0100 /* 0x00 */ 0101 __u32 stx_mask; /* What results were written [uncond] */ 0102 __u32 stx_blksize; /* Preferred general I/O size [uncond] */ 0103 __u64 stx_attributes; /* Flags conveying information about the file [uncond] */ 0104 /* 0x10 */ 0105 __u32 stx_nlink; /* Number of hard links */ 0106 __u32 stx_uid; /* User ID of owner */ 0107 __u32 stx_gid; /* Group ID of owner */ 0108 __u16 stx_mode; /* File mode */ 0109 __u16 __spare0[1]; 0110 /* 0x20 */ 0111 __u64 stx_ino; /* Inode number */ 0112 __u64 stx_size; /* File size */ 0113 __u64 stx_blocks; /* Number of 512-byte blocks allocated */ 0114 __u64 stx_attributes_mask; /* Mask to show what's supported in stx_attributes */ 0115 /* 0x40 */ 0116 struct statx_timestamp stx_atime; /* Last access time */ 0117 struct statx_timestamp stx_btime; /* File creation time */ 0118 struct statx_timestamp stx_ctime; /* Last attribute change time */ 0119 struct statx_timestamp stx_mtime; /* Last data modification time */ 0120 /* 0x80 */ 0121 __u32 stx_rdev_major; /* Device ID of special file [if bdev/cdev] */ 0122 __u32 stx_rdev_minor; 0123 __u32 stx_dev_major; /* ID of device containing file [uncond] */ 0124 __u32 stx_dev_minor; 0125 /* 0x90 */ 0126 __u64 stx_mnt_id; 0127 __u64 __spare2; 0128 /* 0xa0 */ 0129 __u64 __spare3[12]; /* Spare space for future expansion */ 0130 /* 0x100 */ 0131 }; 0132 0133 /* 0134 * Flags to be stx_mask 0135 * 0136 * Query request/result mask for statx() and struct statx::stx_mask. 0137 * 0138 * These bits should be set in the mask argument of statx() to request 0139 * particular items when calling statx(). 0140 */ 0141 #define STATX_TYPE 0x00000001U /* Want/got stx_mode & S_IFMT */ 0142 #define STATX_MODE 0x00000002U /* Want/got stx_mode & ~S_IFMT */ 0143 #define STATX_NLINK 0x00000004U /* Want/got stx_nlink */ 0144 #define STATX_UID 0x00000008U /* Want/got stx_uid */ 0145 #define STATX_GID 0x00000010U /* Want/got stx_gid */ 0146 #define STATX_ATIME 0x00000020U /* Want/got stx_atime */ 0147 #define STATX_MTIME 0x00000040U /* Want/got stx_mtime */ 0148 #define STATX_CTIME 0x00000080U /* Want/got stx_ctime */ 0149 #define STATX_INO 0x00000100U /* Want/got stx_ino */ 0150 #define STATX_SIZE 0x00000200U /* Want/got stx_size */ 0151 #define STATX_BLOCKS 0x00000400U /* Want/got stx_blocks */ 0152 #define STATX_BASIC_STATS 0x000007ffU /* The stuff in the normal stat struct */ 0153 #define STATX_BTIME 0x00000800U /* Want/got stx_btime */ 0154 #define STATX_MNT_ID 0x00001000U /* Got stx_mnt_id */ 0155 0156 #define STATX__RESERVED 0x80000000U /* Reserved for future struct statx expansion */ 0157 0158 #ifndef __KERNEL__ 0159 /* 0160 * This is deprecated, and shall remain the same value in the future. To avoid 0161 * confusion please use the equivalent (STATX_BASIC_STATS | STATX_BTIME) 0162 * instead. 0163 */ 0164 #define STATX_ALL 0x00000fffU 0165 #endif 0166 0167 /* 0168 * Attributes to be found in stx_attributes and masked in stx_attributes_mask. 0169 * 0170 * These give information about the features or the state of a file that might 0171 * be of use to ordinary userspace programs such as GUIs or ls rather than 0172 * specialised tools. 0173 * 0174 * Note that the flags marked [I] correspond to the FS_IOC_SETFLAGS flags 0175 * semantically. Where possible, the numerical value is picked to correspond 0176 * also. Note that the DAX attribute indicates that the file is in the CPU 0177 * direct access state. It does not correspond to the per-inode flag that 0178 * some filesystems support. 0179 * 0180 */ 0181 #define STATX_ATTR_COMPRESSED 0x00000004 /* [I] File is compressed by the fs */ 0182 #define STATX_ATTR_IMMUTABLE 0x00000010 /* [I] File is marked immutable */ 0183 #define STATX_ATTR_APPEND 0x00000020 /* [I] File is append-only */ 0184 #define STATX_ATTR_NODUMP 0x00000040 /* [I] File is not to be dumped */ 0185 #define STATX_ATTR_ENCRYPTED 0x00000800 /* [I] File requires key to decrypt in fs */ 0186 #define STATX_ATTR_AUTOMOUNT 0x00001000 /* Dir: Automount trigger */ 0187 #define STATX_ATTR_MOUNT_ROOT 0x00002000 /* Root of a mount */ 0188 #define STATX_ATTR_VERITY 0x00100000 /* [I] Verity protected file */ 0189 #define STATX_ATTR_DAX 0x00200000 /* File is currently in DAX state */ 0190 0191 0192 #endif /* _UAPI_LINUX_STAT_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |