4.104.114.95
Last change
on this file since bf95ccb5 was
bf95ccb5,
checked in by Thomas Doerfler <Thomas.Doerfler@…>, on 05/27/08 at 10:34:15
|
Added const qualifier to various pointers and data tables to
reduce size of data area.
IMFS: Fixed creation of symbolic links to avoid a compiler warning.
DOSFS: Use LibBlock? instead of read() to read the boot record.
|
-
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 | |
---|
25 | static const char dotname[2] = "."; |
---|
26 | static const char dotdotname[3] = ".."; |
---|
27 | |
---|
28 | IMFS_jnode_t *IMFS_find_match_in_dir( |
---|
29 | IMFS_jnode_t *directory, |
---|
30 | char *name |
---|
31 | ) |
---|
32 | { |
---|
33 | Chain_Node *the_node; |
---|
34 | 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 | !_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.