Filesystem services: Difference between revisions
No edit summary |
|||
(21 intermediate revisions by 3 users not shown) | |||
Line 16: | Line 16: | ||
Takes a type-0x19 input buffer containing a [[#FspPath]] and an input [[NCM_services#ProgramId|ProgramId]]. Returns an [[#IFileSystem]]. | Takes a type-0x19 input buffer containing a [[#FspPath]] and an input [[NCM_services#ProgramId|ProgramId]]. Returns an [[#IFileSystem]]. | ||
[10.0.0+] | [10.0.0+] Now takes an additional type-0x1A output buffer. | ||
[16.0.0+] | [16.0.0+] Now takes an additional input [[#ContentAttributes]]. | ||
[17.0.0+] | [17.0.0+] Now takes a type-0x6 output buffer instead of a type-0x1A output buffer. | ||
[20.0.0+] Now no longer takes a type-0x19 input buffer containing a [[#FspPath]] and instead takes an input [[NCM_services#StorageId|StorageId]]. | |||
== IsArchivedProgram == | == IsArchivedProgram == | ||
Line 45: | Line 47: | ||
== RegisterProgram == | == RegisterProgram == | ||
Takes | Takes an input [[NCM_services#StorageId|StorageId]], an input u64 ProcessId, an input [[NCM_services#ProgramId|ProgramId]], a type-0x5 input buffer containing an [[NPDM#ACID|ACID]] [[NPDM#FsAccessControl|FsAccessControl]], and a type-0x5 input buffer containing an [[NPDM#ACI0|ACI0]] [[NPDM#FsAccessControl|FsAccessControl]]. | ||
Final FS permissions are stored as (ACI0_perms & ACID_perms). Will panic(svcBreak) when buffer sizes from ipc-rawdata are invalid. | Final FS permissions are stored as (ACI0_perms & ACID_perms). Will panic(svcBreak) when buffer sizes from ipc-rawdata are invalid. | ||
[20.0.0+] Now takes an additional input [[#FsAccessControlRestrictionMode]]. | |||
== UnregisterProgram == | == UnregisterProgram == | ||
Takes | Takes an input u64 ProcessId. No output. | ||
Removes registered FS permissions for that PID. | |||
== SetEnabledProgramVerification == | == SetEnabledProgramVerification == | ||
Takes an input bool. No output. | |||
When the flag is zero, it will set ret=0 instead of ret={error} when verifying the fixed-key [[NPDM]] ACID signature fails. This also skips verifying the [[NCA_Format|NCA Header]] signature using the ACID key. Note that if verifying the fixed-key ACID signature is successful, and verifying the ACID-key NCA header signature fails, it will throw an error and abort. | When the flag is zero, it will set ret=0 instead of ret={error} when verifying the fixed-key [[NPDM]] ACID signature fails. This also skips verifying the [[NCA_Format|NCA Header]] signature using the ACID key. Note that if verifying the fixed-key ACID signature is successful, and verifying the ACID-key NCA header signature fails, it will throw an error and abort. | ||
Line 125: | Line 131: | ||
|- | |- | ||
| 37 || [14.0.0+] CreateSaveDataFileSystemWithCreationInfo2 | | 37 || [14.0.0+] CreateSaveDataFileSystemWithCreationInfo2 | ||
|- | |||
| 38 || [20.0.0+] DetachSdCard | |||
|- | |- | ||
| 51 || [[#OpenSaveDataFileSystem]] | | 51 || [[#OpenSaveDataFileSystem]] | ||
Line 209: | Line 217: | ||
|- | |- | ||
| 501 || [[#OpenGameCardDetectionEventNotifier]] | | 501 || [[#OpenGameCardDetectionEventNotifier]] | ||
|- | |||
| 502 || [20.0.0+] OpenSdCardAwakenReadyEventNotifier | |||
|- | |- | ||
| 503 || [19.0.0+] OpenGameCardAwakenReadyEventNotifier | | 503 || [19.0.0+] OpenGameCardAwakenReadyEventNotifier | ||
Line 265: | Line 275: | ||
|- | |- | ||
| 640 || [4.0.0-7.0.1] IsSignedSystemPartitionOnSdCardValid | | 640 || [4.0.0-7.0.1] IsSignedSystemPartitionOnSdCardValid | ||
|- | |||
| 651 || [S2] | |||
|- | |||
| 660 || [S2] | |||
|- | |- | ||
| 700 || [5.0.0+] [[#OpenAccessFailureDetectionEventNotifier]] | | 700 || [5.0.0+] [[#OpenAccessFailureDetectionEventNotifier]] | ||
Line 341: | Line 355: | ||
Note that the functions check whether or not at least one bit is set in the mask. This means that, you don't need to set 0xFFFFFFFFFFFFFFFF to get all permissions: it suffices to set 0x8000000000000000. | Note that the functions check whether or not at least one bit is set in the mask. This means that, you don't need to set 0xFFFFFFFFFFFFFFFF to get all permissions: it suffices to set 0x8000000000000000. | ||
If nn::spl::IsDebugMode() is disabled (retail behavior), the FS sysmodule masks the permission descriptor with 0x3FFFFFFFFFFFFFFF upon process registration. | |||
If the code were to request an invalid input type, panic. But this never happens. | If the code were to request an invalid input type, panic. But this never happens. | ||
Line 625: | Line 641: | ||
| [17.0.0-19.0.0] 0x4A || CanGetProgramId || 0x8000000008000000 || GetProgramId, Removed in 20.0.0 | | [17.0.0-19.0.0] 0x4A || CanGetProgramId || 0x8000000008000000 || GetProgramId, Removed in 20.0.0 | ||
|- | |- | ||
| [20.0.0+] 0x55 || | | [20.0.0+] 0x55 || CanGetContentStorageInfo || 0x8000000000000800 || | ||
|- | |- | ||
| [20.0.0+] 0x56 || | | [20.0.0+] 0x56 || CanDetachSdCard || 0x8000000004000000 || | ||
|- | |- | ||
| [20.0.0+] 0x57 || | | [20.0.0+] 0x57 || CanSetSdCardActivationMode || 0x8000000004000000 || | ||
|} | |} | ||
Line 643: | Line 659: | ||
Takes an input [[#FileSystemProxyType]] and an input [[NCM_services#ProgramId|ProgramId]]. Returns an [[#IFileSystem]]. | Takes an input [[#FileSystemProxyType]] and an input [[NCM_services#ProgramId|ProgramId]]. Returns an [[#IFileSystem]]. | ||
The [[#FileSystemProxyType]] must be '''Manual'''. | |||
Note: web-applet strings refer to both this cmd and [[#OpenFileSystemWithId]] as "MountContent", but official nn_sf_sync symbols use "OpenXX" names. | Note: web-applet strings refer to both this cmd and [[#OpenFileSystemWithId]] as "MountContent", but official nn_sf_sync symbols use "OpenXX" names. | ||
Line 781: | Line 797: | ||
Returns a [[IPC_Marshalling#Domain_message|domain object ID]] implementing the [[#IStorage]] interface for data archives. | Returns a [[IPC_Marshalling#Domain_message|domain object ID]] implementing the [[#IStorage]] interface for data archives. | ||
[[NCA|PublicData]] is exempt from the [[#Permissions|permissions]] check. | |||
== OpenDataFileSystemWithProgramIndex == | == OpenDataFileSystemWithProgramIndex == | ||
Line 1,092: | Line 1,110: | ||
|- | |- | ||
| 6 || [17.0.0+] [[#GetSdCardHostControllerStatus]] | | 6 || [17.0.0+] [[#GetSdCardHostControllerStatus]] | ||
|- | |||
| 7 || [20.0.0+] SetSdCardActivationMode | |||
|- | |||
| 8 || [20.0.0+] [S1] TryGetSdCardInfo | |||
|- | |- | ||
| 100 || [[#GetMmcCid]] | | 100 || [[#GetMmcCid]] | ||
Line 1,113: | Line 1,135: | ||
| 117 || [17.0.0+] [[#EraseMmcWithRange]] | | 117 || [17.0.0+] [[#EraseMmcWithRange]] | ||
|- | |- | ||
| | | 118 || [20.0.0+] MarkBeforeEraseMmcPartitionUserData | ||
|- | |- | ||
| | | 119 || [20.0.0+] CheckAfterEraseMmcPartitionUserData | ||
|- | |- | ||
| | | 200 || [S1] [[#IsGameCardInserted]] | ||
|- | |- | ||
| | | 201 || [S1] [[#EraseGameCard]] | ||
|- | |- | ||
| | | 202 || [S1] [[#GetGameCardHandle]] | ||
|- | |- | ||
| | | 203 || [S1] [[#GetGameCardUpdatePartitionInfo]] | ||
|- | |- | ||
| | | 204 || [S1] [[#FinalizeGameCardDriver]] | ||
|- | |- | ||
| | | 205 || [S1] [[#GetGameCardAttribute]] | ||
|- | |- | ||
| | | 206 || [S1] [[#GetGameCardDeviceCertificate]] | ||
|- | |- | ||
| | | 207 || [S1] [[#GetGameCardAsicInfo]] | ||
|- | |- | ||
| | | 208 || [S1] [[#GetGameCardIdSet]] | ||
|- | |- | ||
| | | 209 || [S1] [[#WriteToGameCardDirectly]] | ||
|- | |- | ||
| | | 210 || [S1] [[#SetVerifyWriteEnalbleFlag]] | ||
|- | |- | ||
| | | 211 || [S1] [[#GetGameCardImageHash]] | ||
|- | |- | ||
| | | 212 || [S1] [2.0.0+] [[#GetGameCardDeviceIdForProdCard]] | ||
|- | |- | ||
| | | 213 || [S1] [2.0.0+] [[#EraseAndWriteParamDirectly]] | ||
|- | |- | ||
| | | 214 || [S1] [2.0.0+] [[#ReadParamDirectly]] | ||
|- | |- | ||
| | | 215 || [S1] [2.0.0+] [[#ForceEraseGameCard]] | ||
|- | |- | ||
| | | 216 || [S1] [2.0.0+] [[#GetGameCardErrorInfo]] | ||
|- | |- | ||
| | | 217 || [S1] [2.1.0+] [[#GetGameCardErrorReportInfo]] | ||
|- | |- | ||
| | | 218 || [S1] [3.0.0+] [[#GetGameCardDeviceId]] | ||
|- | |- | ||
| | | 219 || [S1] [8.0.0+] [[#ChallengeCardExistence]] | ||
|- | |- | ||
| | | 220 || [S1] [9.0.0+] [[#GetGameCardCompatibilityType]] | ||
|- | |- | ||
| | | 221 || [S1] [17.0.0+] [[#GetGameCardAsicCertificate]] | ||
|- | |- | ||
| 224 || [19.0.0+] [[#GetGameCardApplicationIdList]] | | 222 || [S1] [18.0.0+] [[#GetGameCardCardHeader]] | ||
|- | |||
| 223 || [S1] [19.0.0+] [[#SetGameCardSessionCreationDelay]] | |||
|- | |||
| 224 || [S1] [19.0.0+] [[#GetGameCardApplicationIdList]] | |||
|- | |||
| 225 || [S1] [20.0.0+] RegisterGameCardConfigurationData | |||
|- | |||
| 226 || [S1] [20.0.0+] GetGameCardDetailedErrorReportInfo | |||
|- | |- | ||
| 300 || [[#SetSpeedEmulationMode]] | | 300 || [[#SetSpeedEmulationMode]] | ||
Line 1,168: | Line 1,198: | ||
|- | |- | ||
| 302 || [18.0.0+] [[#SetApplicationStorageSpeed]] | | 302 || [18.0.0+] [[#SetApplicationStorageSpeed]] | ||
|- | |||
| 303 || [20.0.0+] SetGameCardClockRateForSpeedEmulation | |||
|- | |||
| 304 || [20.0.0+] ClearGameCardClockRateForSpeedEmulation | |||
|- | |- | ||
| 400 || [5.0.0+] [[#SuspendSdmmcControl]] | | 400 || [5.0.0+] [[#SuspendSdmmcControl]] | ||
Line 1,178: | Line 1,212: | ||
|- | |- | ||
| 501 || [6.0.0+] [[#ClearDeviceSimulationEvent]] | | 501 || [6.0.0+] [[#ClearDeviceSimulationEvent]] | ||
|- | |||
| 800 || [S2] [[#OpenStorageDeviceManager]] | |||
|} | |} | ||
Line 1,333: | Line 1,369: | ||
== ClearDeviceSimulationEvent == | == ClearDeviceSimulationEvent == | ||
Takes a total of 4-bytes of input. No output. | Takes a total of 4-bytes of input. No output. | ||
== OpenStorageDeviceManager == | |||
Takes a byte. Returns an [[#IStorageDeviceManager]]. | |||
= IEventNotifier = | = IEventNotifier = | ||
Line 1,551: | Line 1,590: | ||
|- | |- | ||
| 16 || [[#SetKeySeedPackage]] | | 16 || [[#SetKeySeedPackage]] | ||
|- | |||
| 17 || [20.0.0+] SetLocalKeySeedPackage | |||
|- | |- | ||
| 32 || [[#OpenSaveDataExporter]] | | 32 || [[#OpenSaveDataExporter]] | ||
Line 1,644: | Line 1,685: | ||
|- | |- | ||
| 74 || [18.0.0+] [[#GetKeySeed]] | | 74 || [18.0.0+] [[#GetKeySeed]] | ||
|- | |||
| 75 || [20.0.0+] GetLocalKeySeedPackage | |||
|- | |- | ||
| 80 || [6.0.0+] [[#GetImportInitialDataAad]] | | 80 || [6.0.0+] [[#GetImportInitialDataAad]] | ||
Line 1,852: | Line 1,895: | ||
= IStorageDeviceManager = | = IStorageDeviceManager = | ||
This is "nn::fssrv::storage::sf::IStorageDeviceManager". | [S2] This is "nn::fssrv::storage::sf::IStorageDeviceManager". | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 1,858: | Line 1,901: | ||
! Cmd || Name | ! Cmd || Name | ||
|- | |- | ||
| | | 0 || IsInserted | ||
|- | |- | ||
| | | 1 || IsHandleValid | ||
|- | |- | ||
| | | 2 || [[#OpenDetectionEvent]] | ||
|- | |- | ||
| | | 3 || Returns an [[#IEventNotifier]]. | ||
|- | |- | ||
| | | 10 || [[#OpenOperator]] | ||
|- | |- | ||
| | | 20 || [[#OpenDevice]] | ||
|- | |- | ||
| | | 21 || [[#OpenStorage]] | ||
|- | |||
| 34 || Invalidate | |||
|} | |} | ||
== OpenDetectionEvent == | |||
Returns an [[#IEventNotifier]]. | |||
== OpenOperator == | |||
Returns an [[#IStorageDeviceOperator]]. | |||
== OpenDevice == | |||
Returns an [[#IStorageDevice]]. | |||
== OpenStorage == | |||
Returns an [[#IStorage]]. | |||
= IStorageDeviceOperator = | = IStorageDeviceOperator = | ||
This is "nn::fssrv::storage::sf::IStorageDeviceOperator". | [S2] This is "nn::fssrv::storage::sf::IStorageDeviceOperator". | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 1,880: | Line 1,936: | ||
! Cmd || Name | ! Cmd || Name | ||
|- | |- | ||
| | | 0 || Operate | ||
|- | |- | ||
| | | 1 || OperateIn | ||
|- | |- | ||
| | | 10 || OperateOut | ||
|- | |- | ||
| | | 11 || OperateOut2 | ||
|- | |- | ||
| | | 20 || OperateInOut | ||
|- | |- | ||
| | | 21 || OperateIn2Out | ||
|} | |} | ||
= IStorageDevice = | = IStorageDevice = | ||
This is "nn::fssrv::storage::sf::IStorageDevice". | [S2] This is "nn::fssrv::storage::sf::IStorageDevice". | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 1,900: | Line 1,956: | ||
! Cmd || Name | ! Cmd || Name | ||
|- | |- | ||
| | | 0 || GetHandle | ||
|- | |- | ||
| | | 1 || IsHandleValid | ||
|- | |- | ||
| | | 10 || OpenOperator | ||
|- | |- | ||
| | | 20 || Read | ||
|- | |- | ||
| | | 21 || Write | ||
|- | |- | ||
| | | 22 || Flush | ||
|- | |- | ||
| | | 23 || SetSize | ||
|- | |- | ||
| | | 24 || GetSize | ||
|- | |- | ||
| | | 25 || OperateRange | ||
|} | |} | ||
= FileSystemProxyType = | = FileSystemProxyType = | ||
This is "nn::fs::FileSystemProxyType". | This is "nn::fs::FileSystemProxyType". | ||
sdknso converts the input [[#ContentType|ContentType]] to a FileSystemProxyType, for use with the cmd input. | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 1,971: | Line 2,029: | ||
|- | |- | ||
| 0 || None | | 0 || None | ||
|- | |||
| 1 || [S2] | |||
|- | |- | ||
| 15 || All | | 15 || All | ||
Line 3,148: | Line 3,208: | ||
= InitialDataVersion2 = | = InitialDataVersion2 = | ||
This is a 0x8210-byte struct used by [[#ISaveDataTransferManagerWithDivision]]. | This is a 0x8210-byte struct used by [[#ISaveDataTransferManagerWithDivision]]. | ||
= FsAccessControlRestrictionMode = | |||
This is "nn::fs::FsAccessControlRestrictionMode". | |||
{| class="wikitable" border="1" | |||
|- | |||
! Value || Name | |||
|- | |||
| 0 || | |||
|} | |||
[[Category:Services]] | [[Category:Services]] |