wut  v1.7.0
Wii U Toolchain
filesystem_fsa.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "wut.h"
4 #include "filesystem.h"
5 
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9 
10 typedef uint32_t FSACommand;
11 typedef uint16_t FSAIpcRequestType;
13 typedef uint32_t FSAFileHandle;
14 typedef uint32_t FSADirectoryHandle;
15 typedef uint32_t FSAEntryNum;
17 typedef FSStat FSAStat;
18 typedef uint32_t FSAFilePosition;
19 
20 typedef struct FSAProcessInfo FSAProcessInfo;
21 
35 typedef struct FSARequestIsEof FSARequestIsEof;
38 typedef struct FSARequestMount FSARequestMount;
44 typedef struct FSARequestRemove FSARequestRemove;
45 typedef struct FSARequestRename FSARequestRename;
54 
55 
56 typedef struct FSARequest FSARequest;
67 
68 typedef struct FSAResponse FSAResponse;
69 typedef struct FSAAsyncResult FSAAsyncResult;
70 typedef struct FSAShimBuffer FSAShimBuffer;
72 typedef struct FSABlockInfo FSABlockInfo;
73 typedef struct FSADeviceInfo FSADeviceInfo;
75 typedef struct FSVolumeInfo FSAVolumeInfo;
76 
77 typedef void (*FSAAsyncCallbackFn)(FSError result,
78  FSACommand command,
79  FSARequest *request,
80  FSAResponse *response,
81  void *userContext);
82 
86 struct FSABlockInfo {
87  WUT_UNKNOWN_BYTES(0x14);
88 };
89 WUT_CHECK_SIZE(FSABlockInfo, 0x14);
90 
94 struct FSADeviceInfo {
95  WUT_UNKNOWN_BYTES(0x08);
97  uint32_t deviceSectorSize;
98  WUT_UNKNOWN_BYTES(0x14);
99 };
100 WUT_CHECK_OFFSET(FSADeviceInfo, 0x08, deviceSizeInSectors);
101 WUT_CHECK_OFFSET(FSADeviceInfo, 0x10, deviceSectorSize);
102 WUT_CHECK_SIZE(FSADeviceInfo, 0x28);
103 
108  WUT_UNKNOWN_BYTES(0x1E);
109 };
110 WUT_CHECK_SIZE(FSAFileSystemInfo, 0x1E);
111 
112 typedef enum FSAMountPriority {
118 
119 typedef enum FSAQueryInfoType {
130 
131 typedef enum FSAReadFlag {
135 
136 typedef enum FSAWriteFlag {
140 
145 {
146  uint64_t titleId;
147  uint32_t processId;
148  uint32_t groupId;
149 };
150 WUT_CHECK_OFFSET(FSAProcessInfo, 0x00, titleId);
151 WUT_CHECK_OFFSET(FSAProcessInfo, 0x08, processId);
152 WUT_CHECK_OFFSET(FSAProcessInfo, 0x0C, groupId);
153 WUT_CHECK_SIZE(FSAProcessInfo, 0x10);
154 
156  char path[0x280];
157 };
158 WUT_CHECK_OFFSET(FSARequestRawOpen, 0x0, path);
159 WUT_CHECK_SIZE(FSARequestRawOpen, 0x280);
160 
162  int32_t handle;
163 };
164 WUT_CHECK_OFFSET(FSARequestRawClose, 0x0, handle);
165 WUT_CHECK_SIZE(FSARequestRawClose, 0x04);
166 
167 struct WUT_PACKED FSARequestRawRead {
168  WUT_UNKNOWN_BYTES(0x4);
169  uint64_t blocks_offset;
170  uint32_t count;
171  uint32_t size;
172  uint32_t device_handle;
173 };
174 WUT_CHECK_OFFSET(FSARequestRawRead, 0x04, blocks_offset);
175 WUT_CHECK_OFFSET(FSARequestRawRead, 0x0C, count);
176 WUT_CHECK_OFFSET(FSARequestRawRead, 0x10, size);
177 WUT_CHECK_OFFSET(FSARequestRawRead, 0x14, device_handle);
178 WUT_CHECK_SIZE(FSARequestRawRead, 0x18);
179 
180 struct WUT_PACKED FSARequestRawWrite {
181  WUT_UNKNOWN_BYTES(0x4);
182  uint64_t blocks_offset;
183  uint32_t count;
184  uint32_t size;
185  uint32_t device_handle;
186 };
187 WUT_CHECK_OFFSET(FSARequestRawWrite, 0x04, blocks_offset);
188 WUT_CHECK_OFFSET(FSARequestRawWrite, 0x0C, count);
189 WUT_CHECK_OFFSET(FSARequestRawWrite, 0x10, size);
190 WUT_CHECK_OFFSET(FSARequestRawWrite, 0x14, device_handle);
191 WUT_CHECK_SIZE(FSARequestRawWrite, 0x18);
192 
197 {
198  uint32_t size;
199  uint32_t count;
201  uint32_t unk0x0C;
202 };
203 WUT_CHECK_OFFSET(FSARequestAppendFile, 0x0, size);
204 WUT_CHECK_OFFSET(FSARequestAppendFile, 0x4, count);
205 WUT_CHECK_OFFSET(FSARequestAppendFile, 0x8, handle);
206 WUT_CHECK_OFFSET(FSARequestAppendFile, 0xC, unk0x0C);
207 WUT_CHECK_SIZE(FSARequestAppendFile, 0x10);
208 
213 {
214  char path[FS_MAX_PATH +1];
215 };
216 WUT_CHECK_OFFSET(FSARequestChangeDir, 0x0, path);
217 WUT_CHECK_SIZE(FSARequestChangeDir, 0x280);
218 
219 
224 {
225  char path[FS_MAX_PATH +1];
226  uint32_t mode1;
227  uint32_t mode2;
228 };
229 WUT_CHECK_OFFSET(FSARequestChangeMode, 0x0, path);
230 WUT_CHECK_OFFSET(FSARequestChangeMode, 0x280, mode1);
231 WUT_CHECK_OFFSET(FSARequestChangeMode, 0x284, mode2);
232 WUT_CHECK_SIZE(FSARequestChangeMode, 0x288);
233 
234 
239 {
241 };
242 WUT_CHECK_OFFSET(FSARequestCloseDir, 0x0, handle);
243 WUT_CHECK_SIZE(FSARequestCloseDir, 0x4);
244 
245 
250 {
252 };
253 WUT_CHECK_OFFSET(FSARequestCloseFile, 0x0, handle);
254 WUT_CHECK_SIZE(FSARequestCloseFile, 0x4);
255 
256 
261 {
263 };
264 WUT_CHECK_OFFSET(FSARequestFlushFile, 0x0, handle);
265 WUT_CHECK_SIZE(FSARequestFlushFile, 0x4);
266 
267 
272 {
273  char path[FS_MAX_PATH +1];
274 };
275 WUT_CHECK_OFFSET(FSARequestFlushQuota, 0x0, path);
276 WUT_CHECK_SIZE(FSARequestFlushQuota, 0x280);
277 
278 
283 {
284  char path[FS_MAX_PATH +1];
286 };
287 WUT_CHECK_OFFSET(FSARequestGetInfoByQuery, 0x0, path);
288 WUT_CHECK_OFFSET(FSARequestGetInfoByQuery, 0x280, type);
289 WUT_CHECK_SIZE(FSARequestGetInfoByQuery, 0x284);
290 
291 
296 {
298 };
299 WUT_CHECK_OFFSET(FSARequestGetPosFile, 0x0, handle);
300 WUT_CHECK_SIZE(FSARequestGetPosFile, 0x4);
301 
302 
307 {
309 };
310 WUT_CHECK_OFFSET(FSARequestIsEof, 0x0, handle);
311 WUT_CHECK_SIZE(FSARequestIsEof, 0x4);
312 
313 
318 {
319  char path[FS_MAX_PATH +1];
320  uint32_t permission;
321 };
322 WUT_CHECK_OFFSET(FSARequestMakeDir, 0x0, path);
323 WUT_CHECK_OFFSET(FSARequestMakeDir, 0x280, permission);
324 WUT_CHECK_SIZE(FSARequestMakeDir, 0x284);
325 
329 struct WUT_PACKED FSARequestMakeQuota
330 {
331  char path[FS_MAX_PATH +1];
332  uint32_t mode;
333  uint64_t size;
334 };
335 WUT_CHECK_OFFSET(FSARequestMakeQuota, 0x0, path);
336 WUT_CHECK_OFFSET(FSARequestMakeQuota, 0x280, mode);
337 WUT_CHECK_OFFSET(FSARequestMakeQuota, 0x284, size);
338 WUT_CHECK_SIZE(FSARequestMakeQuota, 0x28C);
339 
340 
345 {
346  char path[FS_MAX_PATH +1];
347  char target[FS_MAX_PATH +1];
348  uint32_t unk0x500;
349  void* unkBuf;
350  uint32_t unkBufLen;
351 };
352 WUT_CHECK_OFFSET(FSARequestMount, 0x0, path);
353 WUT_CHECK_OFFSET(FSARequestMount, 0x280, target);
354 WUT_CHECK_OFFSET(FSARequestMount, 0x500, unk0x500);
355 WUT_CHECK_OFFSET(FSARequestMount, 0x504, unkBuf);
356 WUT_CHECK_OFFSET(FSARequestMount, 0x508, unkBufLen);
357 WUT_CHECK_SIZE(FSARequestMount, 0x50C);
358 
359 
363 struct WUT_PACKED FSARequestMountWithProcess
364 {
365  char path[FS_MAX_PATH +1];
366  char target[FS_MAX_PATH +1];
369  void* unkBuf;
370  uint32_t unkBufLen;
371 };
372 WUT_CHECK_OFFSET(FSARequestMountWithProcess, 0x0, path);
373 WUT_CHECK_OFFSET(FSARequestMountWithProcess, 0x280, target);
374 WUT_CHECK_OFFSET(FSARequestMountWithProcess, 0x500, priority);
375 WUT_CHECK_OFFSET(FSARequestMountWithProcess, 0x504, process);
376 WUT_CHECK_OFFSET(FSARequestMountWithProcess, 0x514, unkBuf);
377 WUT_CHECK_OFFSET(FSARequestMountWithProcess, 0x518, unkBufLen);
378 WUT_CHECK_SIZE(FSARequestMountWithProcess, 0x51C);
379 
380 
385 {
386  char path[FS_MAX_PATH +1];
387 };
388 WUT_CHECK_OFFSET(FSARequestOpenDir, 0x0, path);
389 WUT_CHECK_SIZE(FSARequestOpenDir, 0x280);
390 
395 {
396  char path[FS_MAX_PATH +1];
398  uint32_t unk0x290;
399  uint32_t unk0x294;
400  uint32_t unk0x298;
401 };
402 WUT_CHECK_OFFSET(FSARequestOpenFile, 0x0, path);
403 WUT_CHECK_OFFSET(FSARequestOpenFile, 0x280, mode);
404 WUT_CHECK_OFFSET(FSARequestOpenFile, 0x290, unk0x290);
405 WUT_CHECK_OFFSET(FSARequestOpenFile, 0x294, unk0x294);
406 WUT_CHECK_OFFSET(FSARequestOpenFile, 0x298, unk0x298);
407 WUT_CHECK_SIZE(FSARequestOpenFile, 0x29C);
408 
409 
414 {
416 };
417 WUT_CHECK_OFFSET(FSARequestReadDir, 0x0, handle);
418 WUT_CHECK_SIZE(FSARequestReadDir, 0x4);
419 
420 
425 {
427  uint8_t* buffer;
428  uint32_t size;
429  uint32_t count;
433 };
434 WUT_CHECK_OFFSET(FSARequestReadFile, 0x00, buffer);
435 WUT_CHECK_OFFSET(FSARequestReadFile, 0x04, size);
436 WUT_CHECK_OFFSET(FSARequestReadFile, 0x08, count);
437 WUT_CHECK_OFFSET(FSARequestReadFile, 0x0C, pos);
438 WUT_CHECK_OFFSET(FSARequestReadFile, 0x10, handle);
439 WUT_CHECK_OFFSET(FSARequestReadFile, 0x14, readFlags);
440 WUT_CHECK_SIZE(FSARequestReadFile, 0x18);
441 
442 
447 {
448  char path[FS_MAX_PATH +1];
449 };
450 WUT_CHECK_OFFSET(FSARequestRemove, 0x0, path);
451 WUT_CHECK_SIZE(FSARequestRemove, 0x280);
452 
453 
458 {
461 };
462 WUT_CHECK_OFFSET(FSARequestRename, 0x0, oldPath);
463 WUT_CHECK_OFFSET(FSARequestRename, 0x280, newPath);
464 WUT_CHECK_SIZE(FSARequestRename, 0x500);
465 
466 
471 {
473 };
474 WUT_CHECK_OFFSET(FSARequestRewindDir, 0x0, handle);
475 WUT_CHECK_SIZE(FSARequestRewindDir, 0x4);
476 
477 
482 {
485 };
486 WUT_CHECK_OFFSET(FSARequestSetPosFile, 0x0, handle);
487 WUT_CHECK_OFFSET(FSARequestSetPosFile, 0x4, pos);
488 WUT_CHECK_SIZE(FSARequestSetPosFile, 0x8);
489 
490 
495 {
497 };
498 WUT_CHECK_OFFSET(FSARequestStatFile, 0x0, handle);
499 WUT_CHECK_SIZE(FSARequestStatFile, 0x4);
500 
501 
506 {
508 };
509 WUT_CHECK_OFFSET(FSARequestTruncateFile, 0x0, handle);
510 WUT_CHECK_SIZE(FSARequestTruncateFile, 0x4);
511 
512 
517 {
518  char path[FS_MAX_PATH +1];
519  uint32_t unk0x280;
520 };
521 WUT_CHECK_OFFSET(FSARequestUnmount, 0x0, path);
522 WUT_CHECK_OFFSET(FSARequestUnmount, 0x280, unk0x280);
523 WUT_CHECK_SIZE(FSARequestUnmount, 0x284);
524 
525 
530 {
531  char path[FS_MAX_PATH +1];
534 };
535 WUT_CHECK_OFFSET(FSARequestUnmountWithProcess, 0x0, path);
536 WUT_CHECK_OFFSET(FSARequestUnmountWithProcess, 0x280, priority);
537 WUT_CHECK_OFFSET(FSARequestUnmountWithProcess, 0x284, process);
538 WUT_CHECK_SIZE(FSARequestUnmountWithProcess, 0x294);
539 
540 
545 {
547  const uint8_t* buffer;
548  uint32_t size;
549  uint32_t count;
553 };
554 WUT_CHECK_OFFSET(FSARequestWriteFile, 0x00, buffer);
555 WUT_CHECK_OFFSET(FSARequestWriteFile, 0x04, size);
556 WUT_CHECK_OFFSET(FSARequestWriteFile, 0x08, count);
557 WUT_CHECK_OFFSET(FSARequestWriteFile, 0x0C, pos);
558 WUT_CHECK_OFFSET(FSARequestWriteFile, 0x10, handle);
559 WUT_CHECK_OFFSET(FSARequestWriteFile, 0x14, writeFlags);
560 WUT_CHECK_SIZE(FSARequestWriteFile, 0x18);
561 
563 {
564  char path[FS_MAX_PATH +1];
565  WUT_UNKNOWN_BYTES(4);
566  uint32_t owner;
567  WUT_UNKNOWN_BYTES(4);
568  uint32_t group;
569 };
570 WUT_CHECK_OFFSET(FSARequestChangeOwner, 0x0, path);
571 WUT_CHECK_OFFSET(FSARequestChangeOwner, 0x284, owner);
572 WUT_CHECK_OFFSET(FSARequestChangeOwner, 0x28C, group);
573 WUT_CHECK_SIZE(FSARequestChangeOwner, 0x290);
574 
575 struct FSARequest {
577 
578  union {
579  FSARequestRawOpen rawOpen;
580  FSARequestRawClose rawClose;
581  FSARequestRawRead rawRead;
582  FSARequestRawWrite rawWrite;
583  FSARequestAppendFile appendFile;
584  FSARequestChangeDir changeDir;
585  FSARequestChangeMode changeMode;
586  FSARequestCloseDir closeDir;
587  FSARequestCloseFile closeFile;
588  FSARequestFlushFile flushFile;
589  FSARequestFlushQuota flushQuota;
590  FSARequestGetInfoByQuery getInfoByQuery;
591  FSARequestGetPosFile getPosFile;
592  FSARequestIsEof isEof;
593  FSARequestMakeDir makeDir;
594  FSARequestMakeQuota makeQuota;
595  FSARequestMount mount;
596  FSARequestMountWithProcess mountWithProcess;
597  FSARequestOpenDir openDir;
598  FSARequestOpenFile openFile;
599  FSARequestReadDir readDir;
600  FSARequestReadFile readFile;
601  FSARequestRemove remove;
602  FSARequestRename rename;
603  FSARequestRewindDir rewindDir;
604  FSARequestSetPosFile setPosFile;
605  FSARequestStatFile statFile;
606  FSARequestTruncateFile truncateFile;
607  FSARequestUnmount unmount;
608  FSARequestUnmountWithProcess unmountWithProcess;
609  FSARequestWriteFile writeFile;
610  FSARequestChangeOwner changeOwner;
611  WUT_UNKNOWN_BYTES(0x51C);
612  };
613 };
614 WUT_CHECK_OFFSET(FSARequest, 0x00, emulatedError);
615 WUT_CHECK_OFFSET(FSARequest, 0x04, rawOpen);
616 WUT_CHECK_SIZE(FSARequest, 0x520);
617 
618 
620  int handle;
621 };
622 WUT_CHECK_OFFSET(FSAResponseRawOpen, 0x0, handle);
623 WUT_CHECK_SIZE(FSAResponseRawOpen, 0x4);
624 
626 {
627  char path[FS_MAX_PATH +1];
628 };
629 WUT_CHECK_OFFSET(FSAResponseGetCwd, 0x0, path);
630 WUT_CHECK_SIZE(FSAResponseGetCwd, 0x280);
631 
633 {
634  uint32_t address;
635 };
636 WUT_CHECK_OFFSET(FSAResponseGetFileBlockAddress, 0x0, address);
637 WUT_CHECK_SIZE(FSAResponseGetFileBlockAddress, 0x4);
638 
640 {
642 };
643 WUT_CHECK_OFFSET(FSAResponseGetPosFile, 0x0, pos);
644 WUT_CHECK_SIZE(FSAResponseGetPosFile, 0x4);
645 
647 {
649 };
650 WUT_CHECK_OFFSET(FSAResponseGetVolumeInfo, 0x0, volumeInfo);
651 WUT_CHECK_SIZE(FSAResponseGetVolumeInfo, 0x1BC);
652 
653 struct WUT_PACKED FSAResponseGetInfoByQuery
654 {
655  union WUT_PACKED {
656  FSABlockInfo badBlockInfo;
657  FSADeviceInfo deviceInfo;
658  uint64_t dirSize;
659  FSAEntryNum entryNum;
660  FSAFileSystemInfo fileSystemInfo;
661  FSABlockInfo fragmentBlockInfo;
662  uint64_t freeSpaceSize;
663  uint64_t journalFreeSpaceSize;
664  FSAStat stat;
665  };
666 };
667 WUT_CHECK_OFFSET(FSAResponseGetInfoByQuery, 0x0, badBlockInfo);
668 WUT_CHECK_OFFSET(FSAResponseGetInfoByQuery, 0x0, deviceInfo);
669 WUT_CHECK_OFFSET(FSAResponseGetInfoByQuery, 0x0, dirSize);
670 WUT_CHECK_OFFSET(FSAResponseGetInfoByQuery, 0x0, entryNum);
671 WUT_CHECK_OFFSET(FSAResponseGetInfoByQuery, 0x0, fragmentBlockInfo);
672 WUT_CHECK_OFFSET(FSAResponseGetInfoByQuery, 0x0, freeSpaceSize);
673 WUT_CHECK_OFFSET(FSAResponseGetInfoByQuery, 0x0, fileSystemInfo);
674 WUT_CHECK_OFFSET(FSAResponseGetInfoByQuery, 0x0, journalFreeSpaceSize);
675 WUT_CHECK_OFFSET(FSAResponseGetInfoByQuery, 0x0, stat);
676 WUT_CHECK_SIZE(FSAResponseGetInfoByQuery, 0x64);
677 
679 {
681 };
682 WUT_CHECK_OFFSET(FSAResponseOpenFile, 0x0, handle);
683 WUT_CHECK_SIZE(FSAResponseOpenFile, 0x4);
684 
686 {
688 };
689 WUT_CHECK_OFFSET(FSAResponseOpenDir, 0x0, handle);
690 WUT_CHECK_SIZE(FSAResponseOpenDir, 0x4);
691 
693 {
695 };
696 WUT_CHECK_OFFSET(FSAResponseReadDir, 0x0, entry);
697 WUT_CHECK_SIZE(FSAResponseReadDir, 0x164);
698 
700 {
702 };
703 WUT_CHECK_OFFSET(FSAResponseStatFile, 0x0, stat);
704 WUT_CHECK_SIZE(FSAResponseStatFile, 0x64);
705 
706 struct WUT_PACKED FSAResponse {
707  uint32_t word0;
708  union WUT_PACKED {
709  FSAResponseRawOpen rawOpen;
710  FSAResponseGetCwd getCwd;
711  FSAResponseGetFileBlockAddress getFileBlockAddress;
712  FSAResponseGetPosFile getPosFile;
713  FSAResponseGetVolumeInfo getVolumeInfo;
714  FSAResponseGetInfoByQuery getInfoByQuery;
715  FSAResponseOpenDir openDir;
716  FSAResponseOpenFile openFile;
717  FSAResponseReadDir readDir;
718  FSAResponseStatFile statFile;
719  WUT_UNKNOWN_BYTES(0x28F);
720  };
721 };
722 WUT_CHECK_OFFSET(FSAResponse, 0x0, word0);
723 WUT_CHECK_OFFSET(FSAResponse, 0x4, rawOpen);
724 WUT_CHECK_SIZE(FSAResponse, 0x293);
725 
792 };
793 
797 };
798 
802 
805 
808 
811 
814 
817 
820 
822  void *userContext;
823 };
824 WUT_CHECK_OFFSET(FSAAsyncResult, 0x00, ioMsgQueue);
825 WUT_CHECK_OFFSET(FSAAsyncResult, 0x04, msg);
826 WUT_CHECK_OFFSET(FSAAsyncResult, 0x14, userCallback);
827 WUT_CHECK_OFFSET(FSAAsyncResult, 0x18, error);
828 WUT_CHECK_OFFSET(FSAAsyncResult, 0x1C, command);
829 WUT_CHECK_OFFSET(FSAAsyncResult, 0x20, request);
830 WUT_CHECK_OFFSET(FSAAsyncResult, 0x24, response);
831 WUT_CHECK_OFFSET(FSAAsyncResult, 0x28, userContext);
832 WUT_CHECK_SIZE(FSAAsyncResult, 0x2C);
833 
834 struct WUT_PACKED FSAShimBuffer {
837  WUT_UNKNOWN_BYTES(0x60);
838 
841  WUT_UNKNOWN_BYTES(0x880 - 0x813);
842 
844  IOSVec ioctlvVec[3];
845 
846  WUT_UNKNOWN_BYTES(0x900 - 0x8A4);
847 
850 
852  uint32_t clientHandle;
853 
856 
858  uint8_t ioctlvVecIn;
859 
861  uint8_t ioctlvVecOut;
862 
865 };
866 WUT_CHECK_OFFSET(FSAShimBuffer, 0x0, request);
867 WUT_CHECK_OFFSET(FSAShimBuffer, 0x580, response);
868 WUT_CHECK_OFFSET(FSAShimBuffer, 0x880, ioctlvVec);
869 WUT_CHECK_OFFSET(FSAShimBuffer, 0x900, command);
870 WUT_CHECK_OFFSET(FSAShimBuffer, 0x904, clientHandle);
871 WUT_CHECK_OFFSET(FSAShimBuffer, 0x908, ipcReqType);
872 WUT_CHECK_OFFSET(FSAShimBuffer, 0x90A, ioctlvVecIn);
873 WUT_CHECK_OFFSET(FSAShimBuffer, 0x90B, ioctlvVecOut);
874 WUT_CHECK_OFFSET(FSAShimBuffer, 0x90C, fsaAsyncResult);
875 WUT_CHECK_SIZE(FSAShimBuffer, 0x938);
876 
878  FSACommand command,
879  FSARequest *request,
880  FSAResponse *response,
881  void *userContext);
882 
886 
888  void *userContext;
889 
892 };
893 WUT_CHECK_OFFSET(FSAClientAttachAsyncData, 0x00, userCallback);
894 WUT_CHECK_OFFSET(FSAClientAttachAsyncData, 0x04, userContext);
895 WUT_CHECK_OFFSET(FSAClientAttachAsyncData, 0x08, ioMsgQueue);
896 WUT_CHECK_SIZE(FSAClientAttachAsyncData, 0xC);
897 
898 typedef enum FSAMountFlags {
903 
904 typedef enum FSAUnmountFlags {
905  FSA_UNMOUNT_FLAG_NONE = 0x00000000,
909 
910 FSError
912 
913 void
915 
916 uint32_t
918 
921 
922 FSError
924 
925 const char *
927 
928 FSError
930  IOSError err);
931 
932 FSError
934  const char *path);
935 
936 FSError
938  const char *path);
939 
940 FSError
942  const char *path);
943 
948 void
950 
953 
954 FSError
956  const char *source,
957  const char *target,
958  FSAMountFlags flags,
959  void *arg_buf,
960  uint32_t arg_len);
961 
962 FSError
964  const char *mountedTarget,
965  FSAUnmountFlags flags);
966 
967 FSError
969  const char *path);
970 
971 FSError
973  const char *path,
974  FSMode permission);
975 
976 FSError
978  const char *path,
979  const char *mode,
980  FSMode createMode,
981  FSOpenFileFlags openFlag,
982  uint32_t preallocSize,
983  FSAFileHandle *outFileHandle);
984 
985 FSError
987  FSAStat *stat,
988  const char *mode,
989  const char *path,
990  FSAFileHandle *outFileHandle);
991 
992 FSError
994  FSAFileHandle fileHandle,
995  FSAStat *stat);
996 
997 FSError
999  const char *path,
1000  FSAStat *stat);
1001 
1002 FSError
1004  FSAFileHandle fileHandle);
1005 
1006 FSError
1008  FSAFileHandle fileHandle,
1009  uint32_t size,
1010  uint32_t count);
1011 
1012 FSError
1014  FSAFileHandle fileHandle,
1015  uint32_t size,
1016  uint32_t count,
1017  uint32_t flags);
1018 
1019 FSError
1021  FSAFileHandle fileHandle,
1022  uint32_t *outPos);
1023 
1024 FSError
1026  FSAFileHandle fileHandle);
1027 
1028 FSError
1030  FSAFileHandle fileHandle,
1031  uint32_t pos);
1032 
1033 FSError
1035  FSAFileHandle handle);
1036 
1037 FSError
1039  void *buffer,
1040  uint32_t size,
1041  uint32_t count,
1042  FSAFileHandle handle,
1043  uint32_t flags);
1044 
1045 FSError
1047  void *buffer,
1048  uint32_t size,
1049  uint32_t count,
1050  uint32_t pos,
1051  FSAFileHandle handle,
1052  uint32_t flags);
1053 
1054 FSError
1056  FSAFileHandle fileHandle);
1057 
1058 FSError
1060  void *buffer,
1061  uint32_t size,
1062  uint32_t count,
1063  FSAFileHandle handle,
1064  uint32_t flags);
1065 
1066 FSError
1068  void *buffer,
1069  uint32_t size,
1070  uint32_t count,
1071  uint32_t pos,
1072  FSAFileHandle handle,
1073  uint32_t flags);
1074 
1075 FSError
1077  const char *path);
1078 
1079 FSError
1081  const char *oldPath,
1082  const char *newPath);
1083 
1084 FSError
1086  const char *path,
1087  FSADirectoryHandle *dirHandle);
1088 
1089 FSError
1091  FSADirectoryHandle dirHandle,
1092  FSADirectoryEntry *directoryEntry);
1093 
1094 FSError
1096  FSADirectoryHandle dirHandle);
1097 
1098 FSError
1100  FSADirectoryHandle dirHandle);
1101 
1102 FSError
1104  const char *path,
1105  FSMode mode);
1106 
1107 FSError
1109  char *outPath,
1110  uint32_t outPathLen);
1111 
1112 FSError
1114  uint32_t *poolSize,
1115  uint32_t *numMessages);
1116 
1117 FSError
1119  const char *path,
1120  FSAVolumeInfo *outVolumeInfo);
1121 
1122 
1123 FSError
1125  const char *name,
1126  uint32_t mode,
1127  uint64_t quota);
1128 
1129 FSError
1131  const char *path);
1132 
1133 FSError
1135  const char *path);
1136 
1137 FSError
1139  const char *path);
1140 
1141 FSError
1143  const char *path);
1144 
1145 FSError
1147  const char *path,
1148  uint64_t *freeSpaceSize);
1149 
1150 FSError
1152  const char *path,
1153  uint64_t *journalFreeSpaceSize);
1154 
1155 FSError
1157  const char *path,
1158  uint64_t *freeDirSize);
1159 
1160 FSError
1162  const char *path,
1163  FSAEntryNum *entryNum);
1164 
1165 FSError
1167  const char *path,
1168  FSAFileSystemInfo *fileSystemInfo);
1169 
1170 FSError
1172  const char *path,
1173  FSADeviceInfo *fileSystemInfo);
1174 
1175 FSError
1177  const char *path,
1178  FSABlockInfo *blockInfo);
1179 
1180 FSError
1182  const char *path,
1183  FSABlockInfo *blockInfo);
1184 
1185 #ifdef __cplusplus
1186 }
1187 #endif
FSError FSAAppendFileEx(FSAClientHandle client, FSAFileHandle fileHandle, uint32_t size, uint32_t count, uint32_t flags)
uint8_t ioctlvVecOut
Number of ioctlv output vectors.
FSError FSAOpenFileEx(FSAClientHandle client, const char *path, const char *mode, FSMode createMode, FSOpenFileFlags openFlag, uint32_t preallocSize, FSAFileHandle *outFileHandle)
FSAMountFlags
@ FSA_MOUNT_FLAG_LOCAL_MOUNT
@ FSA_MOUNT_FLAG_BIND_MOUNT
@ FSA_MOUNT_FLAG_GLOBAL_MOUNT
FSAAsyncResult fsaAsyncResult
FSAAsyncResult used for FSA* functions.
FSError FSACloseFile(FSAClientHandle client, FSAFileHandle fileHandle)
FSError FSADelClient(FSAClientHandle client)
FSError FSAOpenDir(FSAClientHandle client, const char *path, FSADirectoryHandle *dirHandle)
FSError FSARegisterFlushQuota(FSAClientHandle client, const char *path)
FSError FSAGetDeviceInfo(FSAClientHandle client, const char *path, FSADeviceInfo *fileSystemInfo)
FSError FSARollbackVolume(FSAClientHandle client, const char *path)
FSAFileHandle handle
uint32_t FSAGetClientNum()
FSError FSAGetEntryNum(FSAClientHandle client, const char *path, FSAEntryNum *entryNum)
FSError FSAFlushVolume(FSAClientHandle client, const char *path)
uint32_t FSACommand
void FSAShutdown()
FSError FSAInit()
FSError FSAGetDirSize(FSAClientHandle client, const char *path, uint64_t *freeDirSize)
FSError FSARewindDir(FSAClientHandle client, FSADirectoryHandle dirHandle)
uint32_t clientHandle
Handle to FSA device.
OSMessageQueue * ioMsgQueue
Queue to put a message on when command is complete.
FSError FSASetPosFile(FSAClientHandle client, FSAFileHandle fileHandle, uint32_t pos)
FSError FSAGetVolumeInfo(FSAClientHandle client, const char *path, FSAVolumeInfo *outVolumeInfo)
FSError FSAUnmount(FSAClientHandle client, const char *mountedTarget, FSAUnmountFlags flags)
FSAReadFlag
@ FSA_READ_FLAG_NONE
@ FSA_READ_FLAG_READ_WITH_POS
FSError FSAIsEof(FSAClientHandle client, FSAFileHandle fileHandle)
uint32_t FSAEntryNum
uint32_t processId
FSError FSAGetFreeSpaceSize(FSAClientHandle client, const char *path, uint64_t *freeSpaceSize)
FSError FSAOpenFileByStat(FSAClientHandle client, FSAStat *stat, const char *mode, const char *path, FSAFileHandle *outFileHandle)
FSError FSAGetFileSystemInfo(FSAClientHandle client, const char *path, FSAFileSystemInfo *fileSystemInfo)
void FSAFreeAsyncResult(FSAAsyncResult *asyncResult)
Frees the FSAShimBuffer where the given asyncResult is part of.
uint8_t * buffer
Virtual pointer used only by Cafe, for IOS we should use ioctlv.vecs[1].
FSError FSARemove(FSAClientHandle client, const char *path)
FSError FSAWriteFileWithPos(FSAClientHandle client, void *buffer, uint32_t size, uint32_t count, uint32_t pos, FSAFileHandle handle, uint32_t flags)
FSError emulatedError
FSError FSAChangeDir(FSAClientHandle client, const char *path)
IOSHandle FSAClientHandle
FSError FSAFlushFile(FSAClientHandle client, FSAFileHandle fileHandle)
FSAAsyncCallbackFn userCallback
Callback to call when the command is complete.
FSError FSAGetStatFile(FSAClientHandle client, FSAFileHandle fileHandle, FSAStat *stat)
FSError FSARename(FSAClientHandle client, const char *oldPath, const char *newPath)
FSError FSAGetTransactionBlockPoolAttributes(uint32_t *messageSize, uint32_t *poolSize, uint32_t *numMessages)
FSAIpcRequestTypeEnum
@ FSA_IPC_REQUEST_IOCTL
@ FSA_IPC_REQUEST_IOCTLV
FSError FSAGetJournalFreeSpaceSize(FSAClientHandle client, const char *path, uint64_t *journalFreeSpaceSize)
FSError FSAFlushQuota(FSAClientHandle client, const char *path)
uint8_t ioctlvVecIn
Number of ioctlv input vectors.
char target[FS_MAX_PATH+1]
FSError FSAFlushMultiQuota(FSAClientHandle client, const char *path)
FSDirectoryEntry FSADirectoryEntry
FSError FSAChangeMode(FSAClientHandle client, const char *path, FSMode permission)
FSARequest request
Buffer for FSA IPC request.
char mode[FS_MODE_LENGTH]
void(* FSAAsyncCallbackFn)(FSError result, FSACommand command, FSARequest *request, FSAResponse *response, void *userContext)
FSError FSAReadFile(FSAClientHandle client, void *buffer, uint32_t size, uint32_t count, FSAFileHandle handle, uint32_t flags)
uint32_t FSADirectoryHandle
FSADirectoryEntry entry
uint16_t FSAIpcRequestType
FSError FSAWriteFile(FSAClientHandle client, void *buffer, uint32_t size, uint32_t count, FSAFileHandle handle, uint32_t flags)
FSAUnmountFlags
@ FSA_UNMOUNT_FLAG_NONE
@ FSA_UNMOUNT_FLAG_BIND_MOUNT
@ FSA_UNMOUNT_FLAG_FORCE
FSError FSAReadDir(FSAClientHandle client, FSADirectoryHandle dirHandle, FSADirectoryEntry *directoryEntry)
FSADirectoryHandle handle
FSError FSAMakeDir(FSAClientHandle client, const char *path, FSMode mode)
FSError FSAMount(FSAClientHandle client, const char *source, const char *target, FSAMountFlags flags, void *arg_buf, uint32_t arg_len)
FSError FSAGetBadBlockInfo(FSAClientHandle client, const char *path, FSABlockInfo *blockInfo)
FSAWriteFlag writeFlags
FSAMountPriority
@ FSA_MOUNT_PRIORITY_RAM_DISK_CACHE
@ FSA_MOUNT_PRIORITY_TITLE_UPDATE
@ FSA_MOUNT_PRIORITY_UNMOUNT_ALL
@ FSA_MOUNT_PRIORITY_BASE
char oldPath[FS_MAX_PATH+1]
FSAAsyncResult FSAGetAsyncResult(OSMessage *asyncResult)
FSError FSAReadFileWithPos(FSAClientHandle client, void *buffer, uint32_t size, uint32_t count, uint32_t pos, FSAFileHandle handle, uint32_t flags)
FSStat FSAStat
FSError FSAGetPosFile(FSAClientHandle client, FSAFileHandle fileHandle, uint32_t *outPos)
FSAClientHandle FSAAddClient(FSAClientAttachAsyncData *attachAsyncData)
FSError FSAAppendFile(FSAClientHandle client, FSAFileHandle fileHandle, uint32_t size, uint32_t count)
uint32_t word0
FSARequest * request
Pointer to allocated FSA IPC Request.
uint32_t deviceSectorSize
FSError FSAMakeQuota(FSAClientHandle client, const char *name, uint32_t mode, uint64_t quota)
FSError FSACloseDir(FSAClientHandle client, FSADirectoryHandle dirHandle)
FSError FSAGetStat(FSAClientHandle client, const char *path, FSAStat *stat)
FSMessage msg
Message used for ioMsgQueue.
FSAIpcRequestType ipcReqType
IOS IPC request type to use.
FSError __FSAShimDecodeIosErrorToFsaStatus(IOSHandle handle, IOSError err)
void(* FSAClientAttachAsyncCallbackFn)(FSError result, FSACommand command, FSARequest *request, FSAResponse *response, void *userContext)
const char * FSAGetStatusStr(FSError error)
FSAQueryInfoType
@ FSA_QUERY_INFO_BAD_BLOCK_INFO
@ FSA_QUERY_INFO_ENTRY_NUM
@ FSA_QUERY_INFO_FREE_SPACE_SIZE
@ FSA_QUERY_INFO_DEVICE_INFO
@ FSA_QUERY_INFO_FRAGMENT_BLOCK_INFO
@ FSA_QUERY_INFO_DIR_SIZE
@ FSA_QUERY_INFO_JOURNAL_FREE_SPACE_SIZE
@ FSA_QUERY_INFO_STAT
@ FSA_QUERY_INFO_FILE_SYSTEM_INFO
FSError error
Result.
uint64_t deviceSizeInSectors
FSAWriteFlag
@ FSA_WRITE_FLAG_NONE
@ FSA_WRITE_FLAG_READ_WITH_POS
FSAResponse * response
Pointer to allocated FSA IPC Response.
FSAResponse response
Buffer for FSA IPC response.
FSError FSAGetCwd(FSAClientHandle client, char *outPath, uint32_t outPathLen)
FSAClientAttachAsyncCallbackFn userCallback
Callback to call when an attach has happened.
FSError FSATruncateFile(FSAClientHandle client, FSAFileHandle handle)
void * userContext
Callback to call when the command is complete.
FSError FSAGetFragmentBlockInfo(FSAClientHandle client, const char *path, FSABlockInfo *blockInfo)
FSACommandEnum
@ FSA_COMMAND_RAW_CLOSE
@ FSA_COMMAND_CHANGE_OWNER
@ FSA_COMMAND_GET_PROC_RESOURCE_USAGE
@ FSA_COMMAND_OPEN_FILE
@ FSA_COMMAND_FORMAT
@ FSA_COMMAND_FLUSH_FILE
@ FSA_COMMAND_GET_VOLUME_INFO
@ FSA_COMMAND_MAKE_LINK
@ FSA_COMMAND_UNMOUNT_WITH_PROCESS
@ FSA_COMMAND_CLOSE_DIR
@ FSA_COMMAND_SEND_PROFILE_CMD
@ FSA_COMMAND_RENAME
@ FSA_COMMAND_CHANGE_DIR
@ FSA_COMMAND_MOUNT
@ FSA_COMMAND_SET_CLIENT_PRIORITY
@ FSA_COMMAND_ADD_USER_PROCESS
@ FSA_COMMAND_STAT_FILE
@ FSA_COMMAND_READ_FILE
@ FSA_COMMAND_RAW_OPEN
@ FSA_COMMAND_DEBUG_SET_TITLE_ID
@ FSA_COMMAND_RAW_WRITE
@ FSA_COMMAND_REMOVE_QUOTA
@ FSA_COMMAND_DEL_USER_PROCESS
@ FSA_COMMAND_ROLLBACK_VOLUME
@ FSA_COMMAND_REWIND_DIR
@ FSA_COMMAND_GET_ALL_RESOURCE_USAGE
@ FSA_COMMAND_GET_ATTACH
@ FSA_COMMAND_GET_ERROR
@ FSA_COMMAND_GET_INFO_BY_QUERY
@ FSA_COMMAND_DEBUG_SET_CAPABILITY
@ FSA_COMMAND_CANCEL_GET_ATTACH
@ FSA_COMMAND_GET_FILE_BLOCK_ADDRESS
@ FSA_COMMAND_REGISTER_FLUSH_QUOTA
@ FSA_COMMAND_IS_EOF
@ FSA_COMMAND_SET_POS_FILE
@ FSA_COMMAND_XFER_PARAMS
@ FSA_COMMAND_UNMOUNT
@ FSA_COMMAND_OPEN_DIR
@ FSA_COMMAND_MAKE_QUOTA
@ FSA_COMMAND_TRUNCATE_FILE
@ FSA_COMMAND_WRITE_FILE
@ FSA_COMMAND_GET_VOLUME_EXISTENCE
@ FSA_COMMAND_CONFIG_UNSET_MEMORY_CACHE
@ FSA_COMMAND_EXEC_DEBUG_PROC
@ FSA_COMMAND_REMOVE
@ FSA_COMMAND_GET_CWD
@ FSA_COMMAND_APPEND_FILE
@ FSA_COMMAND_CONFIG_SET_MEMORY_CACHE
@ FSA_COMMAND_RAW_READ
@ FSA_COMMAND_READ_DIR
@ FSA_COMMAND_CHANGE_MODE
@ FSA_COMMAND_MOUNT_WITH_PROCESS
@ FSA_COMMAND_ROLLBACK_QUOTA
@ FSA_COMMAND_CLOSE_FILE
@ FSA_COMMAND_GET_POS_FILE
@ FSA_COMMAND_OPEN_FILE_BY_STAT
@ FSA_COMMAND_INVALID
@ FSA_COMMAND_FLUSH_MULTI_QUOTA
@ FSA_COMMAND_APPLY_MEMORY_CACHE
@ FSA_COMMAND_CONFIG_SET_PRF2_CHAR_CODE
@ FSA_COMMAND_GET_LAST_FAILED_VOLUME
@ FSA_COMMAND_FLUSH_VOLUME
@ FSA_COMMAND_MAKE_DIR
@ FSA_COMMAND_FLUSH_QUOTA
@ FSA_COMMAND_SET_PROCESS_CONFIG
char path[FS_MAX_PATH+1]
FSAFilePosition pos
char newPath[FS_MAX_PATH+1]
FSError FSARollbackQuotaForce(FSAClientHandle client, const char *path)
uint32_t FSAFilePosition
const uint8_t * buffer
Virtual pointer used only by Cafe, for IOS we should use ioctlv.vecs[1].
FSACommand command
FSA command.
uint32_t FSAFileHandle
FSError FSARollbackQuota(FSAClientHandle client, const char *path)
FSAReadFlag readFlags
Block information.
Device information.
File System information.
Process information.
Request data for Command::AppendFile.
Request data for Command::ChangeDir.
Request data for Command::ChangeMode.
Request data for Command::CloseDir.
Request data for Command::CloseFile.
Request data for Command::FlushFile.
Request data for Command::FlushQuota.
Request data for Command::GetInfoByQuery.
Request data for Command::GetPosFile.
Request data for Command::IsEof.
Request data for Command::MakeDir.
Request data for Command::MakeQuota.
Request data for Command::Mount.
Request data for Command::MountWithProcess.
Request data for Command::OpenDir.
Request data for Command::OpenFile.
Request data for Command::ReadDir.
Request data for Command::ReadFile.
Request data for Command::Remove.
Request data for Command::Rename.
Request data for Command::RewindDir.
Request data for Command::SetPosFile.
Request data for Command::StatFile.
Request data for Command::TruncateFile.
Request data for Command::Unmount.
Request data for Command::UnmountWithProcess.
Request data for Command::WriteFile.
FSOpenFileFlags
Definition: filesystem.h:198
#define FS_MAX_PATH
Definition: filesystem.h:28
FSMode
Definition: filesystem.h:137
#define FS_MODE_LENGTH
Definition: filesystem.h:29
FSError
Definition: filesystem.h:95
IOSError
Definition: ios.h:25
int32_t IOSHandle
Definition: ios.h:15
Definition: ios.h:72