mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-29 19:37:00 -05:00
Simplify lowlevel fuse state management and req mem
This commit is contained in:
parent
9a261ca3a0
commit
d5cdd553b5
14 changed files with 376 additions and 307 deletions
|
|
@ -21,7 +21,7 @@
|
|||
#include "node.hpp"
|
||||
|
||||
#include "fuse_cfg.hpp"
|
||||
#include "fuse_req.h"
|
||||
#include "fuse_req.hpp"
|
||||
#include "fuse_dirents.hpp"
|
||||
#include "fuse_i.h"
|
||||
#include "fuse_kernel.h"
|
||||
|
|
@ -1323,8 +1323,8 @@ reply_entry(fuse_req_t *req_,
|
|||
|
||||
static
|
||||
void
|
||||
fuse_lib_init(void *data,
|
||||
struct fuse_conn_info *conn)
|
||||
fuse_lib_init(void *data,
|
||||
fuse_conn_info_t *conn)
|
||||
{
|
||||
f.ops.init(conn);
|
||||
}
|
||||
|
|
@ -1747,7 +1747,7 @@ fuse_lib_mknod(fuse_req_t *req_,
|
|||
arg = (fuse_mknod_in*)fuse_hdr_arg(hdr_);
|
||||
name = (const char*)PARAM(arg);
|
||||
|
||||
if(req_->f->conn.proto_minor >= 12)
|
||||
if(req_->conn.proto_minor >= 12)
|
||||
req_->ctx.umask = arg->umask;
|
||||
else
|
||||
name = (char*)arg + FUSE_COMPAT_MKNOD_IN_SIZE;
|
||||
|
|
@ -1803,7 +1803,7 @@ fuse_lib_mkdir(fuse_req_t *req_,
|
|||
|
||||
arg = (fuse_mkdir_in*)fuse_hdr_arg(hdr_);
|
||||
name = (const char*)PARAM(arg);
|
||||
if(req_->f->conn.proto_minor >= 12)
|
||||
if(req_->conn.proto_minor >= 12)
|
||||
req_->ctx.umask = arg->umask;
|
||||
|
||||
err = get_path_name(hdr_->nodeid,name,&fusepath);
|
||||
|
|
@ -2040,7 +2040,7 @@ fuse_lib_create(fuse_req_t *req_,
|
|||
|
||||
ffi.flags = arg->flags;
|
||||
|
||||
if(req_->f->conn.proto_minor >= 12)
|
||||
if(req_->conn.proto_minor >= 12)
|
||||
req_->ctx.umask = arg->umask;
|
||||
else
|
||||
name = ((char*)arg + sizeof(struct fuse_open_in));
|
||||
|
|
@ -2194,7 +2194,7 @@ fuse_lib_read(fuse_req_t *req_,
|
|||
|
||||
arg = (fuse_read_in*)fuse_hdr_arg(hdr_);
|
||||
ffi.fh = arg->fh;
|
||||
if(req_->f->conn.proto_minor >= 9)
|
||||
if(req_->conn.proto_minor >= 9)
|
||||
{
|
||||
ffi.flags = arg->flags;
|
||||
ffi.lock_owner = arg->lock_owner;
|
||||
|
|
@ -2229,7 +2229,7 @@ fuse_lib_write(fuse_req_t *req_,
|
|||
arg = (fuse_write_in*)fuse_hdr_arg(hdr_);
|
||||
ffi.fh = arg->fh;
|
||||
ffi.writepage = !!(arg->write_flags & 1);
|
||||
if(req_->f->conn.proto_minor < 9)
|
||||
if(req_->conn.proto_minor < 9)
|
||||
{
|
||||
data = ((char*)arg) + FUSE_COMPAT_WRITE_IN_SIZE;
|
||||
}
|
||||
|
|
@ -2549,8 +2549,8 @@ fuse_lib_setxattr(fuse_req_t *req_,
|
|||
struct fuse_setxattr_in *arg;
|
||||
|
||||
arg = (fuse_setxattr_in*)fuse_hdr_arg(hdr_);
|
||||
if((req_->f->conn.capable & FUSE_SETXATTR_EXT) &&
|
||||
(req_->f->conn.want & FUSE_SETXATTR_EXT))
|
||||
if((req_->conn.capable & FUSE_SETXATTR_EXT) &&
|
||||
(req_->conn.want & FUSE_SETXATTR_EXT))
|
||||
name = (const char*)PARAM(arg);
|
||||
else
|
||||
name = (((char*)arg) + FUSE_COMPAT_SETXATTR_IN_SIZE);
|
||||
|
|
@ -2791,7 +2791,7 @@ fuse_lib_tmpfile(fuse_req_t *req_,
|
|||
|
||||
ffi.flags = arg->flags;
|
||||
|
||||
if(req_->f->conn.proto_minor >= 12)
|
||||
if(req_->conn.proto_minor >= 12)
|
||||
req_->ctx.umask = arg->umask;
|
||||
else
|
||||
name = (char*)arg + sizeof(struct fuse_open_in);
|
||||
|
|
@ -3035,7 +3035,7 @@ fuse_lib_release(fuse_req_t *req_,
|
|||
arg = (fuse_release_in*)fuse_hdr_arg(hdr_);
|
||||
ffi.fh = arg->fh;
|
||||
ffi.flags = arg->flags;
|
||||
if(req_->f->conn.proto_minor >= 8)
|
||||
if(req_->conn.proto_minor >= 8)
|
||||
{
|
||||
ffi.flush = !!(arg->release_flags & FUSE_RELEASE_FLUSH);
|
||||
ffi.lock_owner = arg->lock_owner;
|
||||
|
|
@ -3073,7 +3073,7 @@ fuse_lib_flush(fuse_req_t *req_,
|
|||
|
||||
ffi.fh = arg->fh;
|
||||
ffi.flush = 1;
|
||||
if(req_->f->conn.proto_minor >= 7)
|
||||
if(req_->conn.proto_minor >= 7)
|
||||
ffi.lock_owner = arg->lock_owner;
|
||||
|
||||
err = fuse_flush_common(req_,hdr_->nodeid,&ffi);
|
||||
|
|
@ -3233,14 +3233,14 @@ fuse_lib_ioctl(fuse_req_t *req_,
|
|||
const struct fuse_ioctl_in *arg;
|
||||
|
||||
arg = (fuse_ioctl_in*)fuse_hdr_arg(hdr_);
|
||||
if((arg->flags & FUSE_IOCTL_DIR) && !(req_->f->conn.want & FUSE_CAP_IOCTL_DIR))
|
||||
if((arg->flags & FUSE_IOCTL_DIR) && !(req_->conn.want & FUSE_CAP_IOCTL_DIR))
|
||||
{
|
||||
fuse_reply_err(req_,ENOTTY);
|
||||
return;
|
||||
}
|
||||
|
||||
if((sizeof(void*) == 4) &&
|
||||
(req_->f->conn.proto_minor >= 16) &&
|
||||
(req_->conn.proto_minor >= 16) &&
|
||||
!(arg->flags & FUSE_IOCTL_32BIT))
|
||||
{
|
||||
req_->ioctl_64bit = 1;
|
||||
|
|
@ -3314,7 +3314,6 @@ fuse_lib_poll(fuse_req_t *req_,
|
|||
|
||||
ph->kh = arg->kh;
|
||||
ph->ch = req_->ch;
|
||||
ph->f = req_->f;
|
||||
}
|
||||
|
||||
err = f.ops.poll(&req_->ctx,
|
||||
|
|
|
|||
|
|
@ -43,19 +43,6 @@ struct fuse_notify_req
|
|||
struct fuse_notify_req *prev;
|
||||
};
|
||||
|
||||
struct fuse_ll
|
||||
{
|
||||
struct fuse_lowlevel_ops op;
|
||||
void *userdata;
|
||||
uid_t owner;
|
||||
struct fuse_conn_info conn;
|
||||
pthread_mutex_t lock;
|
||||
int got_init;
|
||||
int got_destroy;
|
||||
uint64_t notify_ctr;
|
||||
struct fuse_notify_req notify_list;
|
||||
};
|
||||
|
||||
struct fuse_cmd
|
||||
{
|
||||
char *buf;
|
||||
|
|
@ -80,11 +67,6 @@ int fuse_chan_clearfd(struct fuse_chan *ch);
|
|||
void fuse_kern_unmount(const char *mountpoint, int fd);
|
||||
int fuse_kern_mount(const char *mountpoint, struct fuse_args *args);
|
||||
|
||||
int fuse_send_reply_iov_nofree(fuse_req_t req, int error, struct iovec *iov,
|
||||
int count);
|
||||
void fuse_free_req(fuse_req_t req);
|
||||
|
||||
|
||||
struct fuse *fuse_setup_common(int argc,
|
||||
char *argv[],
|
||||
const struct fuse_operations *op,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
#include "fuse_cfg.hpp"
|
||||
#include "fuse_msgbuf.hpp"
|
||||
#include "fuse_ll.hpp"
|
||||
|
||||
#include <cassert>
|
||||
#include <memory>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
18
libfuse/lib/fuse_req.cpp
Normal file
18
libfuse/lib/fuse_req.cpp
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#include "fuse_req.hpp"
|
||||
|
||||
#include "objpool.hpp"
|
||||
|
||||
|
||||
static ObjPool<fuse_req_t> g_pool;
|
||||
|
||||
fuse_req_t*
|
||||
fuse_req_alloc()
|
||||
{
|
||||
return g_pool.alloc();
|
||||
}
|
||||
|
||||
void
|
||||
fuse_req_free(fuse_req_t *req_)
|
||||
{
|
||||
return g_pool.free(req_);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue