From ad1b53e5a4078524c297a64e817db4f500203c74 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Mon, 16 Jul 2018 09:45:38 -0700 Subject: [PATCH] dll: fuse: move fsp_fuse_obj_* to sdll/fuse/shared.h --- src/dll/fuse/fuse.c | 29 ----------------------------- src/dll/fuse/library.h | 2 +- src/dll/fuse/shared.h | 29 +++++++++++++++++++++++++++++ src/dll/fuse3/library.h | 2 +- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/dll/fuse/fuse.c b/src/dll/fuse/fuse.c index 3f67a237..fd7ab673 100644 --- a/src/dll/fuse/fuse.c +++ b/src/dll/fuse/fuse.c @@ -122,35 +122,6 @@ static struct fuse_opt fsp_fuse_core_opts[] = static INIT_ONCE fsp_fuse_initonce = INIT_ONCE_STATIC_INIT; static DWORD fsp_fuse_tlskey = TLS_OUT_OF_INDEXES; -struct fsp_fuse_obj_hdr -{ - void (*dtor)(void *); - __declspec(align(MEMORY_ALLOCATION_ALIGNMENT)) UINT8 ObjectBuf[]; -}; - -static inline void *fsp_fuse_obj_alloc(struct fsp_fuse_env *env, size_t size) -{ - struct fsp_fuse_obj_hdr *hdr; - - hdr = env->memalloc(sizeof(struct fsp_fuse_obj_hdr) + size); - if (0 == hdr) - return 0; - - hdr->dtor = env->memfree; - memset(hdr->ObjectBuf, 0, size); - return hdr->ObjectBuf; -} - -static inline void fsp_fuse_obj_free(void *obj) -{ - if (0 == obj) - return; - - struct fsp_fuse_obj_hdr *hdr = (PVOID)((PUINT8)obj - sizeof(struct fsp_fuse_obj_hdr)); - - hdr->dtor(hdr); -} - static BOOL WINAPI fsp_fuse_initialize( PINIT_ONCE InitOnce, PVOID Parameter, PVOID *Context) { diff --git a/src/dll/fuse/library.h b/src/dll/fuse/library.h index 5d840ce8..d5d94d3b 100644 --- a/src/dll/fuse/library.h +++ b/src/dll/fuse/library.h @@ -19,9 +19,9 @@ #define WINFSP_DLL_FUSE_LIBRARY_H_INCLUDED #include -#include #include #include +#include #define FSP_FUSE_LIBRARY_NAME LIBRARY_NAME "-FUSE" diff --git a/src/dll/fuse/shared.h b/src/dll/fuse/shared.h index 1e214323..355ba203 100644 --- a/src/dll/fuse/shared.h +++ b/src/dll/fuse/shared.h @@ -20,4 +20,33 @@ #define enosys(env) ('C' == (env)->environment ? 88 : 40) +struct fsp_fuse_obj_hdr +{ + void (*dtor)(void *); + __declspec(align(MEMORY_ALLOCATION_ALIGNMENT)) UINT8 ObjectBuf[]; +}; + +static inline void *fsp_fuse_obj_alloc(struct fsp_fuse_env *env, size_t size) +{ + struct fsp_fuse_obj_hdr *hdr; + + hdr = env->memalloc(sizeof(struct fsp_fuse_obj_hdr) + size); + if (0 == hdr) + return 0; + + hdr->dtor = env->memfree; + memset(hdr->ObjectBuf, 0, size); + return hdr->ObjectBuf; +} + +static inline void fsp_fuse_obj_free(void *obj) +{ + if (0 == obj) + return; + + struct fsp_fuse_obj_hdr *hdr = (PVOID)((PUINT8)obj - sizeof(struct fsp_fuse_obj_hdr)); + + hdr->dtor(hdr); +} + #endif diff --git a/src/dll/fuse3/library.h b/src/dll/fuse3/library.h index 459721ef..32d39738 100644 --- a/src/dll/fuse3/library.h +++ b/src/dll/fuse3/library.h @@ -19,7 +19,6 @@ #define WINFSP_DLL_FUSE3_LIBRARY_H_INCLUDED #include -#include #include #undef FUSE_H_ #undef FUSE_COMMON_H_ @@ -27,6 +26,7 @@ #undef FUSE_MINOR_VERSION #undef fuse_main #include +#include struct fuse3 {