Return to previous page Return to menu Go to next page

3. Directory operations

3.1 Initialization

GFS_Init must be executed before using this library. GFS_Init performs the following processing.

(1) Initialization

Set the work area used by the library and initialize it. All work areas and directory information storage areas must be prepared by the application.
The size of the area varies depending on the number of files that are opened at the same time. Where open_max is the maximum number of files that can be opened simultaneously.
GFS_WORK_SIZE (open_max)

(2) Mount processing

Read the root directory from the CD-ROM and set it as the current directory. It also initializes the CD block and deletes all sector data in the CD buffer. Since the file system only holds the start address of the directory information storage area, applications should not change the contents of the area.
Initialize directory information management structure as follows and call GFS_Init.

#define OPEN_MAX 20 / * Maximum number of files opened simultaneously * /
#define MAX_DIR 10 / * Maximum number of directory information * / 

Uint32 work [GFS_WORK_SIZE (OPEN_MAX) / 4]; / ​​* Library work area * / GfsDirTbl dirtbl; / * Directory information management structure * / GfsDirId dir [MAX_DIR]; / * Directory information storage area * /

GFS_DIRTBL_TYPE (& dirtbl) = GFS_DIR_ID; / * Directory information storage area type * / GFS_DIRTBL_NDIR (& dirtbl) = MAX_DIR; / * Directory information storage area * /                                            / * Maximum number of elements * / GFS_DIRTBL_DIRID (& dirtbl) = dir; / ​​* Directory information storage area * /                                            / * Address * / GFS_Init(OPEN_MAX, work, &dirtbl);

If you change the CD-ROM, you must call GFS_Init again.


Return to previous page Return to menu Go to next page