RTEMS: File System Operations

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Files | Data Structures | Typedefs | Functions | Variables
File System Operations
IO Library

File system operations. More...

## Files
file | default_are_nodes_equal.c
| RTEMS Default File System has nodes equal.
file | default_clone.c
| RTEMS Default File System creates a child process.
file | default_eval_path.c
| RTEMS Default File System evaluates relative pathname to absolute.
file | default_fstat.c
| RTEMS Default File System gets file status.
file | default_fsync.c
| RTEMS Default File System Synchronises changes to a file.
file | default_fsync_success.c
| RTEMS Default Filesystem succeeds synchronizing file's in-core state.
file | default_ftruncate.c
| RTEMS Default File System Truncates a file to indicated length.
file | default_ioctl.c
| RTEMS Default File System controls a STREAMS device.
file | default_lock_and_unlock.c
| RTEMS Default File System locks and unlocks rtems filesystem.
file | default_lseek.c
| RTEMS Default File System reposits the read/write file offset.
file | default_lseek_directory.c
| RTEMS Default File System reposits read/write file offset directory.
file | default_lseek_file.c
| RTEMS Default File System reposits the offset of the open file fd.
file | default_mknod.c
| RTEMS Default File System creates a special or ordinary file.
file | default_mount.c
| RTEMS Default File System mounts a filesystem.
file | default_rename.c
| RTEMS Default File System Rename Files.
file | default_symlink.c
| RTEMS Default File System creates a symbolic link to a file.
file | default_unmount.c
| RTEMS Default File System Unmounts.
file | default_utime.c
| RTEMS Default File System sets file access and modification times.
file | default_write.c
| RTEMS Default File System sends a message to another user.

## Data Structures
struct | rtems_filesystem_eval_path_context_t
| Path evaluation context. More...
struct | _rtems_filesystem_operations_table
| File system operations table. More...

## Typedefs
typedef void(* | rtems_filesystem_mt_entry_lock_t) (const rtems_filesystem_mount_table_entry_t *mt_entry)
| Locks a file system instance.
typedef void(* | rtems_filesystem_mt_entry_unlock_t) (const rtems_filesystem_mount_table_entry_t *mt_entry)
| Unlocks a file system instance.
typedef void(* | rtems_filesystem_eval_path_t) (rtems_filesystem_eval_path_context_t *ctx)
| Path evaluation.
typedef int(* | rtems_filesystem_link_t) (const rtems_filesystem_location_info_t *parentloc, const rtems_filesystem_location_info_t *targetloc, const char *name, size_t namelen)
| Creates a new link for the existing file.
typedef int(* | rtems_filesystem_fchmod_t) (const rtems_filesystem_location_info_t *loc, mode_t mode)
| Changes the mode of a node.
typedef int(* | rtems_filesystem_chown_t) (const rtems_filesystem_location_info_t *loc, uid_t owner, gid_t group)
| Changes owner and group of a node.
typedef int(* | rtems_filesystem_clonenode_t) (rtems_filesystem_location_info_t *loc)
| Clones a location.
typedef void(* | rtems_filesystem_freenode_t) (const rtems_filesystem_location_info_t *loc)
| Frees the location of a node.
typedef int(* | rtems_filesystem_mount_t) (rtems_filesystem_mount_table_entry_t *mt_entry)
| Mounts a file system instance in a mount point (directory).
typedef int(* | rtems_filesystem_fsmount_me_t) (rtems_filesystem_mount_table_entry_t *mt_entry, const void *data)
| Initializes a file system instance.
typedef int(* | rtems_filesystem_unmount_t) (rtems_filesystem_mount_table_entry_t *mt_entry)
| Unmounts a file system instance in a mount point (directory).
typedef void(* | rtems_filesystem_fsunmount_me_t) (rtems_filesystem_mount_table_entry_t *mt_entry)
| Destroys a file system instance.
typedef bool(* | rtems_filesystem_are_nodes_equal_t) (const rtems_filesystem_location_info_t *a, const rtems_filesystem_location_info_t *b)
| Tests if the node of one location is equal to the node of the other location.
typedef int(* | rtems_filesystem_mknod_t) (const rtems_filesystem_location_info_t *parentloc, const char *name, size_t namelen, mode_t mode, dev_t dev)
| Creates a new node.
typedef int(* | rtems_filesystem_rmnod_t) (const rtems_filesystem_location_info_t *parentloc, const rtems_filesystem_location_info_t *loc)
| Removes a node.
typedef int(* | rtems_filesystem_utime_t) (const rtems_filesystem_location_info_t *loc, time_t actime, time_t modtime)
| Set node access and modification times.
typedef int(* | rtems_filesystem_symlink_t) (const rtems_filesystem_location_info_t *parentloc, const char *name, size_t namelen, const char *target)
| Makes a symbolic link to a node.
typedef ssize_t(* | rtems_filesystem_readlink_t) (const rtems_filesystem_location_info_t *loc, char *buf, size_t bufsize)
| Reads the contents of a symbolic link.
typedef int(* | rtems_filesystem_rename_t) (const rtems_filesystem_location_info_t *oldparentloc, const rtems_filesystem_location_info_t *oldloc, const rtems_filesystem_location_info_t *newparentloc, const char *name, size_t namelen)
| Renames a node.
typedef int(* | rtems_filesystem_statvfs_t) (const rtems_filesystem_location_info_t *loc, struct statvfs *buf)
| Gets file system information.

