mirror of
				https://github.com/winfsp/winfsp.git
				synced 2025-10-30 19:48:38 -05:00 
			
		
		
		
	dll: cygwin integration checkpoint
This commit is contained in:
		| @@ -31,35 +31,30 @@ extern "C" { | ||||
|  | ||||
| struct fuse; | ||||
|  | ||||
| enum fuse_readdir_flags | ||||
| { | ||||
|     FUSE_READDIR_PLUS = (1 << 0), | ||||
| }; | ||||
|  | ||||
| enum fuse_fill_dir_flags | ||||
| { | ||||
|     FUSE_FILL_DIR_PLUS = (1 << 1), | ||||
| }; | ||||
|  | ||||
| typedef int (*fuse_fill_dir_t)(void *buf, const char *name, | ||||
|     const struct fuse_stat *stbuf, fuse_off_t off, enum fuse_fill_dir_flags flags); | ||||
|     const struct fuse_stat *stbuf, fuse_off_t off); | ||||
| typedef struct fuse_dirhandle *fuse_dirh_t; | ||||
| typedef int (*fuse_dirfil_t)(fuse_dirh_t h, const char *name, | ||||
|     int type, fuse_ino_t ino); | ||||
|  | ||||
| struct fuse_operations | ||||
| { | ||||
|     unsigned int flag_nopath:1; | ||||
|     unsigned int flag_nullpath_ok:1; | ||||
|     unsigned int flag_reserved:31; | ||||
|     int (*getattr)(const char *path, struct fuse_stat *stbuf); | ||||
|     int (*getdir)(const char *path, fuse_dirh_t h, fuse_dirfil_t filler); | ||||
|     int (*readlink)(const char *path, char *buf, size_t size); | ||||
|     int (*mknod)(const char *path, fuse_mode_t mode, fuse_dev_t dev); | ||||
|     int (*mkdir)(const char *path, fuse_mode_t mode); | ||||
|     int (*unlink)(const char *path); | ||||
|     int (*rmdir)(const char *path); | ||||
|     int (*symlink)(const char *dstpath, const char *srcpath); | ||||
|     int (*rename)(const char *oldpath, const char *newpath, unsigned int flags); | ||||
|     int (*rename)(const char *oldpath, const char *newpath); | ||||
|     int (*link)(const char *srcpath, const char *dstpath); | ||||
|     int (*chmod)(const char *path, fuse_mode_t mode); | ||||
|     int (*chown)(const char *path, fuse_uid_t uid, fuse_gid_t gid); | ||||
|     int (*truncate)(const char *path, fuse_off_t size); | ||||
|     int (*utime)(const char *path, struct utimbuf *timbuf); | ||||
|     int (*open)(const char *path, struct fuse_file_info *fi); | ||||
|     int (*read)(const char *path, char *buf, size_t size, fuse_off_t off, | ||||
|         struct fuse_file_info *fi); | ||||
| @@ -76,7 +71,7 @@ struct fuse_operations | ||||
|     int (*removexattr)(const char *path, const char *name); | ||||
|     int (*opendir)(const char *path, struct fuse_file_info *fi); | ||||
|     int (*readdir)(const char *path, void *buf, fuse_fill_dir_t filler, fuse_off_t off, | ||||
|         struct fuse_file_info *fi, enum fuse_readdir_flags flags); | ||||
|         struct fuse_file_info *fi); | ||||
|     int (*releasedir)(const char *path, struct fuse_file_info *fi); | ||||
|     int (*fsyncdir)(const char *path, int datasync, struct fuse_file_info *fi); | ||||
|     void *(*init)(struct fuse_conn_info *conn); | ||||
| @@ -92,13 +87,6 @@ struct fuse_operations | ||||
|         unsigned int flags, void *data); | ||||
|     int (*poll)(const char *path, struct fuse_file_info *fi, | ||||
|         struct fuse_pollhandle *ph, unsigned *reventsp); | ||||
|     int (*write_buf)(const char *path, struct fuse_bufvec *buf, fuse_off_t off, | ||||
|         struct fuse_file_info *fi); | ||||
|     int (*read_buf)(const char *path, struct fuse_bufvec **bufp, | ||||
|         size_t size, fuse_off_t off, struct fuse_file_info *fi); | ||||
|     int (*flock)(const char *path, struct fuse_file_info *, int op); | ||||
|     int (*fallocate)(const char *path, int mode, fuse_off_t off, fuse_off_t len, | ||||
|         struct fuse_file_info *fi); | ||||
| }; | ||||
|  | ||||
| struct fuse_context | ||||
| @@ -117,6 +105,8 @@ struct fuse_context | ||||
| FSP_FUSE_API int fsp_fuse_main_real(int argc, char *argv[], | ||||
|     const struct fuse_operations *ops, size_t opsize, void *data, | ||||
|     int environment); | ||||
| FSP_FUSE_API int fsp_fuse_is_lib_option(const char *opt, | ||||
|     FSP_FUSE_MEMFN_P); | ||||
| FSP_FUSE_API struct fuse *fsp_fuse_new(struct fuse_chan *ch, struct fuse_args *args, | ||||
|     const struct fuse_operations *ops, size_t opsize, void *data, | ||||
|     int environment); | ||||
| @@ -132,6 +122,12 @@ static inline int fuse_main_real(int argc, char *argv[], | ||||
|     return fsp_fuse_main_real(argc, argv, ops, opsize, data, FSP_FUSE_ENVIRONMENT); | ||||
| } | ||||
|  | ||||
| static inline int fuse_is_lib_option(const char *opt) | ||||
| { | ||||
|     return fsp_fuse_is_lib_option(opt, | ||||
|         FSP_FUSE_MEMFN_V); | ||||
| } | ||||
|  | ||||
| static inline struct fuse *fuse_new(struct fuse_chan *ch, struct fuse_args *args, | ||||
|     const struct fuse_operations *ops, size_t opsize, void *data) | ||||
| { | ||||
| @@ -167,7 +163,7 @@ static inline int fuse_getgroups(int size, fuse_gid_t list[]) | ||||
| { | ||||
|     (void)size; | ||||
|     (void)list; | ||||
|     return 0; | ||||
|     return -ENOSYS; | ||||
| } | ||||
|  | ||||
| static inline int fuse_interrupted(void) | ||||
| @@ -175,6 +171,19 @@ static inline int fuse_interrupted(void) | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| static inline int fuse_invalidate(struct fuse *f, const char *path) | ||||
| { | ||||
|     (void)f; | ||||
|     (void)path; | ||||
|     return -EINVAL; | ||||
| } | ||||
|  | ||||
| static inline int fuse_notify_poll(struct fuse_pollhandle *ph) | ||||
| { | ||||
|     (void)ph; | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| static inline int fuse_start_cleanup_thread(struct fuse *fuse) | ||||
| { | ||||
|     (void)fuse; | ||||
|   | ||||
| @@ -38,11 +38,33 @@ extern "C" { | ||||
| #endif | ||||
| #endif | ||||
|  | ||||
| #if !defined(FSP_FUSE_MEMFN_P) | ||||
| #define FSP_FUSE_MEMFN_P                void *(*memalloc)(size_t), void (*memfree)(void *) | ||||
| #define FSP_FUSE_MEMFN_A                memalloc, memfree | ||||
| #if defined(WINFSP_DLL_INTERNAL) | ||||
| #define FSP_FUSE_MEMFN_V                MemAlloc, MemFree | ||||
| #else | ||||
| #define FSP_FUSE_MEMFN_V                malloc, free | ||||
| #endif | ||||
| #endif | ||||
|  | ||||
| #define FUSE_MAJOR_VERSION              2 | ||||
| #define FUSE_MINOR_VERSION              9 | ||||
| #define FUSE_MINOR_VERSION              8 | ||||
| #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_BIG_WRITES             (1 << 5) | ||||
| #define FUSE_CAP_DONT_MASK              (1 << 6) | ||||
|  | ||||
| #define FUSE_IOCTL_COMPAT               (1 << 0) | ||||
| #define FUSE_IOCTL_UNRESTRICTED         (1 << 1) | ||||
| #define FUSE_IOCTL_RETRY                (1 << 2) | ||||
| #define FUSE_IOCTL_MAX_IOV              256 | ||||
|  | ||||
| /* | ||||
|  * FUSE uses a number of types (notably: struct stat) that are OS specific. | ||||
|  * Furthermore there are sometimes multiple definitions of the same type even | ||||
| @@ -113,9 +135,11 @@ struct fuse_statvfs | ||||
|  | ||||
| #elif defined(__CYGWIN__) | ||||
|  | ||||
| #include <errno.h> | ||||
| #include <sys/stat.h> | ||||
| #include <sys/statvfs.h> | ||||
| #include <sys/types.h> | ||||
| #include <utime.h> | ||||
|  | ||||
| #define fuse_uid_t                      uid_t | ||||
| #define fuse_gid_t                      gid_t | ||||
| @@ -146,16 +170,15 @@ struct fuse_statvfs | ||||
| struct fuse_file_info | ||||
| { | ||||
|     int flags; | ||||
|     unsigned int writepage:1; | ||||
|     unsigned long fh_old; | ||||
|     int writepage; | ||||
|     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; | ||||
|     unsigned int padding:28; | ||||
|     uint64_t fh; | ||||
|     uint64_t lock_owner; | ||||
|     uint32_t poll_events; | ||||
| }; | ||||
|  | ||||
| struct fuse_conn_info | ||||
| @@ -167,10 +190,7 @@ struct fuse_conn_info | ||||
|     unsigned max_readahead; | ||||
|     unsigned capable; | ||||
|     unsigned want; | ||||
|     unsigned max_background; | ||||
|     unsigned congestion_threshold; | ||||
|     unsigned time_gran; | ||||
|     unsigned reserved[22]; | ||||
|     unsigned reserved[25]; | ||||
| }; | ||||
|  | ||||
| struct fuse_session; | ||||
| @@ -178,22 +198,17 @@ struct fuse_chan; | ||||
| struct fuse_pollhandle; | ||||
|  | ||||
| FSP_FUSE_API int fsp_fuse_version(void); | ||||
| FSP_FUSE_API const char *fsp_fuse_pkgversion(void); | ||||
| FSP_FUSE_API struct fuse_chan *fsp_fuse_mount(const char *mountpoint, struct fuse_args *args); | ||||
| FSP_FUSE_API void fsp_fuse_unmount(const char *mountpoint, struct fuse_chan *ch); | ||||
| FSP_FUSE_API int fsp_fuse_parse_cmdline(struct fuse_args *args, char **mountpoint, | ||||
|     int *multithreaded, int *foreground); | ||||
|     int *multithreaded, int *foreground, | ||||
|     FSP_FUSE_MEMFN_P); | ||||
|  | ||||
| static inline int fuse_version(void) | ||||
| { | ||||
|     return fsp_fuse_version(); | ||||
| } | ||||
|  | ||||
| static inline const char *fuse_pkgversion(void) | ||||
| { | ||||
|     return fsp_fuse_pkgversion(); | ||||
| } | ||||
|  | ||||
| static inline struct fuse_chan *fuse_mount(const char *mountpoint, struct fuse_args *args) | ||||
| { | ||||
|     return fsp_fuse_mount(mountpoint, args); | ||||
| @@ -207,7 +222,8 @@ static inline void fuse_unmount(const char *mountpoint, struct fuse_chan *ch) | ||||
| static inline int fuse_parse_cmdline(struct fuse_args *args, char **mountpoint, | ||||
|     int *multithreaded, int *foreground) | ||||
| { | ||||
|     return fsp_fuse_parse_cmdline(args, mountpoint, multithreaded, foreground); | ||||
|     return fsp_fuse_parse_cmdline(args, mountpoint, multithreaded, foreground, | ||||
|         FSP_FUSE_MEMFN_V); | ||||
| } | ||||
|  | ||||
| static inline void fuse_pollhandle_destroy(struct fuse_pollhandle *ph) | ||||
|   | ||||
| @@ -39,6 +39,7 @@ extern "C" { | ||||
| #endif | ||||
| #endif | ||||
|  | ||||
| #if !defined(FSP_FUSE_MEMFN_P) | ||||
| #define FSP_FUSE_MEMFN_P                void *(*memalloc)(size_t), void (*memfree)(void *) | ||||
| #define FSP_FUSE_MEMFN_A                memalloc, memfree | ||||
| #if defined(WINFSP_DLL_INTERNAL) | ||||
| @@ -46,6 +47,7 @@ extern "C" { | ||||
| #else | ||||
| #define FSP_FUSE_MEMFN_V                malloc, free | ||||
| #endif | ||||
| #endif | ||||
|  | ||||
| #define FUSE_OPT_KEY(templ, key)        { templ, -1, key } | ||||
| #define FUSE_OPT_END                    { NULL, 0, 0 } | ||||
|   | ||||
| @@ -18,9 +18,6 @@ | ||||
| #include <dll/library.h> | ||||
| #include <fuse/fuse.h> | ||||
|  | ||||
| #define STR(x)                          STR_(x) | ||||
| #define STR_(x)                         #x | ||||
|  | ||||
| struct fuse_chan | ||||
| { | ||||
|     PWSTR MountPoint; | ||||
| @@ -100,11 +97,6 @@ FSP_FUSE_API int fsp_fuse_version(void) | ||||
|     return FUSE_VERSION; | ||||
| } | ||||
|  | ||||
| FSP_FUSE_API const char *fsp_fuse_pkgversion(void) | ||||
| { | ||||
|     return STR(FUSE_VERSION); | ||||
| } | ||||
|  | ||||
| FSP_FUSE_API struct fuse_chan *fsp_fuse_mount(const char *mountpoint, struct fuse_args *args) | ||||
| { | ||||
|     struct fuse_chan *ch = 0; | ||||
| @@ -139,7 +131,8 @@ FSP_FUSE_API void fsp_fuse_unmount(const char *mountpoint, struct fuse_chan *ch) | ||||
| } | ||||
|  | ||||
| FSP_FUSE_API int fsp_fuse_parse_cmdline(struct fuse_args *args, char **mountpoint, | ||||
|     int *multithreaded, int *foreground) | ||||
|     int *multithreaded, int *foreground, | ||||
|     FSP_FUSE_MEMFN_P) | ||||
| { | ||||
|     // !!!: NEEDIMPL | ||||
|     return 0; | ||||
| @@ -153,6 +146,13 @@ FSP_FUSE_API int fsp_fuse_main_real(int argc, char *argv[], | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| FSP_FUSE_API int fsp_fuse_is_lib_option(const char *opt, | ||||
|     FSP_FUSE_MEMFN_P) | ||||
| { | ||||
|     // !!!: NEEDIMPL | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| static NTSTATUS fsp_fuse_svcstart(FSP_SERVICE *Service, ULONG argc, PWSTR *argv) | ||||
| { | ||||
|     struct fuse *f = Service->UserContext; | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| prefix=${pcfiledir}/.. | ||||
| incdir=${prefix}/inc/fuse | ||||
| implib=${prefix}/lib/winfsp-${arch}.lib | ||||
| implib=${prefix}/bin/winfsp-${arch}.dll | ||||
|  | ||||
| Name: fuse | ||||
| Description: WinFsp FUSE compatible API | ||||
|   | ||||
		Reference in New Issue
	
	Block a user