source: rtems/cpukit/libfs/src/imfs/fifoimfs_init.c @ a2f5c7e1

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

IMFS: Allow static initialization of FS info

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