4.115
Last change
on this file since 60cf8a5 was
60cf8a5,
checked in by Sebastian Huber <sebastian.huber@…>, on 02/06/15 at 15:32:39
|
IMFS: Add root directory to FS info
Fix memory leak in IMFS_fsunmount().
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Create an IMFS Node |
---|
5 | * @ingroup IMFS |
---|
6 | */ |
---|
7 | /* |
---|
8 | * COPYRIGHT (c) 1989-2010. |
---|
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 | |
---|
22 | #include <stdlib.h> |
---|
23 | #include <string.h> |
---|
24 | |
---|
25 | IMFS_jnode_t *IMFS_create_node( |
---|
26 | const rtems_filesystem_location_info_t *parentloc, |
---|
27 | const IMFS_node_control *node_control, |
---|
28 | size_t node_size, |
---|
29 | const char *name, |
---|
30 | size_t namelen, |
---|
31 | mode_t mode, |
---|
32 | void *arg |
---|
33 | ) |
---|
34 | { |
---|
35 | IMFS_jnode_t *allocated_node; |
---|
36 | IMFS_jnode_t *node; |
---|
37 | |
---|
38 | allocated_node = calloc( 1, node_size ); |
---|
39 | if ( allocated_node == NULL ) { |
---|
40 | errno = ENOMEM; |
---|
41 | |
---|
42 | return NULL; |
---|
43 | } |
---|
44 | |
---|
45 | node = IMFS_initialize_node( |
---|
46 | allocated_node, |
---|
47 | node_control, |
---|
48 | name, |
---|
49 | namelen, |
---|
50 | mode, |
---|
51 | arg |
---|
52 | ); |
---|
53 | if ( node != NULL ) { |
---|
54 | IMFS_jnode_t *parent = parentloc->node_access; |
---|
55 | |
---|
56 | /* |
---|
57 | * This node MUST have a parent, so put it in that directory list. |
---|
58 | */ |
---|
59 | IMFS_assert( parent != NULL ); |
---|
60 | IMFS_add_to_directory( parent, node ); |
---|
61 | } else { |
---|
62 | free( allocated_node ); |
---|
63 | } |
---|
64 | |
---|
65 | return node; |
---|
66 | } |
---|
67 | |
---|
Note: See
TracBrowser
for help on using the repository browser.