Add HAVE_ZVOL changes

This commit is contained in:
Brian Behlendorf 2008-12-22 12:37:43 -08:00
parent 6d13a998fb
commit 2f4b12b228
2 changed files with 38 additions and 1 deletions

View File

@ -1812,7 +1812,11 @@ zfs_ioc_get_fsacl(zfs_cmd_t *zc)
static int static int
zfs_ioc_create_minor(zfs_cmd_t *zc) zfs_ioc_create_minor(zfs_cmd_t *zc)
{ {
#ifdef HAVE_ZVOL
return (zvol_create_minor(zc->zc_name, ddi_driver_major(zfs_dip))); 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 static int
zfs_ioc_remove_minor(zfs_cmd_t *zc) zfs_ioc_remove_minor(zfs_cmd_t *zc)
{ {
#ifdef HAVE_ZVOL
return (zvol_remove_minor(zc->zc_name)); 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; cbfunc = zfs_create_cb;
break; break;
#ifdef HAVE_ZVOL
case DMU_OST_ZVOL: case DMU_OST_ZVOL:
cbfunc = zvol_create_cb; cbfunc = zvol_create_cb;
break; break;
#endif /* HAVE_ZVOL */
default: default:
cbfunc = NULL; cbfunc = NULL;
@ -2090,6 +2100,7 @@ zfs_ioc_create(zfs_cmd_t *zc)
return (EINVAL); return (EINVAL);
} }
#ifdef HAVE_ZVOL
if (type == DMU_OST_ZVOL) { if (type == DMU_OST_ZVOL) {
uint64_t volsize, volblocksize; uint64_t volsize, volblocksize;
@ -2119,7 +2130,9 @@ zfs_ioc_create(zfs_cmd_t *zc)
nvlist_free(nvprops); nvlist_free(nvprops);
return (error); return (error);
} }
} else if (type == DMU_OST_ZFS) { } else
#endif /* HAVE_ZVOL */
if (type == DMU_OST_ZFS) {
int error; 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; uint_t vec;
int error, rc; int error, rc;
#ifdef HAVE_ZVOL
if (getminor(dev) != 0) if (getminor(dev) != 0)
return (zvol_ioctl(dev, cmd, arg, flag, cr, rvalp)); return (zvol_ioctl(dev, cmd, arg, flag, cr, rvalp));
#endif
vec = cmd - ZFS_IOC; vec = cmd - ZFS_IOC;
ASSERT3U(getmajor(dev), ==, ddi_driver_major(zfs_dip)); 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. * so most of the standard driver entry points are in zvol.c.
*/ */
static struct cb_ops zfs_cb_ops = { static struct cb_ops zfs_cb_ops = {
#ifdef HAVE_ZVOL
zvol_open, /* open */ zvol_open, /* open */
zvol_close, /* close */ zvol_close, /* close */
zvol_strategy, /* strategy */ zvol_strategy, /* strategy */
@ -3072,6 +3088,15 @@ static struct cb_ops zfs_cb_ops = {
zvol_dump, /* dump */ zvol_dump, /* dump */
zvol_read, /* read */ zvol_read, /* read */
zvol_write, /* write */ zvol_write, /* write */
#else
nodev, /* open */
nodev, /* close */
nodev, /* strategy */
nodev, /* print */
nodev, /* dump */
nodev, /* read */
nodev, /* write */
#endif /* HAVE_ZVOL */
zfsdev_ioctl, /* ioctl */ zfsdev_ioctl, /* ioctl */
nodev, /* devmap */ nodev, /* devmap */
nodev, /* mmap */ nodev, /* mmap */

View File

@ -37,6 +37,8 @@
* run before opening and using a device. * run before opening and using a device.
*/ */
#ifdef HAVE_ZVOL
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h>
#include <sys/errno.h> #include <sys/errno.h>
@ -1737,3 +1739,13 @@ zvol_dump_fini(zvol_state_t *zv)
return (0); return (0);
} }
#else
int
zvol_busy(void)
{
return DDI_FAILURE;
}
#endif /* HAVE_ZVOL */