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 05/25/01 at 13:46:02

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
RevLine 
[07a3253d]1/*
2 *  Base file system initialization
3 *
[08311cc3]4 *  COPYRIGHT (c) 1989-1999.
[07a3253d]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
[9c49db4]14#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
[07a3253d]18#include <rtems.h>
19#include <rtems/libio.h>
[3ba74c73]20#include <rtems/libio_.h>
[07a3253d]21
22/*
23 *  Global information for the base file system.
24 */
25
[2a929cc]26rtems_user_env_t   rtems_global_user_env;
27rtems_user_env_t * rtems_current_user_env = &rtems_global_user_env;
[07a3253d]28
29/*
30 *  Default mode for created files.
31 */
32
33
34/*
35 *  rtems_filesystem_initialize
36 *
[7b0001f7]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.
[07a3253d]41 */
42
43void rtems_filesystem_initialize( void )
44{
[7a3878b]45#if !defined(RTEMS_UNIX)
[063e4950]46#if 0
47  int                                   i;
48#endif
[07a3253d]49  int                                   status;
[063e4950]50  rtems_filesystem_mount_table_entry_t *entry;
51  rtems_filesystem_mount_table_t       *mt;
52 
[07a3253d]53  /*
54   *  Set the default umask to "022".
55   */
56
[e565720a]57  rtems_filesystem_umask = 022;
58
[07a3253d]59
60  init_fs_mount_table();
61
[657e1bf6]62  /*
63   *  mount the first filesystem.
64   */
65
[063e4950]66  if ( rtems_filesystem_mount_table_size == 0 )
67    rtems_fatal_error_occurred( 0xABCD0001 );
[07a3253d]68
[063e4950]69  mt = &rtems_filesystem_mount_table[0];
[07a3253d]70
[063e4950]71  status = mount(
72     &entry, mt->fs_ops, mt->fsoptions, mt->device, mt->mount_point );
[07a3253d]73
[063e4950]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;
[07a3253d]80
[e565720a]81
[07a3253d]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   *
[c891fe0]87   *  NOTE: UNIX root is 755 and owned by root/root (0/0).  It is actually
88   *        created that way by the IMFS.
[07a3253d]89   */
90
[e565720a]91  status = mkdir( "/dev", 0777);
[07a3253d]92  if ( status != 0 )
93    rtems_fatal_error_occurred( 0xABCD0003 );
[063e4950]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
[7a3878b]118#endif
[07a3253d]119}
Note: See TracBrowser for help on using the repository browser.