1、接口实现
This commit is contained in:
1 parent
cc2fdef069
commit
500c927883
7 files changed
+316
-75
No files matched your search
@@ -10,59 +10,55 @@
|
||||
#include "seafile/seafile_api.hpp"
|
||||
#include "seafile/token_type.hpp"
|
||||
|
||||
namespace seafile::fs
|
||||
{
|
||||
class SeafileFileSystem final
|
||||
{
|
||||
namespace seafile::fs {
|
||||
class SeafileFileSystem final {
|
||||
std::string repo_id;
|
||||
std::string token;
|
||||
TokenType token_type = TokenType::TOKEN;
|
||||
SeaFileApi api;
|
||||
std::wstring mount_point;
|
||||
FSP_FILE_SYSTEM* FileSystem = nullptr;
|
||||
|
||||
public:
|
||||
explicit SeafileFileSystem(const std::string& server,
|
||||
const std::wstring& mount_point) : api(server), mount_point(mount_point)
|
||||
{
|
||||
explicit SeafileFileSystem(const std::string &server,
|
||||
const std::wstring &mount_point) : api(server), mount_point(mount_point) {
|
||||
}
|
||||
|
||||
void auth(const std::string& username, const std::string& password);
|
||||
void auth(const std::string &username, const std::string &password);
|
||||
|
||||
SeafileFileSystem(const SeafileFileSystem&) = delete;
|
||||
SeafileFileSystem(SeafileFileSystem&&) = delete;
|
||||
SeafileFileSystem& operator=(const SeafileFileSystem&) = delete;
|
||||
SeafileFileSystem& operator=(SeafileFileSystem&&) = delete;
|
||||
SeafileFileSystem(const SeafileFileSystem &) = delete;
|
||||
|
||||
NTSTATUS SvcStart(FSP_SERVICE* Service, ULONG argc, PWSTR* argv);
|
||||
SeafileFileSystem(SeafileFileSystem &&) = delete;
|
||||
|
||||
NTSTATUS SvcStop(FSP_SERVICE* Service);
|
||||
SeafileFileSystem &operator=(const SeafileFileSystem &) = delete;
|
||||
|
||||
NTSTATUS GetVolumeInfo(FSP_FSCTL_VOLUME_INFO* VolumeInfo);
|
||||
SeafileFileSystem &operator=(SeafileFileSystem &&) = delete;
|
||||
|
||||
NTSTATUS GetVolumeInfo(FSP_FSCTL_VOLUME_INFO *VolumeInfo);
|
||||
|
||||
NTSTATUS SetVolumeLabel_(PWSTR VolumeLabel,
|
||||
FSP_FSCTL_VOLUME_INFO* VolumeInfo);
|
||||
FSP_FSCTL_VOLUME_INFO *VolumeInfo);
|
||||
|
||||
NTSTATUS GetSecurityByName(PWSTR FileName,
|
||||
PUINT32 PFileAttributes,
|
||||
PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||
SIZE_T* PSecurityDescriptorSize);
|
||||
SIZE_T *PSecurityDescriptorSize);
|
||||
|
||||
NTSTATUS Open(
|
||||
PWSTR FileName,
|
||||
UINT32 CreateOptions,
|
||||
UINT32 GrantedAccess,
|
||||
PVOID* PFileContext,
|
||||
FSP_FSCTL_FILE_INFO* FileInfo);
|
||||
PVOID *PFileContext,
|
||||
FSP_FSCTL_FILE_INFO *FileInfo);
|
||||
|
||||
NTSTATUS GetFileInfoInternal(HANDLE Handle, FSP_FSCTL_FILE_INFO* FileInfo);
|
||||
NTSTATUS Read(PVOID FileContext, PVOID Buffer, UINT64 Offset, ULONG Length,
|
||||
PULONG PBytesTransferred);
|
||||
|
||||
NTSTATUS GetFileInfo(HANDLE Handle, FSP_FSCTL_FILE_INFO *FileInfo);
|
||||
|
||||
|
||||
VOID Close(FSP_FILE_SYSTEM* FileSystem,
|
||||
PVOID FileContext0);
|
||||
VOID Close(PVOID FileContext0);
|
||||
|
||||
NTSTATUS ReadDirectory(FSP_FILE_SYSTEM* FileSystem,
|
||||
PVOID FileContext0, PWSTR Pattern, PWSTR Marker,
|
||||
NTSTATUS ReadDirectory(PVOID FileContext0, PWSTR Pattern, PWSTR Marker,
|
||||
PVOID Buffer, ULONG BufferLength, PULONG PBytesTransferred);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// Created by Shell on 2026/6/20.
|
||||
//
|
||||
|
||||
#ifndef SEADISK_WINFSP_ADAPTER_HPP
|
||||
#define SEADISK_WINFSP_ADAPTER_HPP
|
||||
#include "seafile_file_system.hpp"
|
||||
|
||||
namespace seafile::fs {
|
||||
class WinFSPAdapter {
|
||||
public:
|
||||
static NTSTATUS GetVolumeInfo(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_VOLUME_INFO *VolumeInfo);
|
||||
|
||||
static NTSTATUS SvcStart(FSP_SERVICE *Service, ULONG argc, PWSTR *argv);
|
||||
|
||||
static NTSTATUS SvcStop(FSP_SERVICE *Service);
|
||||
|
||||
|
||||
static NTSTATUS SetVolumeLabel_(FSP_FILE_SYSTEM *FileSystem, PWSTR VolumeLabel,
|
||||
FSP_FSCTL_VOLUME_INFO *VolumeInfo);
|
||||
|
||||
static NTSTATUS GetSecurityByName(FSP_FILE_SYSTEM *FileSystem, PWSTR FileName, PUINT32 PFileAttributes,
|
||||
PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||
SIZE_T *PSecurityDescriptorSize);
|
||||
|
||||
static NTSTATUS Open(FSP_FILE_SYSTEM *FileSystem, PWSTR FileName, UINT32 CreateOptions, UINT32 GrantedAccess,
|
||||
PVOID *PFileContext,
|
||||
FSP_FSCTL_FILE_INFO *FileInfo);
|
||||
|
||||
static NTSTATUS Create(FSP_FILE_SYSTEM *FileSystem,
|
||||
PWSTR FileName, UINT32 CreateOptions, UINT32 GrantedAccess,
|
||||
UINT32 FileAttributes, PSECURITY_DESCRIPTOR SecurityDescriptor, UINT64 AllocationSize,
|
||||
PVOID *PFileContext, FSP_FSCTL_FILE_INFO *FileInfo);
|
||||
|
||||
static NTSTATUS Read(FSP_FILE_SYSTEM *FileSystem,
|
||||
PVOID FileContext, PVOID Buffer, UINT64 Offset, ULONG Length,
|
||||
PULONG PBytesTransferred);
|
||||
|
||||
static NTSTATUS GetFileInfo(FSP_FILE_SYSTEM *FileSystem, HANDLE Handle, FSP_FSCTL_FILE_INFO *FileInfo);
|
||||
|
||||
|
||||
static VOID Close(FSP_FILE_SYSTEM *FileSystem, PVOID FileContext0);
|
||||
|
||||
static NTSTATUS ReadDirectory(FSP_FILE_SYSTEM *FileSystem, PVOID FileContext0, PWSTR Pattern, PWSTR Marker,
|
||||
PVOID Buffer, ULONG BufferLength, PULONG PBytesTransferred);
|
||||
|
||||
static NTSTATUS SetSecurity(FSP_FILE_SYSTEM *FileSystem,
|
||||
PVOID FileContext,
|
||||
SECURITY_INFORMATION SecurityInformation,
|
||||
PSECURITY_DESCRIPTOR ModificationDescriptor);
|
||||
|
||||
static NTSTATUS GetSecurity(FSP_FILE_SYSTEM *FileSystem,
|
||||
PVOID FileContext,
|
||||
PSECURITY_DESCRIPTOR SecurityDescriptor, SIZE_T *PSecurityDescriptorSize);
|
||||
};
|
||||
}
|
||||
#endif //SEADISK_WINFSP_ADAPTER_HPP
|
||||
Reference in new issue
Block a user