4.104.114.84.95
Last change
on this file since b568ccb was
b568ccb,
checked in by Joel Sherrill <joel.sherrill@…>, on 11/02/99 at 20:20:13
|
The object memfile.o was being included in the miniIMFS even though it
should not have been. This required that IMFS_rmnod be split into
three separate (per file type) routines to avoid dependencies.
In the end, a miniIMFS application is 6K smaller than one using the
full IMFS.
|
-
Property mode set to
100644
|
File size:
1.5 KB
|
Line | |
---|
1 | /* |
---|
2 | * IMFS_unlink |
---|
3 | * |
---|
4 | * Routine to remove a link node from the tree. |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989-1998. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * Copyright assigned to U.S. Government, 1994. |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.OARcorp.com/rtems/license.html. |
---|
13 | * |
---|
14 | * $Id$ |
---|
15 | */ |
---|
16 | |
---|
17 | #include <errno.h> |
---|
18 | #include <stdlib.h> |
---|
19 | |
---|
20 | #include "imfs.h" |
---|
21 | #include "libio_.h" |
---|
22 | |
---|
23 | int IMFS_unlink( |
---|
24 | rtems_filesystem_location_info_t *loc /* IN */ |
---|
25 | ) |
---|
26 | { |
---|
27 | IMFS_jnode_t *node; |
---|
28 | rtems_filesystem_location_info_t the_link; |
---|
29 | int result; |
---|
30 | |
---|
31 | node = loc->node_access; |
---|
32 | |
---|
33 | /* |
---|
34 | * Decrement the link counter of node pointed to and free the |
---|
35 | * space. |
---|
36 | */ |
---|
37 | |
---|
38 | /* |
---|
39 | * If this is the last last pointer to the node |
---|
40 | * free the node. |
---|
41 | */ |
---|
42 | |
---|
43 | if ( node->type == IMFS_HARD_LINK ) { |
---|
44 | |
---|
45 | if ( !node->info.hard_link.link_node ) |
---|
46 | set_errno_and_return_minus_one( EINVAL ); |
---|
47 | |
---|
48 | the_link = *loc; |
---|
49 | the_link.node_access = node->info.hard_link.link_node; |
---|
50 | |
---|
51 | /* |
---|
52 | * If this is the last referance to the node |
---|
53 | * Free the node that the link points to. |
---|
54 | */ |
---|
55 | node->info.hard_link.link_node->st_nlink --; |
---|
56 | IMFS_update_ctime( node->info.hard_link.link_node ); |
---|
57 | if ( node->info.hard_link.link_node->st_nlink < 1) { |
---|
58 | result = (*loc->handlers->rmnod)( &the_link ); |
---|
59 | if ( result != 0 ) |
---|
60 | return -1; |
---|
61 | } |
---|
62 | } |
---|
63 | |
---|
64 | result = (*loc->handlers->rmnod)( &the_link ); |
---|
65 | |
---|
66 | return result; |
---|
67 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.