mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-04 02:22:15 +02:00
Const correctness also revert change to FsDirectoryEntry
This commit is contained in:
parent
ec85a2fa5c
commit
4c84d927fe
@ -40,7 +40,7 @@ static inline FsPath fsPathFromLiteralSafe(const char* literal) {
|
|||||||
{
|
{
|
||||||
ret.path[i] = literal[i];
|
ret.path[i] = literal[i];
|
||||||
|
|
||||||
if (literal[i] == 0)
|
if (literal[i] == '\0')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (i == FS_MAX_PATH-1) {
|
if (i == FS_MAX_PATH-1) {
|
||||||
@ -90,7 +90,7 @@ typedef struct {
|
|||||||
|
|
||||||
/// Directory entry.
|
/// Directory entry.
|
||||||
typedef struct {
|
typedef struct {
|
||||||
FsPath name; ///< Entry name.
|
char name[FS_MAX_PATH]; ///< Entry name.
|
||||||
u8 pad[3];
|
u8 pad[3];
|
||||||
s8 type; ///< See FsDirEntryType.
|
s8 type; ///< See FsDirEntryType.
|
||||||
u8 pad2[3]; ///< ?
|
u8 pad2[3]; ///< ?
|
||||||
@ -343,11 +343,11 @@ Service* fsGetServiceSession(void);
|
|||||||
void fsSetPriority(FsPriority prio);
|
void fsSetPriority(FsPriority prio);
|
||||||
|
|
||||||
/// Mount requested filesystem type from content file
|
/// Mount requested filesystem type from content file
|
||||||
Result fsOpenFileSystem(FsFileSystem* out, FsFileSystemType fsType, FsPath* contentPath); ///< same as calling fsOpenFileSystemWithId with 0 as id
|
Result fsOpenFileSystem(FsFileSystem* out, FsFileSystemType fsType, const FsPath* contentPath); ///< same as calling fsOpenFileSystemWithId with 0 as id
|
||||||
Result fsOpenFileSystemWithPatch(FsFileSystem* out, u64 id, FsFileSystemType fsType); ///< [2.0.0+], like OpenFileSystemWithId but without content path.
|
Result fsOpenFileSystemWithPatch(FsFileSystem* out, u64 id, FsFileSystemType fsType); ///< [2.0.0+], like OpenFileSystemWithId but without content path.
|
||||||
Result fsOpenFileSystemWithId(FsFileSystem* out, u64 id, FsFileSystemType fsType, FsPath* contentPath); ///< works on all firmwares, id is ignored on [1.0.0]
|
Result fsOpenFileSystemWithId(FsFileSystem* out, u64 id, FsFileSystemType fsType, const FsPath* contentPath); ///< works on all firmwares, id is ignored on [1.0.0]
|
||||||
|
|
||||||
Result fsOpenBisFileSystem(FsFileSystem* out, FsBisPartitionId partitionId, FsPath* string);
|
Result fsOpenBisFileSystem(FsFileSystem* out, FsBisPartitionId partitionId, const FsPath* path);
|
||||||
Result fsOpenBisStorage(FsStorage* out, FsBisPartitionId partitionId);
|
Result fsOpenBisStorage(FsStorage* out, FsBisPartitionId partitionId);
|
||||||
|
|
||||||
/// Do not call this directly, see fs_dev.h.
|
/// Do not call this directly, see fs_dev.h.
|
||||||
@ -384,10 +384,10 @@ Result fsOpenSdCardDetectionEventNotifier(FsEventNotifier* out);
|
|||||||
Result fsIsSignedSystemPartitionOnSdCardValid(bool *out);
|
Result fsIsSignedSystemPartitionOnSdCardValid(bool *out);
|
||||||
|
|
||||||
/// Retrieves the rights id corresponding to the content path. Only available on [2.0.0+].
|
/// Retrieves the rights id corresponding to the content path. Only available on [2.0.0+].
|
||||||
Result fsGetRightsIdByPath(FsPath* path, FsRightsId* out_rights_id);
|
Result fsGetRightsIdByPath(const FsPath* path, FsRightsId* out_rights_id);
|
||||||
|
|
||||||
/// Retrieves the rights id and key generation corresponding to the content path. Only available on [3.0.0+].
|
/// Retrieves the rights id and key generation corresponding to the content path. Only available on [3.0.0+].
|
||||||
Result fsGetRightsIdAndKeyGenerationByPath(FsPath* path, u8* out_key_generation, FsRightsId* out_rights_id);
|
Result fsGetRightsIdAndKeyGenerationByPath(const FsPath* path, u8* out_key_generation, FsRightsId* out_rights_id);
|
||||||
|
|
||||||
Result fsDisableAutoSaveDataCreation(void);
|
Result fsDisableAutoSaveDataCreation(void);
|
||||||
|
|
||||||
@ -407,27 +407,27 @@ Result fsOpen_SaveData(FsFileSystem* out, u64 application_id, AccountUid uid);
|
|||||||
Result fsOpen_SystemSaveData(FsFileSystem* out, FsSaveDataSpaceId save_data_space_id, u64 system_save_data_id, AccountUid uid);
|
Result fsOpen_SystemSaveData(FsFileSystem* out, FsSaveDataSpaceId save_data_space_id, u64 system_save_data_id, AccountUid uid);
|
||||||
|
|
||||||
// IFileSystem
|
// IFileSystem
|
||||||
Result fsFsCreateFile(FsFileSystem* fs, FsPath* path, s64 size, u32 option);
|
Result fsFsCreateFile(FsFileSystem* fs, const FsPath* path, s64 size, u32 option);
|
||||||
Result fsFsDeleteFile(FsFileSystem* fs, FsPath* path);
|
Result fsFsDeleteFile(FsFileSystem* fs, const FsPath* path);
|
||||||
Result fsFsCreateDirectory(FsFileSystem* fs, FsPath* path);
|
Result fsFsCreateDirectory(FsFileSystem* fs, const FsPath* path);
|
||||||
Result fsFsDeleteDirectory(FsFileSystem* fs, FsPath* path);
|
Result fsFsDeleteDirectory(FsFileSystem* fs, const FsPath* path);
|
||||||
Result fsFsDeleteDirectoryRecursively(FsFileSystem* fs, FsPath* path);
|
Result fsFsDeleteDirectoryRecursively(FsFileSystem* fs, const FsPath* path);
|
||||||
Result fsFsRenameFile(FsFileSystem* fs, FsPath* cur_path, FsPath* new_path);
|
Result fsFsRenameFile(FsFileSystem* fs, const FsPath* cur_path, const FsPath* new_path);
|
||||||
Result fsFsRenameDirectory(FsFileSystem* fs, FsPath* cur_path, FsPath* new_path);
|
Result fsFsRenameDirectory(FsFileSystem* fs, const FsPath* cur_path, const FsPath* new_path);
|
||||||
Result fsFsGetEntryType(FsFileSystem* fs, FsPath* path, FsDirEntryType* out);
|
Result fsFsGetEntryType(FsFileSystem* fs, const FsPath* path, FsDirEntryType* out);
|
||||||
Result fsFsOpenFile(FsFileSystem* fs, FsPath* path, u32 mode, FsFile* out);
|
Result fsFsOpenFile(FsFileSystem* fs, const FsPath* path, u32 mode, FsFile* out);
|
||||||
Result fsFsOpenDirectory(FsFileSystem* fs, FsPath* path, u32 mode, FsDir* out);
|
Result fsFsOpenDirectory(FsFileSystem* fs, const FsPath* path, u32 mode, FsDir* out);
|
||||||
Result fsFsCommit(FsFileSystem* fs);
|
Result fsFsCommit(FsFileSystem* fs);
|
||||||
Result fsFsGetFreeSpace(FsFileSystem* fs, FsPath* path, s64* out);
|
Result fsFsGetFreeSpace(FsFileSystem* fs, const FsPath* path, s64* out);
|
||||||
Result fsFsGetTotalSpace(FsFileSystem* fs, FsPath* path, s64* out);
|
Result fsFsGetTotalSpace(FsFileSystem* fs, const FsPath* path, s64* out);
|
||||||
Result fsFsGetFileTimeStampRaw(FsFileSystem* fs, FsPath* path, FsTimeStampRaw *out); ///< [3.0.0+]
|
Result fsFsGetFileTimeStampRaw(FsFileSystem* fs, const FsPath* path, FsTimeStampRaw *out); ///< [3.0.0+]
|
||||||
Result fsFsCleanDirectoryRecursively(FsFileSystem* fs, FsPath* path); ///< [3.0.0+]
|
Result fsFsCleanDirectoryRecursively(FsFileSystem* fs, const FsPath* path); ///< [3.0.0+]
|
||||||
Result fsFsQueryEntry(FsFileSystem* fs, void *out, size_t out_size, const void *in, size_t in_size, FsPath* path, FsFileSystemQueryId query_id); ///< [4.0.0+]
|
Result fsFsQueryEntry(FsFileSystem* fs, void *out, size_t out_size, const void *in, size_t in_size, const FsPath* path, FsFileSystemQueryId query_id); ///< [4.0.0+]
|
||||||
void fsFsClose(FsFileSystem* fs);
|
void fsFsClose(FsFileSystem* fs);
|
||||||
|
|
||||||
/// Uses \ref fsFsQueryEntry to set the archive bit on the specified absolute directory path.
|
/// Uses \ref fsFsQueryEntry to set the archive bit on the specified absolute directory path.
|
||||||
/// This will cause HOS to treat the directory as if it were a file containing the directory's concatenated contents.
|
/// This will cause HOS to treat the directory as if it were a file containing the directory's concatenated contents.
|
||||||
Result fsFsSetConcatenationFileAttribute(FsFileSystem* fs, FsPath* path);
|
Result fsFsSetConcatenationFileAttribute(FsFileSystem* fs, const FsPath* path);
|
||||||
|
|
||||||
/// Wrapper for fsFsQueryEntry with FsFileSystemQueryId_IsValidSignedSystemPartitionOnSdCard.
|
/// Wrapper for fsFsQueryEntry with FsFileSystemQueryId_IsValidSignedSystemPartitionOnSdCard.
|
||||||
/// Only available on [8.0.0+].
|
/// Only available on [8.0.0+].
|
||||||
|
@ -18,5 +18,5 @@ void fsldrExit(void);
|
|||||||
/// Gets the Service object for the actual fsp-ldr service session.
|
/// Gets the Service object for the actual fsp-ldr service session.
|
||||||
Service* fsldrGetServiceSession(void);
|
Service* fsldrGetServiceSession(void);
|
||||||
|
|
||||||
Result fsldrOpenCodeFileSystem(u64 tid, FsPath* path, FsFileSystem* out);
|
Result fsldrOpenCodeFileSystem(u64 tid, const FsPath* path, FsFileSystem* out);
|
||||||
Result fsldrIsArchivedProgram(u64 pid, bool *out);
|
Result fsldrIsArchivedProgram(u64 pid, bool *out);
|
||||||
|
@ -244,10 +244,10 @@ fsdev_getfspath(struct _reent *r,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t fsdev_convertfromfspath(uint8_t *out, FsPath* in, size_t len)
|
static ssize_t fsdev_convertfromfspath(uint8_t *out, uint8_t* in, size_t len)
|
||||||
{
|
{
|
||||||
ssize_t inlen = strnlen((char*)in->path, len);
|
ssize_t inlen = strnlen((char*)in, len);
|
||||||
memcpy(out, in->path, inlen);
|
memcpy(out, in, inlen);
|
||||||
if (inlen < len)
|
if (inlen < len)
|
||||||
out[inlen+1] = 0;
|
out[inlen+1] = 0;
|
||||||
return inlen;
|
return inlen;
|
||||||
@ -1388,7 +1388,7 @@ fsdev_dirnext(struct _reent *r,
|
|||||||
|
|
||||||
/* convert name from fs-path to UTF-8 */
|
/* convert name from fs-path to UTF-8 */
|
||||||
memset(filename, 0, NAME_MAX);
|
memset(filename, 0, NAME_MAX);
|
||||||
units = fsdev_convertfromfspath((uint8_t*)filename, &entry->name, NAME_MAX);
|
units = fsdev_convertfromfspath((uint8_t*)filename, (uint8_t*)entry->name, NAME_MAX);
|
||||||
if(units < 0)
|
if(units < 0)
|
||||||
{
|
{
|
||||||
r->_errno = EILSEQ;
|
r->_errno = EILSEQ;
|
||||||
|
@ -132,11 +132,11 @@ static Result _fsCmdNoInOutBool(Service* srv, bool *out, u32 cmd_id) {
|
|||||||
// IFileSystemProxy
|
// IFileSystemProxy
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
Result fsOpenFileSystem(FsFileSystem* out, FsFileSystemType fsType, FsPath* contentPath) {
|
Result fsOpenFileSystem(FsFileSystem* out, FsFileSystemType fsType, const FsPath* contentPath) {
|
||||||
return fsOpenFileSystemWithId(out, 0, fsType, contentPath);
|
return fsOpenFileSystemWithId(out, 0, fsType, contentPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result _fsOpenFileSystem(FsFileSystem* out, FsFileSystemType fsType, FsPath* contentPath) {
|
static Result _fsOpenFileSystem(FsFileSystem* out, FsFileSystemType fsType, const FsPath* contentPath) {
|
||||||
u32 tmp=fsType;
|
u32 tmp=fsType;
|
||||||
return _fsObjectDispatchIn(&g_fsSrv, 0, tmp,
|
return _fsObjectDispatchIn(&g_fsSrv, 0, tmp,
|
||||||
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
|
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
|
||||||
@ -161,7 +161,7 @@ Result fsOpenFileSystemWithPatch(FsFileSystem* out, u64 id, FsFileSystemType fsT
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result _fsOpenFileSystemWithId(FsFileSystem* out, u64 id, FsFileSystemType fsType, FsPath* contentPath) {
|
static Result _fsOpenFileSystemWithId(FsFileSystem* out, u64 id, FsFileSystemType fsType, const FsPath* contentPath) {
|
||||||
const struct {
|
const struct {
|
||||||
u32 fsType;
|
u32 fsType;
|
||||||
u64 id;
|
u64 id;
|
||||||
@ -175,14 +175,14 @@ static Result _fsOpenFileSystemWithId(FsFileSystem* out, u64 id, FsFileSystemTyp
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsOpenFileSystemWithId(FsFileSystem* out, u64 id, FsFileSystemType fsType, FsPath* contentPath) {
|
Result fsOpenFileSystemWithId(FsFileSystem* out, u64 id, FsFileSystemType fsType, const FsPath* contentPath) {
|
||||||
if (hosversionAtLeast(2,0,0))
|
if (hosversionAtLeast(2,0,0))
|
||||||
return _fsOpenFileSystemWithId(out, id, fsType, contentPath);
|
return _fsOpenFileSystemWithId(out, id, fsType, contentPath);
|
||||||
else
|
else
|
||||||
return _fsOpenFileSystem(out, fsType, contentPath);
|
return _fsOpenFileSystem(out, fsType, contentPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsOpenBisFileSystem(FsFileSystem* out, FsBisPartitionId partitionId, FsPath* path) {
|
Result fsOpenBisFileSystem(FsFileSystem* out, FsBisPartitionId partitionId, const FsPath* path) {
|
||||||
u32 tmp=partitionId;
|
u32 tmp=partitionId;
|
||||||
return _fsObjectDispatchIn(&g_fsSrv, 11, tmp,
|
return _fsObjectDispatchIn(&g_fsSrv, 11, tmp,
|
||||||
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
|
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
|
||||||
@ -403,7 +403,7 @@ Result fsIsSignedSystemPartitionOnSdCardValid(bool *out) {
|
|||||||
return _fsCmdNoInOutBool(&g_fsSrv, out, 640);
|
return _fsCmdNoInOutBool(&g_fsSrv, out, 640);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsGetRightsIdByPath(FsPath* path, FsRightsId* out_rights_id) {
|
Result fsGetRightsIdByPath(const FsPath* path, FsRightsId* out_rights_id) {
|
||||||
if (hosversionBefore(2,0,0))
|
if (hosversionBefore(2,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
|
|
||||||
@ -413,7 +413,7 @@ Result fsGetRightsIdByPath(FsPath* path, FsRightsId* out_rights_id) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsGetRightsIdAndKeyGenerationByPath(FsPath* path, u8* out_key_generation, FsRightsId* out_rights_id) {
|
Result fsGetRightsIdAndKeyGenerationByPath(const FsPath* path, u8* out_key_generation, FsRightsId* out_rights_id) {
|
||||||
if (hosversionBefore(3,0,0))
|
if (hosversionBefore(3,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
|
|
||||||
@ -497,7 +497,7 @@ Result fsOpen_SystemSaveData(FsFileSystem* out, FsSaveDataSpaceId save_data_spac
|
|||||||
// IFileSystem
|
// IFileSystem
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
Result fsFsCreateFile(FsFileSystem* fs, FsPath* path, s64 size, u32 option) {
|
Result fsFsCreateFile(FsFileSystem* fs, const FsPath* path, s64 size, u32 option) {
|
||||||
const struct {
|
const struct {
|
||||||
u32 option;
|
u32 option;
|
||||||
u64 size;
|
u64 size;
|
||||||
@ -509,30 +509,30 @@ Result fsFsCreateFile(FsFileSystem* fs, FsPath* path, s64 size, u32 option) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result _fsFsCmdWithInPath(FsFileSystem* fs, FsPath* path, u32 cmd_id) {
|
static Result _fsFsCmdWithInPath(FsFileSystem* fs, const FsPath* path, u32 cmd_id) {
|
||||||
return _fsObjectDispatch(&fs->s, cmd_id,
|
return _fsObjectDispatch(&fs->s, cmd_id,
|
||||||
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
|
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
|
||||||
.buffers = { { path, sizeof(*path) } },
|
.buffers = { { path, sizeof(*path) } },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsFsDeleteFile(FsFileSystem* fs, FsPath* path) {
|
Result fsFsDeleteFile(FsFileSystem* fs, const FsPath* path) {
|
||||||
return _fsFsCmdWithInPath(fs, path, 1);
|
return _fsFsCmdWithInPath(fs, path, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsFsCreateDirectory(FsFileSystem* fs, FsPath* path) {
|
Result fsFsCreateDirectory(FsFileSystem* fs, const FsPath* path) {
|
||||||
return _fsFsCmdWithInPath(fs, path, 2);
|
return _fsFsCmdWithInPath(fs, path, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsFsDeleteDirectory(FsFileSystem* fs, FsPath* path) {
|
Result fsFsDeleteDirectory(FsFileSystem* fs, const FsPath* path) {
|
||||||
return _fsFsCmdWithInPath(fs, path, 3);
|
return _fsFsCmdWithInPath(fs, path, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsFsDeleteDirectoryRecursively(FsFileSystem* fs, FsPath* path) {
|
Result fsFsDeleteDirectoryRecursively(FsFileSystem* fs, const FsPath* path) {
|
||||||
return _fsFsCmdWithInPath(fs, path, 4);
|
return _fsFsCmdWithInPath(fs, path, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result _fsFsCmdWithTwoInPaths(FsFileSystem* fs, FsPath* cur_path, FsPath* new_path, u32 cmd_id) {
|
static Result _fsFsCmdWithTwoInPaths(FsFileSystem* fs, const FsPath* cur_path, const FsPath* new_path, u32 cmd_id) {
|
||||||
return _fsObjectDispatch(&fs->s, cmd_id,
|
return _fsObjectDispatch(&fs->s, cmd_id,
|
||||||
.buffer_attrs = {
|
.buffer_attrs = {
|
||||||
SfBufferAttr_HipcPointer | SfBufferAttr_In,
|
SfBufferAttr_HipcPointer | SfBufferAttr_In,
|
||||||
@ -545,22 +545,22 @@ static Result _fsFsCmdWithTwoInPaths(FsFileSystem* fs, FsPath* cur_path, FsPath*
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsFsRenameFile(FsFileSystem* fs, FsPath* cur_path, FsPath* new_path) {
|
Result fsFsRenameFile(FsFileSystem* fs, const FsPath* cur_path, const FsPath* new_path) {
|
||||||
return _fsFsCmdWithTwoInPaths(fs, cur_path, new_path, 5);
|
return _fsFsCmdWithTwoInPaths(fs, cur_path, new_path, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsFsRenameDirectory(FsFileSystem* fs, FsPath* cur_path, FsPath* new_path) {
|
Result fsFsRenameDirectory(FsFileSystem* fs, const FsPath* cur_path, const FsPath* new_path) {
|
||||||
return _fsFsCmdWithTwoInPaths(fs, cur_path, new_path, 6);
|
return _fsFsCmdWithTwoInPaths(fs, cur_path, new_path, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsFsGetEntryType(FsFileSystem* fs, FsPath* path, FsDirEntryType* out) {
|
Result fsFsGetEntryType(FsFileSystem* fs, const FsPath* path, FsDirEntryType* out) {
|
||||||
return _fsObjectDispatchOut(&fs->s, 7, *out,
|
return _fsObjectDispatchOut(&fs->s, 7, *out,
|
||||||
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
|
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
|
||||||
.buffers = { { path, sizeof(*path) } },
|
.buffers = { { path, sizeof(*path) } },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result _fsFsOpenCommon(FsFileSystem* fs, FsPath* path, u32 flags, Service* out, u32 cmd_id) {
|
static Result _fsFsOpenCommon(FsFileSystem* fs, const FsPath* path, u32 flags, Service* out, u32 cmd_id) {
|
||||||
return _fsObjectDispatchIn(&fs->s, cmd_id, flags,
|
return _fsObjectDispatchIn(&fs->s, cmd_id, flags,
|
||||||
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
|
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
|
||||||
.buffers = { { path, sizeof(*path) } },
|
.buffers = { { path, sizeof(*path) } },
|
||||||
@ -569,11 +569,11 @@ static Result _fsFsOpenCommon(FsFileSystem* fs, FsPath* path, u32 flags, Service
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsFsOpenFile(FsFileSystem* fs, FsPath* path, u32 mode, FsFile* out) {
|
Result fsFsOpenFile(FsFileSystem* fs, const FsPath* path, u32 mode, FsFile* out) {
|
||||||
return _fsFsOpenCommon(fs, path, mode, &out->s, 8);
|
return _fsFsOpenCommon(fs, path, mode, &out->s, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsFsOpenDirectory(FsFileSystem* fs, FsPath* path, u32 mode, FsDir* out) {
|
Result fsFsOpenDirectory(FsFileSystem* fs, const FsPath* path, u32 mode, FsDir* out) {
|
||||||
return _fsFsOpenCommon(fs, path, mode, &out->s, 9);
|
return _fsFsOpenCommon(fs, path, mode, &out->s, 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -581,29 +581,29 @@ Result fsFsCommit(FsFileSystem* fs) {
|
|||||||
return _fsCmdNoIO(&fs->s, 10);
|
return _fsCmdNoIO(&fs->s, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result _fsFsCmdWithInPathAndOutU64(FsFileSystem* fs, FsPath* path, u64* out, u32 cmd_id) {
|
static Result _fsFsCmdWithInPathAndOutU64(FsFileSystem* fs, const FsPath* path, u64* out, u32 cmd_id) {
|
||||||
return _fsObjectDispatchOut(&fs->s, cmd_id, *out,
|
return _fsObjectDispatchOut(&fs->s, cmd_id, *out,
|
||||||
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
|
.buffer_attrs = { SfBufferAttr_HipcPointer | SfBufferAttr_In },
|
||||||
.buffers = { { path, sizeof(*path) } },
|
.buffers = { { path, sizeof(*path) } },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsFsGetFreeSpace(FsFileSystem* fs, FsPath* path, s64* out) {
|
Result fsFsGetFreeSpace(FsFileSystem* fs, const FsPath* path, s64* out) {
|
||||||
return _fsFsCmdWithInPathAndOutU64(fs, path, (u64*)out, 11);
|
return _fsFsCmdWithInPathAndOutU64(fs, path, (u64*)out, 11);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsFsGetTotalSpace(FsFileSystem* fs, FsPath* path, s64* out) {
|
Result fsFsGetTotalSpace(FsFileSystem* fs, const FsPath* path, s64* out) {
|
||||||
return _fsFsCmdWithInPathAndOutU64(fs, path, (u64*)out, 12);
|
return _fsFsCmdWithInPathAndOutU64(fs, path, (u64*)out, 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsFsCleanDirectoryRecursively(FsFileSystem* fs, FsPath* path) {
|
Result fsFsCleanDirectoryRecursively(FsFileSystem* fs, const FsPath* path) {
|
||||||
if (hosversionBefore(3,0,0))
|
if (hosversionBefore(3,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
|
|
||||||
return _fsFsCmdWithInPath(fs, path, 13);
|
return _fsFsCmdWithInPath(fs, path, 13);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsFsGetFileTimeStampRaw(FsFileSystem* fs, FsPath* path, FsTimeStampRaw *out) {
|
Result fsFsGetFileTimeStampRaw(FsFileSystem* fs, const FsPath* path, FsTimeStampRaw *out) {
|
||||||
if (hosversionBefore(3,0,0))
|
if (hosversionBefore(3,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
|
|
||||||
@ -613,7 +613,7 @@ Result fsFsGetFileTimeStampRaw(FsFileSystem* fs, FsPath* path, FsTimeStampRaw *o
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsFsQueryEntry(FsFileSystem* fs, void *out, size_t out_size, const void *in, size_t in_size, FsPath* path, FsFileSystemQueryId query_id) {
|
Result fsFsQueryEntry(FsFileSystem* fs, void *out, size_t out_size, const void *in, size_t in_size, const FsPath* path, FsFileSystemQueryId query_id) {
|
||||||
if (hosversionBefore(4,0,0))
|
if (hosversionBefore(4,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
|
|
||||||
@ -631,7 +631,7 @@ Result fsFsQueryEntry(FsFileSystem* fs, void *out, size_t out_size, const void *
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsFsSetConcatenationFileAttribute(FsFileSystem* fs, FsPath* path) {
|
Result fsFsSetConcatenationFileAttribute(FsFileSystem* fs, const FsPath* path) {
|
||||||
return fsFsQueryEntry(fs, NULL, 0, NULL, 0, path, FsFileSystemQueryId_SetConcatenationFileAttribute);
|
return fsFsQueryEntry(fs, NULL, 0, NULL, 0, path, FsFileSystemQueryId_SetConcatenationFileAttribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ Service* fsldrGetServiceSession(void) {
|
|||||||
return &g_fsldrSrv;
|
return &g_fsldrSrv;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsldrOpenCodeFileSystem(u64 tid, FsPath* path, FsFileSystem* out) {
|
Result fsldrOpenCodeFileSystem(u64 tid, const FsPath* path, FsFileSystem* out) {
|
||||||
serviceAssumeDomain(&g_fsldrSrv);
|
serviceAssumeDomain(&g_fsldrSrv);
|
||||||
return serviceDispatchIn(&g_fsldrSrv, 0, tid,
|
return serviceDispatchIn(&g_fsldrSrv, 0, tid,
|
||||||
.buffer_attrs = {
|
.buffer_attrs = {
|
||||||
|
Loading…
Reference in New Issue
Block a user