fs: add GetFileSystemAttribute cmd

This commit is contained in:
Pablo Curiel 2024-03-31 14:43:57 +02:00 committed by yellows8
parent 919e3d3938
commit b69d2fa95e
2 changed files with 42 additions and 2 deletions

View File

@ -326,6 +326,38 @@ typedef enum {
FsFileSystemQueryId_IsValidSignedSystemPartitionOnSdCard = 2, ///< [8.0.0+] FsFileSystemQueryId_IsValidSignedSystemPartitionOnSdCard = 2, ///< [8.0.0+]
} FsFileSystemQueryId; } FsFileSystemQueryId;
/// FileSystemAttribute
typedef struct {
bool directory_name_length_max_has_value;
bool file_name_length_max_has_value;
bool directory_path_length_max_has_value;
bool file_path_length_max_has_value;
bool utf16_create_directory_path_length_max_has_value;
bool utf16_delete_directory_path_length_max_has_value;
bool utf16_rename_source_directory_path_length_max_has_value;
bool utf16_rename_destination_directory_path_length_max_has_value;
bool utf16_open_directory_path_length_max_has_value;
bool utf16_directory_name_length_max_has_value;
bool utf16_file_name_length_max_has_value;
bool utf16_directory_path_length_max_has_value;
bool utf16_file_path_length_max_has_value;
u8 reserved1[0x1B];
s32 directory_name_length_max;
s32 file_name_length_max;
s32 directory_path_length_max;
s32 file_path_length_max;
s32 utf16_create_directory_path_length_max;
s32 utf16_delete_directory_path_length_max;
s32 utf16_rename_source_directory_path_length_max;
s32 utf16_rename_destination_directory_path_length_max;
s32 utf16_open_directory_path_length_max;
s32 utf16_directory_name_length_max;
s32 utf16_file_name_length_max;
s32 utf16_directory_path_length_max;
s32 utf16_file_path_length_max;
u8 reserved2[0x64];
} FsFileSystemAttribute;
/// FsPriority /// FsPriority
typedef enum { typedef enum {
FsPriority_Normal = 0, FsPriority_Normal = 0,
@ -591,6 +623,7 @@ Result fsFsGetTotalSpace(FsFileSystem* fs, const char* path, s64* out);
Result fsFsGetFileTimeStampRaw(FsFileSystem* fs, const char* path, FsTimeStampRaw *out); ///< [3.0.0+] Result fsFsGetFileTimeStampRaw(FsFileSystem* fs, const char* path, FsTimeStampRaw *out); ///< [3.0.0+]
Result fsFsCleanDirectoryRecursively(FsFileSystem* fs, const char* path); ///< [3.0.0+] Result fsFsCleanDirectoryRecursively(FsFileSystem* fs, const char* path); ///< [3.0.0+]
Result fsFsQueryEntry(FsFileSystem* fs, void *out, size_t out_size, const void *in, size_t in_size, const char* 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 char* path, FsFileSystemQueryId query_id); ///< [4.0.0+]
Result fsFsGetFileSystemAttribute(FsFileSystem* fs, FsFileSystemAttribute *out); ///< [15.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.

View File

@ -937,6 +937,13 @@ Result fsFsQueryEntry(FsFileSystem* fs, void *out, size_t out_size, const void *
); );
} }
Result fsFsGetFileSystemAttribute(FsFileSystem* fs, FsFileSystemAttribute *out) {
if (hosversionBefore(15,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _fsObjectDispatchOut(&fs->s, 16, *out);
}
Result fsFsSetConcatenationFileAttribute(FsFileSystem* fs, const char *path) { Result fsFsSetConcatenationFileAttribute(FsFileSystem* fs, const char *path) {
return fsFsQueryEntry(fs, NULL, 0, NULL, 0, path, FsFileSystemQueryId_SetConcatenationFileAttribute); return fsFsQueryEntry(fs, NULL, 0, NULL, 0, path, FsFileSystemQueryId_SetConcatenationFileAttribute);
} }