]> granicus.if.org Git - zfs/commitdiff
Don't hard-code number of ioctls for portability
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Sun, 7 Apr 2019 17:18:01 +0000 (02:18 +0900)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Sun, 14 Apr 2019 18:13:34 +0000 (11:13 -0700)
Use (ZFS_IOC_LAST - ZFS_IOC_FIRST) instead of 256.
It seems 256 is just a number large enough to hold ioctls
at the moment.

Using 256 also causes compile-time warning or error
on platfoms whose enum zfs_ioc definition differs.

Reviewed-by: Olaf Faaland <faaland1@llnl.gov>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Closes #8598

tests/zfs-tests/cmd/libzfs_input_check/libzfs_input_check.c

index 8855a5358e3d784f1cdd799d275fd1bdbe3407e3..977b9e2f3ddd0e6901a5c77618caf6fa620271b5 100644 (file)
@@ -37,7 +37,7 @@ const char *active_test;
 /*
  * Tracks which zfs_ioc_t commands were tested
  */
-boolean_t ioc_tested[256];
+boolean_t ioc_tested[ZFS_IOC_LAST - ZFS_IOC_FIRST];
 
 /*
  * Legacy ioctls that are skipped (for now)