source: rtems/c/src/lib/libc/imfs_getchild.c @ 0162910

4.104.114.84.95
Last change on this file since 0162910 was 07a3253d, checked in by Joel Sherrill <joel.sherrill@…>, on 11/23/98 at 19:07:58

Added base version of file system infrastructure. This includes a major
overhaul of the RTEMS system call interface. This base file system is
the "In-Memory File System" aka IMFS.

The design and implementation was done by the following people:

+ Joel Sherrill (joel@…)
+ Jennifer Averett (jennifer@…)
+ Steve "Mr Mount" Salitasc (salitasc@…)
+ Kerwin Wade (wade@…)

PROBLEMS
========

+ It is VERY likely that merging this will break the UNIX port. This

can/will be fixed.

+ There is likely some reentrancy/mutual exclusion needed.

+ Eventually, there should be a "mini-IMFS" description table to

eliminate links, symlinks, etc to save memory. All you need to
have "classic RTEMS" functionality is technically directories
and device IO. All the rest could be left out to save memory.

  • Property mode set to 100644
File size: 1.3 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-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 <assert.h>
19#include "imfs.h"
20
21static char dotname[2] = ".";
22static char dotdotname[2] = "..";
23
24IMFS_jnode_t *IMFS_find_match_in_dir(
25  IMFS_jnode_t *directory,
26  char         *name
27)
28{
29  Chain_Node        *the_node;
30  Chain_Control     *the_chain;
31  IMFS_jnode_t      *the_jnode;
32
33  /*
34   *  Check for fatal errors
35   */
36
37  assert( directory );
38  if ( !name )
39    return 0;
40
41  assert( name );
42  if ( !directory )
43    return 0;
44
45  /*
46   *  Check for "." and ".."
47   */
48
49  if ( !strcmp( name, dotname ) )
50    return directory;
51
52  if ( !strcmp( name, dotdotname ) )
53    return directory->Parent;
54
55  the_chain = &directory->info.directory.Entries;
56
57  for ( the_node = the_chain->first;
58        !_Chain_Is_tail( the_chain, the_node );
59        the_node = the_node->next ) {
60
61    the_jnode = (IMFS_jnode_t *) the_node;
62
63    if ( !strcmp( name, the_jnode->name ) )
64      return the_jnode;
65  }
66
67  return 0;
68}
Note: See TracBrowser for help on using the repository browser.