Japanese
PROGRAMMER'S GUIDEFile system library
BackForward
file system library

8.Function specification-1


8.1 Directory management


 one
View
table
 Title

function specification

 Function

Initialize/mount file system

 Function name

GFS_Init

 No

1.1

Format
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 library
 dirtbl
 :Directory information management structure
output
dirtbl: Directory information management structure (directory information storage area)
function value
Number of directory information read. Returns a negative error code when an error occurs.
 If NULL is specified for the argument pointer to the directory information management structure, the number of directory information held by the CD block file system is returned as the function value.
function
Initializes the file system and mounts the CD-ROM.
Specify the directory management function by specifying dirtbl.

 dirtbl
 Directory management functions used
 directory management structure
 Directory management for this library
 NULL
 CD block file system directory management
remarks

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

  2. The INT_ChgMsk function enables the SCU's level 0-DMA end interrupt.

  3. Initialize the CD block as follows.

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

 one
View
table
 Title

function specification

 Function

Load directory information

 Function name

GFS_LoadDir

 No

1.2

Format
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
Number of directories read. Returns a negative error code when an error occurs.
 If NULL is specified for the argument pointer to the directory information management structure, the number of directory information held by the CD block file system is returned as the function value.
function
Reads directory information from the specified directory file.
The storage location of directory information changes depending on the dirtbl specification.
 dirtbl
 Directory information storage area
 directory management structure
 dirtbl directory information storage area
 NULL
 File management information area in CD block

If NULL is specified for dirtbl, an error will occur if the CD block file system is not declared in GFS_Init. However, it is always possible to pass dirtbl a non-NULL pointer to an appropriate directory information management structure.

 one
View
table
 Title

function specification

 Function

Setting the current directory

 Function name

GFS_SetDir

 No

1.3

Format
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 dirtbl specification.
 dirtbl
 Directory information to use
 directory management structure
 contents of dirtbl
 NULL
 File management information in CD block
If you specify NULL for dirtbl, an error will occur unless you declare in GFS_Init that the CD block file system will be used. However, it is always possible to pass dirtbl a non-NULL pointer to an appropriate directory information management structure.

 one
View
table
 Title

function specification

 Function

Convert name to file identifier

 Function name

GFS_NameToId

 No

1.4

Format
Sint 32GFS_NameToId(Sint8 *fname)
input
fname: File name
output
none
function value
File identifier. A negative error code if an error occurs.
function
Returns the file identifier corresponding to the file name.

 one
View
table
 Title

function specification

 Function

Converting an identifier to a file name

 Function name

GFS_IdToName

 No

1.5

Format
const Sint8 *GFS_IdToName(Sint32 fid)
input
fid: file identifier
output
none
function value
Pointer to file name. NULL if an error occurs.
function
Returns a pointer to the file name corresponding to the file identifier. This pointer points to the conversion table area used by this library.

 one
View
table
 Title

function specification

 Function

Get directory information

 Function name

GFS_GetDirInfo

 No

1.6

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

 one
View
table
 Title

function specification

 Function

Resetting the file system

 Function name

GFS_Reset

 No

1.7

Format
void GFS_Reset(void)
input
none
output
none
function value
none
function
Closes all open files and resets the file system.
(Initializes everything 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