RTEMS Logo

RTEMS 4.7.99.2 On-Line Library


link

PREV UP NEXT Bookshelf RTEMS Filesystem Design Guide

4.15: link

File:

link.c

Processing:

This routine will establish a hard link to a file, directory or a device. The target of the hard link must be in the same filesystem as the new link being created. A link to an existing link is also permitted but the existing link is evaluated before the new link is made. This implies that links to links are reduced to links to files, directories or devices before they are made.

Development Comments:

Calling parameters: const char *existing const char *new

link() will determine if the target of the link actually exists using rtems_filesystem_evaluate_path()

rtems_filesystem_get_start_loc() is used to determine where to start the path evaluation of the new name. This macro examines the first characters of the name to see if the name of the new link starts with a rtems_filesystem_is_separator. If it does the search starts from the root of the RTEMS filesystem; otherwise the search will start from the current directory.

The OPS table evalformake() function for the parent's filesystem is used to locate the node that will be the parent of the new link. It will also locate the start of the new path's name. This name will be used to define a child under the parent directory.

If the parent is found, the routine will determine if the hard link that we are trying to create will cross a filesystem boundary. This is not permitted for hard-links.

If the hard-link does not cross a filesystem boundary, a check is performed to determine if the OPS table contains an entry for the link() function.

If a link() function is defined, the OPS table link() function will be called to establish the actual link within the filesystem.

The return code from the OPS table link() function is returned to the calling program.


PREV UP NEXT Bookshelf RTEMS Filesystem Design Guide

Copyright © 1988-2004 OAR Corporation