RTEMS CPU Kit with SuperCore  4.11.3
Typedefs | Enumerations | Functions

RTEMS File System Link Support. More...

#include <dirent.h>
#include <rtems/rfs/rtems-rfs-file-system.h>
#include <rtems/rfs/rtems-rfs-inode.h>
Include dependency graph for rtems-rfs-link.h:

Go to the source code of this file.

Typedefs

typedef enum rtems_rfs_unlink_dir_e rtems_rfs_unlink_dir
 Directory unlink modes.
 

Enumerations

enum  rtems_rfs_unlink_dir_e { rtems_rfs_unlink_dir_denied, rtems_rfs_unlink_dir_if_empty, rtems_rfs_unlink_dir_allowed }
 Directory unlink modes. More...
 

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)
 Create a link. More...
 
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. More...
 
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. More...
 
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. More...
 

Detailed Description

RTEMS File System Link Support.

RTEMS File System Link Support

This file provides the link support functions.

Enumeration Type Documentation

◆ 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]fsis the file system.
[in]nameis a pointer to the name of the link.
[in]lengthis the length of the name.
[in]parentis the inode number of the parent directory.
[in]targetis the inode of the target.
[in]link_dirIf true directories can be linked. Useful when renaming.
Return values
0Successful operation.
error_codeAn 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]fsis the file system data.
[in]nameis a pointer to the name of the node.
[in]lengthis the length of the name of the node.
[in]linkis a pointer to the link path attached to the symlink inode.
[in]link_lengthis the length of the link path.
[in]parentis the parent inode number.
Return values
0Successful operation.
error_codeAn 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]fsis the file system data.
[in]linkis the link inode number to read.
[in]pathis a pointer to the buffer to write the link path into.
[in]sizeis the size of the buffer.
[out]lengthwill contain the length of the link path.
Return values
0Successful operation.
error_codeAn 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]fsis the file system.
[in]parentis the inode number of the parent directory.
[in]targetis the inode of the target.
[in]doffis the parent directory entry offset for the target entry.
[in]dir_modeis the directory unlink mode.
Return values
0Successful operation.
error_codeAn error occurred.