4.104.114.84.95
Last change
on this file since 32163db 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.6 KB
|
Line | |
---|
1 | /* |
---|
2 | * IMFS_mknod |
---|
3 | * |
---|
4 | * Routine to create a node in the IMFS file system. |
---|
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 <sys/types.h> |
---|
18 | #include <sys/stat.h> |
---|
19 | #include <fcntl.h> |
---|
20 | #include <unistd.h> |
---|
21 | #include <errno.h> |
---|
22 | #include <stdlib.h> |
---|
23 | #include <assert.h> |
---|
24 | |
---|
25 | #include "imfs.h" |
---|
26 | #include "libio_.h" |
---|
27 | |
---|
28 | int IMFS_mknod( |
---|
29 | const char *token, /* IN */ |
---|
30 | mode_t mode, /* IN */ |
---|
31 | dev_t dev, /* IN */ |
---|
32 | rtems_filesystem_location_info_t *pathloc /* IN/OUT */ |
---|
33 | ) |
---|
34 | { |
---|
35 | IMFS_token_types type = 0; |
---|
36 | IMFS_jnode_t *new_node; |
---|
37 | int result; |
---|
38 | char new_name[ NAME_MAX + 1 ]; |
---|
39 | IMFS_types_union info; |
---|
40 | |
---|
41 | IMFS_get_token( token, new_name, &result ); |
---|
42 | |
---|
43 | /* |
---|
44 | * Figure out what type of IMFS node this is. |
---|
45 | */ |
---|
46 | |
---|
47 | if ( S_ISDIR(mode) ) |
---|
48 | type = IMFS_DIRECTORY; |
---|
49 | else if ( S_ISREG(mode) ) |
---|
50 | type = IMFS_MEMORY_FILE; |
---|
51 | else if ( S_ISBLK(mode) || S_ISCHR(mode) ) { |
---|
52 | type = IMFS_DEVICE; |
---|
53 | rtems_filesystem_split_dev_t( dev, info.device.major, info.device.minor ); |
---|
54 | } else { |
---|
55 | assert( 0 ); |
---|
56 | set_errno_and_return_minus_one( EINVAL ); |
---|
57 | } |
---|
58 | |
---|
59 | /* |
---|
60 | * Allocate and fill in an IMFS jnode |
---|
61 | */ |
---|
62 | |
---|
63 | new_node = IMFS_create_node( |
---|
64 | pathloc, |
---|
65 | type, |
---|
66 | new_name, |
---|
67 | mode, |
---|
68 | &info |
---|
69 | ); |
---|
70 | |
---|
71 | if ( !new_node ) |
---|
72 | set_errno_and_return_minus_one( ENOMEM ); |
---|
73 | |
---|
74 | return 0; |
---|
75 | } |
---|
76 | |
---|
Note: See
TracBrowser
for help on using the repository browser.