mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-05 19:02:14 +02:00
fs: Add fsFsSetArchiveBit
This commit is contained in:
parent
fd4afacb01
commit
a2d4699f1f
@ -178,6 +178,11 @@ typedef enum
|
||||
FsFileSystemType_ApplicationPackage = 7
|
||||
} FsFileSystemType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
FsFileSystemQueryType_SetArchiveBit = 0,
|
||||
} FsFileSystemQueryType;
|
||||
|
||||
/// Mount requested filesystem type from content file
|
||||
Result fsOpenFileSystem(FsFileSystem* out, FsFileSystemType fsType, const char* contentPath); /// same as calling fsOpenFileSystemWithId with 0 as titleId
|
||||
Result fsOpenFileSystemWithId(FsFileSystem* out, u64 titleId, FsFileSystemType fsType, const char* contentPath); /// works on all firmwares, titleId is ignored on 1.0.0
|
||||
@ -197,6 +202,9 @@ Result fsFsCommit(FsFileSystem* fs);
|
||||
Result fsFsGetFreeSpace(FsFileSystem* fs, const char* path, u64* out);
|
||||
Result fsFsGetTotalSpace(FsFileSystem* fs, const char* path, u64* out);
|
||||
Result fsFsCleanDirectoryRecursively(FsFileSystem* fs, const char* path);
|
||||
Result fsFsQueryEntry(FsFileSystem* fs, void *out, size_t out_size, const void *in, size_t in_size, const char* path, FsFileSystemQueryType query_type);
|
||||
Result fsFsSetArchiveBit(FsFileSystem* fs, const char *path);
|
||||
|
||||
void fsFsClose(FsFileSystem* fs);
|
||||
|
||||
// IFile
|
||||
|
@ -1007,6 +1007,50 @@ Result fsFsCleanDirectoryRecursively(FsFileSystem* fs, const char* path) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result fsFsQueryEntry(FsFileSystem* fs, void *out, size_t out_size, const void *in, size_t in_size, const char* path, FsFileSystemQueryType query_type) {
|
||||
char send_path[FS_MAX_PATH] = {0};
|
||||
strncpy(send_path, path, sizeof(send_path)-1);
|
||||
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
ipcAddSendStatic(&c, send_path, sizeof(send_path), 0);
|
||||
ipcAddSendBuffer(&c, in, in_size, BufferType_Type1);
|
||||
ipcAddRecvBuffer(&c, out, out_size, BufferType_Type1);
|
||||
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 cmd_id;
|
||||
u32 query_type;
|
||||
} *raw;
|
||||
|
||||
raw = serviceIpcPrepareHeader(&fs->s, &c, sizeof(*raw));
|
||||
|
||||
raw->magic = SFCI_MAGIC;
|
||||
raw->cmd_id = 15;
|
||||
raw->query_type = query_type;
|
||||
|
||||
Result rc = serviceIpcDispatch(&fs->s);
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
IpcParsedCommand r;
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 result;
|
||||
} *resp;
|
||||
|
||||
serviceIpcParse(&fs->s, &r, sizeof(*resp));
|
||||
resp = r.Raw;
|
||||
|
||||
rc = resp->result;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result fsFsSetArchiveBit(FsFileSystem* fs, const char *path) {
|
||||
return fsFsQueryEntry(fs, NULL, 0, NULL, 0, path, FsFileSystemQueryType_SetArchiveBit);
|
||||
}
|
||||
|
||||
void fsFsClose(FsFileSystem* fs) {
|
||||
serviceClose(&fs->s);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user