2016-10-05 21:33:37 +08:00
|
|
|
/*
|
|
|
|
FUSE: Filesystem in Userspace
|
|
|
|
Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
|
|
|
|
|
|
|
|
This program can be distributed under the terms of the GNU LGPLv2.
|
|
|
|
See the file COPYING.LIB
|
|
|
|
*/
|
|
|
|
|
2020-08-09 07:10:36 +08:00
|
|
|
#pragma once
|
|
|
|
|
2016-10-05 21:33:37 +08:00
|
|
|
#include "fuse.h"
|
|
|
|
#include "fuse_lowlevel.h"
|
2022-11-30 07:24:09 +08:00
|
|
|
#include "fuse_msgbuf.h"
|
|
|
|
|
|
|
|
#include "extern_c.h"
|
2016-10-05 21:33:37 +08:00
|
|
|
|
|
|
|
struct fuse_chan;
|
|
|
|
struct fuse_ll;
|
|
|
|
|
2020-08-01 11:50:47 +08:00
|
|
|
struct fuse_session
|
|
|
|
{
|
2022-11-06 12:25:25 +08:00
|
|
|
int (*receive_buf)(struct fuse_session *se,
|
2022-11-30 07:24:09 +08:00
|
|
|
fuse_msgbuf_t *msgbuf);
|
2016-10-05 21:33:37 +08:00
|
|
|
|
2022-11-30 07:24:09 +08:00
|
|
|
void (*process_buf)(struct fuse_session *se,
|
|
|
|
const fuse_msgbuf_t *msgbuf);
|
2016-10-05 21:33:37 +08:00
|
|
|
|
2022-11-06 12:25:25 +08:00
|
|
|
void (*destroy)(void *data);
|
2016-10-05 21:33:37 +08:00
|
|
|
|
2022-11-30 07:24:09 +08:00
|
|
|
struct fuse_ll *f;
|
2020-08-01 11:50:47 +08:00
|
|
|
volatile int exited;
|
|
|
|
struct fuse_chan *ch;
|
2016-10-05 21:33:37 +08:00
|
|
|
};
|
|
|
|
|
2020-08-01 11:50:47 +08:00
|
|
|
struct fuse_req
|
|
|
|
{
|
|
|
|
struct fuse_ll *f;
|
|
|
|
uint64_t unique;
|
|
|
|
struct fuse_ctx ctx;
|
|
|
|
struct fuse_chan *ch;
|
|
|
|
unsigned int ioctl_64bit : 1;
|
2016-10-05 21:33:37 +08:00
|
|
|
};
|
|
|
|
|
2020-08-01 11:50:47 +08:00
|
|
|
struct fuse_notify_req
|
|
|
|
{
|
|
|
|
uint64_t unique;
|
2021-10-01 11:28:54 +08:00
|
|
|
void (*reply)(struct fuse_notify_req *,
|
|
|
|
fuse_req_t,
|
|
|
|
uint64_t,
|
2022-11-09 12:43:59 +08:00
|
|
|
const void *);
|
2020-08-01 11:50:47 +08:00
|
|
|
struct fuse_notify_req *next;
|
|
|
|
struct fuse_notify_req *prev;
|
2016-10-05 21:33:37 +08:00
|
|
|
};
|
|
|
|
|
2020-08-01 11:50:47 +08:00
|
|
|
struct fuse_ll
|
|
|
|
{
|
|
|
|
int debug;
|
|
|
|
int no_remote_posix_lock;
|
|
|
|
int no_remote_flock;
|
|
|
|
int big_writes;
|
|
|
|
struct fuse_lowlevel_ops op;
|
|
|
|
void *userdata;
|
|
|
|
uid_t owner;
|
|
|
|
struct fuse_conn_info conn;
|
|
|
|
pthread_mutex_t lock;
|
2022-11-30 07:24:09 +08:00
|
|
|
int got_init;
|
2020-08-01 11:50:47 +08:00
|
|
|
int got_destroy;
|
|
|
|
pthread_key_t pipe_key;
|
|
|
|
int broken_splice_nonblock;
|
|
|
|
uint64_t notify_ctr;
|
|
|
|
struct fuse_notify_req notify_list;
|
2016-10-05 21:33:37 +08:00
|
|
|
};
|
|
|
|
|
2020-08-01 11:50:47 +08:00
|
|
|
struct fuse_cmd
|
|
|
|
{
|
|
|
|
char *buf;
|
|
|
|
size_t buflen;
|
|
|
|
struct fuse_chan *ch;
|
2016-10-05 21:33:37 +08:00
|
|
|
};
|
|
|
|
|
2022-11-30 07:24:09 +08:00
|
|
|
EXTERN_C_BEGIN
|
|
|
|
|
2016-10-05 21:33:37 +08:00
|
|
|
struct fuse *fuse_new_common(struct fuse_chan *ch, struct fuse_args *args,
|
|
|
|
const struct fuse_operations *op,
|
2021-08-25 09:24:51 +08:00
|
|
|
size_t op_size);
|
2016-10-05 21:33:37 +08:00
|
|
|
|
|
|
|
struct fuse_chan *fuse_kern_chan_new(int fd);
|
|
|
|
|
|
|
|
struct fuse_session *fuse_lowlevel_new_common(struct fuse_args *args,
|
2020-08-01 11:50:47 +08:00
|
|
|
const struct fuse_lowlevel_ops *op,
|
|
|
|
size_t op_size, void *userdata);
|
2016-10-05 21:33:37 +08:00
|
|
|
|
|
|
|
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,
|
|
|
|
size_t op_size,
|
|
|
|
char **mountpoint,
|
2021-08-25 09:24:51 +08:00
|
|
|
int *fd);
|
2016-10-05 21:33:37 +08:00
|
|
|
|
|
|
|
int fuse_start_thread(pthread_t *thread_id, void *(*func)(void *), void *arg);
|
2022-11-30 07:24:09 +08:00
|
|
|
|
|
|
|
EXTERN_C_END
|