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