The CFS API is intentionally simple. The CFS API is modeled after the POSIX file API, and slightly simplified.
Files | |
file | cfs.h |
CFS header file. | |
Defines | |
#define | CFS_READ 0 |
Specify that cfs_open() should open a file for reading. | |
#define | CFS_WRITE 1 |
Specify that cfs_open() should open a file for writing. | |
#define | cfs_open(name, flags) (cfs_find_service()->open(name, flags)) |
#define | cfs_close(fd) (cfs_find_service()->close(fd)) |
#define | cfs_read(fd, buf, len) (cfs_find_service()->read(fd, buf, len)) |
#define | cfs_write(fd, buf, len) (cfs_find_service()->write(fd, buf, len)) |
#define | cfs_seek(fd, off) (cfs_find_service()->seek(fd, off)) |
#define | cfs_opendir(dirp, name) (cfs_find_service()->opendir(dirp, name)) |
#define | cfs_readdir(dirp, ent) (cfs_find_service()->readdir(dirp, ent)) |
#define | cfs_closedir(dirp) (cfs_find_service()->closedir(dirp)) |
Functions | |
int | cfs_open (const char *name, int flags) |
Open a file. | |
void | cfs_close (int fd) |
Close an open file. | |
int | cfs_read (int fd, char *buf, unsigned int len) |
Read data from an open file. | |
int | cfs_write (int fd, char *buf, unsigned int len) |
Write data to an open file. | |
int | cfs_seek (int fd, unsigned int offset) |
Seek to a specified position in an open file. | |
int | cfs_opendir (struct cfs_dir *dirp, const char *name) |
Open a directory for reading directory entries. | |
int | cfs_readdir (struct cfs_dir *dirp, struct cfs_dirent *dirent) |
Read a directory entry. | |
int | cfs_closedir (struct cfs_dir *dirp) |
Close a directory opened with cfs_opendir(). |
|
Specify that cfs_open() should open a file for reading. This constant indicates to cfs_open() that a file should be opened for reading. CFS_WRITE should be used if the file is opened for writing, and CFS_READ + CFS_WRITE indicates that the file is opened for both reading and writing.
|
|
Specify that cfs_open() should open a file for writing. This constant indicates to cfs_open() that a file should be opened for writing. CFS_READ should be used if the file is opened for reading, and CFS_READ + CFS_WRITE indicates that the file is opened for both reading and writing.
|
|
Close an open file.
|
|
Close a directory opened with cfs_opendir().
|
|
Open a file.
An opened file must be closed with cfs_close().
|
|
Open a directory for reading directory entries.
|
|
Read data from an open file.
|
|
Read a directory entry.
|
|
Seek to a specified position in an open file.
|
|
Write data to an open file.
|