dll: fuse: move fsp_fuse_obj_* to sdll/fuse/shared.h

This commit is contained in:
Bill Zissimopoulos 2018-07-16 09:45:38 -07:00
parent e4077c92e9
commit ad1b53e5a4
No known key found for this signature in database
GPG Key ID: 3D4F95D52C7B3EA3
4 changed files with 31 additions and 31 deletions

View File

@ -122,35 +122,6 @@ static struct fuse_opt fsp_fuse_core_opts[] =
static INIT_ONCE fsp_fuse_initonce = INIT_ONCE_STATIC_INIT; static INIT_ONCE fsp_fuse_initonce = INIT_ONCE_STATIC_INIT;
static DWORD fsp_fuse_tlskey = TLS_OUT_OF_INDEXES; 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( static BOOL WINAPI fsp_fuse_initialize(
PINIT_ONCE InitOnce, PVOID Parameter, PVOID *Context) PINIT_ONCE InitOnce, PVOID Parameter, PVOID *Context)
{ {

View File

@ -19,9 +19,9 @@
#define WINFSP_DLL_FUSE_LIBRARY_H_INCLUDED #define WINFSP_DLL_FUSE_LIBRARY_H_INCLUDED
#include <dll/library.h> #include <dll/library.h>
#include <dll/fuse/shared.h>
#include <fuse/fuse.h> #include <fuse/fuse.h>
#include <fuse/fuse_opt.h> #include <fuse/fuse_opt.h>
#include <dll/fuse/shared.h>
#define FSP_FUSE_LIBRARY_NAME LIBRARY_NAME "-FUSE" #define FSP_FUSE_LIBRARY_NAME LIBRARY_NAME "-FUSE"

View File

@ -20,4 +20,33 @@
#define enosys(env) ('C' == (env)->environment ? 88 : 40) #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 #endif

View File

@ -19,7 +19,6 @@
#define WINFSP_DLL_FUSE3_LIBRARY_H_INCLUDED #define WINFSP_DLL_FUSE3_LIBRARY_H_INCLUDED
#include <dll/library.h> #include <dll/library.h>
#include <dll/fuse/shared.h>
#include <fuse/fuse.h> #include <fuse/fuse.h>
#undef FUSE_H_ #undef FUSE_H_
#undef FUSE_COMMON_H_ #undef FUSE_COMMON_H_
@ -27,6 +26,7 @@
#undef FUSE_MINOR_VERSION #undef FUSE_MINOR_VERSION
#undef fuse_main #undef fuse_main
#include <fuse3/fuse.h> #include <fuse3/fuse.h>
#include <dll/fuse/shared.h>
struct fuse3 struct fuse3
{ {