#include <FS.h>
Collaboration diagram for FS:

Public Member Functions | |
| int | open (Volume &volume, const char *path, const char *name) |
| Open takes a Volume, a path, and a file name, and returns a file descriptor to the open file. Returns DISK_ERROR on error. | |
| void | close (int fd) |
| Close takes a file descriptor and closes the file. | |
| int | read (int fd, char *buf, int len) |
| Read takes a file descriptor, a buffer, and buffer length arguments, fills the buffer, and returns the number of bytes written in the buffer. Zero is returned to indicate EOF. DISK_ERROR is returned for errors. | |
| int | write (int fd, char *buf, int len) |
| Write takes a file descriptor, a buffer with content, the length of the buffer, and writes the data to file. DISK_OK is returned on success and DISK_ERROR if an error occurred. | |
| int | seek (int fd, int pos) |
| Seek moves the current pointer to a new position within the file. Returns DISK_OK on success, and DISK_ERROR when an error occurred. | |
| int | ls (Volume &volume, const char *path) |
| Ls lists the directory contents of a Volume given a path. | |
| int | rm (Volume &volume, const char *path, const char *name) |
| Rm removes a file from a Volume on a path. | |
| int | mkdir (Volume &volume, const char *path, const char *name) |
| Mkdir creates a new directory in a Volume on a path. | |
| int | rmdir (Volume &volume, const char *path, const char *name) |
| Rmdir removes a directory of a Volume on a path. | |
An FS object provides a high-level interface to a collection of Volumes. The FS API supports open, close, read, write, seek, and close operations on files, file removal, and directory creation, listing, and removal. An FS object maintains open files in the open file table, which should normally be placed in a monitor for concurrency control.
Example:
FS fs; // create a file system object RAMDisk ram1; // create a RAM disk object ram1.format(100); // format the RAM disk with 100 blocks Volume A("A", ram1); // create a volume "A" for the RAM disk fs.mkdir(A, "/", "foo"); // Create a subdir "foo" on volume A fs.mkdir(A, "/foo", "bar"); // Create a sub-sub dir "bar" under "foo" fs.ls(A, "/"); // list the root directory of the RAM disk fs.ls(A, "/foo"); // list the "foo" directory fs.rmdir(A. "/foo", "bar"); // remove the "bar" directory
Definition at line 36 of file FS.h.
1.3.8