dll: fuse: fuseop.c

This commit is contained in:
Bill Zissimopoulos 2016-06-01 16:44:11 -07:00
parent a53e79984a
commit da95f05b29
8 changed files with 213 additions and 5 deletions

View File

@ -26,12 +26,14 @@
<ClInclude Include="..\..\inc\fuse\winfsp_fuse.h" />
<ClInclude Include="..\..\inc\winfsp\fsctl.h" />
<ClInclude Include="..\..\inc\winfsp\winfsp.h" />
<ClInclude Include="..\..\src\dll\fuse\library.h" />
<ClInclude Include="..\..\src\dll\library.h" />
<ClInclude Include="..\..\src\shared\minimal.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\dll\eventlog.c" />
<ClCompile Include="..\..\src\dll\fuse\fuse.c" />
<ClCompile Include="..\..\src\dll\fuse\fuseop.c" />
<ClCompile Include="..\..\src\dll\fuse\fuse_main.c" />
<ClCompile Include="..\..\src\dll\fuse\fuse_opt.c" />
<ClCompile Include="..\..\src\dll\np.c" />

View File

@ -47,6 +47,9 @@
<ClInclude Include="..\..\inc\fuse\winfsp_fuse.h">
<Filter>Include\fuse</Filter>
</ClInclude>
<ClInclude Include="..\..\src\dll\fuse\library.h">
<Filter>Source\fuse</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\dll\library.c">
@ -94,6 +97,9 @@
<ClCompile Include="..\..\src\dll\fuse\fuse_main.c">
<Filter>Source\fuse</Filter>
</ClCompile>
<ClCompile Include="..\..\src\dll\fuse\fuseop.c">
<Filter>Source\fuse</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\..\src\dll\ntstatus.i">

View File

