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

4.115
Last change on this file since c17d0b3 was c17d0b3, checked in by Sebastian Huber <sebastian.huber@…>, on 10/02/12 at 13:44:59

Filesystem: Reject removal of root nodes

Reject the removal of file system instance root nodes in rmdir() and
unlink() and return the EBUSY error status. File system instances can
be removed with unmount(). Remove root node special cases in IMFS,
DOSFS, and RFS.

  • Property mode set to 100644
File size: 1010 bytes
Line 
1/*
2 *  IMFS Node Removal Handler
3 *
4 *  This file contains the handler used to remove a node when a file type
5 *  does not require special actions.
6 *
7 *  COPYRIGHT (c) 1989-1999.
8 *  On-Line Applications Research Corporation (OAR).
9 *
10 *  Modifications to support reference counting in the file system are
11 *  Copyright (c) 2012 embedded brains GmbH.
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.com/license/LICENSE.
16 */
17
18#if HAVE_CONFIG_H
19  #include "config.h"
20#endif
21
22#include "imfs.h"
23
24int IMFS_rmnod(
25  const rtems_filesystem_location_info_t *parentloc,
26  const rtems_filesystem_location_info_t *loc
27)
28{
29  int rv = 0;
30  IMFS_jnode_t *node = loc->node_access;
31
32  node = (*node->control->node_remove)( node );
33  if ( node != NULL ) {
34    --node->reference_count;
35    --node->st_nlink;
36    if ( node->Parent != NULL ) {
37      IMFS_remove_from_directory( node );
38    }
39  } else {
40    rv = -1;
41  }
42
43  return rv;
44}
Note: See TracBrowser for help on using the repository browser.