mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
fuse: support 64 bit, server allocated backing ID
Add support for server allocated 64-bit backing IDs alongside the existing kernel allocated 32-bit IDs. Opened with FUSE_DEV_IOC_BACKING_CREATE, the backing ID sent via fuse_backing_create_in.backing_id. Closed with FUSE_NOTIFY_BACKING_REMOVE. Since close only provides the backing ID, not the file descriptor, it doesn't have to be done with an ioctl. Backing ID can take any 64 bit value other than zero. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
parent
b89c73703e
commit
2f19d54c05
|
|
@ -1213,6 +1213,7 @@ struct fd fdget_raw(unsigned int fd)
|
|||
{
|
||||
return __fget_light(fd, 0);
|
||||
}
|
||||
EXPORT_SYMBOL(fdget_raw);
|
||||
|
||||
/*
|
||||
* Try to avoid f_pos locking. We only need it if the
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include "fuse_i.h"
|
||||
|
||||
#include <linux/file.h>
|
||||
#include <linux/rhashtable.h>
|
||||
|
||||
static struct fuse_backing *fuse_backing_get(struct fuse_backing *fb)
|
||||
{
|
||||
|
|
@ -48,6 +49,8 @@ static int fuse_backing_id_alloc(struct fuse_conn *fc, struct fuse_backing *fb)
|
|||
id = idr_alloc_cyclic(&fc->backing_files_map, fb, 1, 0, GFP_ATOMIC);
|
||||
spin_unlock(&fc->lock);
|
||||
idr_preload_end();
|
||||
if (id > 0)
|
||||
fb->backing_id = id;
|
||||
|
||||
WARN_ON_ONCE(id == 0);
|
||||
return id;
|
||||
|
|
@ -61,81 +64,130 @@ static struct fuse_backing *fuse_backing_id_remove(struct fuse_conn *fc,
|
|||
spin_lock(&fc->lock);
|
||||
fb = idr_remove(&fc->backing_files_map, id);
|
||||
spin_unlock(&fc->lock);
|
||||
if (fb)
|
||||
fb->backing_id = 0;
|
||||
|
||||
return fb;
|
||||
}
|
||||
|
||||
static int fuse_backing_id_free(int id, void *p, void *data)
|
||||
{
|
||||
struct fuse_backing *fb = p;
|
||||
static const struct rhashtable_params fuse_backing_prm = {
|
||||
.head_offset = offsetof(struct fuse_backing, hash_node),
|
||||
.key_offset = offsetof(struct fuse_backing, backing_id),
|
||||
.key_len = sizeof_field(struct fuse_backing, backing_id),
|
||||
};
|
||||
|
||||
static int fuse_backing_add_64(struct fuse_conn *fc, struct fuse_backing *fb)
|
||||
{
|
||||
return rhashtable_lookup_insert_fast(&fc->backing_64_ht, &fb->hash_node, fuse_backing_prm);
|
||||
}
|
||||
|
||||
int fuse_backing_close_64(struct fuse_conn *fc, u64 backing_id)
|
||||
{
|
||||
struct fuse_backing *fb;
|
||||
int err;
|
||||
|
||||
if (!fc->backing_id_64)
|
||||
return -EINVAL;
|
||||
|
||||
scoped_guard(spinlock, &fc->lock) {
|
||||
fb = rhashtable_lookup_fast(&fc->backing_64_ht, &backing_id, fuse_backing_prm);
|
||||
if (!fb)
|
||||
return -ENOENT;
|
||||
|
||||
err = rhashtable_remove_fast(&fc->backing_64_ht, &fb->hash_node, fuse_backing_prm);
|
||||
WARN_ON(err);
|
||||
}
|
||||
fb->backing_id = 0;
|
||||
fuse_backing_put(fb);
|
||||
|
||||
WARN_ON_ONCE(refcount_read(&fb->count) != 1);
|
||||
fuse_backing_free(fb);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void fuse_backing_files_free(struct fuse_conn *fc)
|
||||
static struct fuse_backing *fuse_backing_new(struct fuse_conn *fc, int fd)
|
||||
{
|
||||
idr_for_each(&fc->backing_files_map, fuse_backing_id_free, NULL);
|
||||
idr_destroy(&fc->backing_files_map);
|
||||
struct fuse_backing *fb;
|
||||
struct super_block *backing_sb;
|
||||
struct file *file;
|
||||
|
||||
/* TODO: relax CAP_SYS_ADMIN once backing files are visible to lsof */
|
||||
if (!fc->passthrough || !capable(CAP_SYS_ADMIN))
|
||||
return ERR_PTR(-EPERM);
|
||||
|
||||
CLASS(fd_raw, f)(fd);
|
||||
if (fd_empty(f))
|
||||
return ERR_PTR(-EBADF);
|
||||
|
||||
file = fd_file(f);
|
||||
|
||||
/* read/write/splice/mmap passthrough only relevant for regular files */
|
||||
if (!d_is_reg(file->f_path.dentry))
|
||||
return d_is_dir(file->f_path.dentry) ? ERR_PTR(-EISDIR) : ERR_PTR(-EINVAL);
|
||||
|
||||
backing_sb = file_inode(file)->i_sb;
|
||||
if (backing_sb->s_stack_depth >= fc->max_stack_depth)
|
||||
return ERR_PTR(-ELOOP);
|
||||
|
||||
fb = kmalloc_obj(struct fuse_backing);
|
||||
if (!fb)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
fb->file = get_file(file);
|
||||
fb->cred = get_current_cred();
|
||||
refcount_set(&fb->count, 1);
|
||||
|
||||
return fb;
|
||||
}
|
||||
|
||||
int fuse_backing_open_64(struct fuse_conn *fc, struct fuse_backing_create_in *map)
|
||||
{
|
||||
struct fuse_backing *fb;
|
||||
int res;
|
||||
|
||||
if (map->padding || map->spare[0] || map->spare[1] || !map->backing_id)
|
||||
return -EINVAL;
|
||||
|
||||
if (!fc->backing_id_64)
|
||||
return -EINVAL;
|
||||
|
||||
fb = fuse_backing_new(fc, map->fd);
|
||||
if (IS_ERR(fb))
|
||||
return PTR_ERR(fb);
|
||||
|
||||
fb->backing_id = map->backing_id;
|
||||
res = fuse_backing_add_64(fc, fb);
|
||||
if (res < 0)
|
||||
fuse_backing_free(fb);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
int fuse_backing_open(struct fuse_conn *fc, struct fuse_backing_map *map)
|
||||
{
|
||||
struct file *file;
|
||||
struct super_block *backing_sb;
|
||||
struct fuse_backing *fb = NULL;
|
||||
int res;
|
||||
|
||||
pr_debug("%s: fd=%d flags=0x%x\n", __func__, map->fd, map->flags);
|
||||
|
||||
/* TODO: relax CAP_SYS_ADMIN once backing files are visible to lsof */
|
||||
res = -EPERM;
|
||||
if (!fc->passthrough || !capable(CAP_SYS_ADMIN))
|
||||
goto out;
|
||||
|
||||
res = -EINVAL;
|
||||
if (map->flags || map->padding)
|
||||
goto out;
|
||||
|
||||
file = fget_raw(map->fd);
|
||||
res = -EBADF;
|
||||
if (!file)
|
||||
if (fc->backing_id_64)
|
||||
goto out;
|
||||
|
||||
/* read/write/splice/mmap passthrough only relevant for regular files */
|
||||
res = d_is_dir(file->f_path.dentry) ? -EISDIR : -EINVAL;
|
||||
if (!d_is_reg(file->f_path.dentry))
|
||||
goto out_fput;
|
||||
|
||||
backing_sb = file_inode(file)->i_sb;
|
||||
res = -ELOOP;
|
||||
if (backing_sb->s_stack_depth >= fc->max_stack_depth)
|
||||
goto out_fput;
|
||||
|
||||
fb = kmalloc_obj(struct fuse_backing);
|
||||
res = -ENOMEM;
|
||||
if (!fb)
|
||||
goto out_fput;
|
||||
|
||||
fb->file = file;
|
||||
fb->cred = get_current_cred();
|
||||
refcount_set(&fb->count, 1);
|
||||
|
||||
res = fuse_backing_id_alloc(fc, fb);
|
||||
if (res < 0) {
|
||||
fuse_backing_free(fb);
|
||||
fb = NULL;
|
||||
fb = fuse_backing_new(fc, map->fd);
|
||||
res = PTR_ERR(fb);
|
||||
if (!IS_ERR(fb)) {
|
||||
res = fuse_backing_id_alloc(fc, fb);
|
||||
if (res < 0) {
|
||||
fuse_backing_free(fb);
|
||||
fb = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
pr_debug("%s: fb=0x%p, ret=%i\n", __func__, fb, res);
|
||||
|
||||
return res;
|
||||
|
||||
out_fput:
|
||||
fput(file);
|
||||
goto out;
|
||||
}
|
||||
|
||||
int fuse_backing_close(struct fuse_conn *fc, int backing_id)
|
||||
|
|
@ -145,6 +197,9 @@ int fuse_backing_close(struct fuse_conn *fc, int backing_id)
|
|||
|
||||
pr_debug("%s: backing_id=%d\n", __func__, backing_id);
|
||||
|
||||
if (fc->backing_id_64)
|
||||
return -EINVAL;
|
||||
|
||||
/* TODO: relax CAP_SYS_ADMIN once backing files are visible to lsof */
|
||||
err = -EPERM;
|
||||
if (!fc->passthrough || !capable(CAP_SYS_ADMIN))
|
||||
|
|
@ -167,14 +222,47 @@ int fuse_backing_close(struct fuse_conn *fc, int backing_id)
|
|||
return err;
|
||||
}
|
||||
|
||||
struct fuse_backing *fuse_backing_lookup(struct fuse_conn *fc, int backing_id)
|
||||
struct fuse_backing *fuse_backing_lookup(struct fuse_conn *fc, u64 backing_id)
|
||||
{
|
||||
struct fuse_backing *fb;
|
||||
|
||||
rcu_read_lock();
|
||||
fb = idr_find(&fc->backing_files_map, backing_id);
|
||||
fb = fuse_backing_get(fb);
|
||||
rcu_read_unlock();
|
||||
guard(rcu)();
|
||||
if (!fc->backing_id_64)
|
||||
fb = idr_find(&fc->backing_files_map, backing_id);
|
||||
else
|
||||
fb = rhashtable_lookup(&fc->backing_64_ht, &backing_id, fuse_backing_prm);
|
||||
|
||||
return fb;
|
||||
return fuse_backing_get(fb);
|
||||
}
|
||||
|
||||
static void fuse_backing_check_free(struct fuse_backing *fb)
|
||||
{
|
||||
WARN_ON_ONCE(refcount_read(&fb->count) != 1);
|
||||
fuse_backing_free(fb);
|
||||
}
|
||||
|
||||
static int fuse_backing_idr_free(int id, void *p, void *data)
|
||||
{
|
||||
fuse_backing_check_free(p);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void fuse_backing_rht_free(void *p, void *data)
|
||||
{
|
||||
fuse_backing_check_free(p);
|
||||
}
|
||||
|
||||
void fuse_backing_files_free(struct fuse_conn *fc)
|
||||
{
|
||||
if (fc->backing_id_64) {
|
||||
rhashtable_free_and_destroy(&fc->backing_64_ht, fuse_backing_rht_free, NULL);
|
||||
} else {
|
||||
idr_for_each(&fc->backing_files_map, fuse_backing_idr_free, NULL);
|
||||
idr_destroy(&fc->backing_files_map);
|
||||
}
|
||||
}
|
||||
|
||||
void fuse_backing_files_init_64(struct fuse_conn *fc)
|
||||
{
|
||||
rhashtable_init(&fc->backing_64_ht, &fuse_backing_prm);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2324,39 +2324,64 @@ static long fuse_dev_ioctl_clone(struct file *file, __u32 __user *argp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct fuse_conn *fuse_get_conn_for_passthrough(struct file *file)
|
||||
{
|
||||
struct fuse_dev *fud = fuse_get_dev(file);
|
||||
|
||||
if (IS_ERR(fud))
|
||||
return ERR_CAST(fud);
|
||||
|
||||
if (!smp_load_acquire(&fud->chan->initialized))
|
||||
return ERR_PTR(-ENOTCONN);
|
||||
|
||||
if (!IS_ENABLED(CONFIG_FUSE_PASSTHROUGH))
|
||||
return ERR_PTR(-EOPNOTSUPP);
|
||||
|
||||
return fud->chan->conn;
|
||||
}
|
||||
|
||||
static long fuse_dev_ioctl_backing_open(struct file *file,
|
||||
struct fuse_backing_map __user *argp)
|
||||
{
|
||||
struct fuse_dev *fud = fuse_get_dev(file);
|
||||
struct fuse_conn *fc = fuse_get_conn_for_passthrough(file);
|
||||
struct fuse_backing_map map;
|
||||
|
||||
if (IS_ERR(fud))
|
||||
return PTR_ERR(fud);
|
||||
|
||||
if (!IS_ENABLED(CONFIG_FUSE_PASSTHROUGH))
|
||||
return -EOPNOTSUPP;
|
||||
if (IS_ERR(fc))
|
||||
return PTR_ERR(fc);
|
||||
|
||||
if (copy_from_user(&map, argp, sizeof(map)))
|
||||
return -EFAULT;
|
||||
|
||||
return fuse_backing_open(fud->chan->conn, &map);
|
||||
return fuse_backing_open(fc, &map);
|
||||
}
|
||||
|
||||
static long fuse_dev_ioctl_backing_create(struct file *file,
|
||||
struct fuse_backing_create_in __user *argp)
|
||||
{
|
||||
struct fuse_conn *fc = fuse_get_conn_for_passthrough(file);
|
||||
struct fuse_backing_create_in map;
|
||||
|
||||
if (IS_ERR(fc))
|
||||
return PTR_ERR(fc);
|
||||
|
||||
if (copy_from_user(&map, argp, sizeof(map)))
|
||||
return -EFAULT;
|
||||
|
||||
return fuse_backing_open_64(fc, &map);
|
||||
}
|
||||
|
||||
static long fuse_dev_ioctl_backing_close(struct file *file, __u32 __user *argp)
|
||||
{
|
||||
struct fuse_dev *fud = fuse_get_dev(file);
|
||||
struct fuse_conn *fc = fuse_get_conn_for_passthrough(file);
|
||||
int backing_id;
|
||||
|
||||
if (IS_ERR(fud))
|
||||
return PTR_ERR(fud);
|
||||
|
||||
if (!IS_ENABLED(CONFIG_FUSE_PASSTHROUGH))
|
||||
return -EOPNOTSUPP;
|
||||
if (IS_ERR(fc))
|
||||
return PTR_ERR(fc);
|
||||
|
||||
if (get_user(backing_id, argp))
|
||||
return -EFAULT;
|
||||
|
||||
return fuse_backing_close(fud->chan->conn, backing_id);
|
||||
return fuse_backing_close(fc, backing_id);
|
||||
}
|
||||
|
||||
static long fuse_dev_ioctl_sync_init(struct file *file)
|
||||
|
|
@ -2382,6 +2407,9 @@ static long fuse_dev_ioctl(struct file *file, unsigned int cmd,
|
|||
case FUSE_DEV_IOC_BACKING_OPEN:
|
||||
return fuse_dev_ioctl_backing_open(file, argp);
|
||||
|
||||
case FUSE_DEV_IOC_BACKING_CREATE:
|
||||
return fuse_dev_ioctl_backing_create(file, argp);
|
||||
|
||||
case FUSE_DEV_IOC_BACKING_CLOSE:
|
||||
return fuse_dev_ioctl_backing_close(file, argp);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ struct fuse_dev;
|
|||
struct fuse_args;
|
||||
struct fuse_copy_state;
|
||||
struct fuse_backing_map;
|
||||
struct fuse_backing_create_in;
|
||||
struct file;
|
||||
struct folio;
|
||||
enum fuse_notify_code;
|
||||
|
|
@ -87,6 +88,8 @@ int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code,
|
|||
|
||||
int fuse_backing_open(struct fuse_conn *fc, struct fuse_backing_map *map);
|
||||
int fuse_backing_close(struct fuse_conn *fc, int backing_id);
|
||||
int fuse_backing_open_64(struct fuse_conn *fc, struct fuse_backing_create_in *map);
|
||||
int fuse_backing_close_64(struct fuse_conn *fc, u64 backing_id);
|
||||
|
||||
int fuse_copy_one(struct fuse_copy_state *cs, void *val, unsigned size);
|
||||
int fuse_copy_folio(struct fuse_copy_state *cs, struct folio **foliop,
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
#include <linux/pid_namespace.h>
|
||||
#include <linux/refcount.h>
|
||||
#include <linux/user_namespace.h>
|
||||
#include <linux/rhashtable-types.h>
|
||||
|
||||
/** Default max number of pages that can be used in a single read request */
|
||||
#define FUSE_DEFAULT_MAX_PAGES_PER_REQ 32
|
||||
|
|
@ -92,7 +93,8 @@ struct fuse_submount_lookup {
|
|||
struct fuse_backing {
|
||||
struct file *file;
|
||||
const struct cred *cred;
|
||||
|
||||
u64 backing_id;
|
||||
struct rhash_head hash_node;
|
||||
/* refcount */
|
||||
refcount_t count;
|
||||
struct rcu_head rcu;
|
||||
|
|
@ -713,6 +715,9 @@ struct fuse_conn {
|
|||
/** @passthrough: Passthrough support for read/write IO */
|
||||
unsigned int passthrough:1;
|
||||
|
||||
/** @backing_id_64: Backing ID is 64 bit and allocated by the server */
|
||||
bool backing_id_64:1;
|
||||
|
||||
/** @use_pages_for_kvec_io: Use pages instead of pointer for kernel I/O */
|
||||
unsigned int use_pages_for_kvec_io:1;
|
||||
|
||||
|
|
@ -770,8 +775,14 @@ struct fuse_conn {
|
|||
struct fuse_sync_bucket __rcu *curr_bucket;
|
||||
|
||||
#ifdef CONFIG_FUSE_PASSTHROUGH
|
||||
/** @backing_files_map: IDR for backing files ids */
|
||||
struct idr backing_files_map;
|
||||
/* Selected by backing_id_64 */
|
||||
union {
|
||||
/** @backing_files_map: IDR for backing files ids */
|
||||
struct idr backing_files_map;
|
||||
|
||||
/** @backing_64_ht: 64 bit ID lookup hash table */
|
||||
struct rhashtable backing_64_ht;
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
@ -1270,7 +1281,7 @@ void fuse_file_release(struct inode *inode, struct fuse_file *ff,
|
|||
/* backing.c */
|
||||
#ifdef CONFIG_FUSE_PASSTHROUGH
|
||||
void fuse_backing_put(struct fuse_backing *fb);
|
||||
struct fuse_backing *fuse_backing_lookup(struct fuse_conn *fc, int backing_id);
|
||||
|
||||
#else
|
||||
|
||||
static inline void fuse_backing_put(struct fuse_backing *fb)
|
||||
|
|
@ -1278,7 +1289,9 @@ static inline void fuse_backing_put(struct fuse_backing *fb)
|
|||
}
|
||||
#endif
|
||||
|
||||
struct fuse_backing *fuse_backing_lookup(struct fuse_conn *fc, u64 backing_id);
|
||||
void fuse_backing_files_init(struct fuse_conn *fc);
|
||||
void fuse_backing_files_init_64(struct fuse_conn *fc);
|
||||
void fuse_backing_files_free(struct fuse_conn *fc);
|
||||
|
||||
/* passthrough.c */
|
||||
|
|
|
|||
|
|
@ -1408,13 +1408,17 @@ static void process_init_reply(struct fuse_args *args, int error)
|
|||
* them together.
|
||||
*/
|
||||
if (IS_ENABLED(CONFIG_FUSE_PASSTHROUGH) &&
|
||||
(flags & FUSE_PASSTHROUGH) &&
|
||||
(flags & (FUSE_PASSTHROUGH | FUSE_PASSTHROUGH_V2)) &&
|
||||
arg->max_stack_depth > 0 &&
|
||||
arg->max_stack_depth <= FILESYSTEM_MAX_STACK_DEPTH &&
|
||||
!(flags & FUSE_WRITEBACK_CACHE)) {
|
||||
fc->passthrough = 1;
|
||||
fc->max_stack_depth = arg->max_stack_depth;
|
||||
fm->sb->s_stack_depth = arg->max_stack_depth;
|
||||
if (flags & FUSE_PASSTHROUGH_V2) {
|
||||
fc->backing_id_64 = true;
|
||||
fuse_backing_files_init_64(fc);
|
||||
}
|
||||
}
|
||||
if (flags & FUSE_NO_EXPORT_SUPPORT)
|
||||
fm->sb->s_export_op = &fuse_export_fid_operations;
|
||||
|
|
@ -1500,7 +1504,7 @@ static struct fuse_init_args *fuse_new_init(struct fuse_mount *fm)
|
|||
if (fm->fc->auto_submounts)
|
||||
flags |= FUSE_SUBMOUNTS;
|
||||
if (IS_ENABLED(CONFIG_FUSE_PASSTHROUGH))
|
||||
flags |= FUSE_PASSTHROUGH;
|
||||
flags |= FUSE_PASSTHROUGH | FUSE_PASSTHROUGH_V2;
|
||||
/* Only offered to sufficiently privileged servers; see
|
||||
* fuse_syncfs_enable().
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -409,6 +409,31 @@ static int fuse_notify_prune(struct fuse_conn *fc, unsigned int size,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int fuse_notify_backing_remove(struct fuse_conn *fc, unsigned int size,
|
||||
struct fuse_copy_state *cs)
|
||||
{
|
||||
struct fuse_notify_backing_remove_out outarg;
|
||||
int err;
|
||||
|
||||
if (!IS_ENABLED(CONFIG_FUSE_PASSTHROUGH))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (size != sizeof(outarg))
|
||||
return -EINVAL;
|
||||
|
||||
err = fuse_copy_one(cs, &outarg, sizeof(outarg));
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (outarg.reserved)
|
||||
return -EINVAL;
|
||||
|
||||
if (!fc->backing_id_64)
|
||||
return -EINVAL;
|
||||
|
||||
return fuse_backing_close_64(fc, outarg.backing_id);
|
||||
}
|
||||
|
||||
int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code,
|
||||
unsigned int size, struct fuse_copy_state *cs)
|
||||
{
|
||||
|
|
@ -440,6 +465,9 @@ int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code,
|
|||
case FUSE_NOTIFY_PRUNE:
|
||||
return fuse_notify_prune(fc, size, cs);
|
||||
|
||||
case FUSE_NOTIFY_BACKING_REMOVE:
|
||||
return fuse_notify_backing_remove(fc, size, cs);
|
||||
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,6 +173,9 @@ struct fuse_backing *fuse_passthrough_open(struct file *file, int backing_id)
|
|||
struct fuse_backing *fb = NULL;
|
||||
struct file *backing_file;
|
||||
|
||||
if (fc->backing_id_64)
|
||||
return ERR_PTR(fuse_EIO("incompatible backing version"));
|
||||
|
||||
if (backing_id <= 0)
|
||||
return ERR_PTR(fuse_EIO("invalid backing_id"));
|
||||
|
||||
|
|
|
|||
|
|
@ -251,6 +251,9 @@
|
|||
*
|
||||
* 7.47
|
||||
* - add FUSE_HAS_SYNCFS opt-in flag for privileged userspace servers
|
||||
* - add FUSE_PASSTHROUGH_V2
|
||||
* - add FUSE_DEV_IOC_BACKING_CREATE, struct fuse_backing_create_in
|
||||
* - add FUSE_NOTIFY_BACKING_REMOVE, struct fuse_notify_backing_remove_out
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_FUSE_H
|
||||
|
|
@ -473,6 +476,7 @@ struct fuse_file_lock {
|
|||
* with CAP_SYS_ADMIN in the initial user namespace (the same
|
||||
* privilege that mounting virtiofs or fuseblk requires).
|
||||
* Insufficiently privileged servers ignore it.
|
||||
* FUSE_PASSTHROUGH_V2: use 64 bit server allocated backing ID
|
||||
*/
|
||||
#define FUSE_ASYNC_READ (1 << 0)
|
||||
#define FUSE_POSIX_LOCKS (1 << 1)
|
||||
|
|
@ -522,6 +526,7 @@ struct fuse_file_lock {
|
|||
#define FUSE_REQUEST_TIMEOUT (1ULL << 42)
|
||||
#define FUSE_HAS_IO_URING_BUFPOOL (1ULL << 43)
|
||||
#define FUSE_HAS_SYNCFS (1ULL << 44)
|
||||
#define FUSE_PASSTHROUGH_V2 (1ULL << 45)
|
||||
|
||||
/*
|
||||
* CUSE INIT request/reply flags
|
||||
|
|
@ -709,6 +714,7 @@ enum fuse_notify_code {
|
|||
FUSE_NOTIFY_RESEND = 7,
|
||||
FUSE_NOTIFY_INC_EPOCH = 8,
|
||||
FUSE_NOTIFY_PRUNE = 9,
|
||||
FUSE_NOTIFY_BACKING_REMOVE = 10,
|
||||
};
|
||||
|
||||
/* The read buffer is required to be at least 8k, but may be much larger */
|
||||
|
|
@ -1159,13 +1165,20 @@ struct fuse_backing_map {
|
|||
uint64_t padding;
|
||||
};
|
||||
|
||||
struct fuse_backing_create_in {
|
||||
int32_t fd;
|
||||
uint32_t padding;
|
||||
uint64_t backing_id; /* Zero value is reserved */
|
||||
uint64_t spare[2];
|
||||
};
|
||||
|
||||
/* Device ioctls: */
|
||||
#define FUSE_DEV_IOC_MAGIC 229
|
||||
#define FUSE_DEV_IOC_CLONE _IOR(FUSE_DEV_IOC_MAGIC, 0, uint32_t)
|
||||
#define FUSE_DEV_IOC_BACKING_OPEN _IOW(FUSE_DEV_IOC_MAGIC, 1, \
|
||||
struct fuse_backing_map)
|
||||
#define FUSE_DEV_IOC_BACKING_OPEN _IOW(FUSE_DEV_IOC_MAGIC, 1, struct fuse_backing_map)
|
||||
#define FUSE_DEV_IOC_BACKING_CLOSE _IOW(FUSE_DEV_IOC_MAGIC, 2, uint32_t)
|
||||
#define FUSE_DEV_IOC_SYNC_INIT _IO(FUSE_DEV_IOC_MAGIC, 3)
|
||||
#define FUSE_DEV_IOC_BACKING_CREATE _IOW(FUSE_DEV_IOC_MAGIC, 4, struct fuse_backing_create_in)
|
||||
|
||||
struct fuse_lseek_in {
|
||||
uint64_t fh;
|
||||
|
|
@ -1193,6 +1206,11 @@ struct fuse_copy_file_range_out {
|
|||
uint64_t bytes_copied;
|
||||
};
|
||||
|
||||
struct fuse_notify_backing_remove_out {
|
||||
uint64_t backing_id;
|
||||
uint64_t reserved;
|
||||
};
|
||||
|
||||
#define FUSE_SETUPMAPPING_FLAG_WRITE (1ull << 0)
|
||||
#define FUSE_SETUPMAPPING_FLAG_READ (1ull << 1)
|
||||
struct fuse_setupmapping_in {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user