OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [libfs/] [src/] [imfs/] [imfs_initsupp.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*
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
 *  imfs_initsupp.c,v 1.12 2001/05/25 13:47:47 joel Exp
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
 
36
int 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
   *  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
    return 1;
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->linearfile_handlers   = linearfile_handlers;
81
  fs_info->memfile_handlers      = memfile_handlers;
82
  fs_info->directory_handlers    = directory_handlers;
83
 
84
  jnode = temp_mt_entry->mt_fs_root.node_access;
85
  jnode->st_ino = fs_info->ino_count;
86
 
87
  return 0;
88
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.