OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [libcsupport/] [src/] [base_fs.c] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*
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
 *  base_fs.c,v 1.12 2001/05/25 13:46:02 joel Exp
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
 
26
rtems_user_env_t   rtems_global_user_env;
27
rtems_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
 
43
void 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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.