## Functions
void | rtems_filesystem_default_lock (const rtems_filesystem_mount_table_entry_t *mt_entry)
| Obtains the IO library mutex.
void | rtems_filesystem_default_unlock (const rtems_filesystem_mount_table_entry_t *mt_entry)
| Releases the IO library mutex.
void | rtems_filesystem_default_eval_path (rtems_filesystem_eval_path_context_t *ctx)
| Terminates the path evaluation and replaces the current location with the null location.
int | rtems_filesystem_default_link (const rtems_filesystem_location_info_t *parentloc, const rtems_filesystem_location_info_t *targetloc, const char *name, size_t namelen)
bool | rtems_filesystem_default_are_nodes_equal (const rtems_filesystem_location_info_t *a, const rtems_filesystem_location_info_t *b)
| Tests if the node access pointer of one location is equal to the node access pointer of the other location.
int | rtems_filesystem_default_mknod (const rtems_filesystem_location_info_t *parentloc, const char *name, size_t namelen, mode_t mode, dev_t dev)
int | rtems_filesystem_default_rmnod (const rtems_filesystem_location_info_t *parentloc, const rtems_filesystem_location_info_t *loc)
int | rtems_filesystem_default_fchmod (const rtems_filesystem_location_info_t *loc, mode_t mode)
int | rtems_filesystem_default_chown (const rtems_filesystem_location_info_t *loc, uid_t owner, gid_t group)
int | rtems_filesystem_default_clonenode (rtems_filesystem_location_info_t *loc)
void | rtems_filesystem_default_freenode (const rtems_filesystem_location_info_t *loc)
int | rtems_filesystem_default_mount (rtems_filesystem_mount_table_entry_t *mt_entry)
int | rtems_filesystem_default_unmount (rtems_filesystem_mount_table_entry_t *mt_entry)
void | rtems_filesystem_default_fsunmount (rtems_filesystem_mount_table_entry_t *mt_entry)
int | rtems_filesystem_default_utime (const rtems_filesystem_location_info_t *loc, time_t actime, time_t modtime)
int | rtems_filesystem_default_symlink (const rtems_filesystem_location_info_t *parentloc, const char *name, size_t namelen, const char *target)
ssize_t | rtems_filesystem_default_readlink (const rtems_filesystem_location_info_t *loc, char *buf, size_t bufsize)
int | rtems_filesystem_default_rename (const rtems_filesystem_location_info_t *oldparentloc, const rtems_filesystem_location_info_t *oldloc, const rtems_filesystem_location_info_t *newparentloc, const char *name, size_t namelen)
int | rtems_filesystem_default_statvfs (const rtems_filesystem_location_info_t *loc, struct statvfs *buf)

## Variables
const rtems_filesystem_operations_table | rtems_filesystem_operations_default
| File system operations table with default operations.

## Detailed Description

File system operations.

## Typedef Documentation

