mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-28 20:02:17 +00:00
![Jeff Layton](/assets/img/avatar_default.png)
The NFS server has a lot of special handling for different types of change attribute access, depending on the underlying filesystem. In most cases, it's doing a getattr anyway and then fetching that value after the fact. Rather that do that, add a new STATX_CHANGE_COOKIE flag that is a kernel-only symbol (for now). If requested and getattr can implement it, it can fill out this field. For IS_I_VERSION inodes, add a generic implementation in vfs_getattr_nosec. Take care to mask STATX_CHANGE_COOKIE off in requests from userland and in the result mask. Since not all filesystems can give the same guarantees of monotonicity, claim a STATX_ATTR_CHANGE_MONOTONIC flag that filesystems can set to indicate that they offer an i_version value that can never go backward. Eventually if we decide to make the i_version available to userland, we can just designate a field for it in struct statx, and move the STATX_CHANGE_COOKIE definition to the uapi header. Reviewed-by: NeilBrown <neilb@suse.de> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Jeff Layton <jlayton@kernel.org>
66 lines
1.7 KiB
C
66 lines
1.7 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _LINUX_STAT_H
|
|
#define _LINUX_STAT_H
|
|
|
|
|
|
#include <asm/stat.h>
|
|
#include <uapi/linux/stat.h>
|
|
|
|
#define S_IRWXUGO (S_IRWXU|S_IRWXG|S_IRWXO)
|
|
#define S_IALLUGO (S_ISUID|S_ISGID|S_ISVTX|S_IRWXUGO)
|
|
#define S_IRUGO (S_IRUSR|S_IRGRP|S_IROTH)
|
|
#define S_IWUGO (S_IWUSR|S_IWGRP|S_IWOTH)
|
|
#define S_IXUGO (S_IXUSR|S_IXGRP|S_IXOTH)
|
|
|
|
#define UTIME_NOW ((1l << 30) - 1l)
|
|
#define UTIME_OMIT ((1l << 30) - 2l)
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/time.h>
|
|
#include <linux/uidgid.h>
|
|
|
|
struct kstat {
|
|
u32 result_mask; /* What fields the user got */
|
|
umode_t mode;
|
|
unsigned int nlink;
|
|
uint32_t blksize; /* Preferred I/O size */
|
|
u64 attributes;
|
|
u64 attributes_mask;
|
|
#define KSTAT_ATTR_FS_IOC_FLAGS \
|
|
(STATX_ATTR_COMPRESSED | \
|
|
STATX_ATTR_IMMUTABLE | \
|
|
STATX_ATTR_APPEND | \
|
|
STATX_ATTR_NODUMP | \
|
|
STATX_ATTR_ENCRYPTED | \
|
|
STATX_ATTR_VERITY \
|
|
)/* Attrs corresponding to FS_*_FL flags */
|
|
#define KSTAT_ATTR_VFS_FLAGS \
|
|
(STATX_ATTR_IMMUTABLE | \
|
|
STATX_ATTR_APPEND \
|
|
) /* Attrs corresponding to S_* flags that are enforced by the VFS */
|
|
u64 ino;
|
|
dev_t dev;
|
|
dev_t rdev;
|
|
kuid_t uid;
|
|
kgid_t gid;
|
|
loff_t size;
|
|
struct timespec64 atime;
|
|
struct timespec64 mtime;
|
|
struct timespec64 ctime;
|
|
struct timespec64 btime; /* File creation time */
|
|
u64 blocks;
|
|
u64 mnt_id;
|
|
u32 dio_mem_align;
|
|
u32 dio_offset_align;
|
|
u64 change_cookie;
|
|
};
|
|
|
|
/* These definitions are internal to the kernel for now. Mainly used by nfsd. */
|
|
|
|
/* mask values */
|
|
#define STATX_CHANGE_COOKIE 0x40000000U /* Want/got stx_change_attr */
|
|
|
|
/* file attribute values */
|
|
#define STATX_ATTR_CHANGE_MONOTONIC 0x8000000000000000ULL /* version monotonically increases */
|
|
|
|
#endif
|