RTEMS 6.1-rc2
|
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) |
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.
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.
[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. |
0 | Successful operation. |
error_code | An error occurred. |
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.
[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. |
0 | Successful operation. |
error_code | An error occurred. |
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.
[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. |
0 | Successful operation. |
error_code | An error occurred. |
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.
[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. |
0 | Successful operation. |
error_code | An error occurred. |