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

5
Last change on this file since c6bb1c33 was c6bb1c33, checked in by Kevin Kirspel <kevin-kirspel@…>, on Jun 29, 2017 at 2:36:43 PM

posix/mmap: Add support for file handler and MAP_ANON

Added a mmap file handler to struct _rtems_filesystem_file_handlers_r.
Updated each file handler object to support the default mmap handler.
Updated mmap() to call the mmap handler for MAP_SHARED.
Added a mmap file handler for shm

Added support for MAP_ANON in mmap().

Updates #2859

  • 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 "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.