source: rtems/cpukit/libfs/src/imfs/imfs_initsupp.c @ 3fb2a8da

4.104.114.84.95
Last change on this file since 3fb2a8da was 3fb2a8da, checked in by Joel Sherrill <joel.sherrill@…>, on 11/02/99 at 16:23:50

Fixed typo where memfile_handlers set twice and directory_handlers
was not set.

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