source: rtems/cpukit/libfs/src/imfs/deviceio.c @ fed66f99

4.11
Last change on this file since fed66f99 was fed66f99, checked in by Sebastian Huber <sebastian.huber@…>, on May 14, 2012 at 1:19:20 PM

Filesystem: Add shared device IO support

The device IO file system support in IMFS, devFS, and RFS uses now a
shared implementation.

  • Property mode set to 100644
File size: 2.1 KB
Line 
1/*
2 *  IMFS Device Node Handlers
3 *
4 *  This file contains the set of handlers used to map operations on
5 *  IMFS device nodes onto calls to the RTEMS Classic API IO Manager.
6 *
7 *  COPYRIGHT (c) 1989-2012.
8 *  On-Line Applications Research Corporation (OAR).
9 *
10 *  The license and distribution terms for this file may be
11 *  found in the file LICENSE in this distribution or at
12 *  http://www.rtems.com/license/LICENSE.
13 */
14
15#if HAVE_CONFIG_H
16  #include "config.h"
17#endif
18
19#include "imfs.h"
20
21#include <rtems/deviceio.h>
22
23int device_open(
24  rtems_libio_t *iop,
25  const char    *pathname,
26  int            oflag,
27  mode_t         mode
28)
29{
30  IMFS_jnode_t                  *the_jnode;
31
32  the_jnode  = iop->pathinfo.node_access;
33
34  return rtems_deviceio_open(
35    iop,
36    pathname,
37    oflag,
38    mode,
39    the_jnode->info.device.major,
40    the_jnode->info.device.minor
41  );
42}
43
44int device_close(
45  rtems_libio_t *iop
46)
47{
48  IMFS_jnode_t                  *the_jnode;
49
50  the_jnode = iop->pathinfo.node_access;
51
52  return rtems_deviceio_close(
53    iop,
54    the_jnode->info.device.major,
55    the_jnode->info.device.minor
56  );
57}
58
59ssize_t device_read(
60  rtems_libio_t *iop,
61  void          *buffer,
62  size_t         count
63)
64{
65  IMFS_jnode_t           *the_jnode;
66
67  the_jnode = iop->pathinfo.node_access;
68
69  return rtems_deviceio_read(
70    iop,
71    buffer,
72    count,
73    the_jnode->info.device.major,
74    the_jnode->info.device.minor
75  );
76}
77
78ssize_t device_write(
79  rtems_libio_t *iop,
80  const void    *buffer,
81  size_t         count
82)
83{
84  IMFS_jnode_t           *the_jnode;
85
86  the_jnode = iop->pathinfo.node_access;
87
88  return rtems_deviceio_write(
89    iop,
90    buffer,
91    count,
92    the_jnode->info.device.major,
93    the_jnode->info.device.minor
94  );
95}
96
97int device_ioctl(
98  rtems_libio_t   *iop,
99  ioctl_command_t  command,
100  void            *buffer
101)
102{
103  IMFS_jnode_t             *the_jnode;
104
105  the_jnode = iop->pathinfo.node_access;
106
107  return rtems_deviceio_control(
108    iop,
109    command,
110    buffer,
111    the_jnode->info.device.major,
112    the_jnode->info.device.minor
113  );
114}
115
116int device_ftruncate(
117  rtems_libio_t *iop,
118  off_t          length
119)
120{
121  return 0;
122}
Note: See TracBrowser for help on using the repository browser.