diff --git a/build/VStudio/winfsp_dll.vcxproj b/build/VStudio/winfsp_dll.vcxproj index 7e3b7ac4..d5361b80 100644 --- a/build/VStudio/winfsp_dll.vcxproj +++ b/build/VStudio/winfsp_dll.vcxproj @@ -20,6 +20,10 @@ + + + + @@ -28,6 +32,7 @@ + @@ -35,6 +40,8 @@ + + diff --git a/build/VStudio/winfsp_dll.vcxproj.filters b/build/VStudio/winfsp_dll.vcxproj.filters index 73bedbf3..db769319 100644 --- a/build/VStudio/winfsp_dll.vcxproj.filters +++ b/build/VStudio/winfsp_dll.vcxproj.filters @@ -21,6 +21,12 @@ {518cce17-85cd-489c-b4be-920a84c1d73c} + + {12afd2f1-f5ec-4008-b6ef-89cc626019ea} + + + {96091a7b-3923-4a74-9491-3ee230c688f9} + @@ -56,6 +62,21 @@ Include\winfsp + + Include\fuse3 + + + Include\fuse3 + + + Include\fuse3 + + + Include\fuse3 + + + Source\fuse3 + @@ -121,6 +142,12 @@ Source + + Source\fuse3 + + + Source\fuse3 + diff --git a/inc/fuse3/fuse.h b/inc/fuse3/fuse.h new file mode 100644 index 00000000..d6de06bc --- /dev/null +++ b/inc/fuse3/fuse.h @@ -0,0 +1,334 @@ +/** + * @file fuse3/fuse.h + * WinFsp FUSE3 compatible API. + * + * This file is derived from libfuse/include/fuse.h: + * FUSE: Filesystem in Userspace + * Copyright (C) 2001-2007 Miklos Szeredi + * + * @copyright 2015-2018 Bill Zissimopoulos + */ +/* + * This file is part of WinFsp. + * + * You can redistribute it and/or modify it under the terms of the GNU + * General Public License version 3 as published by the Free Software + * Foundation. + * + * Licensees holding a valid commercial license may use this file in + * accordance with the commercial license agreement provided with the + * software. + */ + +#ifndef FUSE_H_ +#define FUSE_H_ + +#include "fuse_common.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct fuse3; + +enum fuse3_readdir_flags +{ + FUSE_READDIR_PLUS = (1 << 0), +}; + +enum fuse3_fill_dir_flags +{ + FUSE_FILL_DIR_PLUS = (1 << 1), +}; + +typedef int (*fuse3_fill_dir_t)(void *buf, const char *name, + const struct fuse_stat *stbuf, fuse_off_t off, + enum fuse3_fill_dir_flags flags); + +struct fuse3_config +{ + int set_gid; + unsigned int gid; + int set_uid; + unsigned int uid; + int set_mode; + unsigned int umask; + double entry_timeout; + double negative_timeout; + double attr_timeout; + int intr; + int intr_signal; + int remember; + int hard_remove; + int use_ino; + int readdir_ino; + int direct_io; + int kernel_cache; + int auto_cache; + int ac_attr_timeout_set; + double ac_attr_timeout; + int nullpath_ok; + /* private */ + int show_help; + char *modules; + int debug; +}; + +struct fuse3_operations +{ + /* S - supported by WinFsp */ + /* S */ int (*getattr)(const char *path, struct fuse_stat *stbuf, + struct fuse3_file_info *fi); + /* S */ int (*readlink)(const char *path, char *buf, size_t size); + /* S */ int (*mknod)(const char *path, fuse_mode_t mode, fuse_dev_t dev); + /* S */ int (*mkdir)(const char *path, fuse_mode_t mode); + /* S */ int (*unlink)(const char *path); + /* S */ int (*rmdir)(const char *path); + /* S */ int (*symlink)(const char *dstpath, const char *srcpath); + /* S */ int (*rename)(const char *oldpath, const char *newpath, unsigned int flags); + /* _ */ int (*link)(const char *srcpath, const char *dstpath); + /* S */ int (*chmod)(const char *path, fuse_mode_t mode, + struct fuse3_file_info *fi); + /* S */ int (*chown)(const char *path, fuse_uid_t uid, fuse_gid_t gid, + struct fuse3_file_info *fi); + /* S */ int (*truncate)(const char *path, fuse_off_t size, + struct fuse3_file_info *fi); + /* S */ int (*open)(const char *path, struct fuse3_file_info *fi); + /* S */ int (*read)(const char *path, char *buf, size_t size, fuse_off_t off, + struct fuse3_file_info *fi); + /* S */ int (*write)(const char *path, const char *buf, size_t size, fuse_off_t off, + struct fuse3_file_info *fi); + /* S */ int (*statfs)(const char *path, struct fuse_statvfs *stbuf); + /* S */ int (*flush)(const char *path, struct fuse3_file_info *fi); + /* S */ int (*release)(const char *path, struct fuse3_file_info *fi); + /* S */ int (*fsync)(const char *path, int datasync, struct fuse3_file_info *fi); + /* _ */ int (*setxattr)(const char *path, const char *name, const char *value, size_t size, + int flags); + /* _ */ int (*getxattr)(const char *path, const char *name, char *value, size_t size); + /* _ */ int (*listxattr)(const char *path, char *namebuf, size_t size); + /* _ */ int (*removexattr)(const char *path, const char *name); + /* S */ int (*opendir)(const char *path, struct fuse3_file_info *fi); + /* S */ int (*readdir)(const char *path, void *buf, fuse3_fill_dir_t filler, fuse_off_t off, + struct fuse3_file_info *fi, enum fuse3_readdir_flags); + /* S */ int (*releasedir)(const char *path, struct fuse3_file_info *fi); + /* S */ int (*fsyncdir)(const char *path, int datasync, struct fuse3_file_info *fi); + /* S */ void *(*init)(struct fuse3_conn_info *conn, + struct fuse3_config *conf); + /* S */ void (*destroy)(void *data); + /* _ */ int (*access)(const char *path, int mask); + /* S */ int (*create)(const char *path, fuse_mode_t mode, struct fuse3_file_info *fi); + /* _ */ int (*lock)(const char *path, + struct fuse3_file_info *fi, int cmd, struct fuse_flock *lock); + /* S */ int (*utimens)(const char *path, const struct fuse_timespec tv[2], + struct fuse3_file_info *fi); + /* _ */ int (*bmap)(const char *path, size_t blocksize, uint64_t *idx); + /* S */ int (*ioctl)(const char *path, int cmd, void *arg, struct fuse3_file_info *fi, + unsigned int flags, void *data); + /* _ */ int (*poll)(const char *path, struct fuse3_file_info *fi, + struct fuse3_pollhandle *ph, unsigned *reventsp); + /* _ */ int (*write_buf)(const char *path, + struct fuse3_bufvec *buf, fuse_off_t off, struct fuse3_file_info *fi); + /* _ */ int (*read_buf)(const char *path, + struct fuse3_bufvec **bufp, size_t size, fuse_off_t off, struct fuse3_file_info *fi); + /* _ */ int (*flock)(const char *path, struct fuse3_file_info *, int op); + /* _ */ int (*fallocate)(const char *path, int mode, fuse_off_t off, fuse_off_t len, + struct fuse3_file_info *fi); +}; + +struct fuse3_context +{ + struct fuse3 *fuse; + fuse_uid_t uid; + fuse_gid_t gid; + fuse_pid_t pid; + void *private_data; + fuse_mode_t umask; +}; + +#define fuse_main(argc, argv, ops, data)\ + fuse3_main_real(argc, argv, ops, sizeof *(ops), data) + +FSP_FUSE_API int FSP_FUSE_API_NAME(fsp_fuse3_main_real)(struct fsp_fuse_env *env, + int argc, char *argv[], + const struct fuse3_operations *ops, size_t opsize, void *data); +FSP_FUSE_API void FSP_FUSE_API_NAME(fsp_fuse3_lib_help)(struct fsp_fuse_env *env, + struct fuse_args *args); +FSP_FUSE_API struct fuse3 *FSP_FUSE_API_NAME(fsp_fuse3_new_30)(struct fsp_fuse_env *env, + struct fuse_args *args, + const struct fuse3_operations *ops, size_t opsize, void *data); +FSP_FUSE_API struct fuse3 *FSP_FUSE_API_NAME(fsp_fuse3_new)(struct fsp_fuse_env *env, + struct fuse_args *args, + const struct fuse3_operations *ops, size_t opsize, void *data); +FSP_FUSE_API void FSP_FUSE_API_NAME(fsp_fuse3_destroy)(struct fsp_fuse_env *env, + struct fuse3 *f); +FSP_FUSE_API int FSP_FUSE_API_NAME(fsp_fuse3_mount)(struct fsp_fuse_env *env, + struct fuse3 *f, const char *mountpoint); +FSP_FUSE_API void FSP_FUSE_API_NAME(fsp_fuse3_unmount)(struct fsp_fuse_env *env, + struct fuse3 *f); +FSP_FUSE_API int FSP_FUSE_API_NAME(fsp_fuse3_loop)(struct fsp_fuse_env *env, + struct fuse3 *f); +FSP_FUSE_API int FSP_FUSE_API_NAME(fsp_fuse3_loop_mt_31)(struct fsp_fuse_env *env, + struct fuse3 *f, int clone_fd); +FSP_FUSE_API int FSP_FUSE_API_NAME(fsp_fuse3_loop_mt)(struct fsp_fuse_env *env, + struct fuse3 *f, struct fuse3_loop_config *config); +FSP_FUSE_API void FSP_FUSE_API_NAME(fsp_fuse3_exit)(struct fsp_fuse_env *env, + struct fuse3 *f); +FSP_FUSE_API struct fuse3_context *FSP_FUSE_API_NAME(fsp_fuse3_get_context)(struct fsp_fuse_env *env); + +FSP_FUSE_SYM( +int fuse3_main_real(int argc, char *argv[], + const struct fuse3_operations *ops, size_t opsize, void *data), +{ + return FSP_FUSE_API_CALL(fsp_fuse3_main_real) + (fsp_fuse_env(), argc, argv, ops, opsize, data); +}) + +FSP_FUSE_SYM( +void fuse3_lib_help(struct fuse_args *args), +{ + FSP_FUSE_API_CALL(fsp_fuse3_lib_help) + (fsp_fuse_env(), args); +}) + +#if FUSE_USE_VERSION == 30 +FSP_FUSE_SYM( +struct fuse3 *fuse3_new_30(struct fuse_args *args, + const struct fuse3_operations *ops, size_t opsize, void *data), +{ + return FSP_FUSE_API_CALL(fsp_fuse3_new_30) + (fsp_fuse_env(), args, ops, opsize, data); +}) +#define fuse_new(args, op, size, data)\ + fuse3_new_30(args, op, size, data) + +#else +FSP_FUSE_SYM( +struct fuse3 *fuse3_new(struct fuse_args *args, + const struct fuse3_operations *ops, size_t opsize, void *data), +{ + return FSP_FUSE_API_CALL(fsp_fuse3_new) + (fsp_fuse_env(), args, ops, opsize, data); +}) +#endif + +FSP_FUSE_SYM( +void fuse3_destroy(struct fuse3 *f), +{ + FSP_FUSE_API_CALL(fsp_fuse3_destroy) + (fsp_fuse_env(), f); +}) + +FSP_FUSE_SYM( +int fuse3_mount(struct fuse3 *f, const char *mountpoint), +{ + return FSP_FUSE_API_CALL(fsp_fuse3_mount) + (fsp_fuse_env(), f, mountpoint); +}) + +FSP_FUSE_SYM( +void fuse3_unmount(struct fuse3 *f), +{ + FSP_FUSE_API_CALL(fsp_fuse3_unmount) + (fsp_fuse_env(), f); +}) + +FSP_FUSE_SYM( +int fuse3_loop(struct fuse3 *f), +{ + return FSP_FUSE_API_CALL(fsp_fuse3_loop) + (fsp_fuse_env(), f); +}) + +#if FUSE_USE_VERSION < 32 +FSP_FUSE_SYM( +int fuse3_loop_mt_31(struct fuse3 *f, int clone_fd), +{ + return FSP_FUSE_API_CALL(fsp_fuse3_loop_mt_31) + (fsp_fuse_env(), f, clone_fd); +}) +#define fuse_loop_mt(f, clone_fd)\ + fuse3_loop_mt_31(f, clone_fd) + +#else +FSP_FUSE_SYM( +int fuse3_loop_mt(struct fuse3 *f, struct fuse3_loop_config *config), +{ + return FSP_FUSE_API_CALL(fsp_fuse3_loop_mt) + (fsp_fuse_env(), f, config); +}) +#endif + +FSP_FUSE_SYM( +void fuse3_exit(struct fuse3 *f), +{ + FSP_FUSE_API_CALL(fsp_fuse3_exit) + (fsp_fuse_env(), f); +}) + +FSP_FUSE_SYM( +struct fuse3_context *fuse3_get_context(void), +{ + return FSP_FUSE_API_CALL(fsp_fuse3_get_context) + (fsp_fuse_env()); +}) + +FSP_FUSE_SYM( +int fuse3_getgroups(int size, fuse_gid_t list[]), +{ + (void)size; + (void)list; + return -ENOSYS; +}) + +FSP_FUSE_SYM( +int fuse3_interrupted(void), +{ + return 0; +}) + +FSP_FUSE_SYM( +int fuse3_invalidate_path(struct fuse3 *f, const char *path), +{ + (void)f; + (void)path; + return -ENOENT; +}) + +FSP_FUSE_SYM( +int fuse3_notify_poll(struct fuse3_pollhandle *ph), +{ + (void)ph; + return 0; +}) + +FSP_FUSE_SYM( +int fuse3_start_cleanup_thread(struct fuse3 *f), +{ + (void)f; + return 0; +}) + +FSP_FUSE_SYM( +void fuse3_stop_cleanup_thread(struct fuse3 *f), +{ + (void)f; +}) + +FSP_FUSE_SYM( +int fuse3_clean_cache(struct fuse3 *f), +{ + (void)f; + return 600; +}) + +FSP_FUSE_SYM( +struct fuse3_session *fuse3_get_session(struct fuse3 *f), +{ + return (struct fuse3_session *)f; +}) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/inc/fuse3/fuse_common.h b/inc/fuse3/fuse_common.h new file mode 100644 index 00000000..adf135f1 --- /dev/null +++ b/inc/fuse3/fuse_common.h @@ -0,0 +1,228 @@ +/** + * @file fuse3/fuse_common.h + * WinFsp FUSE3 compatible API. + * + * This file is derived from libfuse/include/fuse_common.h: + * FUSE: Filesystem in Userspace + * Copyright (C) 2001-2007 Miklos Szeredi + * + * @copyright 2015-2018 Bill Zissimopoulos + */ +/* + * This file is part of WinFsp. + * + * You can redistribute it and/or modify it under the terms of the GNU + * General Public License version 3 as published by the Free Software + * Foundation. + * + * Licensees holding a valid commercial license may use this file in + * accordance with the commercial license agreement provided with the + * software. + */ + +#ifndef FUSE_COMMON_H_ +#define FUSE_COMMON_H_ + +#include "winfsp_fuse.h" +#include "fuse_opt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define FUSE_MAJOR_VERSION 3 +#define FUSE_MINOR_VERSION 2 +#define FUSE_MAKE_VERSION(maj, min) ((maj) * 10 + (min)) +#define FUSE_VERSION FUSE_MAKE_VERSION(FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION) + +#define FUSE_CAP_ASYNC_READ (1 << 0) +#define FUSE_CAP_POSIX_LOCKS (1 << 1) +#define FUSE_CAP_ATOMIC_O_TRUNC (1 << 3) +#define FUSE_CAP_EXPORT_SUPPORT (1 << 4) +#define FUSE_CAP_DONT_MASK (1 << 6) +#define FUSE_CAP_SPLICE_WRITE (1 << 7) +#define FUSE_CAP_SPLICE_MOVE (1 << 8) +#define FUSE_CAP_SPLICE_READ (1 << 9) +#define FUSE_CAP_FLOCK_LOCKS (1 << 10) +#define FUSE_CAP_IOCTL_DIR (1 << 11) +#define FUSE_CAP_AUTO_INVAL_DATA (1 << 12) +#define FUSE_CAP_READDIRPLUS (1 << 13) +#define FUSE_CAP_READDIRPLUS_AUTO (1 << 14) +#define FUSE_CAP_ASYNC_DIO (1 << 15) +#define FUSE_CAP_WRITEBACK_CACHE (1 << 16) +#define FUSE_CAP_NO_OPEN_SUPPORT (1 << 17) +#define FUSE_CAP_PARALLEL_DIROPS (1 << 18) +#define FUSE_CAP_POSIX_ACL (1 << 19) +#define FUSE_CAP_HANDLE_KILLPRIV (1 << 20) +#define FUSE_CAP_ALLOCATE (1 << 27) /* reserved (OSXFUSE) */ +#define FUSE_CAP_EXCHANGE_DATA (1 << 28) /* reserved (OSXFUSE) */ +#define FUSE_CAP_CASE_INSENSITIVE (1 << 29) /* file system is case insensitive */ +#define FUSE_CAP_VOL_RENAME (1 << 30) /* reserved (OSXFUSE) */ +#define FUSE_CAP_XTIMES (1 << 31) /* reserved (OSXFUSE) */ + +#define FSP_FUSE_CAP_CASE_INSENSITIVE FUSE_CAP_CASE_INSENSITIVE + +#define FUSE_IOCTL_COMPAT (1 << 0) +#define FUSE_IOCTL_UNRESTRICTED (1 << 1) +#define FUSE_IOCTL_RETRY (1 << 2) +#define FUSE_IOCTL_DIR (1 << 4) +#define FUSE_IOCTL_MAX_IOV 256 + +#define FUSE_BUFVEC_INIT(s) \ + ((struct fuse3_bufvec){ 1, 0, 0, { {s, (enum fuse3_buf_flags)0, 0, -1, 0} } }) + +struct fuse3_file_info +{ + int flags; + unsigned int writepage:1; + unsigned int direct_io:1; + unsigned int keep_cache:1; + unsigned int flush:1; + unsigned int nonseekable:1; + unsigned int flock_release:1; + unsigned int padding:27; + uint64_t fh; + uint64_t lock_owner; + uint32_t poll_events; +}; + +struct fuse3_loop_config +{ + int clone_fd; /* ignored */ + unsigned int max_idle_threads; /* ignored */ +}; + +struct fuse3_conn_info +{ + unsigned proto_major; + unsigned proto_minor; + unsigned max_write; + unsigned max_read; + unsigned max_readahead; + unsigned capable; + unsigned want; + unsigned max_background; + unsigned congestion_threshold; + unsigned time_gran; + unsigned reserved[22]; +}; + +enum fuse3_buf_flags +{ + FUSE_BUF_IS_FD = (1 << 1), + FUSE_BUF_FD_SEEK = (1 << 2), + FUSE_BUF_FD_RETRY = (1 << 3), +}; + +enum fuse3_buf_copy_flags +{ + FUSE_BUF_NO_SPLICE = (1 << 1), + FUSE_BUF_FORCE_SPLICE = (1 << 2), + FUSE_BUF_SPLICE_MOVE = (1 << 3), + FUSE_BUF_SPLICE_NONBLOCK = (1 << 4), +}; + +struct fuse3_buf +{ + size_t size; + enum fuse3_buf_flags flags; + void *mem; + int fd; + fuse_off_t pos; +}; + +struct fuse3_bufvec +{ + size_t count; + size_t idx; + size_t off; + struct fuse3_buf buf[1]; +}; + +struct fuse3_session; +struct fuse3_pollhandle; +struct fuse3_conn_info_opts; + +FSP_FUSE_API struct fuse3_conn_info_opts* FSP_FUSE_API_NAME(fsp_fuse3_parse_conn_info_opts)( + struct fsp_fuse_env *env, + struct fuse_args *args); +FSP_FUSE_API void FSP_FUSE_API_NAME(fsp_fuse3_apply_conn_info_opts)(struct fsp_fuse_env *env, + struct fuse3_conn_info_opts *opts, struct fuse3_conn_info *conn); +FSP_FUSE_API int FSP_FUSE_API_NAME(fsp_fuse3_version)(struct fsp_fuse_env *env); +FSP_FUSE_API const char *FSP_FUSE_API_NAME(fsp_fuse3_pkgversion)(struct fsp_fuse_env *env); +FSP_FUSE_API int32_t FSP_FUSE_API_NAME(fsp_fuse_ntstatus_from_errno)(struct fsp_fuse_env *env, + int err); + +FSP_FUSE_SYM( +struct fuse3_conn_info_opts* fuse3_parse_conn_info_opts( + struct fuse_args *args), +{ + return FSP_FUSE_API_CALL(fsp_fuse3_parse_conn_info_opts) + (fsp_fuse_env(), args); +}) + +FSP_FUSE_SYM( +void fuse3_apply_conn_info_opts( + struct fuse3_conn_info_opts *opts, struct fuse3_conn_info *conn), +{ + FSP_FUSE_API_CALL(fsp_fuse3_apply_conn_info_opts) + (fsp_fuse_env(), opts, conn); +}) + +FSP_FUSE_SYM( +int fuse3_version(void), +{ + return FSP_FUSE_API_CALL(fsp_fuse3_version) + (fsp_fuse_env()); +}) + +FSP_FUSE_SYM( +const char *fuse3_pkgversion(void), +{ + return FSP_FUSE_API_CALL(fsp_fuse3_pkgversion) + (fsp_fuse_env()); +}) + +FSP_FUSE_SYM( +void fuse3_pollhandle_destroy(struct fuse3_pollhandle *ph), +{ + (void)ph; +}) + +FSP_FUSE_SYM( +size_t fuse3_buf_size(const struct fuse3_bufvec *bufv), +{ + return 0; +}) + +FSP_FUSE_SYM( +ssize_t fuse3_buf_copy(struct fuse3_bufvec *dst, struct fuse3_bufvec *src, + enum fuse3_buf_copy_flags flags), +{ + return 0; +}) + +FSP_FUSE_SYM( +int fuse3_daemonize(int foreground), +{ + return fsp_fuse_daemonize(foreground); +}) + +FSP_FUSE_SYM( +int fuse3_set_signal_handlers(struct fuse3_session *se), +{ + return fsp_fuse_set_signal_handlers(se); +}) + +FSP_FUSE_SYM( +void fuse3_remove_signal_handlers(struct fuse3_session *se), +{ + (void)se; + fsp_fuse_set_signal_handlers(0); +}) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/inc/fuse3/fuse_opt.h b/inc/fuse3/fuse_opt.h new file mode 100644 index 00000000..289d52f1 --- /dev/null +++ b/inc/fuse3/fuse_opt.h @@ -0,0 +1,19 @@ +/** + * @file fuse3/fuse_opt.h + * WinFsp FUSE3 compatible API. + * + * @copyright 2015-2018 Bill Zissimopoulos + */ +/* + * This file is part of WinFsp. + * + * You can redistribute it and/or modify it under the terms of the GNU + * General Public License version 3 as published by the Free Software + * Foundation. + * + * Licensees holding a valid commercial license may use this file in + * accordance with the commercial license agreement provided with the + * software. + */ + +#include "../fuse/fuse_opt.h" diff --git a/inc/fuse3/winfsp_fuse.h b/inc/fuse3/winfsp_fuse.h new file mode 100644 index 00000000..f8ac0dec --- /dev/null +++ b/inc/fuse3/winfsp_fuse.h @@ -0,0 +1,78 @@ +/** + * @file fuse3/winfsp_fuse.h + * WinFsp FUSE3 compatible API. + * + * @copyright 2015-2018 Bill Zissimopoulos + */ +/* + * This file is part of WinFsp. + * + * You can redistribute it and/or modify it under the terms of the GNU + * General Public License version 3 as published by the Free Software + * Foundation. + * + * Licensees holding a valid commercial license may use this file in + * accordance with the commercial license agreement provided with the + * software. + */ + +#ifndef FUSE3_WINFSP_FUSE_H_INCLUDED +#define FUSE3_WINFSP_FUSE_H_INCLUDED + +#include "../fuse/winfsp_fuse.h" + +#if defined(_WIN64) || defined(_WIN32) +typedef intptr_t ssize_t; +#endif + +#if !defined(WINFSP_DLL_INTERNAL) +#define fuse3 fuse +#define fuse3_apply_conn_info_opts fuse_apply_conn_info_opts +#define fuse3_buf fuse_buf +#define fuse3_buf_copy fuse_buf_copy +#define fuse3_buf_copy_flags fuse_buf_copy_flags +#define fuse3_buf_flags fuse_buf_flags +#define fuse3_buf_size fuse_buf_size +#define fuse3_bufvec fuse_bufvec +#define fuse3_clean_cache fuse_clean_cache +#define fuse3_config fuse_config +#define fuse3_conn_info fuse_conn_info +#define fuse3_conn_info_opts fuse_conn_info_opts +#define fuse3_context fuse_context +#define fuse3_daemonize fuse_daemonize +#define fuse3_destroy fuse_destroy +#define fuse3_exit fuse_exit +#define fuse3_file_info fuse_file_info +#define fuse3_fill_dir_flags fuse_fill_dir_flags +#define fuse3_fill_dir_t fuse_fill_dir_t +#define fuse3_get_context fuse_get_context +#define fuse3_get_session fuse_get_session +#define fuse3_getgroups fuse_getgroups +#define fuse3_interrupted fuse_interrupted +#define fuse3_invalidate_path fuse_invalidate_path +#define fuse3_lib_help fuse_lib_help +#define fuse3_loop fuse_loop +#define fuse3_loop_config fuse_loop_config +#define fuse3_loop_mt fuse_loop_mt +#define fuse3_loop_mt_31 fuse_loop_mt_31 +#define fuse3_main_real fuse_main_real +#define fuse3_mount fuse_mount +#define fuse3_new fuse_new +#define fuse3_new_30 fuse_new_30 +#define fuse3_notify_poll fuse_notify_poll +#define fuse3_operations fuse_operations +#define fuse3_parse_conn_info_opts fuse_parse_conn_info_opts +#define fuse3_pkgversion fuse_pkgversion +#define fuse3_pollhandle fuse_pollhandle +#define fuse3_pollhandle_destroy fuse_pollhandle_destroy +#define fuse3_readdir_flags fuse_readdir_flags +#define fuse3_remove_signal_handlers fuse_remove_signal_handlers +#define fuse3_session fuse_session +#define fuse3_set_signal_handlers fuse_set_signal_handlers +#define fuse3_start_cleanup_thread fuse_start_cleanup_thread +#define fuse3_stop_cleanup_thread fuse_stop_cleanup_thread +#define fuse3_unmount fuse_unmount +#define fuse3_version fuse_version +#endif + +#endif diff --git a/src/dll/fuse3/fuse2to3.c b/src/dll/fuse3/fuse2to3.c new file mode 100644 index 00000000..944a435a --- /dev/null +++ b/src/dll/fuse3/fuse2to3.c @@ -0,0 +1,283 @@ +/** + * @file dll/fuse3/fuse2to3.c + * + * @copyright 2015-2018 Bill Zissimopoulos + */ +/* + * This file is part of WinFsp. + * + * You can redistribute it and/or modify it under the terms of the GNU + * General Public License version 3 as published by the Free Software + * Foundation. + * + * Licensees holding a valid commercial license may use this file in + * accordance with the commercial license agreement provided with the + * software. + */ + +#include + +static int fuse2to3_getattr(const char *path, struct fuse_stat *stbuf) +{ + return -ENOSYS; +} + +static int fuse2to3_readlink(const char *path, char *buf, size_t size) +{ + return -ENOSYS; +} + +static int fuse2to3_mknod(const char *path, fuse_mode_t mode, fuse_dev_t dev) +{ + return -ENOSYS; +} + +static int fuse2to3_mkdir(const char *path, fuse_mode_t mode) +{ + return -ENOSYS; +} + +static int fuse2to3_unlink(const char *path) +{ + return -ENOSYS; +} + +static int fuse2to3_rmdir(const char *path) +{ + return -ENOSYS; +} + +static int fuse2to3_symlink(const char *dstpath, const char *srcpath) +{ + return -ENOSYS; +} + +static int fuse2to3_rename(const char *oldpath, const char *newpath) +{ + return -ENOSYS; +} + +static int fuse2to3_link(const char *srcpath, const char *dstpath) +{ + return -ENOSYS; +} + +static int fuse2to3_chmod(const char *path, fuse_mode_t mode) +{ + return -ENOSYS; +} + +static int fuse2to3_chown(const char *path, fuse_uid_t uid, fuse_gid_t gid) +{ + return -ENOSYS; +} + +static int fuse2to3_truncate(const char *path, fuse_off_t size) +{ + return -ENOSYS; +} + +static int fuse2to3_open(const char *path, struct fuse_file_info *fi) +{ + return -ENOSYS; +} + +static int fuse2to3_read(const char *path, char *buf, size_t size, fuse_off_t off, + struct fuse_file_info *fi) +{ + return -ENOSYS; +} + +static int fuse2to3_write(const char *path, const char *buf, size_t size, fuse_off_t off, + struct fuse_file_info *fi) +{ + return -ENOSYS; +} + +static int fuse2to3_statfs(const char *path, struct fuse_statvfs *stbuf) +{ + return -ENOSYS; +} + +static int fuse2to3_flush(const char *path, struct fuse_file_info *fi) +{ + return -ENOSYS; +} + +static int fuse2to3_release(const char *path, struct fuse_file_info *fi) +{ + return -ENOSYS; +} + +static int fuse2to3_fsync(const char *path, int datasync, struct fuse_file_info *fi) +{ + return -ENOSYS; +} + +static int fuse2to3_setxattr(const char *path, const char *name, const char *value, size_t size, + int flags) +{ + return -ENOSYS; +} + +static int fuse2to3_getxattr(const char *path, const char *name, char *value, size_t size) +{ + return -ENOSYS; +} + +static int fuse2to3_listxattr(const char *path, char *namebuf, size_t size) +{ + return -ENOSYS; +} + +static int fuse2to3_removexattr(const char *path, const char *name) +{ + return -ENOSYS; +} + +static int fuse2to3_opendir(const char *path, struct fuse_file_info *fi) +{ + return -ENOSYS; +} + +static int fuse2to3_readdir(const char *path, void *buf, fuse_fill_dir_t filler, fuse_off_t off, + struct fuse_file_info *fi) +{ + return -ENOSYS; +} + +static int fuse2to3_releasedir(const char *path, struct fuse_file_info *fi) +{ + return -ENOSYS; +} + +static int fuse2to3_fsyncdir(const char *path, int datasync, struct fuse_file_info *fi) +{ + return -ENOSYS; +} + +static void *fuse2to3_init(struct fuse_conn_info *conn) +{ + return 0; +} + +static void fuse2to3_destroy(void *data) +{ +} + +static int fuse2to3_access(const char *path, int mask) +{ + return -ENOSYS; +} + +static int fuse2to3_create(const char *path, fuse_mode_t mode, struct fuse_file_info *fi) +{ + return -ENOSYS; +} + +static int fuse2to3_ftruncate(const char *path, fuse_off_t off, struct fuse_file_info *fi) +{ + return -ENOSYS; +} + +static int fuse2to3_fgetattr(const char *path, struct fuse_stat *stbuf, struct fuse_file_info *fi) +{ + return -ENOSYS; +} + +static int fuse2to3_lock(const char *path, + struct fuse_file_info *fi, int cmd, struct fuse_flock *lock) +{ + return -ENOSYS; +} + +static int fuse2to3_utimens(const char *path, const struct fuse_timespec tv[2]) +{ + return -ENOSYS; +} + +static int fuse2to3_bmap(const char *path, size_t blocksize, uint64_t *idx) +{ + return -ENOSYS; +} + +static int fuse2to3_ioctl(const char *path, int cmd, void *arg, struct fuse_file_info *fi, + unsigned int flags, void *data) +{ + return -ENOSYS; +} + +static int fuse2to3_poll(const char *path, struct fuse_file_info *fi, + struct fuse_pollhandle *ph, unsigned *reventsp) +{ + return -ENOSYS; +} + +static int fuse2to3_write_buf(const char *path, + struct fuse_bufvec *buf, fuse_off_t off, struct fuse_file_info *fi) +{ + return -ENOSYS; +} + +static int fuse2to3_read_buf(const char *path, + struct fuse_bufvec **bufp, size_t size, fuse_off_t off, struct fuse_file_info *fi) +{ + return -ENOSYS; +} + +static int fuse2to3_flock(const char *path, struct fuse_file_info *fi, int op) +{ + return -ENOSYS; +} + +static int fuse2to3_fallocate(const char *path, int mode, fuse_off_t off, fuse_off_t len, + struct fuse_file_info *fi) +{ + return -ENOSYS; +} + +static struct fuse_operations fuse2to3_ops = +{ + .getattr = fuse2to3_getattr, + .readlink = fuse2to3_readlink, + .mknod = fuse2to3_mknod, + .mkdir = fuse2to3_mkdir, + .unlink = fuse2to3_unlink, + .rmdir = fuse2to3_rmdir, + .symlink = fuse2to3_symlink, + .rename = fuse2to3_rename, + .link = fuse2to3_link, + .chmod = fuse2to3_chmod, + .chown = fuse2to3_chown, + .truncate = fuse2to3_truncate, + .open = fuse2to3_open, + .read = fuse2to3_read, + .write = fuse2to3_write, + .statfs = fuse2to3_statfs, + .flush = fuse2to3_flush, + .release = fuse2to3_release, + .fsync = fuse2to3_fsync, + .setxattr = fuse2to3_setxattr, + .getxattr = fuse2to3_getxattr, + .listxattr = fuse2to3_listxattr, + .removexattr = fuse2to3_removexattr, + .opendir = fuse2to3_opendir, + .readdir = fuse2to3_readdir, + .releasedir = fuse2to3_releasedir, + .fsyncdir = fuse2to3_fsyncdir, + .init = fuse2to3_init, + .destroy = fuse2to3_destroy, + .access = fuse2to3_access, + .create = fuse2to3_create, + .ftruncate = fuse2to3_ftruncate, + .fgetattr = fuse2to3_fgetattr, + .lock = fuse2to3_lock, + .utimens = fuse2to3_utimens, + .bmap = fuse2to3_bmap, + .ioctl = fuse2to3_ioctl, + .poll = fuse2to3_poll, + .write_buf = fuse2to3_write_buf, + .read_buf = fuse2to3_read_buf, + .flock = fuse2to3_flock, + .fallocate = fuse2to3_fallocate, +}; diff --git a/src/dll/fuse3/fuse3.c b/src/dll/fuse3/fuse3.c new file mode 100644 index 00000000..32724a71 --- /dev/null +++ b/src/dll/fuse3/fuse3.c @@ -0,0 +1,112 @@ +/** + * @file dll/fuse3/fuse3.c + * + * @copyright 2015-2018 Bill Zissimopoulos + */ +/* + * This file is part of WinFsp. + * + * You can redistribute it and/or modify it under the terms of the GNU + * General Public License version 3 as published by the Free Software + * Foundation. + * + * Licensees holding a valid commercial license may use this file in + * accordance with the commercial license agreement provided with the + * software. + */ + +#include + +FSP_FUSE_API int fsp_fuse3_main_real(struct fsp_fuse_env *env, + int argc, char *argv[], + const struct fuse3_operations *ops, size_t opsize, void *data) +{ + return 0; +} + +FSP_FUSE_API void fsp_fuse3_lib_help(struct fsp_fuse_env *env, + struct fuse_args *args) +{ +} + +FSP_FUSE_API struct fuse3 *fsp_fuse3_new_30(struct fsp_fuse_env *env, + struct fuse_args *args, + const struct fuse3_operations *ops, size_t opsize, void *data) +{ + return 0; +} + +FSP_FUSE_API struct fuse3 *fsp_fuse3_new(struct fsp_fuse_env *env, + struct fuse_args *args, + const struct fuse3_operations *ops, size_t opsize, void *data) +{ + return 0; +} + +FSP_FUSE_API void fsp_fuse3_destroy(struct fsp_fuse_env *env, + struct fuse3 *f) +{ +} + +FSP_FUSE_API int fsp_fuse3_mount(struct fsp_fuse_env *env, + struct fuse3 *f, const char *mountpoint) +{ + return 0; +} + +FSP_FUSE_API void fsp_fuse3_unmount(struct fsp_fuse_env *env, + struct fuse3 *f) +{ +} + +FSP_FUSE_API int fsp_fuse3_loop(struct fsp_fuse_env *env, + struct fuse3 *f) +{ + return 0; +} + +FSP_FUSE_API int fsp_fuse3_loop_mt_31(struct fsp_fuse_env *env, + struct fuse3 *f, int clone_fd) +{ + return 0; +} + +FSP_FUSE_API int fsp_fuse3_loop_mt(struct fsp_fuse_env *env, + struct fuse3 *f, struct fuse3_loop_config *config) +{ + return 0; +} + +FSP_FUSE_API void fsp_fuse3_exit(struct fsp_fuse_env *env, + struct fuse3 *f) +{ +} + +FSP_FUSE_API struct fuse3_context *fsp_fuse3_get_context(struct fsp_fuse_env *env) +{ + return 0; +} + +FSP_FUSE_API struct fuse3_conn_info_opts* fsp_fuse3_parse_conn_info_opts( + struct fsp_fuse_env *env, + struct fuse_args *args) +{ + return 0; +} + +FSP_FUSE_API void fsp_fuse3_apply_conn_info_opts(struct fsp_fuse_env *env, + struct fuse3_conn_info_opts *opts, struct fuse3_conn_info *conn) +{ +} + +FSP_FUSE_API int fsp_fuse3_version(struct fsp_fuse_env *env) +{ + return FUSE_VERSION; +} + +FSP_FUSE_API const char *fsp_fuse3_pkgversion(struct fsp_fuse_env *env) +{ +#define STR(x) #x + return STR(FUSE_MAJOR_VERSION) "." STR(FUSE_MINOR_VERSION); +#undef STR +} diff --git a/src/dll/fuse3/library.h b/src/dll/fuse3/library.h new file mode 100644 index 00000000..5d5983e5 --- /dev/null +++ b/src/dll/fuse3/library.h @@ -0,0 +1,35 @@ +/** + * @file dll/fuse3/library.h + * + * @copyright 2015-2018 Bill Zissimopoulos + */ +/* + * This file is part of WinFsp. + * + * You can redistribute it and/or modify it under the terms of the GNU + * General Public License version 3 as published by the Free Software + * Foundation. + * + * Licensees holding a valid commercial license may use this file in + * accordance with the commercial license agreement provided with the + * software. + */ + +#ifndef WINFSP_DLL_FUSE3_LIBRARY_H_INCLUDED +#define WINFSP_DLL_FUSE3_LIBRARY_H_INCLUDED + +#include +#include +#undef FUSE_H_ +#undef FUSE_COMMON_H_ +#undef FUSE_MAJOR_VERSION +#undef FUSE_MINOR_VERSION +#undef fuse_main +#include + +struct fuse3 +{ + struct fuse3_operations ops; +}; + +#endif