RTEMS: File System Types and Mount

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Modules | Files | Data Structures | Typedefs | Enumerations | Functions | Variables
File System Types and Mount
IO Library

File system types and mount. More...

## Modules
| FAT Filesystem Support
| FAT file system configuration support, format and mount options.
| FIFO/Pipe File System Support
| Interface to the POSIX FIFO/Pipe File System.
| File System Mount Support
| File System Mount Functions.
| File Transfer Protocol File System
| The FTP file system (FTP client) can be used to transfer files from or to remote hosts.
| In-Memory File System Support
| In-Memory File System Support.
| Journalling Flash File System Version 2 (JFFS2) Support
| Mount options for the Journalling Flash File System, Version 2 (JFFS2).
| RTEMS File System Group Management
| libfs
| libfs
| nfs Client
| nfs Client

## Files
file | mount.c
| Mounts a File System.

## Data Structures
struct | rtems_filesystem_mount_table_entry_tt
| Mount table entry. More...
struct | rtems_filesystem_table_t
| File system table entry. More...
struct | rtems_filesystem_mount_configuration

## Typedefs
typedef struct rtems_filesystem_table_t | rtems_filesystem_table_t
| File system table entry.
typedef bool(* | rtems_per_filesystem_routine) (const rtems_filesystem_table_t *fs_entry, void *arg)
| Per file system type routine.
typedef bool(* | rtems_filesystem_mt_entry_visitor) (const rtems_filesystem_mount_table_entry_t *mt_entry, void *arg)
| Mount table entry visitor.

## Enumerations
enum | rtems_filesystem_options_t { RTEMS_FILESYSTEM_READ_ONLY , RTEMS_FILESYSTEM_READ_WRITE , RTEMS_FILESYSTEM_BAD_OPTIONS }
| File system options.

## Functions
int | rtems_filesystem_register (const char *type, rtems_filesystem_fsmount_me_t mount_h)
| Registers a file system type.
int | rtems_filesystem_unregister (const char *type)
| Unregisters a file system type.
int | unmount (const char *mount_path)
| Unmounts the file system instance at the specified mount path.
int | mount (const char *source, const char *target, const char *filesystemtype, rtems_filesystem_options_t options, const void *data)
| Mounts a file system instance at the specified target path.
int | mount_and_make_target_path (const char *source, const char *target, const char *filesystemtype, rtems_filesystem_options_t options, const void *data)
| Mounts a file system and makes the target path.
bool | rtems_filesystem_iterate (rtems_per_filesystem_routine routine, void *routine_arg)
| Iterates over all file system types.
bool | rtems_filesystem_mount_iterate (rtems_filesystem_mt_entry_visitor visitor, void *visitor_arg)
| Iterates over all file system mount entries.

## Variables
const rtems_filesystem_table_t | rtems_filesystem_table []
| Static table of file systems.
rtems_chain_control | rtems_filesystem_mount_table
const rtems_filesystem_mount_configuration | rtems_filesystem_root_configuration

## File System Types
#define | RTEMS_FILESYSTEM_TYPE_IMFS "imfs"
#define | RTEMS_FILESYSTEM_TYPE_FTPFS "ftpfs"
#define | RTEMS_FILESYSTEM_TYPE_TFTPFS "tftpfs"
#define | RTEMS_FILESYSTEM_TYPE_NFS "nfs"
#define | RTEMS_FILESYSTEM_TYPE_DOSFS "dosfs"
#define | RTEMS_FILESYSTEM_TYPE_RFS "rfs"
#define | RTEMS_FILESYSTEM_TYPE_JFFS2 "jffs2"

## Detailed Description

File system types and mount.

## Typedef Documentation

## ◆ rtems_filesystem_mt_entry_visitor

typedef bool(* rtems_filesystem_mt_entry_visitor) (const rtems_filesystem_mount_table_entry_t *mt_entry, void *arg)

Mount table entry visitor.

Return values

  true | Stop the iteration.
  false | Continue the iteration.

See also
  rtems_filesystem_mount_iterate().

## ◆ rtems_per_filesystem_routine

typedef bool(* rtems_per_filesystem_routine) (const rtems_filesystem_table_t *fs_entry, void *arg)

Per file system type routine.

See also
  rtems_filesystem_iterate().

Return values

  true | Stop the iteration.
  false | Continue the iteration.

## Function Documentation

## ◆ mount()

int mount | ( | const char * | source,
|  | const char * | target,
|  | const char * | filesystemtype,
|  | rtems_filesystem_options_t | options,
|  | const void * | data
| ) |  |

Mounts a file system instance at the specified target path.

To mount a standard file system instance one of the following defines should be used to select the file system type

