Difference between revisions of "VFS Implementation"

From Vita Development Wiki
Jump to navigation Jump to search
Line 127: Line 127:
 
|-
 
|-
 
|}
 
|}
 +
 +
== Typical i/o operation execution ==
 +
 +
This is a very brief desctiption for overall understanding of io <code>vfs_node</code> operations.
 +
Implementation of SceIofilemgr is quite solid and most of the functions are implemented in the same manner however there could be exceptions.
 +
When io operation like <code>sceIoLseek</code> is called here is what happens:
 +
*all user space arguments are copied to kernel space, usually onto the kernel stack. all user space uids are converted to kernel space uids
 +
*optionally control may be passed to wrapper function that also does conversion
 +
*then control is passed to kernel level function like <code>sceIoLseekForDriver</code>
 +
*kernel level function checks 0x2198 (IoSchedulerDispatcher initialized) flag
 +
 +
if dispatcher is not initialized:
 +
*kernel level function updates 0x1964 (i/o dirty) and 0x1980 (i/o counter) flags
 +
*kernel level function spawns separate thread and passes all arguments in single structure
 +
*separate thread then unpacks all arguments, finds <code>vfs_node</code> and calls exported function like <code>vfs_node_func7</code>
 +
*exported function packs all arguments into single stucture and calls real callback since it has <code>vfs_node</code> with node operation table
 +
*callback routine should be located in generic device driver, like SceSdstor, SceExfatfs or ScePfsMgr. It unpacks the arguments and then does something. For example SceSdstor dispatches the call further to SceSdif, SceWlanBt, SceMsif and SceUsbMass.
 +
*kernel level function updates 0x1980 (i/o counter) flag
 +
 +
if dispatcher is initialized:
 +
*kernel level function passes arguments to wrapper
 +
*wrapper initializes <code>io_contex</code> and assigns i/o operation index
 +
*wrapper updates 0x1964 (i/o dirty) and 0x1980 (i/o counter) flags
 +
*wrapper runs dispatcher function (offset 0x17C00) in separate thread. this function selects proper <code>vfs_node</code> function based on i/o operation index.
 +
*wrapper updates 0x1980 (i/o counter) flag

Revision as of 16:29, 1 October 2017

VFS Nodes

Module Name Comment
SceSdstor sdstor_dev_fs
SceExfatfs exfat
SceIofilemgr dummy_ttyp_dev_fs
ScePfsMgr PFS_REDIRECT_INF Redirect Pseudo Drive.
ScePfsMgr PFS_GDSD_INF Gamedata/Savedata Pseudo Drive.
ScePfsMgr PFS_AC_INF AC Pseudo Drive.

VFS Operations

  • implemented operation is marked as implemented
  • not implemented is marked as
  • return 0 placeholder is marked as 0
  • return error is marked with corresponding error name
Function sdstor_dev_fs exfat dummy_ttyp_dev_fs PFS_REDIRECT_INF PFS_GDSD_INF PFS_AC_INF
1 implemented implemented implemented implemented implemented implemented
2 SCE_ERROR_ERRNO_EBUSY implemented 0 implemented implemented implemented
3 implemented implemented implemented implemented implemented implemented
4 implemented
5
6
7 implemented 0 implemented implemented
8
9 0 0 0 0 0 0
10 0 0 0 0 0
11
12 implemented implemented implemented implemented implemented
13 implemented implemented implemented implemented implemented

VFS Node Operations

  • implemented operation is marked as implemented
  • not implemented is marked as
  • return 0 placeholder is marked as 0
  • return error is marked with corresponding error name
Function sdstor_dev_fs exfat dummy_ttyp_dev_fs PFS_REDIRECT_INF PFS_GDSD_INF PFS_AC_INF
1 implemented implemented 0 implemented implemented implemented
2 implemented implemented implemented implemented
3 implemented implemented 0 implemented implemented implemented
4 implemented implemented implemented implemented implemented implemented
5 implemented implemented 0 implemented implemented implemented
6 implemented implemented implemented implemented implemented implemented
7 implemented implemented 0 implemented implemented implemented
8 SCE_ERROR_ERRNO_EUNSUP 0 implemented implemented implemented
9 implemented implemented implemented implemented implemented
10 implemented implemented implemented implemented
11 implemented implemented implemented implemented
12 implemented implemented implemented implemented
13 implemented implemented implemented implemented
14 implemented implemented implemented implemented
15 implemented implemented implemented implemented
16 implemented implemented implemented implemented
17 implemented implemented implemented implemented
18
19 implemented implemented implemented implemented implemented
20 implemented implemented implemented implemented implemented
21 0 implemented 0 implemented implemented implemented
22 implemented
23 implemented
24 0 implemented implemented implemented implemented
25 implemented implemented implemented implemented
26 implemented implemented implemented implemented
27 implemented implemented implemented implemented
28 implemented implemented implemented implemented
29

Typical i/o operation execution

This is a very brief desctiption for overall understanding of io vfs_node operations. Implementation of SceIofilemgr is quite solid and most of the functions are implemented in the same manner however there could be exceptions. When io operation like sceIoLseek is called here is what happens:

  • all user space arguments are copied to kernel space, usually onto the kernel stack. all user space uids are converted to kernel space uids
  • optionally control may be passed to wrapper function that also does conversion
  • then control is passed to kernel level function like sceIoLseekForDriver
  • kernel level function checks 0x2198 (IoSchedulerDispatcher initialized) flag

if dispatcher is not initialized:

  • kernel level function updates 0x1964 (i/o dirty) and 0x1980 (i/o counter) flags
  • kernel level function spawns separate thread and passes all arguments in single structure
  • separate thread then unpacks all arguments, finds vfs_node and calls exported function like vfs_node_func7
  • exported function packs all arguments into single stucture and calls real callback since it has vfs_node with node operation table
  • callback routine should be located in generic device driver, like SceSdstor, SceExfatfs or ScePfsMgr. It unpacks the arguments and then does something. For example SceSdstor dispatches the call further to SceSdif, SceWlanBt, SceMsif and SceUsbMass.
  • kernel level function updates 0x1980 (i/o counter) flag

if dispatcher is initialized:

  • kernel level function passes arguments to wrapper
  • wrapper initializes io_contex and assigns i/o operation index
  • wrapper updates 0x1964 (i/o dirty) and 0x1980 (i/o counter) flags
  • wrapper runs dispatcher function (offset 0x17C00) in separate thread. this function selects proper vfs_node function based on i/o operation index.
  • wrapper updates 0x1980 (i/o counter) flag