aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/zinject/zinject.c
diff options
context:
space:
mode:
authorMatthew Macy <[email protected]>2019-10-25 13:50:34 -0700
committerBrian Behlendorf <[email protected]>2019-10-25 13:50:34 -0700
commit24cf9f4eb2bbfad49dc70a1540ff096191d7c39f (patch)
tree8b579f67612e10c86b30c32424cbe584b80be3d2 /cmd/zinject/zinject.c
parent0ee89a1252f23fa2f1086670e47091400b1f857a (diff)
Use zfs_ioctl() in zinject.c
Consistently use the `zfs_ioctl()` wrapper since `ioctl()` cannot be called directly due to differing semantics between platforms. Follow up PR to #9492. Reviewed-by: Igor Kozhukhov <[email protected]> Reviewed-by: Jorgen Lundman <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Matt Macy <[email protected]> Closes #9507
Diffstat (limited to 'cmd/zinject/zinject.c')
-rw-r--r--cmd/zinject/zinject.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/cmd/zinject/zinject.c b/cmd/zinject/zinject.c
index 1795bfd45..8a8762899 100644
--- a/cmd/zinject/zinject.c
+++ b/cmd/zinject/zinject.c
@@ -340,7 +340,7 @@ iter_handlers(int (*func)(int, const char *, zinject_record_t *, void *),
zfs_cmd_t zc = {"\0"};
int ret;
- while (ioctl(zfs_fd, ZFS_IOC_INJECT_LIST_NEXT, &zc) == 0)
+ while (zfs_ioctl(g_zfs, ZFS_IOC_INJECT_LIST_NEXT, &zc) == 0)
if ((ret = func((int)zc.zc_guid, zc.zc_name,
&zc.zc_inject_record, data)) != 0)
return (ret);
@@ -508,7 +508,7 @@ cancel_one_handler(int id, const char *pool, zinject_record_t *record,
zc.zc_guid = (uint64_t)id;
- if (ioctl(zfs_fd, ZFS_IOC_CLEAR_FAULT, &zc) != 0) {
+ if (zfs_ioctl(g_zfs, ZFS_IOC_CLEAR_FAULT, &zc) != 0) {
(void) fprintf(stderr, "failed to remove handler %d: %s\n",
id, strerror(errno));
return (1);
@@ -541,7 +541,7 @@ cancel_handler(int id)
zc.zc_guid = (uint64_t)id;
- if (ioctl(zfs_fd, ZFS_IOC_CLEAR_FAULT, &zc) != 0) {
+ if (zfs_ioctl(g_zfs, ZFS_IOC_CLEAR_FAULT, &zc) != 0) {
(void) fprintf(stderr, "failed to remove handler %d: %s\n",
id, strerror(errno));
return (1);
@@ -565,7 +565,7 @@ register_handler(const char *pool, int flags, zinject_record_t *record,
zc.zc_inject_record = *record;
zc.zc_guid = flags;
- if (ioctl(zfs_fd, ZFS_IOC_INJECT_FAULT, &zc) != 0) {
+ if (zfs_ioctl(g_zfs, ZFS_IOC_INJECT_FAULT, &zc) != 0) {
(void) fprintf(stderr, "failed to add handler: %s\n",
errno == EDOM ? "block level exceeds max level of object" :
strerror(errno));
@@ -625,7 +625,7 @@ perform_action(const char *pool, zinject_record_t *record, int cmd)
zc.zc_guid = record->zi_guid;
zc.zc_cookie = cmd;
- if (ioctl(zfs_fd, ZFS_IOC_VDEV_SET_STATE, &zc) == 0)
+ if (zfs_ioctl(g_zfs, ZFS_IOC_VDEV_SET_STATE, &zc) == 0)
return (0);
return (1);