source: rtems/cpukit/libfs/src/devfs/devfs_init.c @ 339069fc

5
Last change on this file since 339069fc was 339069fc, checked in by Sebastian Huber <sebastian.huber@…>, on Dec 13, 2017 at 7:02:09 AM

devfs: Include <rtems/devfs.h>

Prepare for header file move to common include directory.

Update #3254.

  • Property mode set to 100644
File size: 2.3 KB
Line 
1/**
2 * @file
3 *
4 * @brief Creates the Main Device Table
5 * @ingroup DevFsDeviceTable Define Device Table Type
6 */
7
8/*
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.rtems.org/license/LICENSE.
12 */
13
14#if HAVE_CONFIG_H
15  #include "config.h"
16#endif
17
18#include <rtems/devfs.h>
19
20const rtems_filesystem_operations_table devFS_ops = {
21  .lock_h = rtems_filesystem_default_lock,
22  .unlock_h = rtems_filesystem_default_unlock,
23  .eval_path_h = devFS_eval_path,
24  .link_h = rtems_filesystem_default_link,
25  .are_nodes_equal_h = rtems_filesystem_default_are_nodes_equal,
26  .mknod_h = devFS_mknod,
27  .rmnod_h = rtems_filesystem_default_rmnod,
28  .fchmod_h = rtems_filesystem_default_fchmod,
29  .chown_h = rtems_filesystem_default_chown,
30  .clonenod_h = rtems_filesystem_default_clonenode,
31  .freenod_h = rtems_filesystem_default_freenode,
32  .mount_h = rtems_filesystem_default_mount,
33  .unmount_h = rtems_filesystem_default_unmount,
34  .fsunmount_me_h = rtems_filesystem_default_fsunmount,
35  .utime_h = rtems_filesystem_default_utime,
36  .symlink_h = rtems_filesystem_default_symlink,
37  .readlink_h = rtems_filesystem_default_readlink,
38  .rename_h = rtems_filesystem_default_rename,
39  .statvfs_h = rtems_filesystem_default_statvfs
40};
41
42const rtems_filesystem_file_handlers_r devFS_file_handlers = {
43  .open_h = devFS_open,
44  .close_h = devFS_close,
45  .read_h = devFS_read,
46  .write_h = devFS_write,
47  .ioctl_h = devFS_ioctl,
48  .lseek_h = rtems_filesystem_default_lseek_file,
49  .fstat_h = devFS_stat,
50  .ftruncate_h = rtems_filesystem_default_ftruncate,
51  .fsync_h = rtems_filesystem_default_fsync_or_fdatasync,
52  .fdatasync_h = rtems_filesystem_default_fsync_or_fdatasync,
53  .fcntl_h = rtems_filesystem_default_fcntl,
54  .kqfilter_h = rtems_filesystem_default_kqfilter,
55  .mmap_h = rtems_filesystem_default_mmap,
56  .poll_h = rtems_filesystem_default_poll,
57  .readv_h = rtems_filesystem_default_readv,
58  .writev_h = rtems_filesystem_default_writev
59};
60
61int devFS_initialize(
62  rtems_filesystem_mount_table_entry_t *mt_entry,
63  const void *data
64)
65{
66  int rv = 0;
67
68  if (data != NULL) {
69    mt_entry->ops = &devFS_ops;
70    mt_entry->immutable_fs_info = data;
71    mt_entry->mt_fs_root->location.handlers = &devFS_file_handlers;
72  } else {
73    errno = EINVAL;
74    rv = -1;
75  }
76
77  return rv;
78}
79
Note: See TracBrowser for help on using the repository browser.