RTEMS 6.1-rc1
Functions

RTEMS File Systems Link Routines. More...

#include <inttypes.h>
#include <string.h>
#include <rtems/rfs/rtems-rfs-block.h>
#include <rtems/rfs/rtems-rfs-buffer.h>
#include <rtems/rfs/rtems-rfs-file-system.h>
#include <rtems/rfs/rtems-rfs-trace.h>
#include <rtems/rfs/rtems-rfs-dir.h>
#include <rtems/rfs/rtems-rfs-dir-hash.h>
#include <rtems/rfs/rtems-rfs-link.h>

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 Systems Link Routines.

These functions manage links. A link is the addition of a directory entry in a parent directory and incrementing the links count in the inode.

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.