## ◆ rtems_filesystem_are_nodes_equal_t

typedef bool(* rtems_filesystem_are_nodes_equal_t) (const rtems_filesystem_location_info_t *a, const rtems_filesystem_location_info_t *b)

Tests if the node of one location is equal to the node of the other location.

The caller ensures that both nodes are within the same file system instance.

Parameters

  [in] | a | The one location.
  [in] | b | The other location.

Return values

  true | The nodes of the locations are equal.
  false | Otherwise.

See also
  rtems_filesystem_default_are_nodes_equal().

## ◆ rtems_filesystem_chown_t

typedef int(* rtems_filesystem_chown_t) (const rtems_filesystem_location_info_t *loc, uid_t owner, gid_t group)

Changes owner and group of a node.

Parameters

  [in] | loc | The location of the node.
  [in] | owner | User ID for the node.
  [in] | group | Group ID for the node.

Return values

  0 | Successful operation.
  -1 | An error occurred. The errno is set to indicate the error.

See also
  rtems_filesystem_default_chown().

## ◆ rtems_filesystem_clonenode_t

typedef int(* rtems_filesystem_clonenode_t) (rtems_filesystem_location_info_t *loc)

Clones a location.

The location is initialized with a bitwise copy of an existing location. The caller must ensure that this location is protected from a release during the clone operation. After a successful clone operation the clone will be added to the location chain of the corresponding mount table entry.

Parameters

  [in,out] | loc | Location to clone.

Return values

  0 | Successful operation.
  -1 | An error occurred. The errno is set to indicate the error.

See also
  rtems_filesystem_default_clonenode().

## ◆ rtems_filesystem_eval_path_t

typedef void(* rtems_filesystem_eval_path_t) (rtems_filesystem_eval_path_context_t *ctx)

Path evaluation.

Parameters

  [in,out] | ctx | The path evaluation context.

See also
  rtems_filesystem_default_eval_path().

## ◆ rtems_filesystem_fchmod_t

typedef int(* rtems_filesystem_fchmod_t) (const rtems_filesystem_location_info_t *loc, mode_t mode)

Changes the mode of a node.

Parameters

  [in] | loc | The location of the node.
  [in] | mode | The new mode of the node

Return values

  0 | Successful operation.
  -1 | An error occurred. The errno is set to indicate the error.

See also
  rtems_filesystem_default_fchmod().

## ◆ rtems_filesystem_freenode_t

typedef void(* rtems_filesystem_freenode_t) (const rtems_filesystem_location_info_t *loc)

Frees the location of a node.

Parameters

  [in] | loc | The location of the node.

See also
  rtems_filesystem_default_freenode().

## ◆ rtems_filesystem_fsmount_me_t

typedef int(* rtems_filesystem_fsmount_me_t) (rtems_filesystem_mount_table_entry_t *mt_entry, const void *data)

Initializes a file system instance.

This function must initialize the file system root node in the mount table entry.

Parameters

  [in] | mt_entry | The mount table entry.
  [in] | data | The data provided by the user.

Return values

  0 | Successful operation.
  -1 | An error occurred. The errno is set to indicate the error.

## ◆ rtems_filesystem_fsunmount_me_t

typedef void(* rtems_filesystem_fsunmount_me_t) (rtems_filesystem_mount_table_entry_t *mt_entry)

Destroys a file system instance.

The mount point node location of the mount table entry is invalid. This handler must free the file system root location and all remaining resources of the file system instance.

Parameters

  [in] | mt_entry | The mount table entry.

See also
  rtems_filesystem_default_fsunmount().

## ◆ rtems_filesystem_link_t

typedef int(* rtems_filesystem_link_t) (const rtems_filesystem_location_info_t *parentloc, const rtems_filesystem_location_info_t *targetloc, const char *name, size_t namelen)

Creates a new link for the existing file.

Parameters

  [in] | parentloc | The location of the parent of the new link.
  [in] | targetloc | The location of the target file.
  [in] | name | Name for the new link.
  [in] | namelen | Length of the name for the new link in characters.

Return values

  0 | Successful operation.
  -1 | An error occurred. The errno is set to indicate the error.

