source: rtems/cpukit/libfs/src/imfs/imfs_initsupp.c @ 624867b

4.104.114.84.95
Last change on this file since 624867b was 624867b, checked in by Eric Norum <WENorum@…>, on Feb 8, 2005 at 5:12:54 PM

Add copy-on-write semantics to rtems_tarfs_load().

  • 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.rtems.com/license/LICENSE.
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#include <rtems/seterr.h>
28
29#if defined(IMFS_DEBUG)
30#include <stdio.h>
31#endif
32
33/*
34 *  IMFS_initialize
35 */
36
37int IMFS_initialize_support(
38  rtems_filesystem_mount_table_entry_t *temp_mt_entry,
39   rtems_filesystem_operations_table    *op_table,
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   *  NOTE: UNIX root is 755 and owned by root/root (0/0).
51   */
52
53  temp_mt_entry->mt_fs_root.node_access = IMFS_create_node(
54    NULL,
55    IMFS_DIRECTORY,
56    "",
57    ( S_IFDIR | 0755 ),
58    NULL
59  );
60
61  temp_mt_entry->mt_fs_root.handlers         = directory_handlers;
62  temp_mt_entry->mt_fs_root.ops              = op_table;
63  temp_mt_entry->pathconf_limits_and_options = IMFS_LIMITS_AND_OPTIONS;
64
65  /*
66   * Create custom file system data.
67   */
68  fs_info = calloc( 1, sizeof( IMFS_fs_info_t ) );
69  if ( !fs_info ){
70    free(temp_mt_entry->mt_fs_root.node_access);
71    rtems_set_errno_and_return_minus_one(ENOMEM);
72  }
73  temp_mt_entry->fs_info = fs_info;
74
75  /*
76   * Set st_ino for the root to 1.
77   */
78
79  fs_info->ino_count             = 1;
80  fs_info->memfile_handlers      = memfile_handlers;
81  fs_info->directory_handlers    = directory_handlers;
82
83  jnode = temp_mt_entry->mt_fs_root.node_access;
84  jnode->st_ino = fs_info->ino_count;
85
86  return 0;
87}
Note: See TracBrowser for help on using the repository browser.