source: rtems/cpukit/libfs/src/imfs/imfs_dir.c @ f785492

4.115
Last change on this file since f785492 was f785492, checked in by Sebastian Huber <sebastian.huber@…>, on Feb 14, 2015 at 7:07:19 PM

IMFS: Add CONFIGURE_IMFS_DISABLE_READDIR

  • Property mode set to 100644
File size: 976 bytes
Line 
1/**
2 * @file
3 *
4 * @ingroup IMFS
5 */
6
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.rtems.org/license/LICENSE.
14 */
15
16#if HAVE_CONFIG_H
17  #include "config.h"
18#endif
19
20#include "imfs.h"
21
22IMFS_jnode_t *IMFS_node_initialize_directory(
23  IMFS_jnode_t *node,
24  void *arg
25)
26{
27  IMFS_directory_t *dir = (IMFS_directory_t *) node;
28
29  rtems_chain_initialize_empty( &dir->Entries );
30
31  return node;
32}
33
34static bool IMFS_is_mount_point( const IMFS_directory_t *dir )
35{
36  return dir->mt_fs != NULL;
37}
38
39IMFS_jnode_t *IMFS_node_remove_directory( IMFS_jnode_t *node )
40{
41  IMFS_directory_t *dir = (IMFS_directory_t *) node;
42
43  if ( !rtems_chain_is_empty( &dir->Entries ) ) {
44    errno = ENOTEMPTY;
45    dir = NULL;
46  } else if ( IMFS_is_mount_point( dir ) ) {
47    errno = EBUSY;
48    dir = NULL;
49  }
50
51  return &dir->Node;
52}
Note: See TracBrowser for help on using the repository browser.