source: rtems/c/src/lib/libc/base_fs.c @ 2e0fd427

4.104.114.84.95
Last change on this file since 2e0fd427 was 3ba74c73, checked in by Joel Sherrill <joel.sherrill@…>, on 11/01/00 at 21:08:14

2000-11-01 Joel Sherrill <joel@…>

  • include/Makefile.am, include/rtems/libio_.h, libc/Makefile.am, libc/assoc.c, libc/assocnamebad.c, libc/base_fs.c, libc/cfsetispeed.c, libc/cfsetospeed.c, libc/chdir.c, libc/chmod.c, libc/chown.c, libc/close.c, libc/closedir.c, libc/dup2.c, libc/error.c, libc/eval.c, libc/fchdir.c, libc/fchmod.c, libc/fcntl.c, libc/fdatasync.c, libc/fpathconf.c, libc/fstat.c, libc/fsync.c, libc/ftruncate.c, libc/getdents.c, libc/ioctl.c, libc/libio.c, libc/libio_sockets.c, libc/link.c, libc/lseek.c, libc/malloc.c, libc/mallocfreespace.c, libc/mknod.c, libc/mount.c, libc/newlibc.c, libc/no_libc.c, libc/open.c, libc/read.c, libc/readlink.c, libc/rmdir.c, libc/stat.c, libc/symlink.c, libc/tcsetattr.c, libc/telldir.c, libc/ttyname.c, libc/ttyname_r.c, libc/umask.c, libc/unlink.c, libc/unmount.c, libc/utime.c, libc/write.c: assoc.h, error.h, libio_.h, libio.h, and libcsupport.h moved from libc to lib/include/rtems and now must be referenced as <rtems/XXX.h>.
  • include/rtems/Makefile.am, include/rtems/.cvsignore: New file.
  • include/rtems/assoc.h, include/rtems/error.h, include/rtems/libcsupport.h, include/rtems/libio.h, include/rtems/libio_.h: New/moved files.
  • 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 <rtems/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.