source: rtems/cpukit/libfs/src/imfs/imfs_getchild.c @ 72d2ec4d

4.104.114.95
Last change on this file since 72d2ec4d was 72d2ec4d, checked in by Chris Johns <chrisj@…>, on 07/03/08 at 01:37:38

2008-07-03 Chris Johns <chrisj@…>

  • cpukit/libcsupport/include/chain.h: Removed. Use the SAPI interface that is supported.
  • cpukit/libcsupport/Makefile.am, cpukit/libcsupport/preinstall.am: Remove chain.h header references.
  • cpukit/sapi/include/rtems/chain.h, cpukit/sapi/inline/rtems/chain.inl: New. A supported chains interface.
  • cpukit/sapi/Makefile.am, cpukit/sapi/preinstall.am: Updated to include the new chains interface.
  • cpukit/libfs/src/imfs/imfs.h, cpukit/libfs/src/imfs/imfs_creat.c, cpukit/libfs/src/imfs/imfs_debug.c, cpukit/libfs/src/imfs/imfs_directory.c, cpukit/libfs/src/imfs/imfs_fsunmount.c, cpukit/libfs/src/imfs/imfs_getchild.c, cpukit/libfs/src/imfs/imfs_load_tar.c, cpukit/libfs/src/imfs/imfs_rmnod.c, cpukit/libfs/src/imfs/memfile.c, cpukit/libfs/src/nfsclient/src/nfs.c, cpukit/libcsupport/include/rtems/libio.h, cpukit/libcsupport/src/malloc_deferred.c, cpukit/libcsupport/src/mount.c, cpukit/libcsupport/src/privateenv.c, cpukit/libcsupport/src/unmount.c: Change to the new chains interface.
  • cpukit/libcsupport/src/malloc_boundary.c: Remove warning.
  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 *  IMFS_find_match_in_dir()
3 *
4 *  This routine returns the child name in the given directory.
5 *
6 *  COPYRIGHT (c) 1989-1999.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.rtems.com/license/LICENSE.
12 *
13 *  $Id$
14 */
15
16#if HAVE_CONFIG_H
17#include "config.h"
18#endif
19
20#include <errno.h>
21#include <assert.h>
22#include <string.h>
23#include "imfs.h"
24
25static const char dotname[2] = ".";
26static const char dotdotname[3] = "..";
27
28IMFS_jnode_t *IMFS_find_match_in_dir(
29  IMFS_jnode_t *directory,
30  char         *name
31)
32{
33  rtems_chain_node    *the_node;
34  rtems_chain_control *the_chain;
35  IMFS_jnode_t        *the_jnode;
36
37  /*
38   *  Check for fatal errors.  A NULL directory show a problem in the
39   *  the IMFS code.
40   */
41
42  assert( directory );
43  if ( !name )
44    return 0;
45
46  assert( name );
47  if ( !directory )
48    return 0;
49
50  /*
51   *  Check for "." and ".."
52   */
53
54  if ( !strcmp( name, dotname ) )
55    return directory;
56
57  if ( !strcmp( name, dotdotname ) )
58    return directory->Parent;
59
60  the_chain = &directory->info.directory.Entries;
61
62  for ( the_node = the_chain->first;
63        !rtems_chain_is_tail( the_chain, the_node );
64        the_node = the_node->next ) {
65
66    the_jnode = (IMFS_jnode_t *) the_node;
67
68    if ( !strcmp( name, the_jnode->name ) )
69      return the_jnode;
70  }
71
72  return 0;
73}
Note: See TracBrowser for help on using the repository browser.