source: rtems/c/src/libfs/src/imfs/imfs_initsupp.c @ d6b1d73

4.104.114.84.95
Last change on this file since d6b1d73 was d6b1d73, checked in by Joel Sherrill <joel.sherrill@…>, on 01/22/01 at 14:05:14

2001-01-22 Ralf Corsepius <corsepiu@…>

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