dll: fuse: remove dll/fuse/shared.h

This commit is contained in:
Bill Zissimopoulos 2018-07-16 14:21:57 -07:00
parent 27d03d4323
commit 3dc09b2496
No known key found for this signature in database
GPG Key ID: 3D4F95D52C7B3EA3
7 changed files with 37 additions and 63 deletions

View File

@ -34,7 +34,6 @@
<ClInclude Include="..\..\inc\winfsp\winfsp.hpp" /> <ClInclude Include="..\..\inc\winfsp\winfsp.hpp" />
<ClInclude Include="..\..\src\dll\fuse3\library.h" /> <ClInclude Include="..\..\src\dll\fuse3\library.h" />
<ClInclude Include="..\..\src\dll\fuse\library.h" /> <ClInclude Include="..\..\src\dll\fuse\library.h" />
<ClInclude Include="..\..\src\dll\fuse\shared.h" />
<ClInclude Include="..\..\src\dll\library.h" /> <ClInclude Include="..\..\src\dll\library.h" />
<ClInclude Include="..\..\src\shared\minimal.h" /> <ClInclude Include="..\..\src\shared\minimal.h" />
</ItemGroup> </ItemGroup>

View File

@ -77,9 +77,6 @@
<ClInclude Include="..\..\src\dll\fuse3\library.h"> <ClInclude Include="..\..\src\dll\fuse3\library.h">
<Filter>Source\fuse3</Filter> <Filter>Source\fuse3</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\dll\fuse\shared.h">
<Filter>Source\fuse</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\src\dll\library.c"> <ClCompile Include="..\..\src\dll\library.c">

View File

@ -354,7 +354,7 @@ static NTSTATUS fsp_fuse_svcstart(FSP_SERVICE *Service, ULONG argc, PWSTR *argv)
/* this should always fail with ENOSYS or EINVAL */ /* this should always fail with ENOSYS or EINVAL */
err = f->ops.readlink("/", buf, sizeof buf); err = f->ops.readlink("/", buf, sizeof buf);
f->has_symlinks = -enosys(f->env) != err; f->has_symlinks = -ENOSYS_(f->env) != err;
} }
/* the FSD does not currently limit these VolumeParams fields; do so here! */ /* the FSD does not currently limit these VolumeParams fields; do so here! */

View File

@ -266,7 +266,7 @@ loopend:;
if (0 != f->ops.getattr) if (0 != f->ops.getattr)
err = f->ops.getattr(PosixHiddenPath, (void *)&stbuf); err = f->ops.getattr(PosixHiddenPath, (void *)&stbuf);
else else
err = -enosys(f->env); err = -ENOSYS_(f->env);
} while (0 == err && 0 < --maxtries); } while (0 == err && 0 < --maxtries);
if (0 == err) if (0 == err)
@ -308,7 +308,7 @@ static BOOLEAN fsp_fuse_intf_CheckSymlinkDirectory(FSP_FILE_SYSTEM *FileSystem,
if (0 != f->ops.getattr) if (0 != f->ops.getattr)
err = f->ops.getattr(PosixDotPath, (void *)&stbuf); err = f->ops.getattr(PosixDotPath, (void *)&stbuf);
else else
err = -enosys(f->env); err = -ENOSYS_(f->env);
MemFree(PosixDotPath); MemFree(PosixDotPath);

View File

@ -21,7 +21,6 @@
#include <dll/library.h> #include <dll/library.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"
@ -32,6 +31,8 @@
#define FSP_FUSE_HAS_SYMLINKS(f) ((f)->has_symlinks) #define FSP_FUSE_HAS_SYMLINKS(f) ((f)->has_symlinks)
#define ENOSYS_(env) ('C' == (env)->environment ? 88 : 40)
struct fuse struct fuse
{ {
struct fsp_fuse_env *env; struct fsp_fuse_env *env;
@ -103,4 +104,35 @@ NTSTATUS fsp_fuse_get_token_uidgid(
#define NFS_SPECFILE_LNK 0x00000000014b4e4c #define NFS_SPECFILE_LNK 0x00000000014b4e4c
#define NFS_SPECFILE_SOCK 0x000000004B434F53 #define NFS_SPECFILE_SOCK 0x000000004B434F53
/* FUSE obj alloc/free */
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

@ -1,52 +0,0 @@
/**
* @file dll/fuse/shared.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_FUSE_SHARED_H_INCLUDED
#define WINFSP_DLL_FUSE_SHARED_H_INCLUDED
#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

View File

@ -18,15 +18,13 @@
#ifndef WINFSP_DLL_FUSE3_LIBRARY_H_INCLUDED #ifndef WINFSP_DLL_FUSE3_LIBRARY_H_INCLUDED
#define WINFSP_DLL_FUSE3_LIBRARY_H_INCLUDED #define WINFSP_DLL_FUSE3_LIBRARY_H_INCLUDED
#include <dll/library.h> #include <dll/fuse/library.h>
#include <fuse/fuse.h>
#undef FUSE_H_ #undef FUSE_H_
#undef FUSE_COMMON_H_ #undef FUSE_COMMON_H_
#undef FUSE_MAJOR_VERSION #undef FUSE_MAJOR_VERSION
#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
{ {