source: rtems/c/src/lib/libc/base_fs.c @ 81f6e8cc

4.104.114.84.95
Last change on this file since 81f6e8cc was 9c49db4, checked in by Joel Sherrill <joel.sherrill@…>, on 01/08/01 at 18:26:44

2001-01-08 Ralf Corsepius <corsepiu@…>

  • configure.in: Add libc/config.h
  • libc/Makefile.am: Add INCLUDES += -I. to pickup config.h
  • libc/.cvsignore: Add config.h and stamp-h
  • libc/*.c: Add config.h support.
  • Property mode set to 100644
File size: 2.9 KB
Line 
1/*
2 *  Base file system initialization
3 *
4 *  COPYRIGHT (c) 1989-1999.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.OARcorp.com/rtems/license.html.
10 *
11 *  $Id$
12 */
13
14#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <rtems.h>
19#include <rtems/libio.h>
20#include <rtems/libio_.h>
21
22/*
23 *  Global information for the base file system.
24 */
25
26rtems_filesystem_location_info_t rtems_filesystem_current;
27rtems_filesystem_location_info_t rtems_filesystem_root;
28nlink_t                          rtems_filesystem_link_counts;
29
30/*
31 *  Default mode for created files.
32 */
33
34mode_t rtems_filesystem_umask;
35
36/*
37 *  rtems_filesystem_initialize
38 *
39 *  Initialize the foundation of the file system.  This is specified
40 *  by the structure rtems_filesystem_mount_table.  The usual
41 *  configuration is a single instantiation of the IMFS or miniIMFS with
42 *  a single "/dev" directory in it.
43 */
44
45void rtems_filesystem_initialize( void )
46{
47#if !defined(RTEMS_UNIX)
48#if 0
49  int                                   i;
50#endif
51  int                                   status;
52  rtems_filesystem_mount_table_entry_t *entry;
53  rtems_filesystem_mount_table_t       *mt;
54 
55  /*
56   *  Set the default umask to "022".
57   */
58
59  rtems_filesystem_umask = S_IWOTH | S_IROTH;
60
61  init_fs_mount_table();
62
63  /*
64   *  mount the first filesystem.
65   */
66
67  if ( rtems_filesystem_mount_table_size == 0 )
68    rtems_fatal_error_occurred( 0xABCD0001 );
69
70  mt = &rtems_filesystem_mount_table[0];
71
72  status = mount(
73     &entry, mt->fs_ops, mt->fsoptions, mt->device, mt->mount_point );
74
75  if ( status == -1 )
76    rtems_fatal_error_occurred( 0xABCD0002 );
77
78  rtems_filesystem_link_counts = 0;
79  rtems_filesystem_root        = entry->mt_fs_root;
80  rtems_filesystem_current     = rtems_filesystem_root;
81
82  /*
83   *  Traditionally RTEMS devices are under "/dev" so install this directory.
84   *
85   *  If the mkdir() fails, we can't print anything so just fatal error.
86   *
87   *  NOTE: UNIX root is 755 and owned by root/root (0/0).
88   */
89
90  status = mkdir( "/dev", S_IRWXU | S_IRWXG | S_IRWXO );
91  if ( status != 0 )
92    rtems_fatal_error_occurred( 0xABCD0003 );
93
94  /*
95   *  This code if if'ed 0 out because you can't mount another
96   *  filesystem properly until the mount point it will be
97   *  mounted onto is created.  Moreover, if it is going to
98   *  use a device, then it is REALLY unfair to attempt this
99   *  before device drivers are initialized.
100   */
101
102#if 0
103  /*
104   *  Now if there are other filesystems to mount, go for it.
105   */
106
107  for ( i=1 ; i < rtems_filesystem_mount_table_size ; i++ ) {
108    mt = &rtems_filesystem_mount_table[0];
109
110    status = mount(
111       &entry, mt->fs_ops, mt->fsoptions, mt->device, mt->mount_point );
112
113    if ( status == -1 )
114      rtems_fatal_error_occurred( 0xABCD0003 );
115  }
116#endif
117#endif
118}
Note: See TracBrowser for help on using the repository browser.