diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index b77ee4da38..d9f43a61a4 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -1812,7 +1812,11 @@ zfs_ioc_get_fsacl(zfs_cmd_t *zc) static int zfs_ioc_create_minor(zfs_cmd_t *zc) { +#ifdef HAVE_ZVOL return (zvol_create_minor(zc->zc_name, ddi_driver_major(zfs_dip))); +#else + return (ENOTSUP); +#endif /* HAVE_ZVOL */ } /* @@ -1824,7 +1828,11 @@ zfs_ioc_create_minor(zfs_cmd_t *zc) static int zfs_ioc_remove_minor(zfs_cmd_t *zc) { +#ifdef HAVE_ZVOL return (zvol_remove_minor(zc->zc_name)); +#else + return (ENOTSUP); +#endif /* HAVE_ZVOL */ } /* @@ -2037,9 +2045,11 @@ zfs_ioc_create(zfs_cmd_t *zc) cbfunc = zfs_create_cb; break; +#ifdef HAVE_ZVOL case DMU_OST_ZVOL: cbfunc = zvol_create_cb; break; +#endif /* HAVE_ZVOL */ default: cbfunc = NULL; @@ -2090,6 +2100,7 @@ zfs_ioc_create(zfs_cmd_t *zc) return (EINVAL); } +#ifdef HAVE_ZVOL if (type == DMU_OST_ZVOL) { uint64_t volsize, volblocksize; @@ -2119,7 +2130,9 @@ zfs_ioc_create(zfs_cmd_t *zc) nvlist_free(nvprops); return (error); } - } else if (type == DMU_OST_ZFS) { + } else +#endif /* HAVE_ZVOL */ + if (type == DMU_OST_ZFS) { int error; /* @@ -2952,8 +2965,10 @@ zfsdev_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr, int *rvalp) uint_t vec; int error, rc; +#ifdef HAVE_ZVOL if (getminor(dev) != 0) return (zvol_ioctl(dev, cmd, arg, flag, cr, rvalp)); +#endif vec = cmd - ZFS_IOC; ASSERT3U(getmajor(dev), ==, ddi_driver_major(zfs_dip)); @@ -3065,6 +3080,7 @@ zfs_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result) * so most of the standard driver entry points are in zvol.c. */ static struct cb_ops zfs_cb_ops = { +#ifdef HAVE_ZVOL zvol_open, /* open */ zvol_close, /* close */ zvol_strategy, /* strategy */ @@ -3072,6 +3088,15 @@ static struct cb_ops zfs_cb_ops = { zvol_dump, /* dump */ zvol_read, /* read */ zvol_write, /* write */ +#else + nodev, /* open */ + nodev, /* close */ + nodev, /* strategy */ + nodev, /* print */ + nodev, /* dump */ + nodev, /* read */ + nodev, /* write */ +#endif /* HAVE_ZVOL */ zfsdev_ioctl, /* ioctl */ nodev, /* devmap */ nodev, /* mmap */ diff --git a/module/zfs/zvol.c b/module/zfs/zvol.c index e686816af6..462faf689b 100644 --- a/module/zfs/zvol.c +++ b/module/zfs/zvol.c @@ -37,6 +37,8 @@ * run before opening and using a device. */ +#ifdef HAVE_ZVOL + #include #include #include @@ -1737,3 +1739,13 @@ zvol_dump_fini(zvol_state_t *zv) return (0); } + +#else + +int +zvol_busy(void) +{ + return DDI_FAILURE; +} + +#endif /* HAVE_ZVOL */