@ -123,7 +123,6 @@ FSP_API NTSTATUS FspFileSystemCreate(PWSTR DevicePath,
FileSystem->Operations[FspFsctlTransactQueryDirectoryKind] = FspFileSystemOpQueryDirectory;
FileSystem->Operations[FspFsctlTransactQuerySecurityKind] = FspFileSystemOpQuerySecurity;
FileSystem->Operations[FspFsctlTransactSetSecurityKind] = FspFileSystemOpSetSecurity;
// !!!: ...
FileSystem->Interface = Interface;
*PFileSystem = FileSystem;

View File

@ -15,7 +15,7 @@
* software.
*/
#include <dll/library.h>
#include <dll/fuse/library.h>
#include <fuse/fuse.h>
#define FSP_FUSE_CORE_OPT(n, f, v) { n, offsetof(struct fsp_fuse_core_opt_data, f), v }
@ -284,6 +284,12 @@ FSP_FUSE_API struct fuse *fsp_fuse_new(struct fsp_fuse_env *env,
struct fuse_chan *ch, struct fuse_args *args,
const struct fuse_operations *ops, size_t opsize, void *data)
{
static FSP_FILE_SYSTEM_INTERFACE intf =
{
0,
0,
fsp_fuse_op_get_security_by_name,
};
struct fsp_fuse_core_opt_data opt_data;
struct fuse *f = 0;
PWSTR ServiceName = FspDiagIdent();
@ -330,7 +336,7 @@ FSP_FUSE_API struct fuse *fsp_fuse_new(struct fsp_fuse_env *env,
FspServiceAllowConsoleMode(f->Service);
f->Service->UserContext = f;
Result = FspFileSystemCreate(L"" FSP_FSCTL_NET_DEVICE_NAME, &opt_data.VolumeParams, 0,
Result = FspFileSystemCreate(L"" FSP_FSCTL_NET_DEVICE_NAME, &opt_data.VolumeParams, &intf,
&f->FileSystem);
if (!NT_SUCCESS(Result))
{
@ -338,6 +344,36 @@ FSP_FUSE_API struct fuse *fsp_fuse_new(struct fsp_fuse_env *env,
goto fail;
}
FspFileSystemSetOperation(f->FileSystem, FspFsctlTransactCreateKind,
fsp_fuse_op_create);
FspFileSystemSetOperation(f->FileSystem, FspFsctlTransactOverwriteKind,
fsp_fuse_op_overwrite);
FspFileSystemSetOperation(f->FileSystem, FspFsctlTransactCleanupKind,
fsp_fuse_op_cleanup);
FspFileSystemSetOperation(f->FileSystem, FspFsctlTransactCloseKind,
fsp_fuse_op_close);
FspFileSystemSetOperation(f->FileSystem, FspFsctlTransactReadKind,
fsp_fuse_op_read);
FspFileSystemSetOperation(f->FileSystem, FspFsctlTransactWriteKind,
fsp_fuse_op_write);
FspFileSystemSetOperation(f->FileSystem, FspFsctlTransactQueryInformationKind,
fsp_fuse_op_query_information);
FspFileSystemSetOperation(f->FileSystem, FspFsctlTransactSetInformationKind,
fsp_fuse_op_set_information);
FspFileSystemSetOperation(f->FileSystem, FspFsctlTransactFlushBuffersKind,
fsp_fuse_op_flush_buffers);
FspFileSystemSetOperation(f->FileSystem, FspFsctlTransactQueryVolumeInformationKind,
fsp_fuse_op_query_volume_information);
FspFileSystemSetOperation(f->FileSystem, FspFsctlTransactSetVolumeInformationKind,
fsp_fuse_op_set_volume_information);
FspFileSystemSetOperation(f->FileSystem, FspFsctlTransactQueryDirectoryKind,
fsp_fuse_op_query_directory);
FspFileSystemSetOperation(f->FileSystem, FspFsctlTransactQuerySecurityKind,
fsp_fuse_op_query_security);
FspFileSystemSetOperation(f->FileSystem, FspFsctlTransactSetSecurityKind,
fsp_fuse_op_set_security);
//FspFileSystemSetOperationGuard(f->FileSystem, 0, 0);
if (opt_data.debug)
FspFileSystemSetDebugLog(f->FileSystem, -1);

View File

@ -15,7 +15,7 @@
* software.
*/
#include <dll/library.h>
#include <dll/fuse/library.h>
#include <fuse/fuse.h>
#define FSP_FUSE_MAIN_OPT(n, f, v) { n, offsetof(struct fsp_fuse_main_opt_data, f), v }

View File

@ -15,7 +15,7 @@
* software.
*/
#include <dll/library.h>
#include <dll/fuse/library.h>
#include <fuse/fuse_opt.h>
#include <stdint.h>

110
src/dll/fuse/fuseop.c Normal file
View File

@ -0,0 +1,110 @@
/**
* @file dll/fuse/fuseop.c
*
* @copyright 2015-2016 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
*
* You can redistribute it and/or modify it under the terms of the
* GNU Affero 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 <dll/fuse/library.h>
NTSTATUS fsp_fuse_op_get_security_by_name(FSP_FILE_SYSTEM *FileSystem,
PWSTR FileName, PUINT32 PFileAttributes,
PSECURITY_DESCRIPTOR SecurityDescriptor, SIZE_T *PSecurityDescriptorSize)
{
/* not a true file system op, required for access checks! */
return STATUS_INVALID_DEVICE_REQUEST;
}
NTSTATUS fsp_fuse_op_create(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response)
{
return STATUS_INVALID_DEVICE_REQUEST;
}
NTSTATUS fsp_fuse_op_overwrite(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response)
{
return STATUS_INVALID_DEVICE_REQUEST;
}
NTSTATUS fsp_fuse_op_cleanup(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response)
{
return STATUS_INVALID_DEVICE_REQUEST;
}
NTSTATUS fsp_fuse_op_close(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response)
{
return STATUS_INVALID_DEVICE_REQUEST;
}
NTSTATUS fsp_fuse_op_read(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response)
{
return STATUS_INVALID_DEVICE_REQUEST;
}
NTSTATUS fsp_fuse_op_write(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response)
{
return STATUS_INVALID_DEVICE_REQUEST;
}
NTSTATUS fsp_fuse_op_flush_buffers(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response)
{
return STATUS_INVALID_DEVICE_REQUEST;
}
NTSTATUS fsp_fuse_op_query_information(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response)
{
return STATUS_INVALID_DEVICE_REQUEST;
}
NTSTATUS fsp_fuse_op_set_information(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response)
{
return STATUS_INVALID_DEVICE_REQUEST;
}
NTSTATUS fsp_fuse_op_query_volume_information(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response)
{
return STATUS_INVALID_DEVICE_REQUEST;
}
NTSTATUS fsp_fuse_op_set_volume_information(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response)
{
return STATUS_INVALID_DEVICE_REQUEST;
}
NTSTATUS fsp_fuse_op_query_directory(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response)
{
return STATUS_INVALID_DEVICE_REQUEST;
}
NTSTATUS fsp_fuse_op_query_security(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response)
{
return STATUS_INVALID_DEVICE_REQUEST;
}
NTSTATUS fsp_fuse_op_set_security(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response)
{
return STATUS_INVALID_DEVICE_REQUEST;
}

55
src/dll/fuse/library.h Normal file
View File

@ -0,0 +1,55 @@
/**
* @file dll/fuse/library.h
*
* @copyright 2015-2016 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
*
* You can redistribute it and/or modify it under the terms of the
* GNU Affero 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_LIBRARY_H_INCLUDED
#define WINFSP_DLL_FUSE_LIBRARY_H_INCLUDED
#include <dll/library.h>
NTSTATUS fsp_fuse_op_get_security_by_name(FSP_FILE_SYSTEM *FileSystem,
PWSTR FileName, PUINT32 PFileAttributes,
PSECURITY_DESCRIPTOR SecurityDescriptor, SIZE_T *PSecurityDescriptorSize);
NTSTATUS fsp_fuse_op_create(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response);
NTSTATUS fsp_fuse_op_overwrite(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response);
NTSTATUS fsp_fuse_op_cleanup(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response);
NTSTATUS fsp_fuse_op_close(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response);
NTSTATUS fsp_fuse_op_read(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response);
NTSTATUS fsp_fuse_op_write(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response);
NTSTATUS fsp_fuse_op_flush_buffers(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response);
NTSTATUS fsp_fuse_op_query_information(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response);
NTSTATUS fsp_fuse_op_set_information(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response);
NTSTATUS fsp_fuse_op_query_volume_information(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response);
NTSTATUS fsp_fuse_op_set_volume_information(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response);
NTSTATUS fsp_fuse_op_query_directory(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response);
NTSTATUS fsp_fuse_op_query_security(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response);
NTSTATUS fsp_fuse_op_set_security(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response);
#endif