diff options
author | Bryant Mairs <bryant@mai.rs> | 2017-07-18 09:36:49 -0700 |
---|---|---|
committer | Bryant Mairs <bryant@mai.rs> | 2017-07-19 07:19:26 -0700 |
commit | 85bb9d8101b3c59b4df2c08a07026782bcf710b2 (patch) | |
tree | 0c27321382d238b3497ea56ee0716bbcd58cc848 /test/sys | |
parent | b1c9e9d46fe0c6304374f533fa611a9741be3941 (diff) | |
download | nix-85bb9d8101b3c59b4df2c08a07026782bcf710b2.zip |
Split ioctl!(write ...) into write_ptr and write_int
There two different write semantics used with ioctls: one involves
passing a pointer the other involves passing an int. Previously the
ioctl! macro did not distinguish between these cases and left it up
to the user to set the proper datatype. This previous version was
not type safe and prone to errors. The solution here is to split the
"write" variant into a "write_ptr" and "write_int" variant that makes
the semantics more explicit and improves type safety by specifying
arguments better.
Diffstat (limited to 'test/sys')
-rw-r--r-- | test/sys/test_ioctl.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/test/sys/test_ioctl.rs b/test/sys/test_ioctl.rs index c0ae078a..7f0018d3 100644 --- a/test/sys/test_ioctl.rs +++ b/test/sys/test_ioctl.rs @@ -5,10 +5,15 @@ ioctl!(bad do_bad with 0x1234); ioctl!(bad none do_bad_none with 0x1234); ioctl!(none do_none with 0, 0); ioctl!(read read_test with 0, 0; u32); -ioctl!(write write_test with 0, 0; u64); +ioctl!(write_int write_ptr_int with 0, 0); +ioctl!(write_ptr write_ptr_u8 with 0, 0; u8); +ioctl!(write_ptr write_ptr_u32 with 0, 0; u32); +ioctl!(write_ptr write_ptr_u64 with 0, 0; u64); ioctl!(readwrite readwrite_test with 0, 0; u64); ioctl!(read buf readbuf_test with 0, 0; u32); -ioctl!(write buf writebuf_test with 0, 0; u32); +ioctl!(write buf writebuf_test_u8 with 0, 0; u8); +ioctl!(write buf writebuf_test_u32 with 0, 0; u32); +ioctl!(write buf writebuf_test_u64 with 0, 0; u64); ioctl!(readwrite buf readwritebuf_test with 0, 0; u32); // See C code for source of values for op calculations (does NOT work for mips/powerpc): |