From 3c761b708b2b314376c7e812201cdfcc243e7c59 Mon Sep 17 00:00:00 2001 From: Antonio SJ Musumeci Date: Sat, 1 Aug 2020 22:44:00 -0400 Subject: [PATCH] libfuse cleanup: remove libfuse API compatibility --- libfuse/include/fuse.h | 47 ----- libfuse/include/fuse_common.h | 34 ---- libfuse/include/fuse_common_compat.h | 27 --- libfuse/include/fuse_compat.h | 197 -------------------- libfuse/include/fuse_lowlevel.h | 22 --- libfuse/include/fuse_lowlevel_compat.h | 157 ---------------- libfuse/include/old/fuse.h | 9 - libfuse/lib/fuse.c | 246 +------------------------ libfuse/lib/fuse_i.h | 8 +- libfuse/lib/fuse_lowlevel.c | 152 +-------------- libfuse/lib/fuse_opt.c | 10 - libfuse/lib/fuse_session.c | 27 +-- libfuse/lib/helper.c | 113 +----------- libfuse/lib/mount_bsd.c | 49 ----- libfuse/lib/mount_generic.c | 18 -- 15 files changed, 24 insertions(+), 1092 deletions(-) delete mode 100644 libfuse/include/fuse_common_compat.h delete mode 100644 libfuse/include/fuse_compat.h delete mode 100644 libfuse/include/fuse_lowlevel_compat.h delete mode 100644 libfuse/include/old/fuse.h diff --git a/libfuse/include/fuse.h b/libfuse/include/fuse.h index 9d5f0f43..8e2c9474 100644 --- a/libfuse/include/fuse.h +++ b/libfuse/include/fuse.h @@ -929,53 +929,6 @@ extern "C" { /** Get session from fuse object */ struct fuse_session *fuse_get_session(struct fuse *f); - /* ----------------------------------------------------------- * - * Compatibility stuff * - * ----------------------------------------------------------- */ - -#if FUSE_USE_VERSION < 26 -# include "fuse_compat.h" -# undef fuse_main -# if FUSE_USE_VERSION == 25 -# define fuse_main(argc, argv, op) \ - fuse_main_real_compat25(argc, argv, op, sizeof(*(op))) -# define fuse_new fuse_new_compat25 -# define fuse_setup fuse_setup_compat25 -# define fuse_teardown fuse_teardown_compat22 -# define fuse_operations fuse_operations_compat25 -# elif FUSE_USE_VERSION == 22 -# define fuse_main(argc, argv, op) \ - fuse_main_real_compat22(argc, argv, op, sizeof(*(op))) -# define fuse_new fuse_new_compat22 -# define fuse_setup fuse_setup_compat22 -# define fuse_teardown fuse_teardown_compat22 -# define fuse_operations fuse_operations_compat22 -# define fuse_file_info fuse_file_info_compat -# elif FUSE_USE_VERSION == 24 -# error Compatibility with high-level API version 24 not supported -# else -# define fuse_dirfil_t fuse_dirfil_t_compat -# define __fuse_read_cmd fuse_read_cmd -# define __fuse_process_cmd fuse_process_cmd -# define __fuse_loop_mt fuse_loop_mt_proc -# if FUSE_USE_VERSION == 21 -# define fuse_operations fuse_operations_compat2 -# define fuse_main fuse_main_compat2 -# define fuse_new fuse_new_compat2 -# define __fuse_setup fuse_setup_compat2 -# define __fuse_teardown fuse_teardown_compat22 -# define __fuse_exited fuse_exited -# define __fuse_set_getcontext_func fuse_set_getcontext_func -# else -# define fuse_statfs fuse_statfs_compat1 -# define fuse_operations fuse_operations_compat1 -# define fuse_main fuse_main_compat1 -# define fuse_new fuse_new_compat1 -# define FUSE_DEBUG FUSE_DEBUG_COMPAT1 -# endif -# endif -#endif - #ifdef __cplusplus } #endif diff --git a/libfuse/include/fuse_common.h b/libfuse/include/fuse_common.h index 79feb44e..c7d47ea8 100644 --- a/libfuse/include/fuse_common.h +++ b/libfuse/include/fuse_common.h @@ -479,40 +479,6 @@ extern "C" { */ void fuse_remove_signal_handlers(struct fuse_session *se); - /* ----------------------------------------------------------- * - * Compatibility stuff * - * ----------------------------------------------------------- */ - -#if FUSE_USE_VERSION < 26 -# ifdef __FreeBSD__ -# if FUSE_USE_VERSION < 25 -# error On FreeBSD API version 25 or greater must be used -# endif -# endif -# include "fuse_common_compat.h" -# undef FUSE_MINOR_VERSION -# undef fuse_main -# define fuse_unmount fuse_unmount_compat22 -# if FUSE_USE_VERSION == 25 -# define FUSE_MINOR_VERSION 5 -# define fuse_mount fuse_mount_compat25 -# elif FUSE_USE_VERSION == 24 || FUSE_USE_VERSION == 22 -# define FUSE_MINOR_VERSION 4 -# define fuse_mount fuse_mount_compat22 -# elif FUSE_USE_VERSION == 21 -# define FUSE_MINOR_VERSION 1 -# define fuse_mount fuse_mount_compat22 -# elif FUSE_USE_VERSION == 11 -# warning Compatibility with API version 11 is deprecated -# undef FUSE_MAJOR_VERSION -# define FUSE_MAJOR_VERSION 1 -# define FUSE_MINOR_VERSION 1 -# define fuse_mount fuse_mount_compat1 -# else -# error Compatibility with API version other than 21, 22, 24, 25 and 11 not supported -# endif -#endif - #ifdef __cplusplus } #endif diff --git a/libfuse/include/fuse_common_compat.h b/libfuse/include/fuse_common_compat.h deleted file mode 100644 index dea34468..00000000 --- a/libfuse/include/fuse_common_compat.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - FUSE: Filesystem in Userspace - Copyright (C) 2001-2007 Miklos Szeredi - - This program can be distributed under the terms of the GNU LGPLv2. - See the file COPYING.LIB. -*/ - -/* these definitions provide source compatibility to prior versions. - Do not include this file directly! */ - -struct fuse_file_info_compat -{ - int flags; - unsigned long fh; - int writepage; - unsigned int direct_io : 1; - unsigned int keep_cache : 1; -}; - -int fuse_mount_compat25(const char *mountpoint, struct fuse_args *args); - -int fuse_mount_compat22(const char *mountpoint, const char *opts); - -int fuse_mount_compat1(const char *mountpoint, const char *args[]); - -void fuse_unmount_compat22(const char *mountpoint); diff --git a/libfuse/include/fuse_compat.h b/libfuse/include/fuse_compat.h deleted file mode 100644 index a2147a62..00000000 --- a/libfuse/include/fuse_compat.h +++ /dev/null @@ -1,197 +0,0 @@ -/* - FUSE: Filesystem in Userspace - Copyright (C) 2001-2007 Miklos Szeredi - - This program can be distributed under the terms of the GNU LGPLv2. - See the file COPYING.LIB. -*/ - -/* these definitions provide source compatibility to prior versions. - Do not include this file directly! */ - -struct fuse_operations_compat25 -{ - int (*getattr) (const char *, struct stat *); - int (*readlink) (const char *, char *, size_t); - int (*mknod) (const char *, mode_t, dev_t); - int (*mkdir) (const char *, mode_t); - int (*unlink) (const char *); - int (*rmdir) (const char *); - int (*symlink) (const char *, const char *); - int (*rename) (const char *, const char *); - int (*link) (const char *, const char *); - int (*chmod) (const char *, mode_t); - int (*chown) (const char *, uid_t, gid_t); - int (*truncate) (const char *, off_t); - int (*utime) (const char *, struct utimbuf *); - int (*open) (const char *, struct fuse_file_info *); - int (*read) (const char *, char *, size_t, off_t, - struct fuse_file_info *); - int (*write) (const char *, const char *, size_t, off_t, - struct fuse_file_info *); - int (*statfs) (const char *, struct statvfs *); - int (*flush) (const char *, struct fuse_file_info *); - int (*release) (const char *, struct fuse_file_info *); - int (*fsync) (const char *, int, struct fuse_file_info *); - int (*setxattr) (const char *, const char *, const char *, size_t, int); - int (*getxattr) (const char *, const char *, char *, size_t); - int (*listxattr) (const char *, char *, size_t); - int (*removexattr) (const char *, const char *); - int (*opendir) (const char *, struct fuse_file_info *); - int (*readdir) (const char *, void *, off_t, - struct fuse_file_info *); - int (*releasedir) (const char *, struct fuse_file_info *); - int (*fsyncdir) (const char *, int, struct fuse_file_info *); - void *(*init) (void); - void (*destroy) (void *); - int (*access) (const char *, int); - int (*create) (const char *, mode_t, struct fuse_file_info *); - int (*ftruncate) (const char *, off_t, struct fuse_file_info *); - int (*fgetattr) (const char *, struct stat *, struct fuse_file_info *); -}; - -struct fuse *fuse_new_compat25(int fd, struct fuse_args *args, - const struct fuse_operations_compat25 *op, - size_t op_size); - -int fuse_main_real_compat25(int argc, char *argv[], - const struct fuse_operations_compat25 *op, - size_t op_size); - -struct fuse *fuse_setup_compat25(int argc, char *argv[], - const struct fuse_operations_compat25 *op, - size_t op_size, char **mountpoint, - int *multithreaded, int *fd); - -void fuse_teardown_compat22(struct fuse *fuse, int fd, char *mountpoint); - -#if !defined(__FreeBSD__) && !defined(__NetBSD__) -#include - -struct fuse_operations_compat22 { - int (*getattr) (const char *, struct stat *); - int (*readlink) (const char *, char *, size_t); - int (*mknod) (const char *, mode_t, dev_t); - int (*mkdir) (const char *, mode_t); - int (*unlink) (const char *); - int (*rmdir) (const char *); - int (*symlink) (const char *, const char *); - int (*rename) (const char *, const char *); - int (*link) (const char *, const char *); - int (*chmod) (const char *, mode_t); - int (*chown) (const char *, uid_t, gid_t); - int (*truncate) (const char *, off_t); - int (*utime) (const char *, struct utimbuf *); - int (*open) (const char *, struct fuse_file_info_compat *); - int (*read) (const char *, char *, size_t, off_t, - struct fuse_file_info_compat *); - int (*write) (const char *, const char *, size_t, off_t, - struct fuse_file_info_compat *); - int (*statfs) (const char *, struct statfs *); - int (*flush) (const char *, struct fuse_file_info_compat *); - int (*release) (const char *, struct fuse_file_info_compat *); - int (*fsync) (const char *, int, struct fuse_file_info_compat *); - int (*setxattr) (const char *, const char *, const char *, size_t, int); - int (*getxattr) (const char *, const char *, char *, size_t); - int (*listxattr) (const char *, char *, size_t); - int (*removexattr) (const char *, const char *); - int (*opendir) (const char *, struct fuse_file_info_compat *); - int (*readdir) (const char *, void *, off_t, - struct fuse_file_info_compat *); - int (*releasedir) (const char *, struct fuse_file_info_compat *); - int (*fsyncdir) (const char *, int, struct fuse_file_info_compat *); - void *(*init) (void); - void (*destroy) (void *); -}; - -struct fuse *fuse_new_compat22(int fd, const char *opts, - const struct fuse_operations_compat22 *op, - size_t op_size); - -struct fuse *fuse_setup_compat22(int argc, char *argv[], - const struct fuse_operations_compat22 *op, - size_t op_size, char **mountpoint, - int *multithreaded, int *fd); - -int fuse_main_real_compat22(int argc, char *argv[], - const struct fuse_operations_compat22 *op, - size_t op_size); - -struct fuse_operations_compat2 { - int (*getattr) (const char *, struct stat *); - int (*readlink) (const char *, char *, size_t); - int (*mknod) (const char *, mode_t, dev_t); - int (*mkdir) (const char *, mode_t); - int (*unlink) (const char *); - int (*rmdir) (const char *); - int (*symlink) (const char *, const char *); - int (*rename) (const char *, const char *); - int (*link) (const char *, const char *); - int (*chmod) (const char *, mode_t); - int (*chown) (const char *, uid_t, gid_t); - int (*truncate) (const char *, off_t); - int (*utime) (const char *, struct utimbuf *); - int (*open) (const char *, int); - int (*read) (const char *, char *, size_t, off_t); - int (*write) (const char *, const char *, size_t, off_t); - int (*statfs) (const char *, struct statfs *); - int (*flush) (const char *); - int (*release) (const char *, int); - int (*fsync) (const char *, int); - int (*setxattr) (const char *, const char *, const char *, - size_t, int); - int (*getxattr) (const char *, const char *, char *, size_t); - int (*listxattr) (const char *, char *, size_t); - int (*removexattr) (const char *, const char *); -}; - -int fuse_main_compat2(int argc, char *argv[], - const struct fuse_operations_compat2 *op); - -struct fuse *fuse_new_compat2(int fd, const char *opts, - const struct fuse_operations_compat2 *op); - -struct fuse *fuse_setup_compat2(int argc, char *argv[], - const struct fuse_operations_compat2 *op, - char **mountpoint, int *multithreaded, int *fd); - -struct fuse_statfs_compat1 { - long block_size; - long blocks; - long blocks_free; - long files; - long files_free; - long namelen; -}; - -struct fuse_operations_compat1 { - int (*getattr) (const char *, struct stat *); - int (*readlink) (const char *, char *, size_t); - int (*mknod) (const char *, mode_t, dev_t); - int (*mkdir) (const char *, mode_t); - int (*unlink) (const char *); - int (*rmdir) (const char *); - int (*symlink) (const char *, const char *); - int (*rename) (const char *, const char *); - int (*link) (const char *, const char *); - int (*chmod) (const char *, mode_t); - int (*chown) (const char *, uid_t, gid_t); - int (*truncate) (const char *, off_t); - int (*utime) (const char *, struct utimbuf *); - int (*open) (const char *, int); - int (*read) (const char *, char *, size_t, off_t); - int (*write) (const char *, const char *, size_t, off_t); - int (*statfs) (struct fuse_statfs_compat1 *); - int (*release) (const char *, int); - int (*fsync) (const char *, int); -}; - -#define FUSE_DEBUG_COMPAT1 (1 << 1) - -struct fuse *fuse_new_compat1(int fd, int flags, - const struct fuse_operations_compat1 *op); - -void fuse_main_compat1(int argc, char *argv[], - const struct fuse_operations_compat1 *op); - -#endif /* __FreeBSD__ || __NetBSD__ */ diff --git a/libfuse/include/fuse_lowlevel.h b/libfuse/include/fuse_lowlevel.h index 8054b149..d3e43e64 100644 --- a/libfuse/include/fuse_lowlevel.h +++ b/libfuse/include/fuse_lowlevel.h @@ -1834,28 +1834,6 @@ extern "C" { */ void fuse_chan_destroy(struct fuse_chan *ch); - /* ----------------------------------------------------------- * - * Compatibility stuff * - * ----------------------------------------------------------- */ - -#if FUSE_USE_VERSION < 26 -# include "fuse_lowlevel_compat.h" -# define fuse_chan_ops fuse_chan_ops_compat24 -# define fuse_chan_new fuse_chan_new_compat24 -# if FUSE_USE_VERSION == 25 -# define fuse_lowlevel_ops fuse_lowlevel_ops_compat25 -# define fuse_lowlevel_new fuse_lowlevel_new_compat25 -# elif FUSE_USE_VERSION == 24 -# define fuse_lowlevel_ops fuse_lowlevel_ops_compat -# define fuse_lowlevel_new fuse_lowlevel_new_compat -# define fuse_file_info fuse_file_info_compat -# define fuse_reply_statfs fuse_reply_statfs_compat -# define fuse_reply_open fuse_reply_open_compat -# else -# error Compatibility with low-level API version < 24 not supported -# endif -#endif - #ifdef __cplusplus } #endif diff --git a/libfuse/include/fuse_lowlevel_compat.h b/libfuse/include/fuse_lowlevel_compat.h deleted file mode 100644 index 5c4649d7..00000000 --- a/libfuse/include/fuse_lowlevel_compat.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - FUSE: Filesystem in Userspace - Copyright (C) 2001-2007 Miklos Szeredi - - This program can be distributed under the terms of the GNU LGPLv2. - See the file COPYING.LIB. -*/ - -/* these definitions provide source compatibility to prior versions. - Do not include this file directly! */ - -struct fuse_lowlevel_ops_compat25 -{ - void (*init) (void *userdata); - void (*destroy) (void *userdata); - void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name); - void (*forget) (fuse_req_t req, fuse_ino_t ino, unsigned long nlookup); - void (*getattr) (fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info *fi); - void (*setattr) (fuse_req_t req, fuse_ino_t ino, struct stat *attr, - int to_set, struct fuse_file_info *fi); - void (*readlink) (fuse_req_t req, fuse_ino_t ino); - void (*mknod) (fuse_req_t req, fuse_ino_t parent, const char *name, - mode_t mode, dev_t rdev); - void (*mkdir) (fuse_req_t req, fuse_ino_t parent, const char *name, - mode_t mode); - void (*unlink) (fuse_req_t req, fuse_ino_t parent, const char *name); - void (*rmdir) (fuse_req_t req, fuse_ino_t parent, const char *name); - void (*symlink) (fuse_req_t req, const char *link, fuse_ino_t parent, - const char *name); - void (*rename) (fuse_req_t req, fuse_ino_t parent, const char *name, - fuse_ino_t newparent, const char *newname); - void (*link) (fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent, - const char *newname); - void (*open) (fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info *fi); - void (*read) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, - struct fuse_file_info *fi); - void (*write) (fuse_req_t req, fuse_ino_t ino, const char *buf, - size_t size, off_t off, struct fuse_file_info *fi); - void (*flush) (fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info *fi); - void (*release) (fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info *fi); - void (*fsync) (fuse_req_t req, fuse_ino_t ino, int datasync, - struct fuse_file_info *fi); - void (*opendir) (fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info *fi); - void (*readdir) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, - struct fuse_file_info *fi); - void (*releasedir) (fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info *fi); - void (*fsyncdir) (fuse_req_t req, fuse_ino_t ino, int datasync, - struct fuse_file_info *fi); - void (*statfs) (fuse_req_t req); - void (*setxattr) (fuse_req_t req, fuse_ino_t ino, const char *name, - const char *value, size_t size, int flags); - void (*getxattr) (fuse_req_t req, fuse_ino_t ino, const char *name, - size_t size); - void (*listxattr) (fuse_req_t req, fuse_ino_t ino, size_t size); - void (*removexattr) (fuse_req_t req, fuse_ino_t ino, const char *name); - void (*access) (fuse_req_t req, fuse_ino_t ino, int mask); - void (*create) (fuse_req_t req, fuse_ino_t parent, const char *name, - mode_t mode, struct fuse_file_info *fi); -}; - -struct fuse_session *fuse_lowlevel_new_compat25(struct fuse_args *args, - const struct fuse_lowlevel_ops_compat25 *op, - size_t op_size, void *userdata); - -size_t fuse_dirent_size(size_t namelen); - -char *fuse_add_dirent(char *buf, const char *name, const struct stat *stbuf, - off_t off); - -#if !defined(__FreeBSD__) && !defined(__NetBSD__) - -#include - -struct fuse_lowlevel_ops_compat -{ - void (*init) (void *userdata); - void (*destroy) (void *userdata); - void (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name); - void (*forget) (fuse_req_t req, fuse_ino_t ino, unsigned long nlookup); - void (*getattr) (fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info_compat *fi); - void (*setattr) (fuse_req_t req, fuse_ino_t ino, struct stat *attr, - int to_set, struct fuse_file_info_compat *fi); - void (*readlink) (fuse_req_t req, fuse_ino_t ino); - void (*mknod) (fuse_req_t req, fuse_ino_t parent, const char *name, - mode_t mode, dev_t rdev); - void (*mkdir) (fuse_req_t req, fuse_ino_t parent, const char *name, - mode_t mode); - void (*unlink) (fuse_req_t req, fuse_ino_t parent, const char *name); - void (*rmdir) (fuse_req_t req, fuse_ino_t parent, const char *name); - void (*symlink) (fuse_req_t req, const char *link, fuse_ino_t parent, - const char *name); - void (*rename) (fuse_req_t req, fuse_ino_t parent, const char *name, - fuse_ino_t newparent, const char *newname); - void (*link) (fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent, - const char *newname); - void (*open) (fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info_compat *fi); - void (*read) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, - struct fuse_file_info_compat *fi); - void (*write) (fuse_req_t req, fuse_ino_t ino, const char *buf, - size_t size, off_t off, struct fuse_file_info_compat *fi); - void (*flush) (fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info_compat *fi); - void (*release) (fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info_compat *fi); - void (*fsync) (fuse_req_t req, fuse_ino_t ino, int datasync, - struct fuse_file_info_compat *fi); - void (*opendir) (fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info_compat *fi); - void (*readdir) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, - struct fuse_file_info_compat *fi); - void (*releasedir) (fuse_req_t req, fuse_ino_t ino, - struct fuse_file_info_compat *fi); - void (*fsyncdir) (fuse_req_t req, fuse_ino_t ino, int datasync, - struct fuse_file_info_compat *fi); - void (*statfs) (fuse_req_t req); - void (*setxattr) (fuse_req_t req, fuse_ino_t ino, const char *name, - const char *value, size_t size, int flags); - void (*getxattr) (fuse_req_t req, fuse_ino_t ino, const char *name, - size_t size); - void (*listxattr) (fuse_req_t req, fuse_ino_t ino, size_t size); - void (*removexattr) (fuse_req_t req, fuse_ino_t ino, const char *name); - void (*access) (fuse_req_t req, fuse_ino_t ino, int mask); - void (*create) (fuse_req_t req, fuse_ino_t parent, const char *name, - mode_t mode, struct fuse_file_info_compat *fi); -}; - -int fuse_reply_statfs_compat(fuse_req_t req, const struct statfs *stbuf); - -int fuse_reply_open_compat(fuse_req_t req, - const struct fuse_file_info_compat *fi); - -struct fuse_session *fuse_lowlevel_new_compat(const char *opts, - const struct fuse_lowlevel_ops_compat *op, - size_t op_size, void *userdata); - -#endif /* __FreeBSD__ || __NetBSD__ */ - -struct fuse_chan_ops_compat24 { - int (*receive)(struct fuse_chan *ch, char *buf, size_t size); - int (*send)(struct fuse_chan *ch, const struct iovec iov[], - size_t count); - void (*destroy)(struct fuse_chan *ch); -}; - -struct fuse_chan *fuse_chan_new_compat24(struct fuse_chan_ops_compat24 *op, - int fd, size_t bufsize, void *data); - -int fuse_chan_receive(struct fuse_chan *ch, char *buf, size_t size); -struct fuse_chan *fuse_kern_chan_new(int fd); diff --git a/libfuse/include/old/fuse.h b/libfuse/include/old/fuse.h deleted file mode 100644 index 3db0945a..00000000 --- a/libfuse/include/old/fuse.h +++ /dev/null @@ -1,9 +0,0 @@ -/* - This header is for compatibility with older software using FUSE. - - Please use 'pkg-config --cflags fuse' to set include path. The - correct usage is still '#include ', not '#include - '. -*/ - -#include "fuse/fuse.h" diff --git a/libfuse/lib/fuse.c b/libfuse/lib/fuse.c index 93d6c278..fd7bdd0d 100644 --- a/libfuse/lib/fuse.c +++ b/libfuse/lib/fuse.c @@ -15,8 +15,6 @@ #include "fuse_lowlevel.h" #include "fuse_opt.h" #include "fuse_misc.h" -#include "fuse_common_compat.h" -#include "fuse_compat.h" #include "fuse_kernel.h" #include "fuse_dirents.h" @@ -75,7 +73,6 @@ struct fuse_fs { struct fuse_operations op; void *user_data; - int compat; int debug; }; @@ -1424,128 +1421,6 @@ static inline void fuse_prepare_interrupt(struct fuse *f, fuse_req_t req, fuse_do_prepare_interrupt(req, d); } -#if !defined(__FreeBSD__) && !defined(__NetBSD__) - -static int fuse_compat_open(struct fuse_fs *fs, const char *path, - struct fuse_file_info *fi) -{ - int err; - if (!fs->compat || fs->compat >= 25) - err = fs->op.open(path, fi); - else if (fs->compat == 22) { - struct fuse_file_info_compat tmp; - memcpy(&tmp, fi, sizeof(tmp)); - err = ((struct fuse_operations_compat22 *) &fs->op)->open(path,&tmp); - memcpy(fi, &tmp, sizeof(tmp)); - fi->fh = tmp.fh; - } else - err = ((struct fuse_operations_compat2 *) &fs->op) - ->open(path, fi->flags); - return err; -} - -static int fuse_compat_release(struct fuse_fs *fs, - struct fuse_file_info *fi) -{ - if (!fs->compat || fs->compat >= 22) - return fs->op.release(fi); - else - return ((struct fuse_operations_compat2 *) &fs->op) - ->release(NULL, fi->flags); -} - -static int fuse_compat_opendir(struct fuse_fs *fs, const char *path, - struct fuse_file_info *fi) -{ - if (!fs->compat || fs->compat >= 25) - return fs->op.opendir(path, fi); - else { - int err; - struct fuse_file_info_compat tmp; - memcpy(&tmp, fi, sizeof(tmp)); - err = ((struct fuse_operations_compat22 *) &fs->op) - ->opendir(path, &tmp); - memcpy(fi, &tmp, sizeof(tmp)); - fi->fh = tmp.fh; - return err; - } -} - -static void convert_statfs_compat(struct fuse_statfs_compat1 *compatbuf, - struct statvfs *stbuf) -{ - stbuf->f_bsize = compatbuf->block_size; - stbuf->f_blocks = compatbuf->blocks; - stbuf->f_bfree = compatbuf->blocks_free; - stbuf->f_bavail = compatbuf->blocks_free; - stbuf->f_files = compatbuf->files; - stbuf->f_ffree = compatbuf->files_free; - stbuf->f_namemax = compatbuf->namelen; -} - -static void convert_statfs_old(struct statfs *oldbuf, struct statvfs *stbuf) -{ - stbuf->f_bsize = oldbuf->f_bsize; - stbuf->f_blocks = oldbuf->f_blocks; - stbuf->f_bfree = oldbuf->f_bfree; - stbuf->f_bavail = oldbuf->f_bavail; - stbuf->f_files = oldbuf->f_files; - stbuf->f_ffree = oldbuf->f_ffree; - stbuf->f_namemax = oldbuf->f_namelen; -} - -static int fuse_compat_statfs(struct fuse_fs *fs, const char *path, - struct statvfs *buf) -{ - int err; - - if (!fs->compat || fs->compat >= 25) { - err = fs->op.statfs(fs->compat == 25 ? "/" : path, buf); - } else if (fs->compat > 11) { - struct statfs oldbuf; - err = ((struct fuse_operations_compat22 *) &fs->op) - ->statfs("/", &oldbuf); - if (!err) - convert_statfs_old(&oldbuf, buf); - } else { - struct fuse_statfs_compat1 compatbuf; - memset(&compatbuf, 0, sizeof(struct fuse_statfs_compat1)); - err = ((struct fuse_operations_compat1 *) &fs->op) - ->statfs(&compatbuf); - if (!err) - convert_statfs_compat(&compatbuf, buf); - } - return err; -} - -#else /* __FreeBSD__ || __NetBSD__ */ - -static inline int fuse_compat_open(struct fuse_fs *fs, char *path, - struct fuse_file_info *fi) -{ - return fs->op.open(path, fi); -} - -static inline int fuse_compat_release(struct fuse_fs *fs, - struct fuse_file_info *fi) -{ - return fs->op.release(fi); -} - -static inline int fuse_compat_opendir(struct fuse_fs *fs, const char *path, - struct fuse_file_info *fi) -{ - return fs->op.opendir(path, fi); -} - -static inline int fuse_compat_statfs(struct fuse_fs *fs, const char *path, - struct statvfs *buf) -{ - return fs->op.statfs(fs->compat == 25 ? "/" : path, buf); -} - -#endif /* __FreeBSD__ || __NetBSD__ */ - int fuse_fs_getattr(struct fuse_fs *fs, const char *path, @@ -1679,7 +1554,7 @@ int fuse_fs_release(struct fuse_fs *fs, fi->flush ? "+flush" : "", (unsigned long long) fi->fh, fi->flags); - return fuse_compat_release(fs, fi); + return fs->op.release(fi); } else { return 0; } @@ -1696,7 +1571,7 @@ int fuse_fs_opendir(struct fuse_fs *fs, const char *path, fprintf(stderr, "opendir flags: 0x%x %s\n", fi->flags, path); - err = fuse_compat_opendir(fs, path, fi); + err = fs->op.opendir(path,fi); if (fs->debug && !err) fprintf(stderr, " opendir[%lli] flags: 0x%x %s\n", @@ -1719,7 +1594,7 @@ int fuse_fs_open(struct fuse_fs *fs, const char *path, fprintf(stderr, "open flags: 0x%x %s\n", fi->flags, path); - err = fuse_compat_open(fs, path, fi); + err = fs->op.open(path,fi); if (fs->debug && !err) fprintf(stderr, " open[%lli] flags: 0x%x %s\n", @@ -1941,7 +1816,7 @@ int fuse_fs_statfs(struct fuse_fs *fs, const char *path, struct statvfs *buf) if (fs->debug) fprintf(stderr, "statfs %s\n", path); - return fuse_compat_statfs(fs, path, buf); + return fs->op.statfs(path,buf); } else { buf->f_namemax = 255; buf->f_bsize = 512; @@ -4392,24 +4267,6 @@ struct fuse_context *fuse_get_context(void) return &fuse_get_context_internal()->ctx; } -/* - * The size of fuse_context got extended, so need to be careful about - * incompatibility (i.e. a new binary cannot work with an old - * library). - */ -struct fuse_context *fuse_get_context_compat22(void); -struct fuse_context *fuse_get_context_compat22(void) -{ - return &fuse_get_context_internal()->ctx; -} -FUSE_SYMVER(".symver fuse_get_context_compat22,fuse_get_context@FUSE_2.2"); - -int fuse_getgroups(int size, gid_t list[]) -{ - fuse_req_t req = fuse_get_context_internal()->req; - return fuse_req_getgroups(req, size, list); -} - int fuse_interrupted(void) { return fuse_req_interrupted(fuse_get_context_internal()->req); @@ -4588,7 +4445,7 @@ void fuse_stop_cleanup_thread(struct fuse *f) struct fuse *fuse_new_common(struct fuse_chan *ch, struct fuse_args *args, const struct fuse_operations *op, - size_t op_size, void *user_data, int compat) + size_t op_size, void *user_data) { struct fuse *f; struct node *root; @@ -4608,7 +4465,6 @@ struct fuse *fuse_new_common(struct fuse_chan *ch, struct fuse_args *args, if (!fs) goto out_free; - fs->compat = compat; f->fs = fs; /* Oh f**k, this is ugly! */ @@ -4628,11 +4484,6 @@ struct fuse *fuse_new_common(struct fuse_chan *ch, struct fuse_args *args, fuse_lib_opt_proc) == -1) goto out_free_fs; - if (compat && compat <= 25) { - if (fuse_sync_compat_args(args) == -1) - goto out_free_fs; - } - f->se = fuse_lowlevel_new_common(args, &llop, sizeof(llop), f); if (f->se == NULL) { goto out_free_fs; @@ -4703,7 +4554,7 @@ struct fuse *fuse_new(struct fuse_chan *ch, struct fuse_args *args, const struct fuse_operations *op, size_t op_size, void *user_data) { - return fuse_new_common(ch, args, op, op_size, user_data, 0); + return fuse_new_common(ch, args, op, op_size, user_data); } void fuse_destroy(struct fuse *f) @@ -4750,91 +4601,6 @@ void fuse_destroy(struct fuse *f) fuse_delete_context_key(); } -static -struct fuse * -fuse_new_common_compat25(int fd, struct fuse_args *args, - const struct fuse_operations *op, - size_t op_size, int compat) -{ - struct fuse *f = NULL; - struct fuse_chan *ch = fuse_kern_chan_new(fd); - - if (ch) - f = fuse_new_common(ch, args, op, op_size, NULL, compat); - - return f; -} - -#if !defined(__FreeBSD__) && !defined(__NetBSD__) - -static struct fuse *fuse_new_common_compat(int fd, const char *opts, - const struct fuse_operations *op, - size_t op_size, int compat) -{ - struct fuse *f; - struct fuse_args args = FUSE_ARGS_INIT(0, NULL); - - if (fuse_opt_add_arg(&args, "") == -1) - return NULL; - if (opts && - (fuse_opt_add_arg(&args, "-o") == -1 || - fuse_opt_add_arg(&args, opts) == -1)) { - fuse_opt_free_args(&args); - return NULL; - } - - f = fuse_new_common_compat25(fd, &args, op, op_size, compat); - fuse_opt_free_args(&args); - - return f; -} - -struct fuse *fuse_new_compat22(int fd, const char *opts, - const struct fuse_operations_compat22 *op, - size_t op_size) -{ - return fuse_new_common_compat(fd, opts, (struct fuse_operations *) op, - op_size, 22); -} - -struct fuse *fuse_new_compat2(int fd, const char *opts, - const struct fuse_operations_compat2 *op) -{ - return fuse_new_common_compat(fd, opts, (struct fuse_operations *) op, - sizeof(struct fuse_operations_compat2), - 21); -} - -struct fuse *fuse_new_compat1(int fd, int flags, - const struct fuse_operations_compat1 *op) -{ - const char *opts = NULL; - if (flags & FUSE_DEBUG_COMPAT1) - opts = "debug"; - return fuse_new_common_compat(fd, opts, (struct fuse_operations *) op, - sizeof(struct fuse_operations_compat1), - 11); -} - -FUSE_SYMVER(".symver fuse_exited,__fuse_exited@"); -FUSE_SYMVER(".symver fuse_process_cmd,__fuse_process_cmd@"); -FUSE_SYMVER(".symver fuse_read_cmd,__fuse_read_cmd@"); -FUSE_SYMVER(".symver fuse_set_getcontext_func,__fuse_set_getcontext_func@"); -FUSE_SYMVER(".symver fuse_new_compat2,fuse_new@"); -FUSE_SYMVER(".symver fuse_new_compat22,fuse_new@FUSE_2.2"); - -#endif /* __FreeBSD__ || __NetBSD__ */ - -struct fuse *fuse_new_compat25(int fd, struct fuse_args *args, - const struct fuse_operations_compat25 *op, - size_t op_size) -{ - return fuse_new_common_compat25(fd, args, (struct fuse_operations *) op, - op_size, 25); -} - -FUSE_SYMVER(".symver fuse_new_compat25,fuse_new@FUSE_2.5"); - int fuse_config_num_threads(const struct fuse *fuse_) { diff --git a/libfuse/lib/fuse_i.h b/libfuse/lib/fuse_i.h index 4eb3bfaa..80b5a683 100644 --- a/libfuse/lib/fuse_i.h +++ b/libfuse/lib/fuse_i.h @@ -98,9 +98,7 @@ struct fuse_cmd struct fuse *fuse_new_common(struct fuse_chan *ch, struct fuse_args *args, const struct fuse_operations *op, - size_t op_size, void *user_data, int compat); - -int fuse_sync_compat_args(struct fuse_args *args); + size_t op_size, void *user_data); struct fuse_chan *fuse_kern_chan_new(int fd); @@ -108,7 +106,6 @@ struct fuse_session *fuse_lowlevel_new_common(struct fuse_args *args, const struct fuse_lowlevel_ops *op, size_t op_size, void *userdata); -void fuse_kern_unmount_compat22(const char *mountpoint); int fuse_chan_clearfd(struct fuse_chan *ch); void fuse_kern_unmount(const char *mountpoint, int fd); @@ -125,7 +122,6 @@ struct fuse *fuse_setup_common(int argc, char *argv[], char **mountpoint, int *multithreaded, int *fd, - void *user_data, - int compat); + void *user_data); int fuse_start_thread(pthread_t *thread_id, void *(*func)(void *), void *arg); diff --git a/libfuse/lib/fuse_lowlevel.c b/libfuse/lib/fuse_lowlevel.c index 22f96b22..8a922477 100644 --- a/libfuse/lib/fuse_lowlevel.c +++ b/libfuse/lib/fuse_lowlevel.c @@ -13,8 +13,6 @@ #include "fuse_kernel.h" #include "fuse_opt.h" #include "fuse_misc.h" -#include "fuse_common_compat.h" -#include "fuse_lowlevel_compat.h" #include #include @@ -2290,21 +2288,6 @@ const struct fuse_ctx *fuse_req_ctx(fuse_req_t req) return &req->ctx; } -/* - * The size of fuse_ctx got extended, so need to be careful about - * incompatibility (i.e. a new binary cannot work with an old - * library). - */ -const struct fuse_ctx *fuse_req_ctx_compat24(fuse_req_t req); -const struct fuse_ctx *fuse_req_ctx_compat24(fuse_req_t req) -{ - return fuse_req_ctx(req); -} -#ifndef __NetBSD__ -FUSE_SYMVER(".symver fuse_req_ctx_compat24,fuse_req_ctx@FUSE_2.4"); -#endif - - void fuse_req_interrupt_func(fuse_req_t req, fuse_interrupt_func_t func, void *data) { @@ -2849,136 +2832,11 @@ struct fuse_session *fuse_lowlevel_new_common(struct fuse_args *args, return NULL; } - -struct fuse_session *fuse_lowlevel_new(struct fuse_args *args, - const struct fuse_lowlevel_ops *op, - size_t op_size, void *userdata) +struct fuse_session* +fuse_lowlevel_new(struct fuse_args *args, + const struct fuse_lowlevel_ops *op, + size_t op_size, + void *userdata) { return fuse_lowlevel_new_common(args, op, op_size, userdata); } - -#if !defined(__FreeBSD__) && !defined(__NetBSD__) - -static void fill_open_compat(struct fuse_open_out *arg, - const struct fuse_file_info_compat *f) -{ - arg->fh = f->fh; - if (f->direct_io) - arg->open_flags |= FOPEN_DIRECT_IO; - if (f->keep_cache) - arg->open_flags |= FOPEN_KEEP_CACHE; -} - -static void convert_statfs_compat(const struct statfs *compatbuf, - struct statvfs *buf) -{ - buf->f_bsize = compatbuf->f_bsize; - buf->f_blocks = compatbuf->f_blocks; - buf->f_bfree = compatbuf->f_bfree; - buf->f_bavail = compatbuf->f_bavail; - buf->f_files = compatbuf->f_files; - buf->f_ffree = compatbuf->f_ffree; - buf->f_namemax = compatbuf->f_namelen; -} - -int fuse_reply_open_compat(fuse_req_t req, - const struct fuse_file_info_compat *f) -{ - struct fuse_open_out arg; - - memset(&arg, 0, sizeof(arg)); - fill_open_compat(&arg, f); - return send_reply_ok(req, &arg, sizeof(arg)); -} - -int fuse_reply_statfs_compat(fuse_req_t req, const struct statfs *stbuf) -{ - struct statvfs newbuf; - - memset(&newbuf, 0, sizeof(newbuf)); - convert_statfs_compat(stbuf, &newbuf); - - return fuse_reply_statfs(req, &newbuf); -} - -struct fuse_session *fuse_lowlevel_new_compat(const char *opts, - const struct fuse_lowlevel_ops_compat *op, - size_t op_size, void *userdata) -{ - struct fuse_session *se; - struct fuse_args args = FUSE_ARGS_INIT(0, NULL); - - if (opts && - (fuse_opt_add_arg(&args, "") == -1 || - fuse_opt_add_arg(&args, "-o") == -1 || - fuse_opt_add_arg(&args, opts) == -1)) { - fuse_opt_free_args(&args); - return NULL; - } - se = fuse_lowlevel_new(&args, (const struct fuse_lowlevel_ops *) op, - op_size, userdata); - fuse_opt_free_args(&args); - - return se; -} - -struct fuse_ll_compat_conf { - unsigned max_read; - int set_max_read; -}; - -static const struct fuse_opt fuse_ll_opts_compat[] = { - { "max_read=", offsetof(struct fuse_ll_compat_conf, set_max_read), 1 }, - { "max_read=%u", offsetof(struct fuse_ll_compat_conf, max_read), 0 }, - FUSE_OPT_KEY("max_read=", FUSE_OPT_KEY_KEEP), - FUSE_OPT_END -}; - -int fuse_sync_compat_args(struct fuse_args *args) -{ - struct fuse_ll_compat_conf conf; - - memset(&conf, 0, sizeof(conf)); - if (fuse_opt_parse(args, &conf, fuse_ll_opts_compat, NULL) == -1) - return -1; - - if (fuse_opt_insert_arg(args, 1, "-osync_read")) - return -1; - - if (conf.set_max_read) { - char tmpbuf[64]; - - sprintf(tmpbuf, "-omax_readahead=%u", conf.max_read); - if (fuse_opt_insert_arg(args, 1, tmpbuf) == -1) - return -1; - } - return 0; -} - -FUSE_SYMVER(".symver fuse_reply_statfs_compat,fuse_reply_statfs@FUSE_2.4"); -FUSE_SYMVER(".symver fuse_reply_open_compat,fuse_reply_open@FUSE_2.4"); -FUSE_SYMVER(".symver fuse_lowlevel_new_compat,fuse_lowlevel_new@FUSE_2.4"); - -#else /* __FreeBSD__ || __NetBSD__ */ - -int fuse_sync_compat_args(struct fuse_args *args) -{ - (void) args; - return 0; -} - -#endif /* __FreeBSD__ || __NetBSD__ */ - -struct fuse_session *fuse_lowlevel_new_compat25(struct fuse_args *args, - const struct fuse_lowlevel_ops_compat25 *op, - size_t op_size, void *userdata) -{ - if (fuse_sync_compat_args(args) == -1) - return NULL; - - return fuse_lowlevel_new_common(args, - (const struct fuse_lowlevel_ops *) op, - op_size, userdata); -} - -FUSE_SYMVER(".symver fuse_lowlevel_new_compat25,fuse_lowlevel_new@FUSE_2.5"); diff --git a/libfuse/lib/fuse_opt.c b/libfuse/lib/fuse_opt.c index 5605f4b7..391a0666 100644 --- a/libfuse/lib/fuse_opt.c +++ b/libfuse/lib/fuse_opt.c @@ -97,13 +97,6 @@ int fuse_opt_insert_arg(struct fuse_args *args, int pos, const char *arg) return fuse_opt_insert_arg_common(args, pos, arg); } -int fuse_opt_insert_arg_compat(struct fuse_args *args, int pos, - const char *arg); -int fuse_opt_insert_arg_compat(struct fuse_args *args, int pos, const char *arg) -{ - return fuse_opt_insert_arg_common(args, pos, arg); -} - static int next_arg(struct fuse_opt_context *ctx, const char *opt) { if (ctx->argctr + 1 >= ctx->argc) { @@ -426,6 +419,3 @@ int fuse_opt_parse(struct fuse_args *args, void *data, fuse_opt_free_args(&ctx.outargs); return res; } - -/* This symbol version was mistakenly added to the version script */ -FUSE_SYMVER(".symver fuse_opt_insert_arg_compat,fuse_opt_insert_arg@FUSE_2.5"); diff --git a/libfuse/lib/fuse_session.c b/libfuse/lib/fuse_session.c index 5773ec72..ea6eacc5 100644 --- a/libfuse/lib/fuse_session.c +++ b/libfuse/lib/fuse_session.c @@ -8,8 +8,6 @@ #include "fuse_i.h" #include "fuse_misc.h" -#include "fuse_common_compat.h" -#include "fuse_lowlevel_compat.h" #include #include @@ -24,7 +22,6 @@ struct fuse_chan int fd; size_t bufsize; void *data; - int compat; }; struct fuse_session *fuse_session_new(struct fuse_session_ops *op, void *data) @@ -141,8 +138,7 @@ void *fuse_session_data(struct fuse_session *se) } static struct fuse_chan *fuse_chan_new_common(struct fuse_chan_ops *op, int fd, - size_t bufsize, void *data, - int compat) + size_t bufsize, void *data) { struct fuse_chan *ch = (struct fuse_chan *) malloc(sizeof(*ch)); if (ch == NULL) { @@ -155,7 +151,6 @@ static struct fuse_chan *fuse_chan_new_common(struct fuse_chan_ops *op, int fd, ch->fd = fd; ch->bufsize = bufsize; ch->data = data; - ch->compat = compat; return ch; } @@ -163,14 +158,7 @@ static struct fuse_chan *fuse_chan_new_common(struct fuse_chan_ops *op, int fd, struct fuse_chan *fuse_chan_new(struct fuse_chan_ops *op, int fd, size_t bufsize, void *data) { - return fuse_chan_new_common(op, fd, bufsize, data, 0); -} - -struct fuse_chan *fuse_chan_new_compat24(struct fuse_chan_ops_compat24 *op, - int fd, size_t bufsize, void *data) -{ - return fuse_chan_new_common((struct fuse_chan_ops *) op, fd, bufsize, - data, 24); + return fuse_chan_new_common(op, fd, bufsize, data); } int fuse_chan_fd(struct fuse_chan *ch) @@ -203,11 +191,8 @@ struct fuse_session *fuse_chan_session(struct fuse_chan *ch) int fuse_chan_recv(struct fuse_chan **chp, char *buf, size_t size) { struct fuse_chan *ch = *chp; - if (ch->compat) - return ((struct fuse_chan_ops_compat24 *) &ch->op) - ->receive(ch, buf, size); - else - return ch->op.receive(chp, buf, size); + + return ch->op.receive(chp, buf, size); } int fuse_chan_receive(struct fuse_chan *ch, char *buf, size_t size) @@ -230,7 +215,3 @@ void fuse_chan_destroy(struct fuse_chan *ch) ch->op.destroy(ch); free(ch); } - -#ifndef __FreeBSD__ -FUSE_SYMVER(".symver fuse_chan_new_compat24,fuse_chan_new@FUSE_2.4"); -#endif diff --git a/libfuse/lib/helper.c b/libfuse/lib/helper.c index 95b6d18b..c1e6d7f1 100644 --- a/libfuse/lib/helper.c +++ b/libfuse/lib/helper.c @@ -11,7 +11,6 @@ #include "fuse_misc.h" #include "fuse_opt.h" #include "fuse_lowlevel.h" -#include "fuse_common_compat.h" #include #include @@ -260,7 +259,7 @@ fuse_mount_common(const char *mountpoint_, close(fd); } while(fd >= 0 && fd <= 2); - fd = fuse_mount_compat25(mountpoint_, args_); + fd = fuse_kern_mount(mountpoint_,args_); if(fd == -1) return NULL; @@ -299,8 +298,7 @@ struct fuse *fuse_setup_common(int argc, char *argv[], char **mountpoint, int *multithreaded, int *fd, - void *user_data, - int compat) + void *user_data) { struct fuse_args args = FUSE_ARGS_INIT(argc, argv); struct fuse_chan *ch; @@ -318,7 +316,7 @@ struct fuse *fuse_setup_common(int argc, char *argv[], goto err_free; } - fuse = fuse_new_common(ch, &args, op, op_size, user_data, compat); + fuse = fuse_new_common(ch, &args, op, op_size, user_data); fuse_opt_free_args(&args); if (fuse == NULL) goto err_unmount; @@ -350,7 +348,7 @@ struct fuse *fuse_setup(int argc, char *argv[], char **mountpoint, int *multithreaded, void *user_data) { return fuse_setup_common(argc, argv, op, op_size, mountpoint, - multithreaded, NULL, user_data, 0); + multithreaded, NULL, user_data); } static void fuse_teardown_common(struct fuse *fuse, char *mountpoint) @@ -370,7 +368,7 @@ void fuse_teardown(struct fuse *fuse, char *mountpoint) static int fuse_main_common(int argc, char *argv[], const struct fuse_operations *op, size_t op_size, - void *user_data, int compat) + void *user_data) { struct fuse *fuse; char *mountpoint; @@ -378,7 +376,7 @@ static int fuse_main_common(int argc, char *argv[], int res; fuse = fuse_setup_common(argc, argv, op, op_size, &mountpoint, - &multithreaded, NULL, user_data, compat); + &multithreaded, NULL, user_data); if (fuse == NULL) return 1; @@ -397,7 +395,7 @@ static int fuse_main_common(int argc, char *argv[], int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op, size_t op_size, void *user_data) { - return fuse_main_common(argc, argv, op, op_size, user_data, 0); + return fuse_main_common(argc, argv, op, op_size, user_data); } #undef fuse_main @@ -412,100 +410,3 @@ int fuse_version(void) { return FUSE_VERSION; } - -#include "fuse_compat.h" - -#if !defined(__FreeBSD__) && !defined(__NetBSD__) - -struct fuse *fuse_setup_compat22(int argc, char *argv[], - const struct fuse_operations_compat22 *op, - size_t op_size, char **mountpoint, - int *multithreaded, int *fd) -{ - return fuse_setup_common(argc, argv, (struct fuse_operations *) op, - op_size, mountpoint, multithreaded, fd, NULL, - 22); -} - -struct fuse *fuse_setup_compat2(int argc, char *argv[], - const struct fuse_operations_compat2 *op, - char **mountpoint, int *multithreaded, - int *fd) -{ - return fuse_setup_common(argc, argv, (struct fuse_operations *) op, - sizeof(struct fuse_operations_compat2), - mountpoint, multithreaded, fd, NULL, 21); -} - -int fuse_main_real_compat22(int argc, char *argv[], - const struct fuse_operations_compat22 *op, - size_t op_size) -{ - return fuse_main_common(argc, argv, (struct fuse_operations *) op, - op_size, NULL, 22); -} - -void fuse_main_compat1(int argc, char *argv[], - const struct fuse_operations_compat1 *op) -{ - fuse_main_common(argc, argv, (struct fuse_operations *) op, - sizeof(struct fuse_operations_compat1), NULL, 11); -} - -int fuse_main_compat2(int argc, char *argv[], - const struct fuse_operations_compat2 *op) -{ - return fuse_main_common(argc, argv, (struct fuse_operations *) op, - sizeof(struct fuse_operations_compat2), NULL, - 21); -} - -int fuse_mount_compat1(const char *mountpoint, const char *args[]) -{ - /* just ignore mount args for now */ - (void) args; - return fuse_mount_compat22(mountpoint, NULL); -} - -FUSE_SYMVER(".symver fuse_setup_compat2,__fuse_setup@"); -FUSE_SYMVER(".symver fuse_setup_compat22,fuse_setup@FUSE_2.2"); -FUSE_SYMVER(".symver fuse_teardown,__fuse_teardown@"); -FUSE_SYMVER(".symver fuse_main_compat2,fuse_main@"); -FUSE_SYMVER(".symver fuse_main_real_compat22,fuse_main_real@FUSE_2.2"); - -#endif /* __FreeBSD__ || __NetBSD__ */ - - -struct fuse *fuse_setup_compat25(int argc, char *argv[], - const struct fuse_operations_compat25 *op, - size_t op_size, char **mountpoint, - int *multithreaded, int *fd) -{ - return fuse_setup_common(argc, argv, (struct fuse_operations *) op, - op_size, mountpoint, multithreaded, fd, NULL, - 25); -} - -int fuse_main_real_compat25(int argc, char *argv[], - const struct fuse_operations_compat25 *op, - size_t op_size) -{ - return fuse_main_common(argc, argv, (struct fuse_operations *) op, - op_size, NULL, 25); -} - -void fuse_teardown_compat22(struct fuse *fuse, int fd, char *mountpoint) -{ - (void) fd; - fuse_teardown_common(fuse, mountpoint); -} - -int fuse_mount_compat25(const char *mountpoint, struct fuse_args *args) -{ - return fuse_kern_mount(mountpoint, args); -} - -FUSE_SYMVER(".symver fuse_setup_compat25,fuse_setup@FUSE_2.5"); -FUSE_SYMVER(".symver fuse_teardown_compat22,fuse_teardown@FUSE_2.2"); -FUSE_SYMVER(".symver fuse_main_real_compat25,fuse_main_real@FUSE_2.5"); -FUSE_SYMVER(".symver fuse_mount_compat25,fuse_mount@FUSE_2.5"); diff --git a/libfuse/lib/mount_bsd.c b/libfuse/lib/mount_bsd.c index 23747bc4..82e7b6c7 100644 --- a/libfuse/lib/mount_bsd.c +++ b/libfuse/lib/mount_bsd.c @@ -145,53 +145,6 @@ static int fuse_mount_opt_proc(void *data, const char *arg, int key, return 1; } -void fuse_unmount_compat22(const char *mountpoint) -{ - char dev[128]; - char *ssc, *umount_cmd; - FILE *sf; - int rv; - char seekscript[] = - /* error message is annoying in help output */ - "exec 2>/dev/null; " - "/usr/bin/fstat " FUSE_DEV_TRUNK "* | " - "/usr/bin/awk 'BEGIN{ getline; if (! ($3 == \"PID\" && $10 == \"NAME\")) exit 1; }; " - " { if ($3 == %d) print $10; }' | " - "/usr/bin/sort | " - "/usr/bin/uniq | " - "/usr/bin/awk '{ i += 1; if (i > 1){ exit 1; }; printf; }; END{ if (i == 0) exit 1; }'"; - - (void) mountpoint; - - /* - * If we don't know the fd, we have to resort to the scripted - * solution -- iterating over the fd-s is unpractical, as we - * don't know how many of open files we have. (This could be - * looked up in procfs -- however, that's optional on FBSD; or - * read out from the kmem -- however, that's bound to - * privileges (in fact, that's what happens when we call the - * setgid kmem fstat(1) utility). - */ - if (asprintf(&ssc, seekscript, getpid()) == -1) - return; - - errno = 0; - sf = popen(ssc, "r"); - free(ssc); - if (! sf) - return; - - fgets(dev, sizeof(dev), sf); - rv = pclose(sf); - if (rv) - return; - - if (asprintf(&umount_cmd, "/sbin/umount %s", dev) == -1) - return; - system(umount_cmd); - free(umount_cmd); -} - static void do_unmount(char *dev, int fd) { char device_path[SPECNAMELEN + 12]; @@ -387,5 +340,3 @@ int fuse_kern_mount(const char *mountpoint, struct fuse_args *args) free(mo.kernel_opts); return res; } - -FUSE_SYMVER(".symver fuse_unmount_compat22,fuse_unmount@FUSE_2.2"); diff --git a/libfuse/lib/mount_generic.c b/libfuse/lib/mount_generic.c index 1c4f5c63..249ef74f 100644 --- a/libfuse/lib/mount_generic.c +++ b/libfuse/lib/mount_generic.c @@ -10,7 +10,6 @@ #include "fuse_i.h" #include "fuse_misc.h" #include "fuse_opt.h" -#include "fuse_common_compat.h" #include "mount_util.h" #include @@ -343,11 +342,6 @@ void fuse_kern_unmount(const char *mountpoint, int fd) waitpid(pid, NULL, 0); } -void fuse_unmount_compat22(const char *mountpoint) -{ - fuse_kern_unmount(mountpoint, -1); -} - static int fuse_mount_fusermount(const char *mountpoint, struct mount_opts *mo, const char *opts, int quiet) { @@ -418,15 +412,6 @@ static int fuse_mount_fusermount(const char *mountpoint, struct mount_opts *mo, return rv; } -int fuse_mount_compat22(const char *mountpoint, const char *opts) -{ - struct mount_opts mo; - memset(&mo, 0, sizeof(mo)); - mo.flags = MS_NOSUID | MS_NODEV; - - return fuse_mount_fusermount(mountpoint, &mo, opts, 0); -} - static int fuse_mount_sys(const char *mnt, struct mount_opts *mo, const char *mnt_opts) { @@ -641,6 +626,3 @@ int fuse_kern_mount(const char *mountpoint, struct fuse_args *args) free(mo.mtab_opts); return res; } - -FUSE_SYMVER(".symver fuse_mount_compat22,fuse_mount@FUSE_2.2"); -FUSE_SYMVER(".symver fuse_unmount_compat22,fuse_unmount@FUSE_2.2");