|
93 | 93 | //! More examples on using `ioctl!` can be found in the [rust-spidev crate](https://github.com/rust-embedded/rust-spidev).
|
94 | 94 | //!
|
95 | 95 | //! ```text
|
96 |
| -//! pub unsafe fn $NAME(fd: c_int, val: *mut u8, len: usize) -> Result<c_int>; |
| 96 | +//! pub unsafe fn $NAME(fd: c_int, data: *mut u8, len: usize) -> Result<c_int>; |
97 | 97 | //! ```
|
98 | 98 | //!
|
99 | 99 | //! As mentioned earlier, there are many old `ioctl`s that do not use the newer method of
|
|
116 | 116 | //! The generated function has the same form as that generated by `read`:
|
117 | 117 | //!
|
118 | 118 | //! ```text
|
119 |
| -//! pub unsafe fn tcgets(fd: c_int, val: *mut u8) -> Result<c_int>; |
| 119 | +//! pub unsafe fn tcgets(fd: c_int, data: *mut u8) -> Result<c_int>; |
120 | 120 | //! ```
|
121 | 121 | //!
|
122 | 122 | //! There is also a `bad none` form for use with hard-coded `ioctl`s that do not transfer data.
|
@@ -190,46 +190,47 @@ macro_rules! ioctl {
|
190 | 190 | );
|
191 | 191 | (read $name:ident with $ioty:expr, $nr:expr; $ty:ty) => (
|
192 | 192 | pub unsafe fn $name(fd: $crate::libc::c_int,
|
193 |
| - val: *mut $ty) |
| 193 | + data: *mut $ty) |
194 | 194 | -> $crate::Result<$crate::libc::c_int> {
|
195 |
| - convert_ioctl_res!($crate::libc::ioctl(fd, ior!($ioty, $nr, ::std::mem::size_of::<$ty>()) as $crate::sys::ioctl::ioctl_num_type, val)) |
| 195 | + convert_ioctl_res!($crate::libc::ioctl(fd, ior!($ioty, $nr, ::std::mem::size_of::<$ty>()) as $crate::sys::ioctl::ioctl_num_type, data)) |
196 | 196 | }
|
197 | 197 | );
|
198 | 198 | (write $name:ident with $ioty:expr, $nr:expr; $ty:ty) => (
|
199 | 199 | pub unsafe fn $name(fd: $crate::libc::c_int,
|
200 |
| - val: *const $ty) |
| 200 | + data: *const $ty) |
201 | 201 | -> $crate::Result<$crate::libc::c_int> {
|
202 |
| - convert_ioctl_res!($crate::libc::ioctl(fd, iow!($ioty, $nr, ::std::mem::size_of::<$ty>()) as $crate::sys::ioctl::ioctl_num_type, val)) |
| 202 | + convert_ioctl_res!($crate::libc::ioctl(fd, iow!($ioty, $nr, ::std::mem::size_of::<$ty>()) as $crate::sys::ioctl::ioctl_num_type, data)) |
203 | 203 | }
|
204 | 204 | );
|
205 | 205 | (readwrite $name:ident with $ioty:expr, $nr:expr; $ty:ty) => (
|
206 | 206 | pub unsafe fn $name(fd: $crate::libc::c_int,
|
207 |
| - val: *mut $ty) |
| 207 | + data: *mut $ty) |
208 | 208 | -> $crate::Result<$crate::libc::c_int> {
|
209 |
| - convert_ioctl_res!($crate::libc::ioctl(fd, iorw!($ioty, $nr, ::std::mem::size_of::<$ty>()) as $crate::sys::ioctl::ioctl_num_type, val)) |
| 209 | + convert_ioctl_res!($crate::libc::ioctl(fd, iorw!($ioty, $nr, ::std::mem::size_of::<$ty>()) as $crate::sys::ioctl::ioctl_num_type, data)) |
210 | 210 | }
|
211 | 211 | );
|
212 | 212 | (read buf $name:ident with $ioty:expr, $nr:expr; $ty:ty) => (
|
213 | 213 | pub unsafe fn $name(fd: $crate::libc::c_int,
|
214 |
| - val: *mut $ty, |
| 214 | + data: *mut $ty, |
215 | 215 | len: usize)
|
216 | 216 | -> $crate::Result<$crate::libc::c_int> {
|
217 |
| - convert_ioctl_res!($crate::libc::ioctl(fd, ior!($ioty, $nr, len) as $crate::sys::ioctl::ioctl_num_type, val)) |
| 217 | + convert_ioctl_res!($crate::libc::ioctl(fd, ior!($ioty, $nr, len) as $crate::sys::ioctl::ioctl_num_type, data)) |
218 | 218 | }
|
219 | 219 | );
|
220 | 220 | (write buf $name:ident with $ioty:expr, $nr:expr; $ty:ty) => (
|
221 | 221 | pub unsafe fn $name(fd: $crate::libc::c_int,
|
222 |
| - val: *const $ty, |
223 |
| - len: usize) -> $crate::Result<$crate::libc::c_int> { |
224 |
| - convert_ioctl_res!($crate::libc::ioctl(fd, iow!($ioty, $nr, len) as $crate::sys::ioctl::ioctl_num_type, val)) |
| 222 | + data: *const $ty, |
| 223 | + len: usize) |
| 224 | + -> $crate::Result<$crate::libc::c_int> { |
| 225 | + convert_ioctl_res!($crate::libc::ioctl(fd, iow!($ioty, $nr, len) as $crate::sys::ioctl::ioctl_num_type, data)) |
225 | 226 | }
|
226 | 227 | );
|
227 | 228 | (readwrite buf $name:ident with $ioty:expr, $nr:expr; $ty:ty) => (
|
228 | 229 | pub unsafe fn $name(fd: $crate::libc::c_int,
|
229 |
| - val: *mut $ty, |
| 230 | + data: *mut $ty, |
230 | 231 | len: usize)
|
231 | 232 | -> $crate::Result<$crate::libc::c_int> {
|
232 |
| - convert_ioctl_res!($crate::libc::ioctl(fd, iorw!($ioty, $nr, len) as $crate::sys::ioctl::ioctl_num_type, val)) |
| 233 | + convert_ioctl_res!($crate::libc::ioctl(fd, iorw!($ioty, $nr, len) as $crate::sys::ioctl::ioctl_num_type, data)) |
233 | 234 | }
|
234 | 235 | );
|
235 | 236 | }
|
0 commit comments