mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 08:03:01 +09:00
libfs: Add directory operations for stable offsets
Create a vector of directory operations in fs/libfs.c that handles directory seeks and readdir via stable offsets instead of the current cursor-based mechanism. For the moment these are unused. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Message-Id: <168814732984.530310.11190772066786107220.stgit@manet.1015granger.net> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
committed by
Christian Brauner
parent
509f006932
commit
6faddda69f
@@ -1770,6 +1770,7 @@ struct dir_context {
|
||||
|
||||
struct iov_iter;
|
||||
struct io_uring_cmd;
|
||||
struct offset_ctx;
|
||||
|
||||
struct file_operations {
|
||||
struct module *owner;
|
||||
@@ -1857,6 +1858,7 @@ struct inode_operations {
|
||||
int (*fileattr_set)(struct mnt_idmap *idmap,
|
||||
struct dentry *dentry, struct fileattr *fa);
|
||||
int (*fileattr_get)(struct dentry *dentry, struct fileattr *fa);
|
||||
struct offset_ctx *(*get_offset_ctx)(struct inode *inode);
|
||||
} ____cacheline_aligned;
|
||||
|
||||
static inline ssize_t call_read_iter(struct file *file, struct kiocb *kio,
|
||||
@@ -2971,6 +2973,22 @@ extern ssize_t simple_read_from_buffer(void __user *to, size_t count,
|
||||
extern ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos,
|
||||
const void __user *from, size_t count);
|
||||
|
||||
struct offset_ctx {
|
||||
struct xarray xa;
|
||||
u32 next_offset;
|
||||
};
|
||||
|
||||
void simple_offset_init(struct offset_ctx *octx);
|
||||
int simple_offset_add(struct offset_ctx *octx, struct dentry *dentry);
|
||||
void simple_offset_remove(struct offset_ctx *octx, struct dentry *dentry);
|
||||
int simple_offset_rename_exchange(struct inode *old_dir,
|
||||
struct dentry *old_dentry,
|
||||
struct inode *new_dir,
|
||||
struct dentry *new_dentry);
|
||||
void simple_offset_destroy(struct offset_ctx *octx);
|
||||
|
||||
extern const struct file_operations simple_offset_dir_operations;
|
||||
|
||||
extern int __generic_file_fsync(struct file *, loff_t, loff_t, int);
|
||||
extern int generic_file_fsync(struct file *, loff_t, loff_t, int);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user