xref: /openbmc/linux/include/linux/stat.h (revision a1175d6b)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
21da177e4SLinus Torvalds #ifndef _LINUX_STAT_H
31da177e4SLinus Torvalds #define _LINUX_STAT_H
41da177e4SLinus Torvalds 
51da177e4SLinus Torvalds 
61da177e4SLinus Torvalds #include <asm/stat.h>
7607ca46eSDavid Howells #include <uapi/linux/stat.h>
81da177e4SLinus Torvalds 
91da177e4SLinus Torvalds #define S_IRWXUGO	(S_IRWXU|S_IRWXG|S_IRWXO)
101da177e4SLinus Torvalds #define S_IALLUGO	(S_ISUID|S_ISGID|S_ISVTX|S_IRWXUGO)
111da177e4SLinus Torvalds #define S_IRUGO		(S_IRUSR|S_IRGRP|S_IROTH)
121da177e4SLinus Torvalds #define S_IWUGO		(S_IWUSR|S_IWGRP|S_IWOTH)
131da177e4SLinus Torvalds #define S_IXUGO		(S_IXUSR|S_IXGRP|S_IXOTH)
141da177e4SLinus Torvalds 
151c710c89SUlrich Drepper #define UTIME_NOW	((1l << 30) - 1l)
161c710c89SUlrich Drepper #define UTIME_OMIT	((1l << 30) - 2l)
171c710c89SUlrich Drepper 
181da177e4SLinus Torvalds #include <linux/types.h>
191da177e4SLinus Torvalds #include <linux/time.h>
20a7c1938eSEric W. Biederman #include <linux/uidgid.h>
211da177e4SLinus Torvalds 
221da177e4SLinus Torvalds struct kstat {
23a528d35eSDavid Howells 	u32		result_mask;	/* What fields the user got */
241da177e4SLinus Torvalds 	umode_t		mode;
251da177e4SLinus Torvalds 	unsigned int	nlink;
26a528d35eSDavid Howells 	uint32_t	blksize;	/* Preferred I/O size */
27a528d35eSDavid Howells 	u64		attributes;
283209f68bSDavid Howells 	u64		attributes_mask;
29a528d35eSDavid Howells #define KSTAT_ATTR_FS_IOC_FLAGS				\
30a528d35eSDavid Howells 	(STATX_ATTR_COMPRESSED |			\
31a528d35eSDavid Howells 	 STATX_ATTR_IMMUTABLE |				\
32a528d35eSDavid Howells 	 STATX_ATTR_APPEND |				\
33a528d35eSDavid Howells 	 STATX_ATTR_NODUMP |				\
343ad2522cSEric Biggers 	 STATX_ATTR_ENCRYPTED |				\
353ad2522cSEric Biggers 	 STATX_ATTR_VERITY				\
36a528d35eSDavid Howells 	 )/* Attrs corresponding to FS_*_FL flags */
374f911138SAmir Goldstein #define KSTAT_ATTR_VFS_FLAGS				\
384f911138SAmir Goldstein 	(STATX_ATTR_IMMUTABLE |				\
394f911138SAmir Goldstein 	 STATX_ATTR_APPEND				\
404f911138SAmir Goldstein 	 ) /* Attrs corresponding to S_* flags that are enforced by the VFS */
41a528d35eSDavid Howells 	u64		ino;
42a528d35eSDavid Howells 	dev_t		dev;
43a528d35eSDavid Howells 	dev_t		rdev;
44a7c1938eSEric W. Biederman 	kuid_t		uid;
45a7c1938eSEric W. Biederman 	kgid_t		gid;
461da177e4SLinus Torvalds 	loff_t		size;
4795582b00SDeepa Dinamani 	struct timespec64 atime;
4895582b00SDeepa Dinamani 	struct timespec64 mtime;
4995582b00SDeepa Dinamani 	struct timespec64 ctime;
5095582b00SDeepa Dinamani 	struct timespec64 btime;			/* File creation time */
51a528d35eSDavid Howells 	u64		blocks;
52fa2fcf4fSMiklos Szeredi 	u64		mnt_id;
53825cf206SEric Biggers 	u32		dio_mem_align;
54825cf206SEric Biggers 	u32		dio_offset_align;
55*a1175d6bSJeff Layton 	u64		change_cookie;
561da177e4SLinus Torvalds };
571da177e4SLinus Torvalds 
58*a1175d6bSJeff Layton /* These definitions are internal to the kernel for now. Mainly used by nfsd. */
59*a1175d6bSJeff Layton 
60*a1175d6bSJeff Layton /* mask values */
61*a1175d6bSJeff Layton #define STATX_CHANGE_COOKIE		0x40000000U	/* Want/got stx_change_attr */
62*a1175d6bSJeff Layton 
63*a1175d6bSJeff Layton /* file attribute values */
64*a1175d6bSJeff Layton #define STATX_ATTR_CHANGE_MONOTONIC	0x8000000000000000ULL /* version monotonically increases */
65*a1175d6bSJeff Layton 
661da177e4SLinus Torvalds #endif
67