libnx  v4.8.0
fs.h
Go to the documentation of this file.
1 /**
2  * @file fs.h
3  * @brief Filesystem (fsp-srv) service IPC wrapper.
4  * Normally applications should just use standard stdio not FS-serv directly. However this can be used if obtaining a FsFileSystem, FsFile, or FsStorage, for mounting with fs_dev/romfs_dev, etc.
5  * @author plutoo
6  * @author yellows8
7  * @copyright libnx Authors
8  */
9 #pragma once
10 #include "../types.h"
11 #include "../kernel/event.h"
12 #include "../services/ncm_types.h"
13 #include "../services/acc.h"
14 #include "../sf/service.h"
15 
16 // We use wrapped handles for type safety.
17 
18 #define FS_MAX_PATH 0x301
19 
20 /// For use with \ref FsSaveDataAttribute.
21 #define FS_SAVEDATA_CURRENT_APPLICATIONID 0
22 
23 typedef struct {
24  u8 c[0x10];
25 } FsRightsId;
26 
27 typedef struct {
28  Service s;
29 } FsFileSystem;
30 
31 typedef struct {
32  Service s;
33 } FsFile;
34 
35 typedef struct {
36  Service s;
37 } FsDir;
38 
39 typedef struct {
40  Service s;
41 } FsStorage;
42 
43 typedef struct {
44  Service s;
46 
47 typedef struct {
48  Service s;
50 
51 typedef struct {
52  Service s;
54 
55 /// Directory entry.
56 typedef struct {
57  char name[FS_MAX_PATH]; ///< Entry name.
58  u8 pad[3];
59  s8 type; ///< See FsDirEntryType.
60  u8 pad2[3]; ///< ?
61  s64 file_size; ///< File size.
63 
64 /// SaveDataAttribute
65 typedef struct {
66  u64 application_id; ///< ApplicationId of the savedata to access when accessing other programs' savedata via SaveData, otherwise FS_SAVEDATA_CURRENT_APPLICATIONID.
67  AccountUid uid; ///< \ref AccountUid for the user-specific savedata to access, otherwise 0 for common savedata.
68  u64 system_save_data_id; ///< SystemSaveDataId, 0 for ::FsSaveDataType_Account.
69  u8 save_data_type; ///< \ref FsSaveDataType
70  u8 save_data_rank; ///< \ref FsSaveDataRank
71  u16 save_data_index; ///< SaveDataIndex
72  u32 pad_x24; ///< Padding.
73  u64 unk_x28; ///< 0 for ::FsSaveDataType_System/::FsSaveDataType_Account.
74  u64 unk_x30; ///< 0 for ::FsSaveDataType_System/::FsSaveDataType_Account.
75  u64 unk_x38; ///< 0 for ::FsSaveDataType_System/::FsSaveDataType_Account.
77 
78 /// SaveDataExtraData
79 typedef struct {
80  FsSaveDataAttribute attr; ///< \ref FsSaveDataAttribute
81  u64 owner_id; ///< ProgramId of the owner of this save data. 0 for ::FsSaveDataType_System.
82  u64 timestamp; ///< POSIX timestamp.
83  u32 flags; ///< \ref FsSaveDataFlags
84  u32 unk_x54; ///< Normally 0. Possibly unused?
85  s64 data_size; ///< Usable save data size.
86  s64 journal_size; ///< Journal size of the save data.
87  u64 commit_id; ///< Id of the latest commit.
88  u8 unused[0x190]; ///< Uninitialized.
90 
91 /// SaveDataMetaInfo
92 typedef struct {
93  u32 size;
94  u8 type; ///< \ref FsSaveDataMetaType
95  u8 reserved[0x0B];
97 
98 /// SaveDataCreationInfo
99 typedef struct {
100  s64 save_data_size; ///< Size of the save data.
101  s64 journal_size; ///< Journal size of the save data.
102  u64 available_size; ///< AvailableSize
103  u64 owner_id; ///< ProgramId of the owner of this save data. 0 for ::FsSaveDataType_System.
104  u32 flags; ///< \ref FsSaveDataFlags
105  u8 save_data_space_id; ///< \ref FsSaveDataSpaceId
106  u8 unk; ///< 0 for ::FsSaveDataType_System.
107  u8 padding[0x1a]; ///< Uninitialized for ::FsSaveDataType_System.
109 
110 /// SaveDataInfo
111 typedef struct {
112  u64 save_data_id; ///< SaveDataId
113  u8 save_data_space_id; ///< \ref FsSaveDataSpaceId
114  u8 save_data_type; ///< \ref FsSaveDataType
115  u8 pad[6]; ///< Padding.
116  AccountUid uid; ///< FsSave::userID
117  u64 system_save_data_id; ///< FsSaveDataAttribute::system_save_data_id
118  u64 application_id; ///< ApplicationId for ::FsSaveDataType_Account.
119  u64 size; ///< Raw saveimage size.
120  u16 save_data_index; ///< SaveDataIndex
121  u8 save_data_rank; ///< \ref FsSaveDataRank
122  u8 unk_x3b[0x25]; ///< Unknown. Usually zeros?
124 
125 /// SaveDataFilter
126 typedef struct {
127  bool filter_by_application_id; ///< Filter by \ref FsSaveDataAttribute::application_id
128  bool filter_by_save_data_type; ///< Filter by \ref FsSaveDataAttribute::save_data_type
129  bool filter_by_user_id; ///< Filter by \ref FsSaveDataAttribute::uid
130  bool filter_by_system_save_data_id; ///< Filter by \ref FsSaveDataAttribute::system_save_data_id
131  bool filter_by_index; ///< Filter by \ref FsSaveDataAttribute::save_data_index
132  u8 save_data_rank; ///< \ref FsSaveDataRank
133  u8 padding[0x2]; ///< Padding
134  FsSaveDataAttribute attr; ///< \ref FsSaveDataAttribute
136 
137 typedef struct {
138  u64 created; ///< POSIX timestamp.
139  u64 modified; ///< POSIX timestamp.
140  u64 accessed; ///< POSIX timestamp.
141  u8 is_valid; ///< 0x1 when the timestamps are set.
142  u8 padding[7];
144 
145 /// This is nn::fssystem::ArchiveMacKey. Used by \ref setsysGetThemeKey and \ref setsysSetThemeKey. Does not appear to be in use elsewhere.
146 typedef struct {
147  u8 key[0x10];
149 
150 /// Returned by fsFsGetEntryType.
151 typedef enum {
152  FsDirEntryType_Dir = 0, ///< Entry is a directory.
153  FsDirEntryType_File = 1, ///< Entry is a file.
155 
156 /// For use with fsFsOpenFile.
157 typedef enum {
158  FsOpenMode_Read = BIT(0), ///< Open for reading.
159  FsOpenMode_Write = BIT(1), ///< Open for writing.
160  FsOpenMode_Append = BIT(2), ///< Append file.
161 } FsOpenMode;
162 
163 /// For use with fsFsCreateFile.
164 typedef enum {
165  FsCreateOption_BigFile = BIT(0), ///< Creates a ConcatenationFile (dir with archive bit) instead of file.
167 
168 /// For use with fsFsOpenDirectory.
169 typedef enum {
170  FsDirOpenMode_ReadDirs = BIT(0), ///< Enable reading directory entries.
171  FsDirOpenMode_ReadFiles = BIT(1), ///< Enable reading file entries.
172  FsDirOpenMode_NoFileSize = BIT(31), ///< Causes result entries to not contain filesize information (always 0).
173 } FsDirOpenMode;
174 
175 /// For use with fsFileRead.
176 typedef enum {
177  FsReadOption_None = 0, ///< No option.
178 } FsReadOption;
179 
180 /// For use with fsFileWrite.
181 typedef enum {
182  FsWriteOption_None = 0, ///< No option.
183  FsWriteOption_Flush = BIT(0), ///< Forces a flush after write.
184 } FsWriteOption;
185 
186 typedef enum {
187  FsContentStorageId_System = 0, ///< System
188  FsContentStorageId_User = 1, ///< User
189  FsContentStorageId_SdCard = 2, ///< SdCard
190  FsContentStorageId_System0 = 3, ///< [16.0.0+] System0
192 
193 typedef enum {
194  FsCustomStorageId_System = 0,
195  FsCustomStorageId_SdCard = 1,
196 } FsCustomStorageId;
197 
198 /// ImageDirectoryId
199 typedef enum {
200  FsImageDirectoryId_Nand = 0,
201  FsImageDirectoryId_Sd = 1,
203 
204 /// SaveDataSpaceId
205 typedef enum {
206  FsSaveDataSpaceId_System = 0, ///< System
207  FsSaveDataSpaceId_User = 1, ///< User
208  FsSaveDataSpaceId_SdSystem = 2, ///< SdSystem
209  FsSaveDataSpaceId_Temporary = 3, ///< [3.0.0+] Temporary
210  FsSaveDataSpaceId_SdUser = 4, ///< [4.0.0+] SdUser
211  FsSaveDataSpaceId_ProperSystem = 100, ///< [3.0.0+] ProperSystem
212  FsSaveDataSpaceId_SafeMode = 101, ///< [3.0.0+] SafeMode
213 
214  FsSaveDataSpaceId_All = -1, ///< Pseudo value for fsOpenSaveDataInfoReader().
216 
217 /// SaveDataType
218 typedef enum {
219  FsSaveDataType_System = 0, ///< System
220  FsSaveDataType_Account = 1, ///< Account
221  FsSaveDataType_Bcat = 2, ///< Bcat
222  FsSaveDataType_Device = 3, ///< Device
223  FsSaveDataType_Temporary = 4, ///< [3.0.0+] Temporary
224  FsSaveDataType_Cache = 5, ///< [3.0.0+] Cache
225  FsSaveDataType_SystemBcat = 6, ///< [4.0.0+] SystemBcat
227 
228 /// SaveDataRank
229 typedef enum {
230  FsSaveDataRank_Primary = 0, ///< Primary
231  FsSaveDataRank_Secondary = 1, ///< Secondary
233 
234 /// SaveDataFlags
235 typedef enum {
236  FsSaveDataFlags_KeepAfterResettingSystemSaveData = BIT(0),
237  FsSaveDataFlags_KeepAfterRefurbishment = BIT(1),
238  FsSaveDataFlags_KeepAfterResettingSystemSaveDataWithoutUserSaveData = BIT(2),
239  FsSaveDataFlags_NeedsSecureDelete = BIT(3),
241 
242 /// SaveDataMetaType
243 typedef enum {
244  FsSaveDataMetaType_None = 0,
245  FsSaveDataMetaType_Thumbnail = 1,
246  FsSaveDataMetaType_ExtensionContext = 2,
248 
249 typedef enum {
250  FsGameCardAttribute_AutoBootFlag = BIT(0), ///< Causes the cartridge to automatically start on bootup
251  FsGameCardAttribute_HistoryEraseFlag = BIT(1), ///< Causes NS to throw an error on attempt to load the cartridge
252  FsGameCardAttribute_RepairToolFlag = BIT(2), ///< [4.0.0+] Indicates that this gamecard is a repair tool.
253  FsGameCardAttribute_DifferentRegionCupToTerraDeviceFlag = BIT(3), ///< [9.0.0+] DifferentRegionCupToTerraDeviceFlag
254  FsGameCardAttribute_DifferentRegionCupToGlobalDeviceFlag = BIT(4), ///< [9.0.0+] DifferentRegionCupToGlobalDeviceFlag
256 
257 typedef enum {
258  FsGameCardPartition_Update = 0,
259  FsGameCardPartition_Normal = 1,
260  FsGameCardPartition_Secure = 2,
261  FsGameCardPartition_Logo = 3, ///< [4.0.0+]
263 
264 typedef struct {
265  u32 value;
267 
268 typedef struct {
269  u32 version;
270  u8 pad[0x4];
271  u64 id;
273 
274 typedef struct {
275  u32 aes_ctr_key_type; ///< Contains bitflags describing how data is AES encrypted.
276  u32 speed_emulation_type; ///< Contains bitflags describing how data is emulated.
277  u32 reserved[0x38/sizeof(u32)];
278 } FsRangeInfo;
279 
280 typedef enum {
281  FsOperationId_Clear, ///< Fill range with zero for supported file/storage.
282  FsOperationId_ClearSignature, ///< Clears signature for supported file/storage.
283  FsOperationId_InvalidateCache, ///< Invalidates cache for supported file/storage.
284  FsOperationId_QueryRange, ///< Retrieves information on data for supported file/storage.
285 } FsOperationId;
286 
287 /// BisPartitionId
288 typedef enum {
289  FsBisPartitionId_BootPartition1Root = 0,
290 
291  FsBisPartitionId_BootPartition2Root = 10,
292 
293  FsBisPartitionId_UserDataRoot = 20,
294  FsBisPartitionId_BootConfigAndPackage2Part1 = 21,
295  FsBisPartitionId_BootConfigAndPackage2Part2 = 22,
296  FsBisPartitionId_BootConfigAndPackage2Part3 = 23,
297  FsBisPartitionId_BootConfigAndPackage2Part4 = 24,
298  FsBisPartitionId_BootConfigAndPackage2Part5 = 25,
299  FsBisPartitionId_BootConfigAndPackage2Part6 = 26,
300  FsBisPartitionId_CalibrationBinary = 27,
301  FsBisPartitionId_CalibrationFile = 28,
302  FsBisPartitionId_SafeMode = 29,
303  FsBisPartitionId_User = 30,
304  FsBisPartitionId_System = 31,
305  FsBisPartitionId_SystemProperEncryption = 32,
306  FsBisPartitionId_SystemProperPartition = 33,
307  FsBisPartitionId_SignedSystemPartitionOnSafeMode = 34,
308  FsBisPartitionId_DeviceTreeBlob = 35,
309  FsBisPartitionId_System0 = 36,
311 
312 /// FileSystemType
313 typedef enum {
314  FsFileSystemType_Logo = 2, ///< Logo
315  FsFileSystemType_ContentControl = 3, ///< ContentControl
316  FsFileSystemType_ContentManual = 4, ///< ContentManual
317  FsFileSystemType_ContentMeta = 5, ///< ContentMeta
318  FsFileSystemType_ContentData = 6, ///< ContentData
319  FsFileSystemType_ApplicationPackage = 7, ///< ApplicationPackage
320  FsFileSystemType_RegisteredUpdate = 8, ///< [4.0.0+] RegisteredUpdate
322 
323 /// FileSystemQueryId
324 typedef enum {
328 
329 /// FileSystemAttribute
330 typedef struct {
331  bool directory_name_length_max_has_value;
332  bool file_name_length_max_has_value;
333  bool directory_path_length_max_has_value;
334  bool file_path_length_max_has_value;
335  bool utf16_create_directory_path_length_max_has_value;
336  bool utf16_delete_directory_path_length_max_has_value;
337  bool utf16_rename_source_directory_path_length_max_has_value;
338  bool utf16_rename_destination_directory_path_length_max_has_value;
339  bool utf16_open_directory_path_length_max_has_value;
340  bool utf16_directory_name_length_max_has_value;
341  bool utf16_file_name_length_max_has_value;
342  bool utf16_directory_path_length_max_has_value;
343  bool utf16_file_path_length_max_has_value;
344  u8 reserved1[0x1B];
345  s32 directory_name_length_max;
346  s32 file_name_length_max;
347  s32 directory_path_length_max;
348  s32 file_path_length_max;
349  s32 utf16_create_directory_path_length_max;
350  s32 utf16_delete_directory_path_length_max;
351  s32 utf16_rename_source_directory_path_length_max;
352  s32 utf16_rename_destination_directory_path_length_max;
353  s32 utf16_open_directory_path_length_max;
354  s32 utf16_directory_name_length_max;
355  s32 utf16_file_name_length_max;
356  s32 utf16_directory_path_length_max;
357  s32 utf16_file_path_length_max;
358  u8 reserved2[0x64];
360 
361 /// FsPriority
362 typedef enum {
363  FsPriority_Normal = 0,
364  FsPriority_Realtime = 1,
365  FsPriority_Low = 2,
366  FsPriority_Background = 3,
367 } FsPriority;
368 
369 /// FsContentAttributes
370 typedef enum {
371  FsContentAttributes_None = 0x0,
372  FsContentAttributes_All = 0xF,
374 
375 /// For use with fsOpenHostFileSystemWithOption
376 typedef enum {
377  FsMountHostOptionFlag_None = 0, ///< Host filesystem will be case insensitive.
378  FsMountHostOptionFlag_PseudoCaseSensitive = BIT(0), ///< Host filesystem will be pseudo case sensitive.
380 
381 /// FsStorageErrorInfo
382 typedef struct {
383  u32 num_activation_failures;
384  u32 num_activation_error_corrections;
385  u32 num_read_write_failures;
386  u32 num_read_write_error_corrections;
388 
389 /// FatFatError
390 typedef struct {
391  s32 error;
392  s32 extra_error;
393  s32 drive_id;
394  char name[16];
395  u8 reserved[4];
396 } FatFatError;
397 
398 /// FatFatReportInfo1
399 typedef struct {
400  u16 open_file_peak_count;
401  u16 open_directory_peak_count;
403 
404 /// FatFatReportInfo2
405 typedef struct {
406  u16 open_unique_file_entry_peak_count;
407  u16 open_unique_directory_entry_peak_count;
409 
410 /// FatFatSafeInfo
411 typedef struct {
412  u32 result;
413  u32 error_number;
414  u32 safe_error_number;
416 
417 /// FsFileSystemProxyErrorInfo
418 typedef struct {
419  u32 rom_fs_remount_for_data_corruption_count;
420  u32 rom_fs_unrecoverable_data_corruption_by_remount_count;
421  FatFatError fat_fs_error;
422  u32 rom_fs_recovered_by_invalidate_cache_count;
423  u32 save_data_index_count;
424  FatFatReportInfo1 bis_system_fat_report_info_1;
425  FatFatReportInfo1 bis_user_fat_report_info_1;
426  FatFatReportInfo1 sd_card_fat_report_info_1;
427  FatFatReportInfo2 bis_system_fat_report_info_2;
428  FatFatReportInfo2 bis_user_fat_report_info_2;
429  FatFatReportInfo2 sd_card_fat_report_info_2;
430  u32 rom_fs_deep_retry_start_count;
431  u32 rom_fs_unrecoverable_by_game_card_access_failed_count;
432  FatFatSafeInfo bis_system_fat_safe_info;
433  FatFatSafeInfo bis_user_fat_safe_info;
434 
435  u8 reserved[0x18];
437 
438 /// FsMemoryReportInfo
439 typedef struct {
440  u64 pooled_buffer_peak_free_size;
441  u64 pooled_buffer_retried_count;
442  u64 pooled_buffer_reduce_allocation_count;
443  u64 buffer_manager_peak_free_size;
444  u64 buffer_manager_retried_count;
445  u64 exp_heap_peak_free_size;
446  u64 buffer_pool_peak_free_size;
447  u64 patrol_read_allocate_buffer_success_count;
448  u64 patrol_read_allocate_buffer_failure_count;
449  u64 buffer_manager_peak_total_allocatable_size;
450  u64 buffer_pool_max_allocate_size;
451  u64 pooled_buffer_failed_ideal_allocation_count_on_async_access;
452 
453  u8 reserved[0x20];
455 
456 /// FsGameCardErrorReportInfo
457 typedef struct {
458  u16 game_card_crc_error_num;
459  u16 reserved1;
460  u16 asic_crc_error_num;
461  u16 reserved2;
462  u16 refresh_num;
463  u16 reserved3;
464  u16 retry_limit_out_num;
465  u16 timeout_retry_num;
466  u16 asic_reinitialize_failure_detail;
467  u16 insertion_count;
468  u16 removal_count;
469  u16 asic_reinitialize_num;
470  u32 initialize_count;
471  u16 asic_reinitialize_failure_num;
472  u16 awaken_failure_num;
473  u16 reserved4;
474  u16 refresh_succeeded_count;
475  u32 last_read_error_page_address;
476  u32 last_read_error_page_count;
477  u32 awaken_count;
478  u32 read_count_from_insert;
479  u32 read_count_from_awaken;
480  u8 reserved5[8];
482 
483 /// Initialize fsp-srv. Used automatically during app startup.
485 
486 /// Exit fsp-srv. Used automatically during app exit.
487 void fsExit(void);
488 
489 /// Gets the Service object for the actual fsp-srv service session.
491 
492 /// [5.0.0+] Configures the \ref FsPriority of all filesystem commands issued within the current thread.
494 
495 /// Mount requested filesystem type from content file
496 Result fsOpenFileSystem(FsFileSystem* out, FsFileSystemType fsType, const char* contentPath); ///< same as calling fsOpenFileSystemWithId with 0 as id
497 Result fsOpenDataFileSystemByCurrentProcess(FsFileSystem *out);
498 Result fsOpenFileSystemWithPatch(FsFileSystem* out, u64 id, FsFileSystemType fsType); ///< [2.0.0+], like OpenFileSystemWithId but without content path.
499 Result fsOpenFileSystemWithId(FsFileSystem* out, u64 id, FsFileSystemType fsType, const char* contentPath, FsContentAttributes attr); ///< works on all firmwares, id is ignored on [1.0.0], attr is ignored before [16.0.0]
500 Result fsOpenDataFileSystemByProgramId(FsFileSystem *out, u64 program_id); ///< [3.0.0+]
501 Result fsOpenBisFileSystem(FsFileSystem* out, FsBisPartitionId partitionId, const char* string);
502 Result fsOpenBisStorage(FsStorage* out, FsBisPartitionId partitionId);
503 
504 /// Do not call this directly, see fs_dev.h.
506 
507 Result fsOpenHostFileSystem(FsFileSystem* out, const char *path);
508 Result fsOpenHostFileSystemWithOption(FsFileSystem* out, const char *path, u32 flags); ///< [9.0.0+]
509 
510 Result fsDeleteSaveDataFileSystem(u64 application_id);
511 Result fsCreateSaveDataFileSystem(const FsSaveDataAttribute* attr, const FsSaveDataCreationInfo* creation_info, const FsSaveDataMetaInfo* meta);
512 Result fsCreateSaveDataFileSystemBySystemSaveDataId(const FsSaveDataAttribute* attr, const FsSaveDataCreationInfo* creation_info);
515 
516 Result fsIsExFatSupported(bool* out);
517 
518 Result fsOpenGameCardFileSystem(FsFileSystem* out, const FsGameCardHandle* handle, FsGameCardPartition partition);
519 
520 Result fsExtendSaveDataFileSystem(FsSaveDataSpaceId save_data_space_id, u64 saveID, s64 dataSize, s64 journalSize); ///< [3.0.0+]
521 
522 Result fsOpenSaveDataFileSystem(FsFileSystem* out, FsSaveDataSpaceId save_data_space_id, const FsSaveDataAttribute *attr);
523 Result fsOpenSaveDataFileSystemBySystemSaveDataId(FsFileSystem* out, FsSaveDataSpaceId save_data_space_id, const FsSaveDataAttribute *attr);
524 Result fsOpenReadOnlySaveDataFileSystem(FsFileSystem* out, FsSaveDataSpaceId save_data_space_id, const FsSaveDataAttribute *attr); ///< [2.0.0+].
525 
526 Result fsReadSaveDataFileSystemExtraDataBySaveDataSpaceId(void* buf, size_t len, FsSaveDataSpaceId save_data_space_id, u64 saveID);
527 Result fsReadSaveDataFileSystemExtraData(void* buf, size_t len, u64 saveID);
528 Result fsWriteSaveDataFileSystemExtraData(const void* buf, size_t len, FsSaveDataSpaceId save_data_space_id, u64 saveID);
529 
530 Result fsOpenSaveDataInfoReader(FsSaveDataInfoReader* out, FsSaveDataSpaceId save_data_space_id);
531 
532 Result fsOpenSaveDataInfoReaderWithFilter(FsSaveDataInfoReader* out, FsSaveDataSpaceId save_data_space_id, const FsSaveDataFilter *save_data_filter); ///< [6.0.0+]
533 
534 Result fsOpenImageDirectoryFileSystem(FsFileSystem* out, FsImageDirectoryId image_directory_id);
535 Result fsOpenContentStorageFileSystem(FsFileSystem* out, FsContentStorageId content_storage_id);
536 Result fsOpenCustomStorageFileSystem(FsFileSystem* out, FsCustomStorageId custom_storage_id); ///< [7.0.0+]
537 
538 Result fsOpenDataStorageByCurrentProcess(FsStorage* out);
539 Result fsOpenDataStorageByProgramId(FsStorage *out, u64 program_id); /// <[3.0.0+]
541 Result fsOpenPatchDataStorageByCurrentProcess(FsStorage* out);
542 
543 Result fsOpenDeviceOperator(FsDeviceOperator* out);
544 Result fsOpenSdCardDetectionEventNotifier(FsEventNotifier* out);
545 
546 Result fsIsSignedSystemPartitionOnSdCardValid(bool *out);
547 
548 Result fsGetProgramId(u64* out, const char *path, FsContentAttributes attr); ///< [17.0.0+]
549 
550 /// Retrieves the rights id corresponding to the content path. Only available on [2.0.0-15.0.1].
551 Result fsGetRightsIdByPath(const char* path, FsRightsId* out_rights_id);
552 
553 /// Retrieves the rights id and key generation corresponding to the content path. Only available on [3.0.0+], attr is ignored before [16.0.0].
554 Result fsGetRightsIdAndKeyGenerationByPath(const char* path, FsContentAttributes attr, u8* out_key_generation, FsRightsId* out_rights_id);
555 
557 
558 Result fsDisableAutoSaveDataCreation(void);
559 
560 Result fsSetGlobalAccessLogMode(u32 mode);
561 Result fsGetGlobalAccessLogMode(u32* out_mode);
562 Result fsOutputAccessLogToSdCard(const char *log, size_t size);
563 
565 
567 
568 /// Only available on [7.0.0+].
569 Result fsGetProgramIndexForAccessLog(u32 *out_program_index, u32 *out_program_count);
570 
571 // Wrapper(s) for fsCreateSaveDataFileSystem.
572 Result fsCreate_TemporaryStorage(u64 application_id, u64 owner_id, s64 size, u32 flags);
573 
574 // Wrapper(s) for fsCreateSaveDataFileSystemBySystemSaveDataId.
575 Result fsCreate_SystemSaveDataWithOwner(FsSaveDataSpaceId save_data_space_id, u64 system_save_data_id, AccountUid uid, u64 owner_id, s64 size, s64 journal_size, u32 flags);
576 Result fsCreate_SystemSaveData(FsSaveDataSpaceId save_data_space_id, u64 system_save_data_id, s64 size, s64 journal_size, u32 flags);
577 
578 /// Wrapper for fsOpenSaveDataFileSystem.
579 /// See \ref FsSaveDataAttribute for application_id and uid.
580 Result fsOpen_SaveData(FsFileSystem* out, u64 application_id, AccountUid uid);
581 
582 /// Wrapper for fsOpenReadOnlySaveDataFileSystem.
583 /// Only available on [2.0.0+].
584 /// See \ref FsSaveDataAttribute for application_id and uid.
586 
587 /// Wrapper for fsOpenSaveDataFileSystem, for opening BcatSaveData.
589 
590 /// Wrapper for fsOpenSaveDataFileSystem, for opening DeviceSaveData.
591 /// See \ref FsSaveDataAttribute for application_id.
593 
594 /// Wrapper for fsOpenSaveDataFileSystem, for opening TemporaryStorage.
595 /// Only available on [3.0.0+].
597 
598 /// Wrapper for fsOpenSaveDataFileSystem, for opening CacheStorage.
599 /// Only available on [3.0.0+].
600 /// See \ref FsSaveDataAttribute for application_id.
601 Result fsOpen_CacheStorage(FsFileSystem* out, u64 application_id, u16 save_data_index);
602 
603 /// Wrapper for fsOpenSaveDataFileSystemBySystemSaveDataId, for opening SystemSaveData.
604 /// WARNING: You can brick when writing to SystemSaveData, if the data is corrupted etc.
605 Result fsOpen_SystemSaveData(FsFileSystem* out, FsSaveDataSpaceId save_data_space_id, u64 system_save_data_id, AccountUid uid);
606 
607 /// Wrapper for fsOpenSaveDataFileSystemBySystemSaveDataId, for opening SystemBcatSaveData.
608 /// Only available on [4.0.0+].
610 
611 // IFileSystem
612 Result fsFsCreateFile(FsFileSystem* fs, const char* path, s64 size, u32 option);
613 Result fsFsDeleteFile(FsFileSystem* fs, const char* path);
614 Result fsFsCreateDirectory(FsFileSystem* fs, const char* path);
615 Result fsFsDeleteDirectory(FsFileSystem* fs, const char* path);
616 Result fsFsDeleteDirectoryRecursively(FsFileSystem* fs, const char* path);
617 Result fsFsRenameFile(FsFileSystem* fs, const char* cur_path, const char* new_path);
618 Result fsFsRenameDirectory(FsFileSystem* fs, const char* cur_path, const char* new_path);
619 Result fsFsGetEntryType(FsFileSystem* fs, const char* path, FsDirEntryType* out);
620 Result fsFsOpenFile(FsFileSystem* fs, const char* path, u32 mode, FsFile* out);
621 Result fsFsOpenDirectory(FsFileSystem* fs, const char* path, u32 mode, FsDir* out);
622 Result fsFsCommit(FsFileSystem* fs);
623 Result fsFsGetFreeSpace(FsFileSystem* fs, const char* path, s64* out);
624 Result fsFsGetTotalSpace(FsFileSystem* fs, const char* path, s64* out);
625 Result fsFsGetFileTimeStampRaw(FsFileSystem* fs, const char* path, FsTimeStampRaw *out); ///< [3.0.0+]
626 Result fsFsCleanDirectoryRecursively(FsFileSystem* fs, const char* path); ///< [3.0.0+]
627 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+]
629 void fsFsClose(FsFileSystem* fs);
630 
631 /// Uses \ref fsFsQueryEntry to set the archive bit on the specified absolute directory path.
632 /// This will cause HOS to treat the directory as if it were a file containing the directory's concatenated contents.
634 
635 /// Wrapper for fsFsQueryEntry with FsFileSystemQueryId_IsValidSignedSystemPartitionOnSdCard.
636 /// Only available on [8.0.0+].
638 
639 // IFile
640 Result fsFileRead(FsFile* f, s64 off, void* buf, u64 read_size, u32 option, u64* bytes_read);
641 Result fsFileWrite(FsFile* f, s64 off, const void* buf, u64 write_size, u32 option);
642 Result fsFileFlush(FsFile* f);
643 Result fsFileSetSize(FsFile* f, s64 sz);
644 Result fsFileGetSize(FsFile* f, s64* out);
645 Result fsFileOperateRange(FsFile* f, FsOperationId op_id, s64 off, s64 len, FsRangeInfo* out); ///< [4.0.0+]
646 void fsFileClose(FsFile* f);
647 
648 // IDirectory
649 Result fsDirRead(FsDir* d, s64* total_entries, size_t max_entries, FsDirectoryEntry *buf);
650 Result fsDirGetEntryCount(FsDir* d, s64* count);
651 void fsDirClose(FsDir* d);
652 
653 // IStorage
654 Result fsStorageRead(FsStorage* s, s64 off, void* buf, u64 read_size);
655 Result fsStorageWrite(FsStorage* s, s64 off, const void* buf, u64 write_size);
656 Result fsStorageFlush(FsStorage* s);
657 Result fsStorageSetSize(FsStorage* s, s64 sz);
658 Result fsStorageGetSize(FsStorage* s, s64* out);
659 Result fsStorageOperateRange(FsStorage* s, FsOperationId op_id, s64 off, s64 len, FsRangeInfo* out); ///< [4.0.0+]
660 void fsStorageClose(FsStorage* s);
661 
662 // ISaveDataInfoReader
663 
664 /// Read FsSaveDataInfo data into the buf array.
665 Result fsSaveDataInfoReaderRead(FsSaveDataInfoReader *s, FsSaveDataInfo* buf, size_t max_entries, s64* total_entries);
666 void fsSaveDataInfoReaderClose(FsSaveDataInfoReader *s);
667 
668 // IEventNotifier
669 Result fsEventNotifierGetEventHandle(FsEventNotifier* e, Event* out, bool autoclear);
670 void fsEventNotifierClose(FsEventNotifier* e);
671 
672 // IDeviceOperator
673 Result fsDeviceOperatorIsSdCardInserted(FsDeviceOperator* d, bool* out);
674 Result fsDeviceOperatorGetSdCardSpeedMode(FsDeviceOperator* d, s64* out);
675 Result fsDeviceOperatorGetSdCardCid(FsDeviceOperator* d, void* dst, size_t dst_size, s64 size);
676 Result fsDeviceOperatorGetSdCardUserAreaSize(FsDeviceOperator* d, s64* out);
677 Result fsDeviceOperatorGetSdCardProtectedAreaSize(FsDeviceOperator* d, s64* out);
678 Result fsDeviceOperatorGetAndClearSdCardErrorInfo(FsDeviceOperator* d, FsStorageErrorInfo* out, s64 *out_log_size, void *dst, size_t dst_size, s64 size);
679 Result fsDeviceOperatorGetMmcCid(FsDeviceOperator* d, void* dst, size_t dst_size, s64 size);
680 Result fsDeviceOperatorGetMmcSpeedMode(FsDeviceOperator* d, s64* out);
681 Result fsDeviceOperatorGetMmcPatrolCount(FsDeviceOperator* d, u32* out);
682 Result fsDeviceOperatorGetAndClearMmcErrorInfo(FsDeviceOperator* d, FsStorageErrorInfo* out, s64 *out_log_size, void *dst, size_t dst_size, s64 size);
683 Result fsDeviceOperatorGetMmcExtendedCsd(FsDeviceOperator* d, void* dst, size_t dst_size, s64 size);
684 Result fsDeviceOperatorIsGameCardInserted(FsDeviceOperator* d, bool* out);
685 Result fsDeviceOperatorGetGameCardHandle(FsDeviceOperator* d, FsGameCardHandle* out);
686 Result fsDeviceOperatorGetGameCardUpdatePartitionInfo(FsDeviceOperator* d, const FsGameCardHandle* handle, FsGameCardUpdatePartitionInfo* out);
687 Result fsDeviceOperatorGetGameCardAttribute(FsDeviceOperator* d, const FsGameCardHandle* handle, u8 *out);
688 Result fsDeviceOperatorGetGameCardDeviceCertificate(FsDeviceOperator* d, const FsGameCardHandle* handle, void* dst, size_t dst_size, s64* out_size, s64 size);
689 Result fsDeviceOperatorGetGameCardIdSet(FsDeviceOperator* d, void* dst, size_t dst_size, s64 size);
690 Result fsDeviceOperatorGetGameCardErrorReportInfo(FsDeviceOperator* d, FsGameCardErrorReportInfo* out);
691 Result fsDeviceOperatorGetGameCardDeviceId(FsDeviceOperator* d, void* dst, size_t dst_size, s64 size);
692 Result fsDeviceOperatorChallengeCardExistence(FsDeviceOperator* d, const FsGameCardHandle* handle, void* dst, size_t dst_size, void* seed, size_t seed_size, void* value, size_t value_size);
693 void fsDeviceOperatorClose(FsDeviceOperator* d);
Result fsOpen_SystemBcatSaveData(FsFileSystem *out, u64 system_save_data_id)
Wrapper for fsOpenSaveDataFileSystemBySystemSaveDataId, for opening SystemBcatSaveData.
FsCreateOption
For use with fsFsCreateFile.
Definition: fs.h:164
@ FsCreateOption_BigFile
Creates a ConcatenationFile (dir with archive bit) instead of file.
Definition: fs.h:165
FsOpenMode
For use with fsFsOpenFile.
Definition: fs.h:157
@ FsOpenMode_Read
Open for reading.
Definition: fs.h:158
@ FsOpenMode_Append
Append file.
Definition: fs.h:160
@ FsOpenMode_Write
Open for writing.
Definition: fs.h:159
Result fsOpen_CacheStorage(FsFileSystem *out, u64 application_id, u16 save_data_index)
Wrapper for fsOpenSaveDataFileSystem, for opening CacheStorage.
Result fsOpen_DeviceSaveData(FsFileSystem *out, u64 application_id)
Wrapper for fsOpenSaveDataFileSystem, for opening DeviceSaveData.
FsFileSystemQueryId
FileSystemQueryId.
Definition: fs.h:324
@ FsFileSystemQueryId_SetConcatenationFileAttribute
[4.0.0+]
Definition: fs.h:325
@ FsFileSystemQueryId_IsValidSignedSystemPartitionOnSdCard
[8.0.0+]
Definition: fs.h:326
Result fsStorageOperateRange(FsStorage *s, FsOperationId op_id, s64 off, s64 len, FsRangeInfo *out)
[4.0.0+]
void fsSetPriority(FsPriority prio)
[5.0.0+] Configures the FsPriority of all filesystem commands issued within the current thread.
FsOperationId
Definition: fs.h:280
@ FsOperationId_InvalidateCache
Invalidates cache for supported file/storage.
Definition: fs.h:283
@ FsOperationId_Clear
Fill range with zero for supported file/storage.
Definition: fs.h:281
@ FsOperationId_QueryRange
Retrieves information on data for supported file/storage.
Definition: fs.h:284
@ FsOperationId_ClearSignature
Clears signature for supported file/storage.
Definition: fs.h:282
FsContentStorageId
Definition: fs.h:186
@ FsContentStorageId_SdCard
SdCard.
Definition: fs.h:189
@ FsContentStorageId_User
User.
Definition: fs.h:188
@ FsContentStorageId_System
System.
Definition: fs.h:187
@ FsContentStorageId_System0
[16.0.0+] System0
Definition: fs.h:190
Result fsOpenReadOnlySaveDataFileSystem(FsFileSystem *out, FsSaveDataSpaceId save_data_space_id, const FsSaveDataAttribute *attr)
[2.0.0+].
Result fsFsIsValidSignedSystemPartitionOnSdCard(FsFileSystem *fs, bool *out)
Wrapper for fsFsQueryEntry with FsFileSystemQueryId_IsValidSignedSystemPartitionOnSdCard.
FsImageDirectoryId
ImageDirectoryId.
Definition: fs.h:199
Result fsOpen_SaveData(FsFileSystem *out, u64 application_id, AccountUid uid)
Wrapper for fsOpenSaveDataFileSystem.
void fsExit(void)
Exit fsp-srv. Used automatically during app exit.
Result fsOpenFileSystemWithId(FsFileSystem *out, u64 id, FsFileSystemType fsType, const char *contentPath, FsContentAttributes attr)
works on all firmwares, id is ignored on [1.0.0], attr is ignored before [16.0.0]
Result fsOpen_SystemSaveData(FsFileSystem *out, FsSaveDataSpaceId save_data_space_id, u64 system_save_data_id, AccountUid uid)
Wrapper for fsOpenSaveDataFileSystemBySystemSaveDataId, for opening SystemSaveData.
Result fsOpen_TemporaryStorage(FsFileSystem *out)
Wrapper for fsOpenSaveDataFileSystem, for opening TemporaryStorage.
Result fsDeleteSaveDataFileSystemBySaveDataAttribute(FsSaveDataSpaceId save_data_space_id, const FsSaveDataAttribute *attr)
[4.0.0+]
FsFileSystemType
FileSystemType.
Definition: fs.h:313
@ FsFileSystemType_RegisteredUpdate
[4.0.0+] RegisteredUpdate
Definition: fs.h:320
@ FsFileSystemType_ApplicationPackage
ApplicationPackage.
Definition: fs.h:319
@ FsFileSystemType_ContentManual
ContentManual.
Definition: fs.h:316
@ FsFileSystemType_ContentControl
ContentControl.
Definition: fs.h:315
@ FsFileSystemType_Logo
Logo.
Definition: fs.h:314
@ FsFileSystemType_ContentData
ContentData.
Definition: fs.h:318
@ FsFileSystemType_ContentMeta
ContentMeta.
Definition: fs.h:317
Result fsOpenFileSystem(FsFileSystem *out, FsFileSystemType fsType, const char *contentPath)
Mount requested filesystem type from content file.
Result fsFsGetFileSystemAttribute(FsFileSystem *fs, FsFileSystemAttribute *out)
[15.0.0+]
Result fsOpen_BcatSaveData(FsFileSystem *out, u64 application_id)
Wrapper for fsOpenSaveDataFileSystem, for opening BcatSaveData.
FsBisPartitionId
BisPartitionId.
Definition: fs.h:288
FsContentAttributes
FsContentAttributes.
Definition: fs.h:370
Service * fsGetServiceSession(void)
Gets the Service object for the actual fsp-srv service session.
Result fsInitialize(void)
Initialize fsp-srv. Used automatically during app startup.
Result fsFileOperateRange(FsFile *f, FsOperationId op_id, s64 off, s64 len, FsRangeInfo *out)
[4.0.0+]
Result fsOpenHostFileSystemWithOption(FsFileSystem *out, const char *path, u32 flags)
[9.0.0+]
Result fsOpenSaveDataInfoReaderWithFilter(FsSaveDataInfoReader *out, FsSaveDataSpaceId save_data_space_id, const FsSaveDataFilter *save_data_filter)
[6.0.0+]
FsSaveDataSpaceId
SaveDataSpaceId.
Definition: fs.h:205
@ FsSaveDataSpaceId_All
Pseudo value for fsOpenSaveDataInfoReader().
Definition: fs.h:214
@ FsSaveDataSpaceId_System
System.
Definition: fs.h:206
@ FsSaveDataSpaceId_SdUser
[4.0.0+] SdUser
Definition: fs.h:210
@ FsSaveDataSpaceId_SdSystem
SdSystem.
Definition: fs.h:208
@ FsSaveDataSpaceId_SafeMode
[3.0.0+] SafeMode
Definition: fs.h:212
@ FsSaveDataSpaceId_ProperSystem
[3.0.0+] ProperSystem
Definition: fs.h:211
@ FsSaveDataSpaceId_User
User.
Definition: fs.h:207
@ FsSaveDataSpaceId_Temporary
[3.0.0+] Temporary
Definition: fs.h:209
Result fsGetProgramIndexForAccessLog(u32 *out_program_index, u32 *out_program_count)
Only available on [7.0.0+].
Result fsGetRightsIdByPath(const char *path, FsRightsId *out_rights_id)
Retrieves the rights id corresponding to the content path. Only available on [2.0....
FsReadOption
For use with fsFileRead.
Definition: fs.h:176
@ FsReadOption_None
No option.
Definition: fs.h:177
Result fsSaveDataInfoReaderRead(FsSaveDataInfoReader *s, FsSaveDataInfo *buf, size_t max_entries, s64 *total_entries)
Read FsSaveDataInfo data into the buf array.
FsDirEntryType
Returned by fsFsGetEntryType.
Definition: fs.h:151
@ FsDirEntryType_File
Entry is a file.
Definition: fs.h:153
@ FsDirEntryType_Dir
Entry is a directory.
Definition: fs.h:152
FsDirOpenMode
For use with fsFsOpenDirectory.
Definition: fs.h:169
@ FsDirOpenMode_ReadDirs
Enable reading directory entries.
Definition: fs.h:170
@ FsDirOpenMode_NoFileSize
Causes result entries to not contain filesize information (always 0).
Definition: fs.h:172
@ FsDirOpenMode_ReadFiles
Enable reading file entries.
Definition: fs.h:171
FsGameCardPartition
Definition: fs.h:257
@ FsGameCardPartition_Logo
[4.0.0+]
Definition: fs.h:261
Result fsExtendSaveDataFileSystem(FsSaveDataSpaceId save_data_space_id, u64 saveID, s64 dataSize, s64 journalSize)
[3.0.0+]
Result fsFsSetConcatenationFileAttribute(FsFileSystem *fs, const char *path)
Uses fsFsQueryEntry to set the archive bit on the specified absolute directory path.
Result fsOpenDataFileSystemByProgramId(FsFileSystem *out, u64 program_id)
[3.0.0+]
Result fsGetAndClearErrorInfo(FsFileSystemProxyErrorInfo *out)
[2.0.0+]
FsSaveDataRank
SaveDataRank.
Definition: fs.h:229
@ FsSaveDataRank_Primary
Primary.
Definition: fs.h:230
@ FsSaveDataRank_Secondary
Secondary.
Definition: fs.h:231
Result fsDeleteSaveDataFileSystemBySaveDataSpaceId(FsSaveDataSpaceId save_data_space_id, u64 saveID)
[2.0.0+]
Result fsFsCleanDirectoryRecursively(FsFileSystem *fs, const char *path)
[3.0.0+]
Result fsOpen_SaveDataReadOnly(FsFileSystem *out, u64 application_id, AccountUid uid)
Wrapper for fsOpenReadOnlySaveDataFileSystem.
FsPriority
FsPriority.
Definition: fs.h:362
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 fsOpenFileSystemWithPatch(FsFileSystem *out, u64 id, FsFileSystemType fsType)
[2.0.0+], like OpenFileSystemWithId but without content path.
FsWriteOption
For use with fsFileWrite.
Definition: fs.h:181
@ FsWriteOption_None
No option.
Definition: fs.h:182
@ FsWriteOption_Flush
Forces a flush after write.
Definition: fs.h:183
FsMountHostOption
For use with fsOpenHostFileSystemWithOption.
Definition: fs.h:376
@ FsMountHostOptionFlag_PseudoCaseSensitive
Host filesystem will be pseudo case sensitive.
Definition: fs.h:378
@ FsMountHostOptionFlag_None
Host filesystem will be case insensitive.
Definition: fs.h:377
Result fsOpenSdCardFileSystem(FsFileSystem *out)
Do not call this directly, see fs_dev.h.
Result fsGetAndClearMemoryReportInfo(FsMemoryReportInfo *out)
[4.0.0+]
Result fsGetProgramId(u64 *out, const char *path, FsContentAttributes attr)
[17.0.0+]
FsSaveDataMetaType
SaveDataMetaType.
Definition: fs.h:243
Result fsOpenDataStorageByDataId(FsStorage *out, u64 dataId, NcmStorageId storageId)
<[3.0.0+]
FsGameCardAttribute
Definition: fs.h:249
@ FsGameCardAttribute_AutoBootFlag
Causes the cartridge to automatically start on bootup.
Definition: fs.h:250
@ FsGameCardAttribute_HistoryEraseFlag
Causes NS to throw an error on attempt to load the cartridge.
Definition: fs.h:251
@ FsGameCardAttribute_RepairToolFlag
[4.0.0+] Indicates that this gamecard is a repair tool.
Definition: fs.h:252
@ FsGameCardAttribute_DifferentRegionCupToTerraDeviceFlag
[9.0.0+] DifferentRegionCupToTerraDeviceFlag
Definition: fs.h:253
@ FsGameCardAttribute_DifferentRegionCupToGlobalDeviceFlag
[9.0.0+] DifferentRegionCupToGlobalDeviceFlag
Definition: fs.h:254
FsSaveDataFlags
SaveDataFlags.
Definition: fs.h:235
Result fsFsGetFileTimeStampRaw(FsFileSystem *fs, const char *path, FsTimeStampRaw *out)
[3.0.0+]
FsSaveDataType
SaveDataType.
Definition: fs.h:218
@ FsSaveDataType_Device
Device.
Definition: fs.h:222
@ FsSaveDataType_Temporary
[3.0.0+] Temporary
Definition: fs.h:223
@ FsSaveDataType_System
System.
Definition: fs.h:219
@ FsSaveDataType_Cache
[3.0.0+] Cache
Definition: fs.h:224
@ FsSaveDataType_Account
Account.
Definition: fs.h:220
@ FsSaveDataType_SystemBcat
[4.0.0+] SystemBcat
Definition: fs.h:225
@ FsSaveDataType_Bcat
Bcat.
Definition: fs.h:221
Result fsGetContentStorageInfoIndex(s32 *out)
[19.0.0+]
Result fsGetRightsIdAndKeyGenerationByPath(const char *path, FsContentAttributes attr, u8 *out_key_generation, FsRightsId *out_rights_id)
Retrieves the rights id and key generation corresponding to the content path. Only available on [3....
Result fsOpenCustomStorageFileSystem(FsFileSystem *out, FsCustomStorageId custom_storage_id)
[7.0.0+]
NcmStorageId
StorageId.
Definition: ncm_types.h:12
Account UserId.
Definition: acc.h:25
Kernel-mode event structure.
Definition: event.h:13
FatFatError.
Definition: fs.h:390
FatFatReportInfo1.
Definition: fs.h:399
FatFatReportInfo2.
Definition: fs.h:405
FatFatSafeInfo.
Definition: fs.h:411
This is nn::fssystem::ArchiveMacKey. Used by setsysGetThemeKey and setsysSetThemeKey....
Definition: fs.h:146
Definition: fs.h:51
Definition: fs.h:35
Directory entry.
Definition: fs.h:56
s64 file_size
File size.
Definition: fs.h:61
s8 type
See FsDirEntryType.
Definition: fs.h:59
Definition: fs.h:47
FileSystemAttribute.
Definition: fs.h:330
FsFileSystemProxyErrorInfo.
Definition: fs.h:418
Definition: fs.h:27
Definition: fs.h:31
FsGameCardErrorReportInfo.
Definition: fs.h:457
Definition: fs.h:264
Definition: fs.h:268
FsMemoryReportInfo.
Definition: fs.h:439
Definition: fs.h:274
u32 speed_emulation_type
Contains bitflags describing how data is emulated.
Definition: fs.h:276
u32 aes_ctr_key_type
Contains bitflags describing how data is AES encrypted.
Definition: fs.h:275
Definition: fs.h:23
SaveDataAttribute.
Definition: fs.h:65
u16 save_data_index
SaveDataIndex.
Definition: fs.h:71
u64 unk_x38
0 for FsSaveDataType_System/FsSaveDataType_Account.
Definition: fs.h:75
AccountUid uid
AccountUid for the user-specific savedata to access, otherwise 0 for common savedata.
Definition: fs.h:67
u64 system_save_data_id
SystemSaveDataId, 0 for FsSaveDataType_Account.
Definition: fs.h:68
u64 unk_x28
0 for FsSaveDataType_System/FsSaveDataType_Account.
Definition: fs.h:73
u8 save_data_rank
FsSaveDataRank
Definition: fs.h:70
u64 application_id
ApplicationId of the savedata to access when accessing other programs' savedata via SaveData,...
Definition: fs.h:66
u8 save_data_type
FsSaveDataType
Definition: fs.h:69
u64 unk_x30
0 for FsSaveDataType_System/FsSaveDataType_Account.
Definition: fs.h:74
u32 pad_x24
Padding.
Definition: fs.h:72
SaveDataCreationInfo.
Definition: fs.h:99
s64 save_data_size
Size of the save data.
Definition: fs.h:100
u32 flags
FsSaveDataFlags
Definition: fs.h:104
u8 unk
0 for FsSaveDataType_System.
Definition: fs.h:106
u64 owner_id
ProgramId of the owner of this save data. 0 for FsSaveDataType_System.
Definition: fs.h:103
s64 journal_size
Journal size of the save data.
Definition: fs.h:101
u64 available_size
AvailableSize.
Definition: fs.h:102
u8 save_data_space_id
FsSaveDataSpaceId
Definition: fs.h:105
SaveDataExtraData.
Definition: fs.h:79
FsSaveDataAttribute attr
FsSaveDataAttribute
Definition: fs.h:80
u32 unk_x54
Normally 0. Possibly unused?
Definition: fs.h:84
u32 flags
FsSaveDataFlags
Definition: fs.h:83
s64 data_size
Usable save data size.
Definition: fs.h:85
u64 owner_id
ProgramId of the owner of this save data. 0 for FsSaveDataType_System.
Definition: fs.h:81
u64 commit_id
Id of the latest commit.
Definition: fs.h:87
u64 timestamp
POSIX timestamp.
Definition: fs.h:82
s64 journal_size
Journal size of the save data.
Definition: fs.h:86
SaveDataFilter.
Definition: fs.h:126
bool filter_by_save_data_type
Filter by FsSaveDataAttribute::save_data_type.
Definition: fs.h:128
u8 save_data_rank
FsSaveDataRank
Definition: fs.h:132
bool filter_by_application_id
Filter by FsSaveDataAttribute::application_id.
Definition: fs.h:127
FsSaveDataAttribute attr
FsSaveDataAttribute
Definition: fs.h:134
bool filter_by_index
Filter by FsSaveDataAttribute::save_data_index.
Definition: fs.h:131
bool filter_by_system_save_data_id
Filter by FsSaveDataAttribute::system_save_data_id.
Definition: fs.h:130
bool filter_by_user_id
Filter by FsSaveDataAttribute::uid.
Definition: fs.h:129
Definition: fs.h:43
SaveDataInfo.
Definition: fs.h:111
u8 save_data_space_id
FsSaveDataSpaceId
Definition: fs.h:113
u8 save_data_type
FsSaveDataType
Definition: fs.h:114
u64 application_id
ApplicationId for FsSaveDataType_Account.
Definition: fs.h:118
u8 save_data_rank
FsSaveDataRank
Definition: fs.h:121
u64 system_save_data_id
FsSaveDataAttribute::system_save_data_id.
Definition: fs.h:117
AccountUid uid
FsSave::userID.
Definition: fs.h:116
u64 save_data_id
SaveDataId.
Definition: fs.h:112
u16 save_data_index
SaveDataIndex.
Definition: fs.h:120
u64 size
Raw saveimage size.
Definition: fs.h:119
SaveDataMetaInfo.
Definition: fs.h:92
u8 type
FsSaveDataMetaType
Definition: fs.h:94
FsStorageErrorInfo.
Definition: fs.h:382
Definition: fs.h:39
Definition: fs.h:137
u64 created
POSIX timestamp.
Definition: fs.h:138
u8 is_valid
0x1 when the timestamps are set.
Definition: fs.h:141
u64 accessed
POSIX timestamp.
Definition: fs.h:140
u64 modified
POSIX timestamp.
Definition: fs.h:139
Service object structure.
Definition: service.h:14
int64_t s64
64-bit signed integer.
Definition: types.h:28
#define BIT(n)
Creates a bitmask from a bit number.
Definition: types.h:54
uint64_t u64
64-bit unsigned integer.
Definition: types.h:22
uint8_t u8
8-bit unsigned integer.
Definition: types.h:19
int8_t s8
8-bit signed integer.
Definition: types.h:25
uint16_t u16
16-bit unsigned integer.
Definition: types.h:20
u32 Result
Function error code result type.
Definition: types.h:44
int32_t s32
32-bit signed integer.
Definition: types.h:27
uint32_t u32
32-bit unsigned integer.
Definition: types.h:21