source: rtems/cpukit/libfs/src/imfs/imfs_link.c @ c17d0b3

4.115
Last change on this file since c17d0b3 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 *  IMFS_link
3 *
4 *  The following rouine creates a new link node under parent with the
5 *  name given in name.  The link node is set to point to the node at
6 *  to_loc.
7 *
8 *  COPYRIGHT (c) 1989-2010.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.rtems.com/license/LICENSE.
14 */
15
16#if HAVE_CONFIG_H
17  #include "config.h"
18#endif
19
20#include "imfs.h"
21
22int IMFS_link(
23  const rtems_filesystem_location_info_t *parentloc,
24  const rtems_filesystem_location_info_t *targetloc,
25  const char *name,
26  size_t namelen
27)
28{
29  IMFS_types_union   info;
30  IMFS_jnode_t      *new_node;
31  IMFS_jnode_t      *target;
32
33  target = targetloc->node_access;
34  info.hard_link.link_node = target;
35
36  /*
37   *  Verify this node can be linked to.
38   */
39  if ( target->st_nlink >= LINK_MAX )
40    rtems_set_errno_and_return_minus_one( EMLINK );
41
42  /*
43   *  Create a new link node.
44   */
45  new_node = IMFS_create_node(
46    parentloc,
47    IMFS_HARD_LINK,
48    name,
49    namelen,
50    ( S_IFLNK | ( S_IRWXU | S_IRWXG | S_IRWXO )),
51    &info
52  );
53
54  if ( !new_node )
55    rtems_set_errno_and_return_minus_one( ENOMEM );
56
57  /*
58   * Increment the link count of the node being pointed to.
59   */
60  target->reference_count++;
61  target->st_nlink++;
62  IMFS_update_ctime( target );
63
64  return 0;
65}
Note: See TracBrowser for help on using the repository browser.