1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Base File System Initialization |
---|
5 | * @ingroup LibIO |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-2008. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * Modifications to support reference counting in the file system are |
---|
13 | * Copyright (c) 2012 embedded brains GmbH. |
---|
14 | * |
---|
15 | * The license and distribution terms for this file may be |
---|
16 | * found in the file LICENSE in this distribution or at |
---|
17 | * http://www.rtems.org/license/LICENSE. |
---|
18 | */ |
---|
19 | |
---|
20 | #if HAVE_CONFIG_H |
---|
21 | #include "config.h" |
---|
22 | #endif |
---|
23 | |
---|
24 | #include <rtems.h> |
---|
25 | #include <rtems/libio.h> |
---|
26 | #include <rtems/libio_.h> |
---|
27 | |
---|
28 | /* |
---|
29 | * Default mode for created files. |
---|
30 | */ |
---|
31 | |
---|
32 | void rtems_filesystem_initialize( void ) |
---|
33 | { |
---|
34 | int rv = 0; |
---|
35 | const rtems_filesystem_mount_configuration *root_config = |
---|
36 | &rtems_filesystem_root_configuration; |
---|
37 | |
---|
38 | rv = mount( |
---|
39 | root_config->source, |
---|
40 | root_config->target, |
---|
41 | root_config->filesystemtype, |
---|
42 | root_config->options, |
---|
43 | root_config->data |
---|
44 | ); |
---|
45 | if ( rv != 0 ) |
---|
46 | rtems_fatal_error_occurred( 0xABCD0002 ); |
---|
47 | |
---|
48 | /* |
---|
49 | * Traditionally RTEMS devices are under "/dev" so install this directory. |
---|
50 | * |
---|
51 | * If the mkdir() fails, we can't print anything so just fatal error. |
---|
52 | * |
---|
53 | * NOTE: UNIX root is 755 and owned by root/root (0/0). It is actually |
---|
54 | * created that way by the IMFS. |
---|
55 | */ |
---|
56 | |
---|
57 | rv = mkdir( "/dev", 0777); |
---|
58 | if ( rv != 0 ) |
---|
59 | rtems_fatal_error_occurred( 0xABCD0003 ); |
---|
60 | |
---|
61 | /* |
---|
62 | * You can't mount another filesystem properly until the mount point |
---|
63 | * it will be mounted onto is created. Moreover, if it is going to |
---|
64 | * use a device, then it is REALLY unfair to attempt this |
---|
65 | * before device drivers are initialized. So we return via a base |
---|
66 | * filesystem image and nothing auto-mounted at this point. |
---|
67 | */ |
---|
68 | } |
---|