mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
virtiofsd: Trim down imported files
There's a lot of the original fuse code we don't need; trim them down. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> with additional trimming by: Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Xiao Yang <yangx.jy@cn.fujitsu.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
@@ -157,73 +157,6 @@ static ssize_t fuse_buf_fd_to_fd(const struct fuse_buf *dst, size_t dst_off,
|
||||
return copied;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SPLICE
|
||||
static ssize_t fuse_buf_splice(const struct fuse_buf *dst, size_t dst_off,
|
||||
const struct fuse_buf *src, size_t src_off,
|
||||
size_t len, enum fuse_buf_copy_flags flags)
|
||||
{
|
||||
int splice_flags = 0;
|
||||
off_t *srcpos = NULL;
|
||||
off_t *dstpos = NULL;
|
||||
off_t srcpos_val;
|
||||
off_t dstpos_val;
|
||||
ssize_t res;
|
||||
size_t copied = 0;
|
||||
|
||||
if (flags & FUSE_BUF_SPLICE_MOVE)
|
||||
splice_flags |= SPLICE_F_MOVE;
|
||||
if (flags & FUSE_BUF_SPLICE_NONBLOCK)
|
||||
splice_flags |= SPLICE_F_NONBLOCK;
|
||||
|
||||
if (src->flags & FUSE_BUF_FD_SEEK) {
|
||||
srcpos_val = src->pos + src_off;
|
||||
srcpos = &srcpos_val;
|
||||
}
|
||||
if (dst->flags & FUSE_BUF_FD_SEEK) {
|
||||
dstpos_val = dst->pos + dst_off;
|
||||
dstpos = &dstpos_val;
|
||||
}
|
||||
|
||||
while (len) {
|
||||
res = splice(src->fd, srcpos, dst->fd, dstpos, len,
|
||||
splice_flags);
|
||||
if (res == -1) {
|
||||
if (copied)
|
||||
break;
|
||||
|
||||
if (errno != EINVAL || (flags & FUSE_BUF_FORCE_SPLICE))
|
||||
return -errno;
|
||||
|
||||
/* Maybe splice is not supported for this combination */
|
||||
return fuse_buf_fd_to_fd(dst, dst_off, src, src_off,
|
||||
len);
|
||||
}
|
||||
if (res == 0)
|
||||
break;
|
||||
|
||||
copied += res;
|
||||
if (!(src->flags & FUSE_BUF_FD_RETRY) &&
|
||||
!(dst->flags & FUSE_BUF_FD_RETRY)) {
|
||||
break;
|
||||
}
|
||||
|
||||
len -= res;
|
||||
}
|
||||
|
||||
return copied;
|
||||
}
|
||||
#else
|
||||
static ssize_t fuse_buf_splice(const struct fuse_buf *dst, size_t dst_off,
|
||||
const struct fuse_buf *src, size_t src_off,
|
||||
size_t len, enum fuse_buf_copy_flags flags)
|
||||
{
|
||||
(void) flags;
|
||||
|
||||
return fuse_buf_fd_to_fd(dst, dst_off, src, src_off, len);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static ssize_t fuse_buf_copy_one(const struct fuse_buf *dst, size_t dst_off,
|
||||
const struct fuse_buf *src, size_t src_off,
|
||||
size_t len, enum fuse_buf_copy_flags flags)
|
||||
@@ -247,10 +180,8 @@ static ssize_t fuse_buf_copy_one(const struct fuse_buf *dst, size_t dst_off,
|
||||
return fuse_buf_write(dst, dst_off, src, src_off, len);
|
||||
} else if (!dst_is_fd) {
|
||||
return fuse_buf_read(dst, dst_off, src, src_off, len);
|
||||
} else if (flags & FUSE_BUF_NO_SPLICE) {
|
||||
return fuse_buf_fd_to_fd(dst, dst_off, src, src_off, len);
|
||||
} else {
|
||||
return fuse_buf_splice(dst, dst_off, src, src_off, len, flags);
|
||||
return fuse_buf_fd_to_fd(dst, dst_off, src, src_off, len);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,10 +25,6 @@
|
||||
#include <sys/statvfs.h>
|
||||
#include <sys/uio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ----------------------------------------------------------- *
|
||||
* Basic FUSE API *
|
||||
* ----------------------------------------------------------- */
|
||||
@@ -978,44 +974,6 @@ int fuse_loop(struct fuse *f);
|
||||
*/
|
||||
void fuse_exit(struct fuse *f);
|
||||
|
||||
/**
|
||||
* FUSE event loop with multiple threads
|
||||
*
|
||||
* Requests from the kernel are processed, and the appropriate
|
||||
* operations are called. Request are processed in parallel by
|
||||
* distributing them between multiple threads.
|
||||
*
|
||||
* For a description of the return value and the conditions when the
|
||||
* event loop exits, refer to the documentation of
|
||||
* fuse_session_loop().
|
||||
*
|
||||
* Note: using fuse_loop() instead of fuse_loop_mt() means you are running in
|
||||
* single-threaded mode, and that you will not have to worry about reentrancy,
|
||||
* though you will have to worry about recursive lookups. In single-threaded
|
||||
* mode, FUSE will wait for one callback to return before calling another.
|
||||
*
|
||||
* Enabling multiple threads, by using fuse_loop_mt(), will cause FUSE to make
|
||||
* multiple simultaneous calls into the various callback functions given by your
|
||||
* fuse_operations record.
|
||||
*
|
||||
* If you are using multiple threads, you can enjoy all the parallel execution
|
||||
* and interactive response benefits of threads, and you get to enjoy all the
|
||||
* benefits of race conditions and locking bugs, too. Ensure that any code used
|
||||
* in the callback function of fuse_operations is also thread-safe.
|
||||
*
|
||||
* @param f the FUSE handle
|
||||
* @param config loop configuration
|
||||
* @return see fuse_session_loop()
|
||||
*
|
||||
* See also: fuse_loop()
|
||||
*/
|
||||
#if FUSE_USE_VERSION < 32
|
||||
int fuse_loop_mt_31(struct fuse *f, int clone_fd);
|
||||
#define fuse_loop_mt(f, clone_fd) fuse_loop_mt_31(f, clone_fd)
|
||||
#else
|
||||
int fuse_loop_mt(struct fuse *f, struct fuse_loop_config *config);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Get the current context
|
||||
*
|
||||
@@ -1268,8 +1226,4 @@ struct fuse_session *fuse_get_session(struct fuse *f);
|
||||
*/
|
||||
int fuse_open_channel(const char *mountpoint, const char *options);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FUSE_H_ */
|
||||
|
||||
@@ -28,10 +28,6 @@
|
||||
#define FUSE_MAKE_VERSION(maj, min) ((maj) * 10 + (min))
|
||||
#define FUSE_VERSION FUSE_MAKE_VERSION(FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Information about an open file.
|
||||
*
|
||||
@@ -100,30 +96,6 @@ struct fuse_file_info {
|
||||
uint32_t poll_events;
|
||||
};
|
||||
|
||||
/**
|
||||
* Configuration parameters passed to fuse_session_loop_mt() and
|
||||
* fuse_loop_mt().
|
||||
*/
|
||||
struct fuse_loop_config {
|
||||
/**
|
||||
* whether to use separate device fds for each thread
|
||||
* (may increase performance)
|
||||
*/
|
||||
int clone_fd;
|
||||
|
||||
/**
|
||||
* The maximum number of available worker threads before they
|
||||
* start to get deleted when they become idle. If not
|
||||
* specified, the default is 10.
|
||||
*
|
||||
* Adjusting this has performance implications; a very small number
|
||||
* of threads in the pool will cause a lot of thread creation and
|
||||
* deletion overhead and performance may suffer. When set to 0, a new
|
||||
* thread will be created to service every operation.
|
||||
*/
|
||||
unsigned int max_idle_threads;
|
||||
};
|
||||
|
||||
/**************************************************************************
|
||||
* Capability bits for 'fuse_conn_info.capable' and 'fuse_conn_info.want' *
|
||||
**************************************************************************/
|
||||
@@ -802,10 +774,6 @@ void fuse_remove_signal_handlers(struct fuse_session *se);
|
||||
# error only API version 30 or greater is supported
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* This interface uses 64 bit off_t.
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
#include "fuse.h"
|
||||
#include "fuse_lowlevel.h"
|
||||
|
||||
struct mount_opts;
|
||||
|
||||
struct fuse_req {
|
||||
struct fuse_session *se;
|
||||
uint64_t unique;
|
||||
@@ -45,7 +43,6 @@ struct fuse_session {
|
||||
char *mountpoint;
|
||||
volatile int exited;
|
||||
int fd;
|
||||
struct mount_opts *mo;
|
||||
int debug;
|
||||
int deny_others;
|
||||
struct fuse_lowlevel_ops op;
|
||||
@@ -58,7 +55,6 @@ struct fuse_session {
|
||||
struct fuse_req interrupts;
|
||||
pthread_mutex_t lock;
|
||||
int got_destroy;
|
||||
pthread_key_t pipe_key;
|
||||
int broken_splice_nonblock;
|
||||
uint64_t notify_ctr;
|
||||
struct fuse_notify_req notify_list;
|
||||
@@ -87,53 +83,16 @@ struct fuse_module {
|
||||
int ctr;
|
||||
};
|
||||
|
||||
/* ----------------------------------------------------------- *
|
||||
* Channel interface (when using -o clone_fd) *
|
||||
* ----------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Obtain counted reference to the channel
|
||||
*
|
||||
* @param ch the channel
|
||||
* @return the channel
|
||||
*/
|
||||
struct fuse_chan *fuse_chan_get(struct fuse_chan *ch);
|
||||
|
||||
/**
|
||||
* Drop counted reference to a channel
|
||||
*
|
||||
* @param ch the channel
|
||||
*/
|
||||
void fuse_chan_put(struct fuse_chan *ch);
|
||||
|
||||
struct mount_opts *parse_mount_opts(struct fuse_args *args);
|
||||
void destroy_mount_opts(struct mount_opts *mo);
|
||||
void fuse_mount_version(void);
|
||||
unsigned get_max_read(struct mount_opts *o);
|
||||
void fuse_kern_unmount(const char *mountpoint, int fd);
|
||||
int fuse_kern_mount(const char *mountpoint, struct mount_opts *mo);
|
||||
|
||||
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);
|
||||
|
||||
void cuse_lowlevel_init(fuse_req_t req, fuse_ino_t nodeide, const void *inarg);
|
||||
|
||||
int fuse_start_thread(pthread_t *thread_id, void *(*func)(void *), void *arg);
|
||||
|
||||
int fuse_session_receive_buf_int(struct fuse_session *se, struct fuse_buf *buf,
|
||||
struct fuse_chan *ch);
|
||||
void fuse_session_process_buf_int(struct fuse_session *se,
|
||||
const struct fuse_buf *buf, struct fuse_chan *ch);
|
||||
|
||||
struct fuse *fuse_new_31(struct fuse_args *args, const struct fuse_operations *op,
|
||||
size_t op_size, void *private_data);
|
||||
int fuse_loop_mt_32(struct fuse *f, struct fuse_loop_config *config);
|
||||
int fuse_session_loop_mt_32(struct fuse_session *se, struct fuse_loop_config *config);
|
||||
|
||||
#define FUSE_MAX_MAX_PAGES 256
|
||||
#define FUSE_DEFAULT_MAX_PAGES_PER_REQ 32
|
||||
|
||||
/* room needed in buffer to accommodate header */
|
||||
#define FUSE_BUFFER_HEADER_SIZE 0x1000
|
||||
|
||||
|
||||
@@ -16,10 +16,6 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Log severity level
|
||||
*
|
||||
@@ -75,8 +71,4 @@ void fuse_set_log_func(fuse_log_func_t func);
|
||||
*/
|
||||
void fuse_log(enum fuse_log_level level, const char *fmt, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FUSE_LOG_H_ */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -31,10 +31,6 @@
|
||||
#include <sys/statvfs.h>
|
||||
#include <sys/uio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ----------------------------------------------------------- *
|
||||
* Miscellaneous definitions *
|
||||
* ----------------------------------------------------------- */
|
||||
@@ -1863,14 +1859,12 @@ void fuse_cmdline_help(void);
|
||||
* ----------------------------------------------------------- */
|
||||
|
||||
struct fuse_cmdline_opts {
|
||||
int singlethread;
|
||||
int foreground;
|
||||
int debug;
|
||||
int nodefault_subtype;
|
||||
char *mountpoint;
|
||||
int show_version;
|
||||
int show_help;
|
||||
int clone_fd;
|
||||
unsigned int max_idle_threads;
|
||||
};
|
||||
|
||||
@@ -1961,24 +1955,6 @@ int fuse_session_mount(struct fuse_session *se, const char *mountpoint);
|
||||
*/
|
||||
int fuse_session_loop(struct fuse_session *se);
|
||||
|
||||
/**
|
||||
* Enter a multi-threaded event loop.
|
||||
*
|
||||
* For a description of the return value and the conditions when the
|
||||
* event loop exits, refer to the documentation of
|
||||
* fuse_session_loop().
|
||||
*
|
||||
* @param se the session
|
||||
* @param config session loop configuration
|
||||
* @return see fuse_session_loop()
|
||||
*/
|
||||
#if FUSE_USE_VERSION < 32
|
||||
int fuse_session_loop_mt_31(struct fuse_session *se, int clone_fd);
|
||||
#define fuse_session_loop_mt(se, clone_fd) fuse_session_loop_mt_31(se, clone_fd)
|
||||
#else
|
||||
int fuse_session_loop_mt(struct fuse_session *se, struct fuse_loop_config *config);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Flag a session as terminated.
|
||||
*
|
||||
@@ -2082,8 +2058,4 @@ void fuse_session_process_buf(struct fuse_session *se,
|
||||
*/
|
||||
int fuse_session_receive_buf(struct fuse_session *se, struct fuse_buf *buf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FUSE_LOWLEVEL_H_ */
|
||||
|
||||
@@ -14,10 +14,6 @@
|
||||
* This file defines the option parsing interface of FUSE
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Option description
|
||||
*
|
||||
@@ -264,8 +260,4 @@ void fuse_opt_free_args(struct fuse_args *args);
|
||||
*/
|
||||
int fuse_opt_match(const struct fuse_opt opts[], const char *opt);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FUSE_OPT_H_ */
|
||||
|
||||
@@ -41,14 +41,10 @@ static const struct fuse_opt fuse_helper_opts[] = {
|
||||
FUSE_OPT_KEY("-d", FUSE_OPT_KEY_KEEP),
|
||||
FUSE_OPT_KEY("debug", FUSE_OPT_KEY_KEEP),
|
||||
FUSE_HELPER_OPT("-f", foreground),
|
||||
FUSE_HELPER_OPT("-s", singlethread),
|
||||
FUSE_HELPER_OPT("fsname=", nodefault_subtype),
|
||||
FUSE_OPT_KEY("fsname=", FUSE_OPT_KEY_KEEP),
|
||||
#ifndef __FreeBSD__
|
||||
FUSE_HELPER_OPT("subtype=", nodefault_subtype),
|
||||
FUSE_OPT_KEY("subtype=", FUSE_OPT_KEY_KEEP),
|
||||
#endif
|
||||
FUSE_HELPER_OPT("clone_fd", clone_fd),
|
||||
FUSE_HELPER_OPT("max_idle_threads=%u", max_idle_threads),
|
||||
FUSE_OPT_END
|
||||
};
|
||||
@@ -132,9 +128,6 @@ void fuse_cmdline_help(void)
|
||||
" -V --version print version\n"
|
||||
" -d -o debug enable debug output (implies -f)\n"
|
||||
" -f foreground operation\n"
|
||||
" -s disable multi-threaded operation\n"
|
||||
" -o clone_fd use separate fuse device fd for each thread\n"
|
||||
" (may improve performance)\n"
|
||||
" -o max_idle_threads the maximum number of idle worker threads\n"
|
||||
" allowed (default: 10)\n");
|
||||
}
|
||||
@@ -171,34 +164,6 @@ static int fuse_helper_opt_proc(void *data, const char *arg, int key,
|
||||
}
|
||||
}
|
||||
|
||||
/* Under FreeBSD, there is no subtype option so this
|
||||
function actually sets the fsname */
|
||||
static int add_default_subtype(const char *progname, struct fuse_args *args)
|
||||
{
|
||||
int res;
|
||||
char *subtype_opt;
|
||||
|
||||
const char *basename = strrchr(progname, '/');
|
||||
if (basename == NULL)
|
||||
basename = progname;
|
||||
else if (basename[1] != '\0')
|
||||
basename++;
|
||||
|
||||
subtype_opt = (char *) malloc(strlen(basename) + 64);
|
||||
if (subtype_opt == NULL) {
|
||||
fuse_log(FUSE_LOG_ERR, "fuse: memory allocation failed\n");
|
||||
return -1;
|
||||
}
|
||||
#ifdef __FreeBSD__
|
||||
sprintf(subtype_opt, "-ofsname=%s", basename);
|
||||
#else
|
||||
sprintf(subtype_opt, "-osubtype=%s", basename);
|
||||
#endif
|
||||
res = fuse_opt_add_arg(args, subtype_opt);
|
||||
free(subtype_opt);
|
||||
return res;
|
||||
}
|
||||
|
||||
int fuse_parse_cmdline(struct fuse_args *args,
|
||||
struct fuse_cmdline_opts *opts)
|
||||
{
|
||||
@@ -210,14 +175,6 @@ int fuse_parse_cmdline(struct fuse_args *args,
|
||||
fuse_helper_opt_proc) == -1)
|
||||
return -1;
|
||||
|
||||
/* *Linux*: if neither -o subtype nor -o fsname are specified,
|
||||
set subtype to program's basename.
|
||||
*FreeBSD*: if fsname is not specified, set to program's
|
||||
basename. */
|
||||
if (!opts->nodefault_subtype)
|
||||
if (add_default_subtype(args->argv[0], args) == -1)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -276,88 +233,6 @@ int fuse_daemonize(int foreground)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op,
|
||||
size_t op_size, void *user_data)
|
||||
{
|
||||
struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
|
||||
struct fuse *fuse;
|
||||
struct fuse_cmdline_opts opts;
|
||||
int res;
|
||||
|
||||
if (fuse_parse_cmdline(&args, &opts) != 0)
|
||||
return 1;
|
||||
|
||||
if (opts.show_version) {
|
||||
printf("FUSE library version %s\n", PACKAGE_VERSION);
|
||||
fuse_lowlevel_version();
|
||||
res = 0;
|
||||
goto out1;
|
||||
}
|
||||
|
||||
if (opts.show_help) {
|
||||
if(args.argv[0][0] != '\0')
|
||||
printf("usage: %s [options] <mountpoint>\n\n",
|
||||
args.argv[0]);
|
||||
printf("FUSE options:\n");
|
||||
fuse_cmdline_help();
|
||||
fuse_lib_help(&args);
|
||||
res = 0;
|
||||
goto out1;
|
||||
}
|
||||
|
||||
if (!opts.show_help &&
|
||||
!opts.mountpoint) {
|
||||
fuse_log(FUSE_LOG_ERR, "error: no mountpoint specified\n");
|
||||
res = 2;
|
||||
goto out1;
|
||||
}
|
||||
|
||||
|
||||
fuse = fuse_new_31(&args, op, op_size, user_data);
|
||||
if (fuse == NULL) {
|
||||
res = 3;
|
||||
goto out1;
|
||||
}
|
||||
|
||||
if (fuse_mount(fuse,opts.mountpoint) != 0) {
|
||||
res = 4;
|
||||
goto out2;
|
||||
}
|
||||
|
||||
if (fuse_daemonize(opts.foreground) != 0) {
|
||||
res = 5;
|
||||
goto out3;
|
||||
}
|
||||
|
||||
struct fuse_session *se = fuse_get_session(fuse);
|
||||
if (fuse_set_signal_handlers(se) != 0) {
|
||||
res = 6;
|
||||
goto out3;
|
||||
}
|
||||
|
||||
if (opts.singlethread)
|
||||
res = fuse_loop(fuse);
|
||||
else {
|
||||
struct fuse_loop_config loop_config;
|
||||
loop_config.clone_fd = opts.clone_fd;
|
||||
loop_config.max_idle_threads = opts.max_idle_threads;
|
||||
res = fuse_loop_mt_32(fuse, &loop_config);
|
||||
}
|
||||
if (res)
|
||||
res = 7;
|
||||
|
||||
fuse_remove_signal_handlers(se);
|
||||
out3:
|
||||
fuse_unmount(fuse);
|
||||
out2:
|
||||
fuse_destroy(fuse);
|
||||
out1:
|
||||
free(opts.mountpoint);
|
||||
fuse_opt_free_args(&args);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
void fuse_apply_conn_info_opts(struct fuse_conn_info_opts *opts,
|
||||
struct fuse_conn_info *conn)
|
||||
{
|
||||
@@ -420,21 +295,3 @@ struct fuse_conn_info_opts* fuse_parse_conn_info_opts(struct fuse_args *args)
|
||||
}
|
||||
return opts;
|
||||
}
|
||||
|
||||
int fuse_open_channel(const char *mountpoint, const char* options)
|
||||
{
|
||||
struct mount_opts *opts = NULL;
|
||||
int fd = -1;
|
||||
const char *argv[] = { "", "-o", options };
|
||||
int argc = sizeof(argv) / sizeof(argv[0]);
|
||||
struct fuse_args args = FUSE_ARGS_INIT(argc, (char**) argv);
|
||||
|
||||
opts = parse_mount_opts(&args);
|
||||
if (opts == NULL)
|
||||
return -1;
|
||||
|
||||
fd = fuse_kern_mount(mountpoint, opts);
|
||||
destroy_mount_opts(opts);
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
@@ -42,32 +42,6 @@ static int mknod_wrapper(int dirfd, const char *path, const char *link,
|
||||
res = symlinkat(link, dirfd, path);
|
||||
} else if (S_ISFIFO(mode)) {
|
||||
res = mkfifoat(dirfd, path, mode);
|
||||
#ifdef __FreeBSD__
|
||||
} else if (S_ISSOCK(mode)) {
|
||||
struct sockaddr_un su;
|
||||
int fd;
|
||||
|
||||
if (strlen(path) >= sizeof(su.sun_path)) {
|
||||
errno = ENAMETOOLONG;
|
||||
return -1;
|
||||
}
|
||||
fd = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
if (fd >= 0) {
|
||||
/*
|
||||
* We must bind the socket to the underlying file
|
||||
* system to create the socket file, even though
|
||||
* we'll never listen on this socket.
|
||||
*/
|
||||
su.sun_family = AF_UNIX;
|
||||
strncpy(su.sun_path, path, sizeof(su.sun_path));
|
||||
res = bindat(dirfd, fd, (struct sockaddr*)&su,
|
||||
sizeof(su));
|
||||
if (res == 0)
|
||||
close(fd);
|
||||
} else {
|
||||
res = -1;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
res = mknodat(dirfd, path, mode, rdev);
|
||||
}
|
||||
|
||||
@@ -1240,7 +1240,6 @@ int main(int argc, char *argv[])
|
||||
ret = 0;
|
||||
goto err_out1;
|
||||
} else if (opts.show_version) {
|
||||
printf("FUSE library version %s\n", fuse_pkgversion());
|
||||
fuse_lowlevel_version();
|
||||
ret = 0;
|
||||
goto err_out1;
|
||||
|
||||
Reference in New Issue
Block a user