source: rtems/cpukit/libfs/src/imfs/imfs_init.c @ a9df916

4.115
Last change on this file since a9df916 was a9df916, checked in by Sebastian Huber <sebastian.huber@…>, on 02/08/15 at 18:43:09

IMFS: Add fine grained configuration

Remove miniIMFS. Statically initialize the root IMFS.

Add configuration options to disable individual
features of the root IMFS, e.g.

o CONFIGURE_IMFS_DISABLE_CHOWN,
o CONFIGURE_IMFS_DISABLE_FCHMOD,
o CONFIGURE_IMFS_DISABLE_LINK,
o CONFIGURE_IMFS_DISABLE_MKNOD,
o CONFIGURE_IMFS_DISABLE_MOUNT,
o CONFIGURE_IMFS_DISABLE_READLINK,
o CONFIGURE_IMFS_DISABLE_RENAME,
o CONFIGURE_IMFS_DISABLE_RMNOD,
o CONFIGURE_IMFS_DISABLE_SYMLINK,
o CONFIGURE_IMFS_DISABLE_UNMOUNT, and
o CONFIGURE_IMFS_DISABLE_UTIME.

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup LibFSIMFS
5 *
6 * @brief IMFS initialization.
7 */
8
9/*
10 *  COPYRIGHT (c) 1989-1999.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.org/license/LICENSE.
16 */
17
18#if HAVE_CONFIG_H
19  #include "config.h"
20#endif
21
22#include "imfs.h"
23
24#include <stdlib.h>
25
26#include <rtems/seterr.h>
27
28static const rtems_filesystem_operations_table IMFS_ops = {
29  .lock_h = rtems_filesystem_default_lock,
30  .unlock_h = rtems_filesystem_default_unlock,
31  .eval_path_h = IMFS_eval_path,
32  .link_h = IMFS_link,
33  .are_nodes_equal_h = rtems_filesystem_default_are_nodes_equal,
34  .mknod_h = IMFS_mknod,
35  .rmnod_h = IMFS_rmnod,
36  .fchmod_h = IMFS_fchmod,
37  .chown_h = IMFS_chown,
38  .clonenod_h = IMFS_node_clone,
39  .freenod_h = IMFS_node_free,
40  .mount_h = IMFS_mount,
41  .unmount_h = IMFS_unmount,
42  .fsunmount_me_h = IMFS_fsunmount,
43  .utime_h = IMFS_utime,
44  .symlink_h = IMFS_symlink,
45  .readlink_h = IMFS_readlink,
46  .rename_h = IMFS_rename,
47  .statvfs_h = rtems_filesystem_default_statvfs
48};
49
50static const IMFS_mknod_controls IMFS_default_mknod_controls = {
51  .directory = &IMFS_mknod_control_directory,
52  .device = &IMFS_mknod_control_device,
53  .file = &IMFS_mknod_control_memfile,
54  .fifo = &IMFS_mknod_control_enosys
55};
56
57int IMFS_initialize(
58  rtems_filesystem_mount_table_entry_t *mt_entry,
59  const void                           *data
60)
61{
62  IMFS_fs_info_t *fs_info = calloc( 1, sizeof( *fs_info ) );
63  IMFS_mount_data mount_data = {
64    .fs_info = fs_info,
65    .ops = &IMFS_ops,
66    .mknod_controls = &IMFS_default_mknod_controls
67  };
68
69  if ( fs_info == NULL ) {
70    rtems_set_errno_and_return_minus_one( ENOMEM );
71  }
72
73  return IMFS_initialize_support( mt_entry, &mount_data );
74}
Note: See TracBrowser for help on using the repository browser.