See also
  rtems_filesystem_default_link().

## ◆ rtems_filesystem_mknod_t

typedef int(* rtems_filesystem_mknod_t) (const rtems_filesystem_location_info_t *parentloc, const char *name, size_t namelen, mode_t mode, dev_t dev)

Creates a new node.

This handler should create a new node according to the parameters.

Parameters

  [in] | parentloc | The location of the parent of the new node.
  [in] | name | Name for the new node.
  [in] | namelen | Length of the name for the new node in characters.
  [in] | mode | Mode for the new node.
  [in] | dev | Optional device identifier for the new node.

Return values

  0 | Successful operation.
  -1 | An error occurred. The errno is set to indicate the error.

See also
  rtems_filesystem_default_mknod().

## ◆ rtems_filesystem_mount_t

typedef int(* rtems_filesystem_mount_t) (rtems_filesystem_mount_table_entry_t *mt_entry)

Mounts a file system instance in a mount point (directory).

The mount point belongs to the file system instance of the handler and is specified by a field of the mount table entry. The handler must check that the mount point is capable of mounting a file system instance. This is the last step during the mount process. The file system instance is fully initialized at this point.

Parameters

  [in] | mt_entry | The mount table entry.

Return values

  0 | Successful operation.
  -1 | An error occurred. The errno is set to indicate the error.

See also
  rtems_filesystem_default_mount().

## ◆ rtems_filesystem_mt_entry_lock_t

typedef void(* rtems_filesystem_mt_entry_lock_t) (const rtems_filesystem_mount_table_entry_t *mt_entry)

Locks a file system instance.

This lock must allow nesting.

Parameters

  [in,out] | mt_entry | The mount table entry of the file system instance.

See also
  rtems_filesystem_default_lock().

## ◆ rtems_filesystem_mt_entry_unlock_t

typedef void(* rtems_filesystem_mt_entry_unlock_t) (const rtems_filesystem_mount_table_entry_t *mt_entry)

Unlocks a file system instance.

Parameters

  [in,out] | mt_entry | The mount table entry of the file system instance.

See also
  rtems_filesystem_default_unlock().

## ◆ rtems_filesystem_readlink_t

typedef ssize_t(* rtems_filesystem_readlink_t) (const rtems_filesystem_location_info_t *loc, char *buf, size_t bufsize)

Reads the contents of a symbolic link.

Parameters

  [in] | loc | The location of the symbolic link.
  [out] | buf | The buffer for the contents.
  [in] | bufsize | The size of the buffer in characters.

Return values

  non-negative | Size of the actual contents in characters.
  -1 | An error occurred. The errno is set to indicate the error.

See also
  rtems_filesystem_default_readlink().

## ◆ rtems_filesystem_rename_t

typedef int(* rtems_filesystem_rename_t) (const rtems_filesystem_location_info_t *oldparentloc, const rtems_filesystem_location_info_t *oldloc, const rtems_filesystem_location_info_t *newparentloc, const char *name, size_t namelen)

Renames a node.

Parameters

  [in] | oldparentloc | The location of the parent of the old node.
  [in] | oldloc | The location of the old node.
  [in] | newparentloc | The location of the parent of the new node.
  [in] | name | Name for the new node.
  [in] | namelen | Length of the name for the new node in characters.

Return values

  0 | Successful operation.
  -1 | An error occurred. The errno is set to indicate the error.

See also
  rtems_filesystem_default_rename().

## ◆ rtems_filesystem_rmnod_t

typedef int(* rtems_filesystem_rmnod_t) (const rtems_filesystem_location_info_t *parentloc, const rtems_filesystem_location_info_t *loc)

Removes a node.

Parameters

  [in] | parentloc | The location of the parent of the node.
  [in] | loc | The location of the node.

Return values

  0 | Successful operation.
  -1 | An error occurred. The errno is set to indicate the error.

See also
  rtems_filesystem_default_rmnod().

## ◆ rtems_filesystem_statvfs_t

typedef int(* rtems_filesystem_statvfs_t) (const rtems_filesystem_location_info_t *loc, struct statvfs *buf)

Gets file system information.

Parameters

  [in] | loc | The location of a node.
  [out] | buf | Buffer for file system information.

