source: rtems/cpukit/libmisc/devnull/devnull.c @ 130291f

4.104.114.84.95
Last change on this file since 130291f was d3b8713a, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 13, 2001 at 9:04:49 PM

2001-09-13 Joel Sherrill <joel@…>

  • devnull/devnull.c: Eliminate warning.
  • Property mode set to 100644
File size: 3.5 KB
Line 
1/*  /dev/null
2 *
3 *  Derived from rtems' stub driver.
4 *
5 *  Author: Ralf Corsepius (corsepiu@faw.uni-ulm.de)
6 *
7 *  COPYRIGHT (c) 1989-2000.
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.OARcorp.com/rtems/license.html.
13 *
14 *  $Id$
15 */
16
17#include <rtems.h>
18#include <rtems/devnull.h>
19#include <rtems/libio.h>
20
21/*  null_initialize
22 *
23 *  This routine is the null device driver init routine.
24 *
25 *  Input parameters:
26 *    major - device major number
27 *    minor - device minor number
28 *    pargp - pointer to parameter block
29 *
30 *  Output parameters:
31 *    rval       - NULL_SUCCESSFUL
32 */
33
34rtems_unsigned32 NULL_major;
35static char initialized;
36
37rtems_device_driver null_initialize(
38  rtems_device_major_number major,
39  rtems_device_minor_number minor,
40  void *pargp
41)
42{
43  rtems_device_driver status;
44 
45  if ( !initialized ) {
46    initialized = 1;
47
48    status = rtems_io_register_name(
49      "/dev/null",
50      major,
51      (rtems_device_minor_number) 0
52    );
53
54    if (status != RTEMS_SUCCESSFUL)
55      rtems_fatal_error_occurred(status);
56     
57    NULL_major = major;
58  }
59 
60  return RTEMS_SUCCESSFUL;
61}
62
63/*  null_open
64 *
65 *  This routine is the null device driver open routine.
66 *
67 *  Input parameters:
68 *    major - device major number
69 *    minor - device minor number
70 *    pargb - pointer to open parameter block
71 *
72 *  Output parameters:
73 *    rval       - NULL_SUCCESSFUL
74 */
75
76rtems_device_driver null_open(
77  rtems_device_major_number major,
78  rtems_device_minor_number minor,
79  void *pargp
80)
81{
82  return NULL_SUCCESSFUL;
83}
84
85
86/*  null_close
87 *
88 *  This routine is the null device driver close routine.
89 *
90 *  Input parameters:
91 *    major - device major number
92 *    minor - device minor number
93 *    pargb - pointer to close parameter block
94 *
95 *  Output parameters:
96 *    rval       - NULL_SUCCESSFUL
97 */
98
99rtems_device_driver null_close(
100  rtems_device_major_number major,
101  rtems_device_minor_number minor,
102  void *pargp
103)
104{
105  return NULL_SUCCESSFUL;
106}
107
108
109/*  null_read
110 *
111 *  This routine is the null device driver read routine.
112 *
113 *  Input parameters:
114 *    major - device major number
115 *    minor - device minor number
116 *    pargp - pointer to read parameter block
117 *
118 *  Output parameters:
119 *    rval       - NULL_SUCCESSFUL
120 */
121
122rtems_device_driver null_read(
123  rtems_device_major_number major,
124  rtems_device_minor_number minor,
125  void *pargp
126)
127{
128  return NULL_SUCCESSFUL;
129}
130
131
132/*  null_write
133 *
134 *  This routine is the null device driver write routine.
135 *
136 *  Input parameters:
137 *    major - device major number
138 *    minor - device minor number
139 *    pargp - pointer to write parameter block
140 *
141 *  Output parameters:
142 *    rval       - NULL_SUCCESSFUL
143 */
144
145rtems_device_driver null_write(
146  rtems_device_major_number major,
147  rtems_device_minor_number minor,
148  void *pargp
149)
150{
151  rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *) pargp;
152 
153  if ( rw_args )
154    rw_args->bytes_moved = rw_args->count;
155 
156  return NULL_SUCCESSFUL;
157}
158
159
160/*  null_control
161 *
162 *  This routine is the null device driver control routine.
163 *
164 *  Input parameters:
165 *    major - device major number
166 *    minor - device minor number
167 *    pargp - pointer to cntrl parameter block
168 *
169 *  Output parameters:
170 *    rval       - NULL_SUCCESSFUL
171 */
172
173rtems_device_driver null_control(
174  rtems_device_major_number major,
175  rtems_device_minor_number minor,
176  void *pargp
177)
178{
179  return NULL_SUCCESSFUL;
180}
Note: See TracBrowser for help on using the repository browser.