4.104.114.84.95
Line | |
---|
1 | /* |
---|
2 | * IMFS_symlink |
---|
3 | * |
---|
4 | * The following rouine creates a new symbolic link node under parent |
---|
5 | * with the name given in name. The node is set to point to the node at |
---|
6 | * to_loc. |
---|
7 | * |
---|
8 | * COPYRIGHT (c) 1989-1999. |
---|
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.OARcorp.com/rtems/license.html. |
---|
14 | * |
---|
15 | * $Id$ |
---|
16 | */ |
---|
17 | |
---|
18 | #include <errno.h> |
---|
19 | #include "imfs.h" |
---|
20 | #include "libio_.h" |
---|
21 | |
---|
22 | int IMFS_symlink( |
---|
23 | rtems_filesystem_location_info_t *parent_loc, |
---|
24 | const char *link_name, |
---|
25 | const char *node_name |
---|
26 | ) |
---|
27 | { |
---|
28 | IMFS_types_union info; |
---|
29 | IMFS_jnode_t *new_node; |
---|
30 | char new_name[ IMFS_NAME_MAX + 1 ]; |
---|
31 | int i; |
---|
32 | |
---|
33 | /* |
---|
34 | * Remove any separators at the end of the string. |
---|
35 | */ |
---|
36 | |
---|
37 | IMFS_get_token( node_name, new_name, &i ); |
---|
38 | |
---|
39 | info.sym_link.name = link_name; |
---|
40 | |
---|
41 | /* |
---|
42 | * Create a new link node. |
---|
43 | */ |
---|
44 | |
---|
45 | new_node = IMFS_create_node( |
---|
46 | parent_loc, |
---|
47 | IMFS_SYM_LINK, |
---|
48 | new_name, |
---|
49 | ( S_IFLNK | ( S_IRWXU | S_IRWXG | S_IRWXO )), |
---|
50 | &info |
---|
51 | ); |
---|
52 | |
---|
53 | if ( !new_node ) |
---|
54 | set_errno_and_return_minus_one( ENOMEM ); |
---|
55 | |
---|
56 | return 0; |
---|
57 | } |
---|
58 | |
---|
59 | |
---|
Note: See
TracBrowser
for help on using the repository browser.