Return values

  0 | Successful operation.
  -1 | An error occurred. The errno is set to indicate the error.

See also
  rtems_filesystem_default_statvfs().

## ◆ rtems_filesystem_symlink_t

typedef int(* rtems_filesystem_symlink_t) (const rtems_filesystem_location_info_t *parentloc, const char *name, size_t namelen, const char *target)

Makes a symbolic link to a node.

Parameters

  [in] | parentloc | The location of the parent of the new symbolic link.
  [in] | name | Name for the new symbolic link.
  [in] | namelen | Length of the name for the new symbolic link in characters.
  [in] | target | Contents for the symbolic link.

Return values

  0 | Successful operation.
  -1 | An error occurred. The errno is set to indicate the error.

See also
  rtems_filesystem_default_symlink().

## ◆ rtems_filesystem_unmount_t

typedef int(* rtems_filesystem_unmount_t) (rtems_filesystem_mount_table_entry_t *mt_entry)

Unmounts a file system instance in a mount point (directory).

In case this function is successful the file system instance will be marked as unmounted. The file system instance will be destroyed when the last reference to it vanishes.

Parameters

  [in] | mt_entry | The mount table entry.

Return values

  0 | Successful operation.
  -1 | An error occurred. The errno is set to indicate the error.

See also
  rtems_filesystem_default_unmount().

## ◆ rtems_filesystem_utime_t

typedef int(* rtems_filesystem_utime_t) (const rtems_filesystem_location_info_t *loc, time_t actime, time_t modtime)

Set node access and modification times.

Parameters

  [in] | loc | The location of the node.
  [in] | actime | Access time for the node.
  [in] | modtime | Modification for the node.

Return values

  0 | Successful operation.
  -1 | An error occurred. The errno is set to indicate the error.

See also
  rtems_filesystem_default_utime().

## Function Documentation

## ◆ rtems_filesystem_default_are_nodes_equal()

bool rtems_filesystem_default_are_nodes_equal | ( | const rtems_filesystem_location_info_t * | a,
|  | const rtems_filesystem_location_info_t * | b
| ) |  |

Tests if the node access pointer of one location is equal to the node access pointer of the other location.

Parameters

  [in] | a | The one location.
  [in] | b | The other location.

Return values

  true | The node access pointers of the locations are equal.
  false | Otherwise.

See also
  rtems_filesystem_are_nodes_equal_t.

## ◆ rtems_filesystem_default_chown()

int rtems_filesystem_default_chown | ( | const rtems_filesystem_location_info_t * | loc,
|  | uid_t | owner,
|  | gid_t | group
| ) |  |

Return values

  -1 | Always. The errno is set to ENOTSUP.

See also
  rtems_filesystem_chown_t.

## ◆ rtems_filesystem_default_clonenode()

int rtems_filesystem_default_clonenode | ( | rtems_filesystem_location_info_t * | loc | ) |

Return values

  0 | Always.

See also
  rtems_filesystem_clonenode_t.

## ◆ rtems_filesystem_default_eval_path()

void rtems_filesystem_default_eval_path | ( | rtems_filesystem_eval_path_context_t * | ctx | ) |

Terminates the path evaluation and replaces the current location with the null location.

See also
  rtems_filesystem_eval_path_t.

## ◆ rtems_filesystem_default_fchmod()

int rtems_filesystem_default_fchmod | ( | const rtems_filesystem_location_info_t * | loc,
|  | mode_t | mode
| ) |  |

Return values

  -1 | Always. The errno is set to ENOTSUP.

See also
  rtems_filesystem_fchmod_t.

## ◆ rtems_filesystem_default_freenode()

void rtems_filesystem_default_freenode | ( | const rtems_filesystem_location_info_t * | loc | ) |

See also
  rtems_filesystem_freenode_t.

## ◆ rtems_filesystem_default_fsunmount()

void rtems_filesystem_default_fsunmount | ( | rtems_filesystem_mount_table_entry_t * | mt_entry | ) |

Return values

  -1 | Always. The errno is set to ENOTSUP.

See also
  rtems_filesystem_fsunmount_me_t.

