PROGRAMMER'S GUIDEFile system library
BackForward
File system library

8. Function specifications-1


8.1 Directory management


 List
 Title

Function specifications

 Function

File system initialization / mounting

 Function Name

GFS_Init

 No

1.1

Form
Sint32 GFS_Init (Sint32 open_max, void * work, GfsDirTbl * dirtbl)
input
 open_max
 : Maximum number of files to open at the same time (1 to 24)
 work
 : Work area for the library
 dirtbl
 : Directory information management structure
output
dirtbl: Directory information management structure (directory information storage area)
Function value
The number of directory information read. Returns a negative error code when an error occurs.
 If NULL is specified for the pointer to the directory information management structure as an argument, the number of directory information held by the CD block file system is returned as a function value.
function
Initializes the file system and mounts the CD-ROM.
Specify the directory management function by specifying dirtbl.

 dirtbl
 Directory management function to use
 Directory management structure
 Directory management of this library
 NULL
 CD block file system directory management
remarks

  1. work must be placed on a 4-byte boundary.

  2. The INT_ChgMsk function allows SCU level 0-DMA termination interrupts.

  3. Initialize the CD block as follows.

(The ECC and retry counts are set to the maximum values, otherwise they remain the defaults.)
・ CD block soft reset :do not
・ Subcode decoding :do not
-Mode 2 subheader recognition :do
・ Form 2 lead retry :do not
・ CD-ROM data read : Maximum speed (currently double speed)
・ Standby time : 180 seconds
・ ECC times :5 times
·number of retries : 15 times

 List
 Title

Function specifications

 Function

Read directory information

 Function Name

GFS_LoadDir

 No

1.2

Form
Sint32 GFS_LoadDir (Sint32 fid, GfsDirTbl * dirtbl)
input
 fid
 : Directory file identifier
 dirtbl
 : Directory information management structure
output
dirtbl: Directory information management structure (directory information storage area)
Function value
The number of directories read. Returns a negative error code when an error occurs.
 If NULL is specified for the pointer to the directory information management structure as an argument, the number of directory information held by the CD block file system is returned as a function value.
function
Reads directory information from the specified directory file.
The storage location of directory information changes depending on the specification of dirtbl.
 dirtbl
 Directory information storage area
 Directory management structure
 Dirtbl directory information storage area
 NULL
 File management information area in the CD block

If you specify NULL for dirtbl and GFS_Init does not declare that you want to use the CD block file system, you will get an error. However, it is always possible to pass dirtbl a pointer to a suitable non-null directory information management structure.

 List
 Title

Function specifications

 Function

Current directory settings

 Function Name

GFS_SetDir

 No

1.3 1.3

Form
Sint 32GFS_SetDir (GfsDirTbl * dirtbl);
input
dirtbl: Directory information management structure
output
none
Function value
Error code.
function
Sets the specified directory information to the current directory.
The directory information used changes depending on the specification of dirtbl.
 dirtbl
 Directory information to use
 Directory management structure
 Contents of dirtbl
 NULL
 File management information in the CD block
When NULL is specified for dirtbl, an error will occur unless GFS_Init declares that the CD block file system will be used. However, it is always possible to pass dirtbl a pointer to a suitable non-null directory information management structure.

 List
 Title

Function specifications

 Function

Name-to-file identifier conversion

 Function Name

GFS_NameToId

 No

1.4

Form
Sint 32GFS_NameToId (Sint8 * fname)
input
fname: file name
output
none
Function value
File identifier. Negative error code when an error occurs.
function
Returns the file identifier that corresponds to the file name.

 List
 Title

Function specifications

 Function

Conversion from identifier to filename

 Function Name

GFS_IdToName

 No

1.5

Form
const Sint8 * GFS_IdToName (Sint32 fid)
input
fid: file identifier
output
none
Function value
A pointer to the file name. NULL when an error occurs.
function
Returns a pointer to the file name that corresponds to the file identifier. This pointer points to the conversion table area used by this library.

 List
 Title

Function specifications

 Function

Get directory information

 Function Name

GFS_GetDirInfo

 No

1.6

Form
Sint32 GFS_GetDirInfo (Sint32 fid, GfsDirId * dirrec)
input
fid: File identifier
output
dirrec: Directory information
Function value
Error code
function
Get directory information from the file identifier.

 List
 Title

Function specifications

 Function

File system reset

 Function Name

GFS_Reset

 No

1.7 1.7

Form
void GFS_Reset (void)
input
none
output
none
Function value
none
function
Closes all open files and resets the file system.
(Initializes other than directory information.)
remarks
If you are using a stream system, close the stream before executing this function.

BackForward
PROGRAMMER'S GUIDEFile system library
Copyright SEGA ENTERPRISES, LTD., 1997