- RTEMS_FILESYSTEM_TYPE_DOSFS,
- RTEMS_FILESYSTEM_TYPE_FTPFS,
- RTEMS_FILESYSTEM_TYPE_IMFS,
- RTEMS_FILESYSTEM_TYPE_JFFS2,
- RTEMS_FILESYSTEM_TYPE_NFS,
- RTEMS_FILESYSTEM_TYPE_RFS, or
- RTEMS_FILESYSTEM_TYPE_TFTPFS.

Only configured or registered file system types are available. You can add file system types to your application configuration with the following configuration options

- CONFIGURE_FILESYSTEM_DOSFS,
- CONFIGURE_FILESYSTEM_FTPFS,
- CONFIGURE_FILESYSTEM_IMFS,
- CONFIGURE_FILESYSTEM_JFFS2,
- CONFIGURE_FILESYSTEM_NFS,
- CONFIGURE_FILESYSTEM_RFS, and
- CONFIGURE_FILESYSTEM_TFTPFS.

In addition to these configuration options file system types can be registered with rtems_filesystem_register().

Parameters

  [in] | source | The source parameter will be forwarded to the file system initialization handler. Usually the source is a path to the corresponding device file, or `NULL` in case the file system does not use a device file.
  [in] | target | The target path must lead to an existing directory, or must be `NULL`. In case the target is `NULL`, the root file system will be mounted.
  [in] | filesystemtype | This string selects the file system type.
  [in] | options | The options specify if the file system instance allows read-write or read-only access.
  [in] | data | The data parameter will be forwarded to the file system initialization handler. It can be used to pass file system specific mount options. The data structure for mount options is file system specific. See also in the corresponding file system documentation.

Return values

  0 | Successful operation.
  -1 | An error occurred. The `errno` indicates the error.

See also
  rtems_filesystem_register(), mount_and_make_target_path(), FAT Filesystem Support and Journalling Flash File System Version 2 (JFFS2) Support.

## ◆ mount_and_make_target_path()

int mount_and_make_target_path | ( | const char * | source,
|  | const char * | target,
|  | const char * | filesystemtype,
|  | rtems_filesystem_options_t | options,
|  | const void * | data
| ) |  |

Mounts a file system and makes the target path.

The target path will be created with rtems_mkdir() and must not be `NULL`.

See also
  mount().

Return values

  0 | Successful operation.
  -1 | An error occurred. The `errno` indicates the error.

## ◆ rtems_filesystem_iterate()

bool rtems_filesystem_iterate | ( | rtems_per_filesystem_routine | routine,
|  | void * | routine_arg
| ) |  |

Iterates over all file system types.

For each file system type the routine will be called with the entry and the routine_arg parameter.

Do not register or unregister file system types in routine.

The iteration is protected by the IO library mutex.

Return values

  true | Iteration stopped due to routine return status.
  false | Iteration through all entries.

## ◆ rtems_filesystem_mount_iterate()

bool rtems_filesystem_mount_iterate | ( | rtems_filesystem_mt_entry_visitor | visitor,
|  | void * | visitor_arg
| ) |  |

Iterates over all file system mount entries.

The iteration is protected by the IO library mutex. Do not mount or unmount file systems in the visitor function.

Parameters

  [in] | visitor | For each file system mount entry the visitor function will be called with the entry and the visitor argument as parameters.
  [in] | visitor_arg | The second parameter for the visitor function.

Return values

  true | Iteration stopped due to visitor function return status.
  false | Iteration through all entries.

## ◆ rtems_filesystem_register()

int rtems_filesystem_register | ( | const char * | type,
|  | rtems_filesystem_fsmount_me_t | mount_h
| ) |  |

Registers a file system type.

The mount_h handler will be used to mount a file system of this type.

Return values

  0 | Successful operation.
  -1 | An error occurred. The `errno` indicates the error.

## ◆ rtems_filesystem_unregister()

int rtems_filesystem_unregister | ( | const char * | type | ) |

Unregisters a file system type.

Return values

  0 | Successful operation.
  -1 | An error occurred. The `errno` indicates the error.

## ◆ unmount()

int unmount | ( | const char * | path | ) |

Unmounts the file system instance at the specified mount path.

The function waits for the unmount process completion. In case the calling thread uses resources of the unmounted file system the function may never return. In case the calling thread has its root or current directory in the unmounted file system the function returns with an error status and errno is set to EBUSY.

The unmount process completion notification uses the transient event. It is a fatal error to terminate the calling thread while waiting for this event.

A concurrent unmount request for the same file system instance has unpredictable effects.

Parameters

  [in] | mount_path | The path to the file system instance mount point.

Return values

  0 | Successful operation.
  -1 | An error occurred. The `errno` indicates the error.

See also
  Transient Event.

This routine is not defined in the POSIX 1003.1b standard but in some form is supported on most UNIX and POSIX systems. This routine is necessary to mount instantiations of a file system into the file system name space.

## Variable Documentation

## ◆ rtems_filesystem_table

const rtems_filesystem_table_t rtems_filesystem_table[]
| extern

Static table of file systems.

Externally defined by confdefs.h or the user.