General Info

Interface: FileSystem
Files: filesystem.h
Last change: 30/03/2003
Author: Luiz Henrique Shigunov
Description
Functions

0x00 - Close - Close a file
0x0e - Lookup - Find a directory entry
0x02 - Mount - Mount a file system
0x03 - Open - Open a file
0x05 - Read - Read from a file
0x0f - ReadLink - Read a symbolic link
0x07 - Remove - Remove a file

0x09 - RewindDir - Seek to start of directory
0x0a - Seek - Reposition read/write file offset
0x0b - Status - Get informations about a file
0x01 - StatusFD - Get informations about a file descriptor
0x0c - Unmount - Unmount a file system
0x0d - Write - Write into a file

Description

This page describes the FileSystem interface which provides access to file systems.

Each file system is responsible for access synchronization, check user permissions, etc.

Every device to be mounted must implement BlockDev interface.

0x00 - Close

Syntax

void FileSystem_Close(FileSystem_Handle *fd);

Properties

Description

This function closes fd.

fd is a pointer to a structure created with Open.

Return value

Nothing.

0x0e - Lookup

Syntax

int FileSystem_Lookup(FSManager_Dentry *parent, FSManager_Dentry *newDentry);

Properties

Description

This function searchs directory parent for entry newDentry.

Who calls this function must make sure that only one thread calls this function with the same parent.

Field name of newDentry has the name to be found.

If newDentry is found fields mode and fsData of newDentry must be filled.

Field mode has the same format of field mode of EntryStatus. Field fsdata are file system specific data.

Return value

0x02 - Mount

Syntax

int FileSystem_Mount(const char *devImp, unsigned int unit, int prop, const char *data, FSManager_Dentry *dentry);

Properties

Description

This function mounts unit from device devImp with properties prop.

data is specific to each file system.

This function can only be called one time for each pair devImp, unit.

Who calls this function must make sure that only one thread is executing this function simultaneously.

In case of success, field fsData of dentry must be filled. fsdata are file system specific data.

prop must be 0 or the sum of:

Return value

0x03 - Open

Syntax

int FileSystem_Open(FSManager_Dentry *dentry, int prop, FileSystem_Handle **fd);

Properties

Description

This function opens dentry with properties prop.

fd is where a file descriptor structure pointer will be stored.

prop must be the sum of:

FSManager_READ or FSManager_WRITE must be set, others can be added. (FSManager_WRITE + FSManager_CREATE, for instance).

In case prop has FSManager_CREATE, prop can have the follow values too (in octal):

These values are only used if the file system support them.

The file offset is set to the beginning of the file.

Return value

0x05 - Read

Syntax

int FileSystem_Read(FSManager_FDIO *request);

Properties

Description

This function processes read request.

In case of success, field size of request will contain how many bytes were read and file position is advanced by this number.

Return value

0x0f - ReadLink

Syntax

int FileSystem_ReadLink(FSManager_Dentry *dentry, char *buf, unsigned int size, int prop);

Properties

Description

This function reads symbolic link dentry contents and put it in buf that has size bytes.

prop can be:

Return value

0x07 - Remove

Syntax

int FileSystem_Remove(FSManager_Dentry *dentry);

Properties

Description

This function removes dentry.

dentry can be been used. Who is using it can continue to use, but won't be possible to open, list, etc.

A directory with files can't be removed.

Return value

0x09 - RewindDir

Syntax

int FileSystem_RewindDir(FileSystem_Handle *fd);

Properties

Description

This function repositions fd read offset to the beginning.

Return value

0x0a - Seek

Syntax

int FileSystem_Seek(FileSystem_Handle *fd, int count, int prop, int *newPos);

Properties

Description

This functions repositions fd read/write offset to count bytes according to prop.

prop must be:

In case of success, newPos, if different than NULL, will contain the new position.

Return value

0x0b - Status

Syntax

int FileSystem_Status(FSManager_Dentry *dentry, FSManager_EntryStatus *buf, int prop);

Properties

Description

This function gets informations about dentry and puts them in buf.

prop can be:

Return value

0x01 - StatusFD

Syntax

int FileSystem_StatusFD(FileSystem_Handle *fd, FSManager_EntryStatus *buf, int prop);

Properties

Description

This function gets informations about fd and puts them in buf.

prop can be:

Return value

0x0c - Unmount

Syntax

int FileSystem_Unmount(FSManager_Dentry *dentry, int prop);

Properties

Description

This function unmounts the file system mounted in dentry.

prop can be 0 or the sum of:

Return value

0x0d - Write

Syntax

int FileSystem_Write(FSManager_FDIO *request);

Properties

Description

This function processes write request.

In case of success, field count of request will contain how many bytes were written and file position is advanced by this number.

Return value