source: rtems/c/src/lib/libc/imfs_initsupp.c @ 74d5216

4.104.114.84.95
Last change on this file since 74d5216 was 5e0e012c, checked in by Joel Sherrill <joel.sherrill@…>, on 06/26/00 at 14:46:19

Patch from Chris Johns <cjohns@…> and
Jennifer Averett <jennifer.averett@…> to make sure
"/" is created with S_IFDIR set.

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*
2 *  IMFS 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 <sys/types.h>         /* for mkdir */
15#include <fcntl.h>
16#include <unistd.h>
17#include <stdlib.h>
18
19#include <assert.h>
20
21#include "imfs.h"
22#include "libio_.h"
23
24#if defined(IMFS_DEBUG)
25#include <stdio.h>
26#endif
27
28/*
29 *  IMFS_initialize
30 */
31
32int IMFS_initialize_support(
33  rtems_filesystem_mount_table_entry_t *temp_mt_entry,
34   rtems_filesystem_operations_table    *op_table,
35   rtems_filesystem_file_handlers_r     *memfile_handlers,
36   rtems_filesystem_file_handlers_r     *directory_handlers
37)
38{
39  IMFS_fs_info_t                        *fs_info;
40  IMFS_jnode_t                          *jnode;
41
42  /*
43   *  Create the root node
44   */
45
46  temp_mt_entry->mt_fs_root.node_access = IMFS_create_node(
47    NULL,
48    IMFS_DIRECTORY,
49    "",
50    ( S_IFDIR | S_IRWXO | S_IRWXG| S_IRWXU ),
51    NULL
52  );
53
54  temp_mt_entry->mt_fs_root.handlers         = directory_handlers;
55  temp_mt_entry->mt_fs_root.ops              = op_table;
56  temp_mt_entry->pathconf_limits_and_options = IMFS_LIMITS_AND_OPTIONS;
57
58  /*
59   * Create custom file system data.
60   */
61  fs_info = calloc( 1, sizeof( IMFS_fs_info_t ) );
62  if ( !fs_info ){
63    free(temp_mt_entry->mt_fs_root.node_access);
64    return 1;
65  }
66  temp_mt_entry->fs_info = fs_info;
67
68  /*
69   * Set st_ino for the root to 1.
70   */
71
72  fs_info->ino_count          = 1;
73  fs_info->memfile_handlers   = memfile_handlers;
74  fs_info->directory_handlers = directory_handlers;
75
76  jnode = temp_mt_entry->mt_fs_root.node_access;
77  jnode->st_ino = fs_info->ino_count;
78
79  return 0;
80}
Note: See TracBrowser for help on using the repository browser.