source: rtems/c/src/exec/libcsupport/src/base_fs.c @ 657e1bf6

4.104.114.84.95
Last change on this file since 657e1bf6 was 657e1bf6, checked in by Joel Sherrill <joel.sherrill@…>, on 10/26/99 at 20:17:13

Added initial cut at miniIMFS which leaves out memfile and directory
readdir support. The next step is to add a mount table and configure
either the miniIMFS or the full IMFS at the application level.

  • Property mode set to 100644
File size: 2.1 KB
Line 
1/*
2 *  Base file system initialization
3 *
4 *  COPYRIGHT (c) 1989-1998.
5 *  On-Line Applications Research Corporation (OAR).
6 *  Copyright assigned to U.S. Government, 1994.
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.OARcorp.com/rtems/license.html.
11 *
12 *  $Id$
13 */
14
15#include <rtems.h>
16#include <rtems/libio.h>
17#include "imfs.h"
18#include "libio_.h"
19
20/*
21 *  Global information for the base file system.
22 */
23
24rtems_filesystem_location_info_t rtems_filesystem_current;
25rtems_filesystem_location_info_t rtems_filesystem_root;
26nlink_t                          rtems_filesystem_link_counts;
27
28/*
29 *  Default mode for created files.
30 */
31
32mode_t rtems_filesystem_umask;
33
34/*
35 *  rtems_filesystem_initialize
36 *
37 *  Initialize the foundation of the file system with one instantiation
38 *  of the IMFS with a single "/dev" directory in it.
39 */
40
41void rtems_filesystem_initialize( void )
42{
43#if !defined(RTEMS_UNIX)
44  int                                   status;
45  rtems_filesystem_mount_table_entry_t *first_entry;
46
47  /*
48   *  Set the default umask to "022".
49   */
50
51  rtems_filesystem_umask = S_IWOTH | S_IROTH;
52
53  init_fs_mount_table();
54
55  /*
56   *  mount the first filesystem.
57   *
58   *  NOTE: XXX This really needs to be read from a table of filesystems
59   *        to mount initially and the miniIMFS needs to be shaken out.
60   */
61
62  status = mount(
63     &first_entry,
64     &IMFS_ops,
65     RTEMS_FILESYSTEM_READ_WRITE,
66     NULL,
67     NULL );
68  if( status == -1 ){
69    rtems_fatal_error_occurred( 0xABCD0002 );
70  }
71
72  rtems_filesystem_link_counts = 0;
73
74  rtems_filesystem_root    = first_entry->mt_fs_root;
75
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#endif
90}
Note: See TracBrowser for help on using the repository browser.