source: rtems/cpukit/libfs/src/imfs/imfs_fsunmount.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.9 KB
Line 
1/*
2 *  IMFS Initialization
3 *
4 *  COPYRIGHT (c) 1989-1999.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 */
11
12#if HAVE_CONFIG_H
13  #include "config.h"
14#endif
15
16#include "imfs.h"
17
18/*
19 *  IMFS_fsunmount
20 */
21
22#define jnode_get_control( jnode ) \
23  (&jnode->info.directory.Entries)
24
25#define jnode_has_no_children( jnode )  \
26  rtems_chain_is_empty( jnode_get_control( jnode ) )
27
28#define jnode_has_children( jnode ) \
29  ( ! jnode_has_no_children( jnode ) )
30
31#define jnode_get_first_child( jnode ) \
32    ((IMFS_jnode_t *)( rtems_chain_head( jnode_get_control( jnode ) )->next))
33
34void IMFS_fsunmount(
35  rtems_filesystem_mount_table_entry_t *temp_mt_entry
36)
37{
38   IMFS_jnode_t                     *jnode;
39   IMFS_jnode_t                     *next;
40   rtems_filesystem_location_info_t loc;
41   int                              result = 0;
42
43   /*
44    * Traverse tree that starts at the mt_fs_root and deallocate memory
45    * associated memory space
46    */
47
48   loc = temp_mt_entry->mt_fs_root->location;
49   jnode = (IMFS_jnode_t *)loc.node_access;
50
51   /*
52    *  Set this to null to indicate that it is being unmounted.
53    */
54
55   temp_mt_entry->mt_fs_root->location.node_access = NULL;
56
57   do {
58     next = jnode->Parent;
59     loc.node_access = (void *)jnode;
60     IMFS_Set_handlers( &loc );
61
62     if ( !IMFS_is_directory( jnode ) || jnode_has_no_children( jnode ) ) {
63        result = IMFS_rmnod( NULL, &loc );
64        if ( result != 0 )
65          rtems_fatal_error_occurred( 0xdeadbeef );
66        IMFS_node_destroy( jnode );
67        jnode = next;
68     }
69     if ( jnode != NULL ) {
70       if ( IMFS_is_directory( jnode ) ) {
71         if ( jnode_has_children( jnode ) )
72           jnode = jnode_get_first_child( jnode );
73       }
74     }
75   } while (jnode != NULL);
76}
Note: See TracBrowser for help on using the repository browser.