source: rtems/c/src/exec/libcsupport/src/base_fs.c @ c891fe0

4.104.114.84.95
Last change on this file since c891fe0 was c891fe0, checked in by Joel Sherrill <joel.sherrill@…>, on May 25, 2001 at 1:46:02 PM

2001-05-25 Joel Sherrill <joel@…>

  • libc/base_fs.c: Deleted chmod() now that IMFS creates the

root node with the desired permissions. chmod() is also not
supported by the miniIMFS so this is not allowable.

  • 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#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_user_env_t   rtems_global_user_env;
27rtems_user_env_t * rtems_current_user_env = &rtems_global_user_env;
28
29/*
30 *  Default mode for created files.
31 */
32
33
34/*
35 *  rtems_filesystem_initialize
36 *
37 *  Initialize the foundation of the file system.  This is specified
38 *  by the structure rtems_filesystem_mount_table.  The usual
39 *  configuration is a single instantiation of the IMFS or miniIMFS with
40 *  a single "/dev" directory in it.
41 */
42
43void rtems_filesystem_initialize( void )
44{
45#if !defined(RTEMS_UNIX)
46#if 0
47  int                                   i;
48#endif
49  int                                   status;
50  rtems_filesystem_mount_table_entry_t *entry;
51  rtems_filesystem_mount_table_t       *mt;
52 
53  /*
54   *  Set the default umask to "022".
55   */
56
57  rtems_filesystem_umask = 022;
58
59
60  init_fs_mount_table();
61
62  /*
63   *  mount the first filesystem.
64   */
65
66  if ( rtems_filesystem_mount_table_size == 0 )
67    rtems_fatal_error_occurred( 0xABCD0001 );
68
69  mt = &rtems_filesystem_mount_table[0];
70
71  status = mount(
72     &entry, mt->fs_ops, mt->fsoptions, mt->device, mt->mount_point );
73
74  if ( status == -1 )
75    rtems_fatal_error_occurred( 0xABCD0002 );
76
77  rtems_filesystem_link_counts = 0;
78  rtems_filesystem_root        = entry->mt_fs_root;
79  rtems_filesystem_current     = rtems_filesystem_root;
80
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).  It is actually
88   *        created that way by the IMFS.
89   */
90
91  status = mkdir( "/dev", 0777);
92  if ( status != 0 )
93    rtems_fatal_error_occurred( 0xABCD0003 );
94
95  /*
96   *  This code if if'ed 0 out because you can't mount another
97   *  filesystem properly until the mount point it will be
98   *  mounted onto is created.  Moreover, if it is going to
99   *  use a device, then it is REALLY unfair to attempt this
100   *  before device drivers are initialized.
101   */
102
103#if 0
104  /*
105   *  Now if there are other filesystems to mount, go for it.
106   */
107
108  for ( i=1 ; i < rtems_filesystem_mount_table_size ; i++ ) {
109    mt = &rtems_filesystem_mount_table[0];
110
111    status = mount(
112       &entry, mt->fs_ops, mt->fsoptions, mt->device, mt->mount_point );
113
114    if ( status == -1 )
115      rtems_fatal_error_occurred( 0xABCD0003 );
116  }
117#endif
118#endif
119}
Note: See TracBrowser for help on using the repository browser.