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

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 1.8 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_jnode_t *node = loc->node_access;
29  const IMFS_device_t *io = &node->info.device;
30
31  buf->st_rdev = rtems_filesystem_make_dev_t( io->major, io->minor );
32
33  return IMFS_stat( loc, buf );
34}
35
36static const rtems_filesystem_file_handlers_r IMFS_device_handlers = {
37  .open_h = device_open,
38  .close_h = device_close,
39  .read_h = device_read,
40  .write_h = device_write,
41  .ioctl_h = device_ioctl,
42  .lseek_h = rtems_filesystem_default_lseek_file,
43  .fstat_h = IMFS_stat_device,
44  .ftruncate_h = device_ftruncate,
45  .fsync_h = rtems_filesystem_default_fsync_or_fdatasync,
46  .fdatasync_h = rtems_filesystem_default_fsync_or_fdatasync,
47  .fcntl_h = rtems_filesystem_default_fcntl,
48  .kqfilter_h = rtems_filesystem_default_kqfilter,
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  const IMFS_types_union *info
57)
58{
59  node->info.device.major = info->device.major;
60  node->info.device.minor = info->device.minor;
61
62  return node;
63}
64
65const IMFS_node_control IMFS_node_control_device = {
66  .imfs_type = IMFS_DEVICE,
67  .handlers = &IMFS_device_handlers,
68  .node_initialize = IMFS_node_initialize_device,
69  .node_remove = IMFS_node_remove_default,
70  .node_destroy = IMFS_node_destroy_default
71};
Note: See TracBrowser for help on using the repository browser.