mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
fs/fs_dev: Added FsFileSystemQueryId_IsValidSignedSystemPartitionOnSdCard, fsFsIsValidSignedSystemPartitionOnSdCard, and fsdevIsValidSignedSystemPartitionOnSdCard. Improved docs.
This commit is contained in:
parent
dea3f140f1
commit
5182b57a1d
@ -56,6 +56,9 @@ int fsdevTranslatePath(const char *path, FsFileSystem** device, char *outpath);
|
||||
/// This calls fsFsSetConcatenationFileAttribute on the filesystem specified by the input path (as used in stdio).
|
||||
Result fsdevSetConcatenationFileAttribute(const char *path);
|
||||
|
||||
// Uses \ref fsFsIsValidSignedSystemPartitionOnSdCard with the specified device.
|
||||
Result fsdevIsValidSignedSystemPartitionOnSdCard(const char *name, bool *out);
|
||||
|
||||
/// This calls fsFsCreateFile on the filesystem specified by the input path (as used in stdio).
|
||||
Result fsdevCreateFile(const char* path, size_t size, u32 flags);
|
||||
|
||||
|
@ -272,8 +272,10 @@ typedef enum {
|
||||
FsFileSystemType_RegisteredUpdate = 8, ///< [4.0.0+] RegisteredUpdate
|
||||
} FsFileSystemType;
|
||||
|
||||
/// FileSystemQueryId
|
||||
typedef enum {
|
||||
FsFileSystemQueryId_SetConcatenationFileAttribute = 0,
|
||||
FsFileSystemQueryId_SetConcatenationFileAttribute = 0, ///< [4.0.0+]
|
||||
FsFileSystemQueryId_IsValidSignedSystemPartitionOnSdCard = 2, ///< [8.0.0+]
|
||||
} FsFileSystemQueryId;
|
||||
|
||||
/// FsPriority
|
||||
@ -380,6 +382,10 @@ void fsFsClose(FsFileSystem* fs);
|
||||
/// This will cause HOS to treat the directory as if it were a file containing the directory's concatenated contents.
|
||||
Result fsFsSetConcatenationFileAttribute(FsFileSystem* fs, const char *path);
|
||||
|
||||
/// Wrapper for fsFsQueryEntry with FsFileSystemQueryId_IsValidSignedSystemPartitionOnSdCard.
|
||||
/// Only available on [8.0.0+].
|
||||
Result fsFsIsValidSignedSystemPartitionOnSdCard(FsFileSystem* fs, bool *out);
|
||||
|
||||
// IFile
|
||||
Result fsFileRead(FsFile* f, s64 off, void* buf, u64 read_size, u32 option, u64* bytes_read);
|
||||
Result fsFileWrite(FsFile* f, s64 off, const void* buf, u64 write_size, u32 option);
|
||||
|
@ -407,6 +407,16 @@ Result fsdevSetConcatenationFileAttribute(const char *path) {
|
||||
return fsFsSetConcatenationFileAttribute(&device->fs, fs_path);
|
||||
}
|
||||
|
||||
Result fsdevIsValidSignedSystemPartitionOnSdCard(const char *name, bool *out) {
|
||||
fsdev_fsdevice *device;
|
||||
|
||||
device = fsdevFindDevice(name);
|
||||
if(device==NULL)
|
||||
return MAKERESULT(Module_Libnx, LibnxError_NotFound);
|
||||
|
||||
return fsFsIsValidSignedSystemPartitionOnSdCard(&device->fs, out);
|
||||
}
|
||||
|
||||
Result fsdevCreateFile(const char* path, size_t size, u32 flags) {
|
||||
char *fs_path = __nx_dev_path_buf;
|
||||
fsdev_fsdevice *device = NULL;
|
||||
|
@ -635,6 +635,16 @@ Result fsFsSetConcatenationFileAttribute(FsFileSystem* fs, const char *path) {
|
||||
return fsFsQueryEntry(fs, NULL, 0, NULL, 0, path, FsFileSystemQueryId_SetConcatenationFileAttribute);
|
||||
}
|
||||
|
||||
Result fsFsIsValidSignedSystemPartitionOnSdCard(FsFileSystem* fs, bool *out) {
|
||||
if (hosversionBefore(8,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
u8 tmp=0;
|
||||
Result rc = fsFsQueryEntry(fs, &tmp, sizeof(tmp), NULL, 0, "/", FsFileSystemQueryId_IsValidSignedSystemPartitionOnSdCard);
|
||||
if (R_SUCCEEDED(rc) && out) *out = tmp & 1;
|
||||
return rc;
|
||||
}
|
||||
|
||||
void fsFsClose(FsFileSystem* fs) {
|
||||
_fsObjectClose(&fs->s);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user