|
68 | 68 | //! # use std::mem;
|
69 | 69 | //! # use nix::{Errno, libc, Result};
|
70 | 70 | //! # const SPI_IOC_MAGIC: u8 = 'k' as u8;
|
71 |
| -//! pub unsafe fn spi_read_mode(fd: c_int, val: *mut u8) -> Result<c_int> { |
72 |
| -//! let res = libc::ioctl(fd, ior!(SPI_IOC_MAGIC, 1, mem::size_of::<u8>()), val); |
| 71 | +//! pub unsafe fn spi_read_mode(fd: c_int, data: *mut u8) -> Result<c_int> { |
| 72 | +//! let res = libc::ioctl(fd, ior!(SPI_IOC_MAGIC, 1, mem::size_of::<u8>()), data); |
73 | 73 | //! Errno::result(res)
|
74 | 74 | //! }
|
75 | 75 | //! # fn main() {}
|
@@ -187,46 +187,47 @@ macro_rules! ioctl {
|
187 | 187 | );
|
188 | 188 | (read $name:ident with $ioty:expr, $nr:expr; $ty:ty) => (
|
189 | 189 | pub unsafe fn $name(fd: $crate::libc::c_int,
|
190 |
| - val: *mut $ty) |
| 190 | + data: *mut $ty) |
191 | 191 | -> $crate::Result<$crate::libc::c_int> {
|
192 |
| - convert_ioctl_res!($crate::libc::ioctl(fd, ior!($ioty, $nr, ::std::mem::size_of::<$ty>()) as $crate::sys::ioctl::ioctl_num_type, val)) |
| 192 | + convert_ioctl_res!($crate::libc::ioctl(fd, ior!($ioty, $nr, ::std::mem::size_of::<$ty>()) as $crate::sys::ioctl::ioctl_num_type, data)) |
193 | 193 | }
|
194 | 194 | );
|
195 | 195 | (write $name:ident with $ioty:expr, $nr:expr; $ty:ty) => (
|
196 | 196 | pub unsafe fn $name(fd: $crate::libc::c_int,
|
197 |
| - val: $ty) |
| 197 | + data: $ty) |
198 | 198 | -> $crate::Result<$crate::libc::c_int> {
|
199 |
| - convert_ioctl_res!($crate::libc::ioctl(fd, iow!($ioty, $nr, ::std::mem::size_of::<$ty>()) as $crate::sys::ioctl::ioctl_num_type, val)) |
| 199 | + convert_ioctl_res!($crate::libc::ioctl(fd, iow!($ioty, $nr, ::std::mem::size_of::<$ty>()) as $crate::sys::ioctl::ioctl_num_type, data)) |
200 | 200 | }
|
201 | 201 | );
|
202 | 202 | (readwrite $name:ident with $ioty:expr, $nr:expr; $ty:ty) => (
|
203 | 203 | pub unsafe fn $name(fd: $crate::libc::c_int,
|
204 |
| - val: *mut $ty) |
| 204 | + data: *mut $ty) |
205 | 205 | -> $crate::Result<$crate::libc::c_int> {
|
206 |
| - convert_ioctl_res!($crate::libc::ioctl(fd, iorw!($ioty, $nr, ::std::mem::size_of::<$ty>()) as $crate::sys::ioctl::ioctl_num_type, val)) |
| 206 | + convert_ioctl_res!($crate::libc::ioctl(fd, iorw!($ioty, $nr, ::std::mem::size_of::<$ty>()) as $crate::sys::ioctl::ioctl_num_type, data)) |
207 | 207 | }
|
208 | 208 | );
|
209 | 209 | (read buf $name:ident with $ioty:expr, $nr:expr; $ty:ty) => (
|
210 | 210 | pub unsafe fn $name(fd: $crate::libc::c_int,
|
211 |
| - val: *mut $ty, |
| 211 | + data: *mut $ty, |
212 | 212 | len: usize)
|
213 | 213 | -> $crate::Result<$crate::libc::c_int> {
|
214 |
| - convert_ioctl_res!($crate::libc::ioctl(fd, ior!($ioty, $nr, len) as $crate::sys::ioctl::ioctl_num_type, val)) |
| 214 | + convert_ioctl_res!($crate::libc::ioctl(fd, ior!($ioty, $nr, len) as $crate::sys::ioctl::ioctl_num_type, data)) |
215 | 215 | }
|
216 | 216 | );
|
217 | 217 | (write buf $name:ident with $ioty:expr, $nr:expr; $ty:ty) => (
|
218 | 218 | pub unsafe fn $name(fd: $crate::libc::c_int,
|
219 |
| - val: *const $ty, |
220 |
| - len: usize) -> $crate::Result<$crate::libc::c_int> { |
221 |
| - convert_ioctl_res!($crate::libc::ioctl(fd, iow!($ioty, $nr, len) as $crate::sys::ioctl::ioctl_num_type, val)) |
| 219 | + data: *const $ty, |
| 220 | + len: usize) |
| 221 | + -> $crate::Result<$crate::libc::c_int> { |
| 222 | + convert_ioctl_res!($crate::libc::ioctl(fd, iow!($ioty, $nr, len) as $crate::sys::ioctl::ioctl_num_type, data)) |
222 | 223 | }
|
223 | 224 | );
|
224 | 225 | (readwrite buf $name:ident with $ioty:expr, $nr:expr; $ty:ty) => (
|
225 | 226 | pub unsafe fn $name(fd: $crate::libc::c_int,
|
226 |
| - val: *mut $ty, |
| 227 | + data: *mut $ty, |
227 | 228 | len: usize)
|
228 | 229 | -> $crate::Result<$crate::libc::c_int> {
|
229 |
| - convert_ioctl_res!($crate::libc::ioctl(fd, iorw!($ioty, $nr, len) as $crate::sys::ioctl::ioctl_num_type, val)) |
| 230 | + convert_ioctl_res!($crate::libc::ioctl(fd, iorw!($ioty, $nr, len) as $crate::sys::ioctl::ioctl_num_type, data)) |
230 | 231 | }
|
231 | 232 | );
|
232 | 233 | }
|
0 commit comments