code reorg
This commit is contained in:
parent
7fe7299e7c
commit
daefa58c0c
@ -248,6 +248,7 @@ wfloat
|
||||
wformat
|
||||
windres
|
||||
winfsp
|
||||
winfsp_allocation_unit
|
||||
winfsp_drive
|
||||
winfspdrive
|
||||
winhttp
|
||||
|
@ -150,278 +150,11 @@ template <typename data_type>
|
||||
#define CPPHTTPLIB_OPENSSL_SUPPORT
|
||||
#include <httplib.h>
|
||||
|
||||
REPERTORY_IGNORE_WARNINGS_DISABLE()
|
||||
|
||||
struct sqlite3_deleter {
|
||||
void operator()(sqlite3 *db3) {
|
||||
if (db3 != nullptr) {
|
||||
sqlite3_close_v2(db3);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
using db3_t = std::unique_ptr<sqlite3, sqlite3_deleter>;
|
||||
|
||||
struct sqlite3_statement_deleter {
|
||||
void operator()(sqlite3_stmt *stmt) {
|
||||
if (stmt != nullptr) {
|
||||
sqlite3_finalize(stmt);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
using db3_stmt_t = std::unique_ptr<sqlite3_stmt, sqlite3_statement_deleter>;
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
using json = nlohmann::json;
|
||||
|
||||
#define REPERTORY "repertory"
|
||||
#define REPERTORY_CONFIG_VERSION 0ull
|
||||
#define REPERTORY_DATA_NAME "repertory2"
|
||||
#define REPERTORY_MIN_REMOTE_VERSION "2.0.0"
|
||||
#define REPERTORY_W L"repertory"
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
#ifdef _WIN32
|
||||
#define REPERTORY_INVALID_HANDLE INVALID_HANDLE_VALUE
|
||||
#define REPERTORY_API_INVALID_HANDLE static_cast<std::uint64_t>(-1)
|
||||
using native_handle = HANDLE;
|
||||
#else
|
||||
#define REPERTORY_INVALID_HANDLE (-1)
|
||||
#define REPERTORY_API_INVALID_HANDLE REPERTORY_INVALID_HANDLE
|
||||
using native_handle = int;
|
||||
#endif
|
||||
|
||||
constexpr const auto NANOS_PER_SECOND = 1000000000L;
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef CreateDirectory
|
||||
#undef CreateDirectory
|
||||
#endif
|
||||
|
||||
#ifdef CreateFile
|
||||
#undef CreateFile
|
||||
#endif
|
||||
|
||||
#ifdef DeleteFile
|
||||
#undef DeleteFile
|
||||
#endif
|
||||
|
||||
#ifdef RemoveDirectory
|
||||
#undef RemoveDirectory
|
||||
#endif
|
||||
|
||||
#ifndef _SH_DENYRW
|
||||
#define _SH_DENYRW 0x10 // deny read/write mode
|
||||
#endif
|
||||
|
||||
#ifndef _SH_DENYWR
|
||||
#define _SH_DENYWR 0x20 // deny write mode
|
||||
#endif
|
||||
|
||||
#ifndef _SH_DENYRD
|
||||
#define _SH_DENYRD 0x30 // deny read mode
|
||||
#endif
|
||||
|
||||
#ifndef _SH_DENYNO
|
||||
#define _SH_DENYNO 0x40 // deny none mode
|
||||
#endif
|
||||
|
||||
#ifndef _SH_SECURE
|
||||
#define _SH_SECURE 0x80 // secure mode
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ENETDOWN
|
||||
#define ENETDOWN 100
|
||||
#endif
|
||||
|
||||
#ifndef SETATTR_WANTS_MODE
|
||||
#define SETATTR_WANTS_MODE(attr) ((attr)->valid & (1 << 0))
|
||||
#endif // SETATTR_WANTS_MODE
|
||||
|
||||
#ifndef SETATTR_WANTS_UID
|
||||
#define SETATTR_WANTS_UID(attr) ((attr)->valid & (1 << 1))
|
||||
#endif // SETATTR_WANTS_UID
|
||||
|
||||
#ifndef SETATTR_WANTS_GID
|
||||
#define SETATTR_WANTS_GID(attr) ((attr)->valid & (1 << 2))
|
||||
#endif // SETATTR_WANTS_GID
|
||||
|
||||
#ifndef SETATTR_WANTS_SIZE
|
||||
#define SETATTR_WANTS_SIZE(attr) ((attr)->valid & (1 << 3))
|
||||
#endif // SETATTR_WANTS_SIZE
|
||||
|
||||
#ifndef SETATTR_WANTS_ACCTIME
|
||||
#define SETATTR_WANTS_ACCTIME(attr) ((attr)->valid & (1 << 4))
|
||||
#endif // SETATTR_WANTS_ACCTIME
|
||||
|
||||
#ifndef SETATTR_WANTS_MODTIME
|
||||
#define SETATTR_WANTS_MODTIME(attr) ((attr)->valid & (1 << 5))
|
||||
#endif // SETATTR_WANTS_MODTIME
|
||||
|
||||
#ifndef SETATTR_WANTS_CRTIME
|
||||
#define SETATTR_WANTS_CRTIME(attr) ((attr)->valid & (1 << 28))
|
||||
#endif // SETATTR_WANTS_CRTIME
|
||||
|
||||
#ifndef SETATTR_WANTS_CHGTIME
|
||||
#define SETATTR_WANTS_CHGTIME(attr) ((attr)->valid & (1 << 29))
|
||||
#endif // SETATTR_WANTS_CHGTIME
|
||||
|
||||
#ifndef SETATTR_WANTS_BKUPTIME
|
||||
#define SETATTR_WANTS_BKUPTIME(attr) ((attr)->valid & (1 << 30))
|
||||
#endif // SETATTR_WANTS_BKUPTIME
|
||||
|
||||
#ifndef SETATTR_WANTS_FLAGS
|
||||
#define SETATTR_WANTS_FLAGS(attr) ((attr)->valid & (1 << 31))
|
||||
#endif // SETATTR_WANTS_FLAGS
|
||||
|
||||
#ifndef _WIN32
|
||||
#ifdef __APPLE__
|
||||
#define G_PREFIX "org"
|
||||
#define G_KAUTH_FILESEC_XATTR G_PREFIX ".apple.system.Security"
|
||||
#define A_PREFIX "com"
|
||||
#define A_KAUTH_FILESEC_XATTR A_PREFIX ".apple.system.Security"
|
||||
#define XATTR_APPLE_PREFIX "com.apple."
|
||||
#endif
|
||||
|
||||
#ifndef XATTR_NAME_MAX
|
||||
#define XATTR_NAME_MAX 255 /* # chars in an extended attribute name */
|
||||
#endif
|
||||
|
||||
#ifndef XATTR_SIZE_MAX
|
||||
#define XATTR_SIZE_MAX 65536
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef fstat64
|
||||
#define fstat64 fstat
|
||||
#endif
|
||||
|
||||
#ifndef pread64
|
||||
#define pread64 pread
|
||||
#endif
|
||||
|
||||
#ifndef pwrite64
|
||||
#define pwrite64 pwrite
|
||||
#endif
|
||||
|
||||
#ifndef stat64
|
||||
#define stat64 stat
|
||||
#endif
|
||||
|
||||
#ifndef statfs64
|
||||
#define statfs64 statfs
|
||||
#endif
|
||||
|
||||
#define WINFSP_ALLOCATION_UNIT UINT64(4096U)
|
||||
|
||||
#ifdef _WIN32
|
||||
#define UTIME_NOW ((1l << 30) - 1l)
|
||||
#define UTIME_OMIT ((1l << 30) - 2l)
|
||||
#define CONVERT_STATUS_NOT_IMPLEMENTED(e) e
|
||||
#else
|
||||
using BOOLEAN = std::uint8_t;
|
||||
using DWORD = std::uint32_t;
|
||||
using HANDLE = void *;
|
||||
using PUINT32 = std::uint32_t *;
|
||||
using PVOID = void *;
|
||||
using PWSTR = wchar_t *;
|
||||
using SIZE_T = std::uint64_t;
|
||||
using UINT16 = std::uint16_t;
|
||||
using UINT32 = std::uint32_t;
|
||||
using UINT64 = std::uint64_t;
|
||||
using VOID = void;
|
||||
using WCHAR = wchar_t;
|
||||
|
||||
#define FILE_ATTRIBUTE_READONLY 0x00000001
|
||||
#define FILE_ATTRIBUTE_HIDDEN 0x00000002
|
||||
#define FILE_ATTRIBUTE_SYSTEM 0x00000004
|
||||
#define FILE_ATTRIBUTE_DIRECTORY 0x00000010
|
||||
#define FILE_ATTRIBUTE_ARCHIVE 0x00000020
|
||||
#define FILE_ATTRIBUTE_DEVICE 0x00000040
|
||||
#define FILE_ATTRIBUTE_NORMAL 0x00000080
|
||||
#define FILE_ATTRIBUTE_TEMPORARY 0x00000100
|
||||
#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
|
||||
#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
|
||||
#define FILE_ATTRIBUTE_COMPRESSED 0x00000800
|
||||
#define FILE_ATTRIBUTE_OFFLINE 0x00001000
|
||||
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
|
||||
#define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
|
||||
#define FILE_ATTRIBUTE_INTEGRITY_STREAM 0x00008000
|
||||
#define FILE_ATTRIBUTE_VIRTUAL 0x00010000
|
||||
#define FILE_ATTRIBUTE_NO_SCRUB_DATA 0x00020000
|
||||
#define FILE_ATTRIBUTE_EA 0x00040000
|
||||
#define FILE_ATTRIBUTE_PINNED 0x00080000
|
||||
#define FILE_ATTRIBUTE_UNPINNED 0x00100000
|
||||
#define FILE_ATTRIBUTE_RECALL_ON_OPEN 0x00040000
|
||||
#define FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS 0x00400000
|
||||
|
||||
#define FILE_DIRECTORY_FILE 0x00000001
|
||||
|
||||
#define FILE_EXECUTE (0x0020)
|
||||
#define FILE_GENERIC_EXECUTE (0x00020000L | 0x0080 | 0x0020 | 0x00100000L)
|
||||
|
||||
#define GENERIC_READ (0x80000000L)
|
||||
#define GENERIC_WRITE (0x40000000L)
|
||||
#define GENERIC_EXECUTE (0x20000000L)
|
||||
#define GENERIC_ALL (0x10000000L)
|
||||
|
||||
#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
|
||||
|
||||
#define MAX_PATH 260
|
||||
|
||||
#define STATUS_SUCCESS std::int32_t(0)
|
||||
#define STATUS_ACCESS_DENIED std::int32_t(0xC0000022L)
|
||||
#define STATUS_DEVICE_BUSY std::int32_t(0x80000011L)
|
||||
#define STATUS_DEVICE_INSUFFICIENT_RESOURCES std::int32_t(0xC0000468L)
|
||||
#define STATUS_DIRECTORY_NOT_EMPTY std::int32_t(0xC0000101L)
|
||||
#define STATUS_FILE_IS_A_DIRECTORY std::int32_t(0xC00000BAL)
|
||||
#define STATUS_FILE_TOO_LARGE std::int32_t(0xC0000904L)
|
||||
#define STATUS_INSUFFICIENT_RESOURCES std::int32_t(0xC000009AL)
|
||||
#define STATUS_INTERNAL_ERROR std::int32_t(0xC00000E5L)
|
||||
#define STATUS_INVALID_ADDRESS std::int32_t(0xC0000141L)
|
||||
#define STATUS_INVALID_HANDLE std::int32_t(0xC0000006L)
|
||||
#define STATUS_INVALID_IMAGE_FORMAT std::int32_t(0xC000007BL)
|
||||
#define STATUS_INVALID_PARAMETER std::int32_t(0xC000000DL)
|
||||
#define STATUS_NO_MEMORY std::int32_t(0xC0000017L)
|
||||
#define STATUS_NOT_IMPLEMENTED std::int32_t(0xC0000002L)
|
||||
#define STATUS_OBJECT_NAME_EXISTS std::int32_t(0x40000000L)
|
||||
#define STATUS_OBJECT_NAME_NOT_FOUND std::int32_t(0xC0000034L)
|
||||
#define STATUS_OBJECT_PATH_INVALID std::int32_t(0xC0000039L)
|
||||
#define STATUS_UNEXPECTED_IO_ERROR std::int32_t(0xC00000E9L)
|
||||
|
||||
#define CONVERT_STATUS_NOT_IMPLEMENTED(e) \
|
||||
((std::int32_t(e) == STATUS_NOT_IMPLEMENTED) ? -ENOTSUP : e)
|
||||
|
||||
namespace Fsp::FileSystemBase {
|
||||
enum {
|
||||
FspCleanupDelete = 0x01,
|
||||
FspCleanupSetAllocationSize = 0x02,
|
||||
FspCleanupSetArchiveBit = 0x10,
|
||||
FspCleanupSetLastAccessTime = 0x20,
|
||||
FspCleanupSetLastWriteTime = 0x40,
|
||||
FspCleanupSetChangeTime = 0x80
|
||||
};
|
||||
|
||||
struct FSP_FSCTL_FILE_INFO {
|
||||
UINT32 FileAttributes{};
|
||||
UINT32 ReparseTag{};
|
||||
UINT64 AllocationSize{};
|
||||
UINT64 FileSize{};
|
||||
UINT64 CreationTime{};
|
||||
UINT64 LastAccessTime{};
|
||||
UINT64 LastWriteTime{};
|
||||
UINT64 ChangeTime{};
|
||||
UINT64 IndexNumber{};
|
||||
UINT32 HardLinks{};
|
||||
UINT32 EaSize{};
|
||||
};
|
||||
|
||||
using FileInfo = FSP_FSCTL_FILE_INFO;
|
||||
} // namespace Fsp::FileSystemBase
|
||||
#endif
|
||||
|
||||
using namespace Fsp;
|
||||
REPERTORY_IGNORE_WARNINGS_DISABLE()
|
||||
|
||||
namespace repertory {
|
||||
auto get_repertory_git_revision() -> const std::string &;
|
||||
@ -430,25 +163,6 @@ void repertory_init();
|
||||
void repertory_shutdown();
|
||||
} // namespace repertory
|
||||
|
||||
namespace {
|
||||
template <class... Ts> struct overloaded : Ts... {
|
||||
using Ts::operator()...;
|
||||
};
|
||||
template <class... Ts> overloaded(Ts...) -> overloaded<Ts...>;
|
||||
} // namespace
|
||||
|
||||
#define INTERFACE_SETUP(name) \
|
||||
public: \
|
||||
name(const name &) noexcept = delete; \
|
||||
name &operator=(const name &) noexcept = delete; \
|
||||
name &operator=(name &&) noexcept = delete; \
|
||||
\
|
||||
protected: \
|
||||
name() = default; \
|
||||
name(name &&) noexcept = default; \
|
||||
\
|
||||
public: \
|
||||
virtual ~name() = default
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // INCLUDE_COMMON_HPP_
|
||||
|
@ -27,6 +27,26 @@
|
||||
namespace repertory::db {
|
||||
using db_types_t = std::variant<std::int64_t, std::string>;
|
||||
|
||||
struct sqlite3_deleter {
|
||||
void operator()(sqlite3 *db3) {
|
||||
if (db3 != nullptr) {
|
||||
sqlite3_close_v2(db3);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
using db3_t = std::unique_ptr<sqlite3, sqlite3_deleter>;
|
||||
|
||||
struct sqlite3_statement_deleter {
|
||||
void operator()(sqlite3_stmt *stmt) {
|
||||
if (stmt != nullptr) {
|
||||
sqlite3_finalize(stmt);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
using db3_stmt_t = std::unique_ptr<sqlite3_stmt, sqlite3_statement_deleter>;
|
||||
|
||||
struct comp_data_t final {
|
||||
std::string column_name;
|
||||
std::string op_type;
|
||||
|
@ -23,6 +23,7 @@
|
||||
#define INCLUDE_DRIVES_FUSE_I_FUSE_DRIVE_HPP_
|
||||
#ifndef _WIN32
|
||||
|
||||
#include "platform/platform.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
|
@ -22,11 +22,13 @@
|
||||
#ifndef INCLUDE_FILE_MANAGER_FILE_MANAGER_HPP_
|
||||
#define INCLUDE_FILE_MANAGER_FILE_MANAGER_HPP_
|
||||
|
||||
#include "database/db_common.hpp"
|
||||
#include "events/event_system.hpp"
|
||||
#include "events/events.hpp"
|
||||
#include "file_manager/i_file_manager.hpp"
|
||||
#include "file_manager/i_open_file.hpp"
|
||||
#include "file_manager/i_upload_manager.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "utils/native_file.hpp"
|
||||
|
||||
@ -450,7 +452,7 @@ private:
|
||||
i_provider &provider_;
|
||||
|
||||
private:
|
||||
db3_t db_{nullptr};
|
||||
db::db3_t db_{nullptr};
|
||||
std::uint64_t next_handle_{0U};
|
||||
mutable std::recursive_mutex open_file_mtx_;
|
||||
std::unordered_map<std::string, std::shared_ptr<i_closeable_open_file>>
|
||||
|
@ -25,4 +25,236 @@
|
||||
#include "platform/unix_platform.hpp"
|
||||
#include "platform/win32_platform.hpp"
|
||||
|
||||
#define WINFSP_ALLOCATION_UNIT UINT64(4096U)
|
||||
|
||||
constexpr const auto NANOS_PER_SECOND = 1000000000L;
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef CreateDirectory
|
||||
#undef CreateDirectory
|
||||
#endif
|
||||
|
||||
#ifdef CreateFile
|
||||
#undef CreateFile
|
||||
#endif
|
||||
|
||||
#ifdef DeleteFile
|
||||
#undef DeleteFile
|
||||
#endif
|
||||
|
||||
#ifdef RemoveDirectory
|
||||
#undef RemoveDirectory
|
||||
#endif
|
||||
|
||||
#ifndef _SH_DENYRW
|
||||
#define _SH_DENYRW 0x10 // deny read/write mode
|
||||
#endif
|
||||
|
||||
#ifndef _SH_DENYWR
|
||||
#define _SH_DENYWR 0x20 // deny write mode
|
||||
#endif
|
||||
|
||||
#ifndef _SH_DENYRD
|
||||
#define _SH_DENYRD 0x30 // deny read mode
|
||||
#endif
|
||||
|
||||
#ifndef _SH_DENYNO
|
||||
#define _SH_DENYNO 0x40 // deny none mode
|
||||
#endif
|
||||
|
||||
#ifndef _SH_SECURE
|
||||
#define _SH_SECURE 0x80 // secure mode
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ENETDOWN
|
||||
#define ENETDOWN 100
|
||||
#endif
|
||||
|
||||
#ifndef SETATTR_WANTS_MODE
|
||||
#define SETATTR_WANTS_MODE(attr) ((attr)->valid & (1 << 0))
|
||||
#endif // SETATTR_WANTS_MODE
|
||||
|
||||
#ifndef SETATTR_WANTS_UID
|
||||
#define SETATTR_WANTS_UID(attr) ((attr)->valid & (1 << 1))
|
||||
#endif // SETATTR_WANTS_UID
|
||||
|
||||
#ifndef SETATTR_WANTS_GID
|
||||
#define SETATTR_WANTS_GID(attr) ((attr)->valid & (1 << 2))
|
||||
#endif // SETATTR_WANTS_GID
|
||||
|
||||
#ifndef SETATTR_WANTS_SIZE
|
||||
#define SETATTR_WANTS_SIZE(attr) ((attr)->valid & (1 << 3))
|
||||
#endif // SETATTR_WANTS_SIZE
|
||||
|
||||
#ifndef SETATTR_WANTS_ACCTIME
|
||||
#define SETATTR_WANTS_ACCTIME(attr) ((attr)->valid & (1 << 4))
|
||||
#endif // SETATTR_WANTS_ACCTIME
|
||||
|
||||
#ifndef SETATTR_WANTS_MODTIME
|
||||
#define SETATTR_WANTS_MODTIME(attr) ((attr)->valid & (1 << 5))
|
||||
#endif // SETATTR_WANTS_MODTIME
|
||||
|
||||
#ifndef SETATTR_WANTS_CRTIME
|
||||
#define SETATTR_WANTS_CRTIME(attr) ((attr)->valid & (1 << 28))
|
||||
#endif // SETATTR_WANTS_CRTIME
|
||||
|
||||
#ifndef SETATTR_WANTS_CHGTIME
|
||||
#define SETATTR_WANTS_CHGTIME(attr) ((attr)->valid & (1 << 29))
|
||||
#endif // SETATTR_WANTS_CHGTIME
|
||||
|
||||
#ifndef SETATTR_WANTS_BKUPTIME
|
||||
#define SETATTR_WANTS_BKUPTIME(attr) ((attr)->valid & (1 << 30))
|
||||
#endif // SETATTR_WANTS_BKUPTIME
|
||||
|
||||
#ifndef SETATTR_WANTS_FLAGS
|
||||
#define SETATTR_WANTS_FLAGS(attr) ((attr)->valid & (1 << 31))
|
||||
#endif // SETATTR_WANTS_FLAGS
|
||||
|
||||
#ifndef _WIN32
|
||||
#ifdef __APPLE__
|
||||
#define G_PREFIX "org"
|
||||
#define G_KAUTH_FILESEC_XATTR G_PREFIX ".apple.system.Security"
|
||||
#define A_PREFIX "com"
|
||||
#define A_KAUTH_FILESEC_XATTR A_PREFIX ".apple.system.Security"
|
||||
#define XATTR_APPLE_PREFIX "com.apple."
|
||||
#endif
|
||||
|
||||
#ifndef XATTR_NAME_MAX
|
||||
#define XATTR_NAME_MAX 255 /* # chars in an extended attribute name */
|
||||
#endif
|
||||
|
||||
#ifndef XATTR_SIZE_MAX
|
||||
#define XATTR_SIZE_MAX 65536
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef fstat64
|
||||
#define fstat64 fstat
|
||||
#endif
|
||||
|
||||
#ifndef pread64
|
||||
#define pread64 pread
|
||||
#endif
|
||||
|
||||
#ifndef pwrite64
|
||||
#define pwrite64 pwrite
|
||||
#endif
|
||||
|
||||
#ifndef stat64
|
||||
#define stat64 stat
|
||||
#endif
|
||||
|
||||
#ifndef statfs64
|
||||
#define statfs64 statfs
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define UTIME_NOW ((1l << 30) - 1l)
|
||||
#define UTIME_OMIT ((1l << 30) - 2l)
|
||||
#define CONVERT_STATUS_NOT_IMPLEMENTED(e) e
|
||||
#else
|
||||
using BOOLEAN = std::uint8_t;
|
||||
using DWORD = std::uint32_t;
|
||||
using HANDLE = void *;
|
||||
using PUINT32 = std::uint32_t *;
|
||||
using PVOID = void *;
|
||||
using PWSTR = wchar_t *;
|
||||
using SIZE_T = std::uint64_t;
|
||||
using UINT16 = std::uint16_t;
|
||||
using UINT32 = std::uint32_t;
|
||||
using UINT64 = std::uint64_t;
|
||||
using VOID = void;
|
||||
using WCHAR = wchar_t;
|
||||
|
||||
#define FILE_ATTRIBUTE_READONLY 0x00000001
|
||||
#define FILE_ATTRIBUTE_HIDDEN 0x00000002
|
||||
#define FILE_ATTRIBUTE_SYSTEM 0x00000004
|
||||
#define FILE_ATTRIBUTE_DIRECTORY 0x00000010
|
||||
#define FILE_ATTRIBUTE_ARCHIVE 0x00000020
|
||||
#define FILE_ATTRIBUTE_DEVICE 0x00000040
|
||||
#define FILE_ATTRIBUTE_NORMAL 0x00000080
|
||||
#define FILE_ATTRIBUTE_TEMPORARY 0x00000100
|
||||
#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
|
||||
#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
|
||||
#define FILE_ATTRIBUTE_COMPRESSED 0x00000800
|
||||
#define FILE_ATTRIBUTE_OFFLINE 0x00001000
|
||||
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
|
||||
#define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
|
||||
#define FILE_ATTRIBUTE_INTEGRITY_STREAM 0x00008000
|
||||
#define FILE_ATTRIBUTE_VIRTUAL 0x00010000
|
||||
#define FILE_ATTRIBUTE_NO_SCRUB_DATA 0x00020000
|
||||
#define FILE_ATTRIBUTE_EA 0x00040000
|
||||
#define FILE_ATTRIBUTE_PINNED 0x00080000
|
||||
#define FILE_ATTRIBUTE_UNPINNED 0x00100000
|
||||
#define FILE_ATTRIBUTE_RECALL_ON_OPEN 0x00040000
|
||||
#define FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS 0x00400000
|
||||
|
||||
#define FILE_DIRECTORY_FILE 0x00000001
|
||||
|
||||
#define FILE_EXECUTE (0x0020)
|
||||
#define FILE_GENERIC_EXECUTE (0x00020000L | 0x0080 | 0x0020 | 0x00100000L)
|
||||
|
||||
#define GENERIC_READ (0x80000000L)
|
||||
#define GENERIC_WRITE (0x40000000L)
|
||||
#define GENERIC_EXECUTE (0x20000000L)
|
||||
#define GENERIC_ALL (0x10000000L)
|
||||
|
||||
#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
|
||||
|
||||
#define MAX_PATH 260
|
||||
|
||||
#define STATUS_SUCCESS std::int32_t(0)
|
||||
#define STATUS_ACCESS_DENIED std::int32_t(0xC0000022L)
|
||||
#define STATUS_DEVICE_BUSY std::int32_t(0x80000011L)
|
||||
#define STATUS_DEVICE_INSUFFICIENT_RESOURCES std::int32_t(0xC0000468L)
|
||||
#define STATUS_DIRECTORY_NOT_EMPTY std::int32_t(0xC0000101L)
|
||||
#define STATUS_FILE_IS_A_DIRECTORY std::int32_t(0xC00000BAL)
|
||||
#define STATUS_FILE_TOO_LARGE std::int32_t(0xC0000904L)
|
||||
#define STATUS_INSUFFICIENT_RESOURCES std::int32_t(0xC000009AL)
|
||||
#define STATUS_INTERNAL_ERROR std::int32_t(0xC00000E5L)
|
||||
#define STATUS_INVALID_ADDRESS std::int32_t(0xC0000141L)
|
||||
#define STATUS_INVALID_HANDLE std::int32_t(0xC0000006L)
|
||||
#define STATUS_INVALID_IMAGE_FORMAT std::int32_t(0xC000007BL)
|
||||
#define STATUS_INVALID_PARAMETER std::int32_t(0xC000000DL)
|
||||
#define STATUS_NO_MEMORY std::int32_t(0xC0000017L)
|
||||
#define STATUS_NOT_IMPLEMENTED std::int32_t(0xC0000002L)
|
||||
#define STATUS_OBJECT_NAME_EXISTS std::int32_t(0x40000000L)
|
||||
#define STATUS_OBJECT_NAME_NOT_FOUND std::int32_t(0xC0000034L)
|
||||
#define STATUS_OBJECT_PATH_INVALID std::int32_t(0xC0000039L)
|
||||
#define STATUS_UNEXPECTED_IO_ERROR std::int32_t(0xC00000E9L)
|
||||
|
||||
#define CONVERT_STATUS_NOT_IMPLEMENTED(e) \
|
||||
((std::int32_t(e) == STATUS_NOT_IMPLEMENTED) ? -ENOTSUP : e)
|
||||
|
||||
namespace Fsp::FileSystemBase {
|
||||
enum {
|
||||
FspCleanupDelete = 0x01,
|
||||
FspCleanupSetAllocationSize = 0x02,
|
||||
FspCleanupSetArchiveBit = 0x10,
|
||||
FspCleanupSetLastAccessTime = 0x20,
|
||||
FspCleanupSetLastWriteTime = 0x40,
|
||||
FspCleanupSetChangeTime = 0x80
|
||||
};
|
||||
|
||||
struct FSP_FSCTL_FILE_INFO {
|
||||
UINT32 FileAttributes{};
|
||||
UINT32 ReparseTag{};
|
||||
UINT64 AllocationSize{};
|
||||
UINT64 FileSize{};
|
||||
UINT64 CreationTime{};
|
||||
UINT64 LastAccessTime{};
|
||||
UINT64 LastWriteTime{};
|
||||
UINT64 ChangeTime{};
|
||||
UINT64 IndexNumber{};
|
||||
UINT32 HardLinks{};
|
||||
UINT32 EaSize{};
|
||||
};
|
||||
|
||||
using FileInfo = FSP_FSCTL_FILE_INFO;
|
||||
} // namespace Fsp::FileSystemBase
|
||||
#endif
|
||||
|
||||
using namespace Fsp;
|
||||
|
||||
#endif // INCLUDE_PLATFORM_PLATFORM_HPP_
|
||||
|
@ -23,6 +23,7 @@
|
||||
#define INCLUDE_PROVIDERS_ENCRYPT_ENCRYPT_PROVIDER_HPP_
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "database/db_common.hpp"
|
||||
#include "providers/i_provider.hpp"
|
||||
#include "utils/encrypting_reader.hpp"
|
||||
|
||||
@ -49,7 +50,7 @@ private:
|
||||
|
||||
private:
|
||||
app_config &config_;
|
||||
db3_t db_;
|
||||
db::db3_t db_;
|
||||
|
||||
private:
|
||||
i_file_manager *fm_ = nullptr;
|
||||
|
@ -22,6 +22,7 @@
|
||||
#ifndef INCLUDE_PROVIDERS_META_DB_HPP_
|
||||
#define INCLUDE_PROVIDERS_META_DB_HPP_
|
||||
|
||||
#include "database/db_common.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
@ -38,7 +39,7 @@ public:
|
||||
auto operator=(meta_db &&) -> meta_db & = delete;
|
||||
|
||||
private:
|
||||
db3_t db_;
|
||||
db::db3_t db_;
|
||||
constexpr static const auto table_name = "meta";
|
||||
|
||||
private:
|
||||
|
@ -22,6 +22,8 @@
|
||||
#ifndef INCLUDE_TYPES_REMOTE_HPP_
|
||||
#define INCLUDE_TYPES_REMOTE_HPP_
|
||||
|
||||
#include "platform/platform.hpp"
|
||||
|
||||
#define PACKET_SERVICE_FUSE 1U
|
||||
#define PACKET_SERVICE_WINFSP 2U
|
||||
|
||||
|
@ -23,22 +23,56 @@
|
||||
#define INCLUDE_TYPES_REPERTORY_HPP_
|
||||
|
||||
namespace repertory {
|
||||
const std::string META_ACCESSED = "accessed";
|
||||
const std::string META_ATTRIBUTES = "attributes";
|
||||
const std::string META_BACKUP = "backup";
|
||||
const std::string META_CHANGED = "changed";
|
||||
const std::string META_CREATION = "creation";
|
||||
const std::string META_DIRECTORY = "directory";
|
||||
const std::string META_GID = "gid";
|
||||
const std::string META_KEY = "key";
|
||||
const std::string META_MODE = "mode";
|
||||
const std::string META_MODIFIED = "modified";
|
||||
const std::string META_OSXFLAGS = "flags";
|
||||
const std::string META_PINNED = "pinned";
|
||||
const std::string META_SIZE = "size";
|
||||
const std::string META_SOURCE = "source";
|
||||
const std::string META_UID = "uid";
|
||||
const std::string META_WRITTEN = "written";
|
||||
#define REPERTORY "repertory"
|
||||
#define REPERTORY_CONFIG_VERSION 0ull
|
||||
#define REPERTORY_DATA_NAME "repertory2"
|
||||
#define REPERTORY_MIN_REMOTE_VERSION "2.0.0"
|
||||
#define REPERTORY_W L"repertory"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define REPERTORY_INVALID_HANDLE INVALID_HANDLE_VALUE
|
||||
#define REPERTORY_API_INVALID_HANDLE static_cast<std::uint64_t>(-1)
|
||||
using native_handle = HANDLE;
|
||||
#else
|
||||
#define REPERTORY_INVALID_HANDLE (-1)
|
||||
#define REPERTORY_API_INVALID_HANDLE REPERTORY_INVALID_HANDLE
|
||||
using native_handle = int;
|
||||
#endif
|
||||
|
||||
template <class... Ts> struct overloaded : Ts... {
|
||||
using Ts::operator()...;
|
||||
};
|
||||
template <class... Ts> overloaded(Ts...) -> overloaded<Ts...>;
|
||||
|
||||
#define INTERFACE_SETUP(name) \
|
||||
public: \
|
||||
name(const name &) noexcept = delete; \
|
||||
name &operator=(const name &) noexcept = delete; \
|
||||
name &operator=(name &&) noexcept = delete; \
|
||||
\
|
||||
protected: \
|
||||
name() = default; \
|
||||
name(name &&) noexcept = default; \
|
||||
\
|
||||
public: \
|
||||
virtual ~name() = default
|
||||
|
||||
constexpr const std::string META_ACCESSED = "accessed";
|
||||
constexpr const std::string META_ATTRIBUTES = "attributes";
|
||||
constexpr const std::string META_BACKUP = "backup";
|
||||
constexpr const std::string META_CHANGED = "changed";
|
||||
constexpr const std::string META_CREATION = "creation";
|
||||
constexpr const std::string META_DIRECTORY = "directory";
|
||||
constexpr const std::string META_GID = "gid";
|
||||
constexpr const std::string META_KEY = "key";
|
||||
constexpr const std::string META_MODE = "mode";
|
||||
constexpr const std::string META_MODIFIED = "modified";
|
||||
constexpr const std::string META_OSXFLAGS = "flags";
|
||||
constexpr const std::string META_PINNED = "pinned";
|
||||
constexpr const std::string META_SIZE = "size";
|
||||
constexpr const std::string META_SOURCE = "source";
|
||||
constexpr const std::string META_UID = "uid";
|
||||
constexpr const std::string META_WRITTEN = "written";
|
||||
|
||||
const std::vector<std::string> META_USED_NAMES = {
|
||||
META_ACCESSED, META_ATTRIBUTES, META_BACKUP, META_CHANGED,
|
||||
@ -280,11 +314,10 @@ struct s3_config {
|
||||
bool use_region_in_url{false};
|
||||
};
|
||||
|
||||
using data_buffer = std::vector<char>;
|
||||
|
||||
using api_file_list = std::vector<api_file>;
|
||||
using api_file_provider_callback = std::function<void(api_file &)>;
|
||||
using api_item_added_callback = std::function<api_error(bool, api_file &)>;
|
||||
using data_buffer = std::vector<char>;
|
||||
using directory_item_list = std::vector<directory_item>;
|
||||
using http_headers = std::unordered_map<std::string, std::string>;
|
||||
using http_parameters = std::unordered_map<std::string, std::string>;
|
||||
|
@ -31,7 +31,7 @@ TEST(database, db_insert) {
|
||||
console_consumer consumer1;
|
||||
event_system::instance().start();
|
||||
{
|
||||
db3_t db3;
|
||||
db::db3_t db3;
|
||||
{
|
||||
sqlite3 *db3_ptr{nullptr};
|
||||
auto res = sqlite3_open_v2(
|
||||
@ -76,7 +76,7 @@ TEST(database, db_select) {
|
||||
console_consumer consumer1;
|
||||
event_system::instance().start();
|
||||
{
|
||||
db3_t db3;
|
||||
db::db3_t db3;
|
||||
{
|
||||
sqlite3 *db3_ptr{nullptr};
|
||||
auto res = sqlite3_open_v2(
|
||||
|
Loading…
x
Reference in New Issue
Block a user