Files
seadisk/include/seafile/fs/seafile_file_system.hpp
T
2026-06-20 16:11:17 +08:00

70 lines
2.2 KiB
C++

//
// Created by Shell on 2026-06-18.
//
#ifndef SEADISK_SEAFILE_FILE_SYSTEM_HPP
#define SEADISK_SEAFILE_FILE_SYSTEM_HPP
#include <string>
#include <winfsp/winfsp.h>
#include "seafile/seafile_api.hpp"
#include "seafile/token_type.hpp"
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)
{
}
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;
NTSTATUS SvcStart(FSP_SERVICE* Service, ULONG argc, PWSTR* argv);
NTSTATUS SvcStop(FSP_SERVICE* Service);
NTSTATUS GetVolumeInfo(FSP_FSCTL_VOLUME_INFO* VolumeInfo);
NTSTATUS SetVolumeLabel_(PWSTR VolumeLabel,
FSP_FSCTL_VOLUME_INFO* VolumeInfo);
NTSTATUS GetSecurityByName(PWSTR FileName,
PUINT32 PFileAttributes,
PSECURITY_DESCRIPTOR SecurityDescriptor,
SIZE_T* PSecurityDescriptorSize);
NTSTATUS Open(
PWSTR FileName,
UINT32 CreateOptions,
UINT32 GrantedAccess,
PVOID* PFileContext,
FSP_FSCTL_FILE_INFO* FileInfo);
NTSTATUS GetFileInfoInternal(HANDLE Handle, FSP_FSCTL_FILE_INFO* FileInfo);
VOID Close(FSP_FILE_SYSTEM* FileSystem,
PVOID FileContext0);
NTSTATUS ReadDirectory(FSP_FILE_SYSTEM* FileSystem,
PVOID FileContext0, PWSTR Pattern, PWSTR Marker,
PVOID Buffer, ULONG BufferLength, PULONG PBytesTransferred);
};
}
#endif //SEADISK_SEAFILE_FILE_SYSTEM_HPP