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

4.115
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 3.8 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-2008.
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/devfs.h>
22
23/*
24 *  device_open
25 *
26 *  This handler maps an open() operation onto rtems_io_open().
27 */
28
29int device_open(
30  rtems_libio_t *iop,
31  const char    *pathname,
32  int            oflag,
33  mode_t         mode
34)
35{
36  rtems_libio_open_close_args_t  args;
37  rtems_status_code              status;
38  IMFS_jnode_t                  *the_jnode;
39
40  the_jnode  = iop->pathinfo.node_access;
41
42  args.iop   = iop;
43  args.flags = iop->flags;
44  args.mode  = mode;
45
46  status = rtems_io_open(
47    the_jnode->info.device.major,
48    the_jnode->info.device.minor,
49    (void *) &args
50  );
51
52  return rtems_deviceio_errno( status );
53}
54
55/*
56 *  device_close
57 *
58 *  This handler maps a close() operation onto rtems_io_close().
59 */
60
61int device_close(
62  rtems_libio_t *iop
63)
64{
65  rtems_libio_open_close_args_t  args;
66  rtems_status_code              status;
67  IMFS_jnode_t                  *the_jnode;
68
69  the_jnode = iop->pathinfo.node_access;
70
71  args.iop   = iop;
72  args.flags = 0;
73  args.mode  = 0;
74
75  status = rtems_io_close(
76    the_jnode->info.device.major,
77    the_jnode->info.device.minor,
78    (void *) &args
79  );
80
81  return rtems_deviceio_errno( status );
82}
83
84/*
85 *  device_read
86 *
87 *  This handler maps a read() operation onto rtems_io_read().
88 */
89
90ssize_t device_read(
91  rtems_libio_t *iop,
92  void          *buffer,
93  size_t         count
94)
95{
96  rtems_libio_rw_args_t   args;
97  rtems_status_code       status;
98  IMFS_jnode_t           *the_jnode;
99
100  the_jnode = iop->pathinfo.node_access;
101
102  args.iop         = iop;
103  args.offset      = iop->offset;
104  args.buffer      = buffer;
105  args.count       = count;
106  args.flags       = iop->flags;
107  args.bytes_moved = 0;
108
109  status = rtems_io_read(
110    the_jnode->info.device.major,
111    the_jnode->info.device.minor,
112    (void *) &args
113  );
114
115  if ( status )
116    return rtems_deviceio_errno(status);
117
118  return (ssize_t) args.bytes_moved;
119}
120
121/*
122 *  device_write
123 *
124 *  This handler maps a write() operation onto rtems_io_write().
125 */
126
127ssize_t device_write(
128  rtems_libio_t *iop,
129  const void    *buffer,
130  size_t         count
131)
132{
133  rtems_libio_rw_args_t   args;
134  rtems_status_code       status;
135  IMFS_jnode_t           *the_jnode;
136
137  the_jnode = iop->pathinfo.node_access;
138
139  args.iop         = iop;
140  args.offset      = iop->offset;
141  args.buffer      = (void *) buffer;
142  args.count       = count;
143  args.flags       = iop->flags;
144  args.bytes_moved = 0;
145
146  status = rtems_io_write(
147    the_jnode->info.device.major,
148    the_jnode->info.device.minor,
149    (void *) &args
150  );
151
152  if ( status )
153    return rtems_deviceio_errno(status);
154
155  return (ssize_t) args.bytes_moved;
156}
157
158/*
159 *  device_ioctl
160 *
161 *  This handler maps an ioctl() operation onto rtems_io_ioctl().
162 */
163
164int device_ioctl(
165  rtems_libio_t *iop,
166  uint32_t       command,
167  void          *buffer
168)
169{
170  rtems_libio_ioctl_args_t  args;
171  rtems_status_code         status;
172  IMFS_jnode_t             *the_jnode;
173
174  args.iop     = iop;
175  args.command = command;
176  args.buffer  = buffer;
177
178  the_jnode = iop->pathinfo.node_access;
179
180  status = rtems_io_control(
181    the_jnode->info.device.major,
182    the_jnode->info.device.minor,
183    (void *) &args
184  );
185
186  if ( status )
187    return rtems_deviceio_errno(status);
188
189  return args.ioctl_return;
190}
191
192/*
193 *  device_stat
194 *
195 *  The IMFS_stat() is used.
196 */
197
198/*
199 *  device_rmnod
200 *
201 *  The IMFS_rmnod() is used.
202 */
203
204int device_ftruncate(
205  rtems_libio_t *iop,
206  off_t          length
207)
208{
209  return 0;
210}
Note: See TracBrowser for help on using the repository browser.