source: rtems/c/src/exec/libcsupport/src/base_fs.c @ 7b0001f7

4.104.114.84.95
Last change on this file since 7b0001f7 was 7b0001f7, checked in by Joel Sherrill <joel.sherrill@…>, on 10/25/00 at 16:56:11

2000-10-24 Joel Sherrill <joel@…>

  • libc/ioman.c: Moved to libfs.
  • libc/Makefile.am: Removed ioman.c as part of moving it to libfs.
  • libc/base_fs.c: Removed include of imfs.h and reworded comment to avoid being IMFS specific.
  • libc/libio.h: Removed prototype of IMFS_ops since it should not be in this file.
  • libc/mount.c: Removed IMFS specific configuration information.
  • libc/unmount.c: Removed include of imfs.h and reworded comment to avoid being IMFS specific.
  • Property mode set to 100644
File size: 2.8 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#include <rtems.h>
15#include <rtems/libio.h>
16#include "libio_.h"
17
18/*
19 *  Global information for the base file system.
20 */
21
22rtems_filesystem_location_info_t rtems_filesystem_current;
23rtems_filesystem_location_info_t rtems_filesystem_root;
24nlink_t                          rtems_filesystem_link_counts;
25
26/*
27 *  Default mode for created files.
28 */
29
30mode_t rtems_filesystem_umask;
31
32/*
33 *  rtems_filesystem_initialize
34 *
35 *  Initialize the foundation of the file system.  This is specified
36 *  by the structure rtems_filesystem_mount_table.  The usual
37 *  configuration is a single instantiation of the IMFS or miniIMFS with
38 *  a single "/dev" directory in it.
39 */
40
41void rtems_filesystem_initialize( void )
42{
43#if !defined(RTEMS_UNIX)
44#if 0
45  int                                   i;
46#endif
47  int                                   status;
48  rtems_filesystem_mount_table_entry_t *entry;
49  rtems_filesystem_mount_table_t       *mt;
50 
51  /*
52   *  Set the default umask to "022".
53   */
54
55  rtems_filesystem_umask = S_IWOTH | S_IROTH;
56
57  init_fs_mount_table();
58
59  /*
60   *  mount the first filesystem.
61   */
62
63  if ( rtems_filesystem_mount_table_size == 0 )
64    rtems_fatal_error_occurred( 0xABCD0001 );
65
66  mt = &rtems_filesystem_mount_table[0];
67
68  status = mount(
69     &entry, mt->fs_ops, mt->fsoptions, mt->device, mt->mount_point );
70
71  if ( status == -1 )
72    rtems_fatal_error_occurred( 0xABCD0002 );
73
74  rtems_filesystem_link_counts = 0;
75  rtems_filesystem_root        = entry->mt_fs_root;
76  rtems_filesystem_current     = rtems_filesystem_root;
77
78  /*
79   *  Traditionally RTEMS devices are under "/dev" so install this directory.
80   *
81   *  If the mkdir() fails, we can't print anything so just fatal error.
82   *
83   *  NOTE: UNIX root is 755 and owned by root/root (0/0).
84   */
85
86  status = mkdir( "/dev", S_IRWXU | S_IRWXG | S_IRWXO );
87  if ( status != 0 )
88    rtems_fatal_error_occurred( 0xABCD0003 );
89
90  /*
91   *  This code if if'ed 0 out because you can't mount another
92   *  filesystem properly until the mount point it will be
93   *  mounted onto is created.  Moreover, if it is going to
94   *  use a device, then it is REALLY unfair to attempt this
95   *  before device drivers are initialized.
96   */
97
98#if 0
99  /*
100   *  Now if there are other filesystems to mount, go for it.
101   */
102
103  for ( i=1 ; i < rtems_filesystem_mount_table_size ; i++ ) {
104    mt = &rtems_filesystem_mount_table[0];
105
106    status = mount(
107       &entry, mt->fs_ops, mt->fsoptions, mt->device, mt->mount_point );
108
109    if ( status == -1 )
110      rtems_fatal_error_occurred( 0xABCD0003 );
111  }
112#endif
113#endif
114}
Note: See TracBrowser for help on using the repository browser.