## ◆ rtems_filesystem_default_link()

int rtems_filesystem_default_link | ( | const rtems_filesystem_location_info_t * | parentloc,
|  | const rtems_filesystem_location_info_t * | targetloc,
|  | const char * | name,
|  | size_t | namelen
| ) |  |

Return values

  -1 | Always. The errno is set to ENOTSUP.

See also
  rtems_filesystem_link_t.

## ◆ rtems_filesystem_default_lock()

void rtems_filesystem_default_lock | ( | const rtems_filesystem_mount_table_entry_t * | mt_entry | ) |

Obtains the IO library mutex.

See also
  rtems_filesystem_mt_entry_lock_t.

## ◆ rtems_filesystem_default_mknod()

int rtems_filesystem_default_mknod | ( | const rtems_filesystem_location_info_t * | parentloc,
|  | const char * | name,
|  | size_t | namelen,
|  | mode_t | mode,
|  | dev_t | dev
| ) |  |

Return values

  -1 | Always. The errno is set to ENOTSUP.

See also
  rtems_filesystem_mknod_t.

## ◆ rtems_filesystem_default_mount()

int rtems_filesystem_default_mount | ( | rtems_filesystem_mount_table_entry_t * | mt_entry | ) |

Return values

  -1 | Always. The errno is set to ENOTSUP.

See also
  rtems_filesystem_mount_t.

## ◆ rtems_filesystem_default_readlink()

ssize_t rtems_filesystem_default_readlink | ( | const rtems_filesystem_location_info_t * | loc,
|  | char * | buf,
|  | size_t | bufsize
| ) |  |

Return values

  -1 | Always. The errno is set to ENOTSUP.

See also
  rtems_filesystem_readlink_t.

## ◆ rtems_filesystem_default_rename()

int rtems_filesystem_default_rename | ( | const rtems_filesystem_location_info_t * | oldparentloc,
|  | const rtems_filesystem_location_info_t * | oldloc,
|  | const rtems_filesystem_location_info_t * | newparentloc,
|  | const char * | name,
|  | size_t | namelen
| ) |  |

Return values

  -1 | Always. The errno is set to ENOTSUP.

See also
  rtems_filesystem_rename_t.

## ◆ rtems_filesystem_default_rmnod()

int rtems_filesystem_default_rmnod | ( | const rtems_filesystem_location_info_t * | parentloc,
|  | const rtems_filesystem_location_info_t * | loc
| ) |  |

Return values

  -1 | Always. The errno is set to ENOTSUP.

See also
  rtems_filesystem_rmnod_t.

## ◆ rtems_filesystem_default_statvfs()

int rtems_filesystem_default_statvfs | ( | const rtems_filesystem_location_info_t * | loc,
|  | struct statvfs * | buf
| ) |  |

Return values

  -1 | Always. The errno is set to ENOTSUP.

See also
  rtems_filesystem_statvfs_t.

## ◆ rtems_filesystem_default_symlink()

int rtems_filesystem_default_symlink | ( | const rtems_filesystem_location_info_t * | parentloc,
|  | const char * | name,
|  | size_t | namelen,
|  | const char * | target
| ) |  |

Return values

  -1 | Always. The errno is set to ENOTSUP.

See also
  rtems_filesystem_symlink_t.

## ◆ rtems_filesystem_default_unlock()

void rtems_filesystem_default_unlock | ( | const rtems_filesystem_mount_table_entry_t * | mt_entry | ) |

Releases the IO library mutex.

See also
  rtems_filesystem_mt_entry_unlock_t.

## ◆ rtems_filesystem_default_unmount()

int rtems_filesystem_default_unmount | ( | rtems_filesystem_mount_table_entry_t * | mt_entry | ) |

Return values

  -1 | Always. The errno is set to ENOTSUP.

See also
  rtems_filesystem_unmount_t.

## ◆ rtems_filesystem_default_utime()

int rtems_filesystem_default_utime | ( | const rtems_filesystem_location_info_t * | loc,
|  | time_t | actime,
|  | time_t | modtime
| ) |  |

Return values

  -1 | Always. The errno is set to ENOTSUP.

See also
  rtems_filesystem_utime_t.