1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief IMFS Device Node Handlers |
---|
5 | * @ingroup IMFS |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-2012. |
---|
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.com/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include "imfs.h" |
---|
22 | |
---|
23 | #include <rtems/deviceio.h> |
---|
24 | |
---|
25 | int device_open( |
---|
26 | rtems_libio_t *iop, |
---|
27 | const char *pathname, |
---|
28 | int oflag, |
---|
29 | mode_t mode |
---|
30 | ) |
---|
31 | { |
---|
32 | IMFS_jnode_t *the_jnode; |
---|
33 | |
---|
34 | the_jnode = iop->pathinfo.node_access; |
---|
35 | |
---|
36 | return rtems_deviceio_open( |
---|
37 | iop, |
---|
38 | pathname, |
---|
39 | oflag, |
---|
40 | mode, |
---|
41 | the_jnode->info.device.major, |
---|
42 | the_jnode->info.device.minor |
---|
43 | ); |
---|
44 | } |
---|
45 | |
---|
46 | int device_close( |
---|
47 | rtems_libio_t *iop |
---|
48 | ) |
---|
49 | { |
---|
50 | IMFS_jnode_t *the_jnode; |
---|
51 | |
---|
52 | the_jnode = iop->pathinfo.node_access; |
---|
53 | |
---|
54 | return rtems_deviceio_close( |
---|
55 | iop, |
---|
56 | the_jnode->info.device.major, |
---|
57 | the_jnode->info.device.minor |
---|
58 | ); |
---|
59 | } |
---|
60 | |
---|
61 | ssize_t device_read( |
---|
62 | rtems_libio_t *iop, |
---|
63 | void *buffer, |
---|
64 | size_t count |
---|
65 | ) |
---|
66 | { |
---|
67 | IMFS_jnode_t *the_jnode; |
---|
68 | |
---|
69 | the_jnode = iop->pathinfo.node_access; |
---|
70 | |
---|
71 | return rtems_deviceio_read( |
---|
72 | iop, |
---|
73 | buffer, |
---|
74 | count, |
---|
75 | the_jnode->info.device.major, |
---|
76 | the_jnode->info.device.minor |
---|
77 | ); |
---|
78 | } |
---|
79 | |
---|
80 | ssize_t device_write( |
---|
81 | rtems_libio_t *iop, |
---|
82 | const void *buffer, |
---|
83 | size_t count |
---|
84 | ) |
---|
85 | { |
---|
86 | IMFS_jnode_t *the_jnode; |
---|
87 | |
---|
88 | the_jnode = iop->pathinfo.node_access; |
---|
89 | |
---|
90 | return rtems_deviceio_write( |
---|
91 | iop, |
---|
92 | buffer, |
---|
93 | count, |
---|
94 | the_jnode->info.device.major, |
---|
95 | the_jnode->info.device.minor |
---|
96 | ); |
---|
97 | } |
---|
98 | |
---|
99 | int device_ioctl( |
---|
100 | rtems_libio_t *iop, |
---|
101 | ioctl_command_t command, |
---|
102 | void *buffer |
---|
103 | ) |
---|
104 | { |
---|
105 | IMFS_jnode_t *the_jnode; |
---|
106 | |
---|
107 | the_jnode = iop->pathinfo.node_access; |
---|
108 | |
---|
109 | return rtems_deviceio_control( |
---|
110 | iop, |
---|
111 | command, |
---|
112 | buffer, |
---|
113 | the_jnode->info.device.major, |
---|
114 | the_jnode->info.device.minor |
---|
115 | ); |
---|
116 | } |
---|
117 | |
---|
118 | int device_ftruncate( |
---|
119 | rtems_libio_t *iop, |
---|
120 | off_t length |
---|
121 | ) |
---|
122 | { |
---|
123 | return 0; |
---|
124 | } |
---|