source: rtems/cpukit/libfs/src/imfs/imfs_handlers_device.c @ c6bb1c33

5
Last change on this file since c6bb1c33 was c6bb1c33, checked in by Kevin Kirspel <kevin-kirspel@…>, on 06/29/17 at 14:36:43

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: 1.9 KB
Line 
1/**
2 * @file
3 *
4 * @brief Device Operations Table
5 * @ingroup IMFS
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-1999.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18  #include "config.h"
19#endif
20
21#include "imfs.h"
22
23static int IMFS_stat_device(
24  const rtems_filesystem_location_info_t *loc,
25  struct stat *buf
26)
27{
28  const IMFS_device_t *device = loc->node_access;
29
30  buf->st_rdev = rtems_filesystem_make_dev_t( device->major, device->minor );
31
32  return IMFS_stat( loc, buf );
33}
34
35static const rtems_filesystem_file_handlers_r IMFS_device_handlers = {
36  .open_h = device_open,
37  .close_h = device_close,
38  .read_h = device_read,
39  .write_h = device_write,
40  .ioctl_h = device_ioctl,
41  .lseek_h = rtems_filesystem_default_lseek_file,
42  .fstat_h = IMFS_stat_device,
43  .ftruncate_h = device_ftruncate,
44  .fsync_h = rtems_filesystem_default_fsync_or_fdatasync,
45  .fdatasync_h = rtems_filesystem_default_fsync_or_fdatasync,
46  .fcntl_h = rtems_filesystem_default_fcntl,
47  .kqfilter_h = rtems_filesystem_default_kqfilter,
48  .mmap_h = rtems_filesystem_default_mmap,
49  .poll_h = rtems_filesystem_default_poll,
50  .readv_h = rtems_filesystem_default_readv,
51  .writev_h = rtems_filesystem_default_writev
52};
53
54static IMFS_jnode_t *IMFS_node_initialize_device(
55  IMFS_jnode_t *node,
56  void *arg
57)
58{
59  IMFS_device_t *device = (IMFS_device_t *) node;
60  dev_t *dev = arg;
61
62  rtems_filesystem_split_dev_t( *dev, device->major, device->minor );
63
64  return node;
65}
66
67const IMFS_mknod_control IMFS_mknod_control_device = {
68  {
69    .handlers = &IMFS_device_handlers,
70    .node_initialize = IMFS_node_initialize_device,
71    .node_remove = IMFS_node_remove_default,
72    .node_destroy = IMFS_node_destroy_default
73  },
74  .node_size = sizeof( IMFS_device_t )
75};
Note: See TracBrowser for help on using the repository browser.