RTEMS: cpukit/include/rtems/rfs/rtems-rfs-link.h File Reference

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Typedefs | Enumerations | Functions
rtems-rfs-link.h File Reference
IO Library » File System Types and Mount » RTEMS File System Group Management

RTEMS File System Link Support. More...

`#include <dirent.h>`
`#include <rtems/rfs/rtems-rfs-file-system.h>`
`#include <rtems/rfs/rtems-rfs-inode.h>`

Go to the source code of this file.

## Typedefs
typedef enum rtems_rfs_unlink_dir_e | rtems_rfs_unlink_dir

## Enumerations
enum | rtems_rfs_unlink_dir_e { rtems_rfs_unlink_dir_denied , rtems_rfs_unlink_dir_if_empty , rtems_rfs_unlink_dir_allowed }

## Functions
int | rtems_rfs_link (rtems_rfs_file_system *fs, const char *name, int length, rtems_rfs_ino parent, rtems_rfs_ino target, bool link_dir)
int | rtems_rfs_unlink (rtems_rfs_file_system *fs, rtems_rfs_ino parent, rtems_rfs_ino target, uint32_t doff, rtems_rfs_unlink_dir dir_mode)
int | rtems_rfs_symlink (rtems_rfs_file_system *fs, const char *name, int length, const char *link, int link_length, uid_t uid, gid_t gid, rtems_rfs_ino parent)
int | rtems_rfs_symlink_read (rtems_rfs_file_system *fs, rtems_rfs_ino link, char *path, size_t size, size_t *length)

## Detailed Description

RTEMS File System Link Support.

RTEMS File System Link Support

This file provides the link support functions.

## Typedef Documentation

## ◆ rtems_rfs_unlink_dir

typedef enum rtems_rfs_unlink_dir_e rtems_rfs_unlink_dir

Directory unlink modes.

## Enumeration Type Documentation

## ◆ rtems_rfs_unlink_dir_e

enum rtems_rfs_unlink_dir_e

Directory unlink modes.

Enumerator
rtems_rfs_unlink_dir_denied | Not allowed to unlink a directory.
rtems_rfs_unlink_dir_if_empty | Unlink if the directory is empty.
rtems_rfs_unlink_dir_allowed | Unlinking of directories is allowed.

## Function Documentation

## ◆ rtems_rfs_link()

int rtems_rfs_link | ( | rtems_rfs_file_system * | fs,
|  | const char * | name,
|  | int | length,
|  | rtems_rfs_ino | parent,
|  | rtems_rfs_ino | target,
|  | bool | link_dir
| ) |  |

Create a link. Do not link directories unless renaming or you will create loops in the file system.

Parameters

  [in] | fs | is the file system.
  [in] | name | is a pointer to the name of the link.
  [in] | length | is the length of the name.
  [in] | parent | is the inode number of the parent directory.
  [in] | target | is the inode of the target.
  [in] | link_dir | If true directories can be linked. Useful when renaming.

Return values

  0 | Successful operation.
  error_code | An error occurred.

## ◆ rtems_rfs_symlink()

int rtems_rfs_symlink | ( | rtems_rfs_file_system * | fs,
|  | const char * | name,
|  | int | length,
|  | const char * | link,
|  | int | link_length,
|  | uid_t | uid,
|  | gid_t | gid,
|  | rtems_rfs_ino | parent
| ) |  |

Symbolic link is an inode that has a path attached.

Parameters

  [in] | fs | is the file system data.
  [in] | name | is a pointer to the name of the node.
  [in] | length | is the length of the name of the node.
  [in] | link | is a pointer to the link path attached to the symlink inode.
  [in] | link_length | is the length of the link path.
  [in] | parent | is the parent inode number.

Return values

  0 | Successful operation.
  error_code | An error occurred.

## ◆ rtems_rfs_symlink_read()

int rtems_rfs_symlink_read | ( | rtems_rfs_file_system * | fs,
|  | rtems_rfs_ino | link,
|  | char * | path,
|  | size_t | size,
|  | size_t * | length
| ) |  |

Read a symbolic link into the provided buffer returning the link of link name.

Parameters

  [in] | fs | is the file system data.
  [in] | link | is the link inode number to read.
  [in] | path | is a pointer to the buffer to write the link path into.
  [in] | size | is the size of the buffer.
  [out] | length | will contain the length of the link path.

Return values

  0 | Successful operation.
  error_code | An error occurred.

## ◆ rtems_rfs_unlink()

int rtems_rfs_unlink | ( | rtems_rfs_file_system * | fs,
|  | rtems_rfs_ino | parent,
|  | rtems_rfs_ino | target,
|  | uint32_t | doff,
|  | rtems_rfs_unlink_dir | dir_mode
| ) |  |

Unlink the node from the parent directory. A directory offset for the target entry is required because links cause a number of inode numbers to appear in a single directory so scanning does not work.

Parameters

  [in] | fs | is the file system.
  [in] | parent | is the inode number of the parent directory.
  [in] | target | is the inode of the target.
  [in] | doff | is the parent directory entry offset for the target entry.
  [in] | dir_mode | is the directory unlink mode.

Return values

  0 | Successful operation.
  error_code | An error occurred.