source: rtems/c/src/lib/libc/base_fs.c @ c0438add

4.104.114.84.95
Last change on this file since c0438add was 7a3878b, checked in by Jennifer Averett <Jennifer.Averett@…>, on 12/03/98 at 22:17:13

Modifications for RTEMS_UNIX.

  • Property mode set to 100644
File size: 1.8 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  status = mount(
56     &first_entry,
57     &IMFS_ops,
58     "RW",
59     NULL,
60     NULL );
61  if( status == -1 ){
62    rtems_fatal_error_occurred( 0xABCD0002 );
63  }
64
65  rtems_filesystem_link_counts = 0;
66
67  rtems_filesystem_root    = first_entry->mt_fs_root;
68
69  rtems_filesystem_current = rtems_filesystem_root;
70
71  /*
72   *  Traditionally RTEMS devices are under "/dev" so install this directory.
73   *
74   *  If the mkdir() fails, we can't print anything so just fatal error.
75   *
76   *  NOTE: UNIX root is 755 and owned by root/root (0/0).
77   */
78
79  status = mkdir( "/dev", S_IRWXU | S_IRWXG | S_IRWXO );
80  if ( status != 0 )
81    rtems_fatal_error_occurred( 0xABCD0003 );
82#endif
83}
Note: See TracBrowser for help on using the repository browser.