Chapter 20. file system table, File system table – Comtrol eCos User Manual

Page 417

Advertising
background image

Chapter 20. File System Table

The filesystem table is an array of entries that describe each filesystem implementation that is part of the system
image. Each resident filesystem should export an entry to this table using the

FSTAB_ENTRY()

macro.

Note: At present we do not support dynamic addition or removal of table entries. However, an API similar to

mount()

would allow new entries to be added to the table.

The table entries are described by the following structure:

struct cyg_fstab_entry

{

const char

*name;

// filesystem name

CYG_ADDRWORD

data;

// private data value

cyg_uint32

syncmode;

// synchronization mode

int

(*mount)

( cyg_fstab_entry *fste, cyg_mtab_entry *mte );

int

(*umount)

( cyg_mtab_entry *mte );

int

(*open)

( cyg_mtab_entry *mte, cyg_dir dir, const char *name,

int mode,

cyg_file *fte );

int

(*unlink)

( cyg_mtab_entry *mte, cyg_dir dir, const char *name );

int

(*mkdir)

( cyg_mtab_entry *mte, cyg_dir dir, const char *name );

int

(*rmdir)

( cyg_mtab_entry *mte, cyg_dir dir, const char *name );

int

(*rename)

( cyg_mtab_entry *mte, cyg_dir dir1, const char *name1,

cyg_dir dir2, const char *name2 );

int

(*link)

( cyg_mtab_entry *mte, cyg_dir dir1, const char *name1,

cyg_dir dir2, const char *name2, int type );

int

(*opendir)

( cyg_mtab_entry *mte, cyg_dir dir, const char *name,

cyg_file *fte );

int

(*chdir)

( cyg_mtab_entry *mte, cyg_dir dir, const char *name,

cyg_dir *dir_out );

int

(*stat)

( cyg_mtab_entry *mte, cyg_dir dir, const char *name,

struct stat *buf);

int

(*getinfo)

( cyg_mtab_entry *mte, cyg_dir dir, const char *name,

int key, char *buf, int len );

int

(*setinfo)

( cyg_mtab_entry *mte, cyg_dir dir, const char *name,

int key, char *buf, int len );

};

The

name

field points to a string that identifies this filesystem implementation. Typical values might be "romfs",

"msdos", "ext2" etc.

The

data

field contains any private data that the filesystem needs, perhaps the root of its data structures.

The

syncmode

field contains a description of the locking protocol to be used when accessing this filesystem. It

will be described in more detail in

Chapter 24

.

313

Advertising