diff --git a/module/zcommon/include/sys/fs/zfs.h b/module/zcommon/include/sys/fs/zfs.h index 95f04d842e..c518382871 100644 --- a/module/zcommon/include/sys/fs/zfs.h +++ b/module/zcommon/include/sys/fs/zfs.h @@ -491,6 +491,8 @@ typedef struct vdev_stat { #define ZVOL_DRIVER "zvol" #define ZFS_DRIVER "zfs" #define ZFS_DEV "/dev/zfs" +#define ZFS_MAJOR 230 /* XXX: Arbitrary */ +#define ZFS_MINORS 16 /* XXX: Arbitrary */ /* * zvol paths. Irritatingly, the devfsadm interfaces want all these diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index b77ee4da38..477100b02e 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -394,6 +394,7 @@ zfs_secpolicy_send(zfs_cmd_t *zc, cred_t *cr) int zfs_secpolicy_share(zfs_cmd_t *zc, cred_t *cr) { +#ifdef HAVE_ZPL if (!INGLOBALZONE(curproc)) return (EPERM); @@ -420,6 +421,9 @@ zfs_secpolicy_share(zfs_cmd_t *zc, cred_t *cr) return (dsl_deleg_access(zc->zc_name, ZFS_DELEG_PERM_SHARE, cr)); } +#else + return (ENOTSUP); +#endif /* HAVE_ZPL */ } static int @@ -1688,6 +1692,7 @@ zfs_ioc_pool_get_props(zfs_cmd_t *zc) static int zfs_ioc_iscsi_perm_check(zfs_cmd_t *zc) { +#ifdef HAVE_ZPL nvlist_t *nvp; int error; uint32_t uid; @@ -1730,6 +1735,9 @@ zfs_ioc_iscsi_perm_check(zfs_cmd_t *zc) zfs_prop_to_name(ZFS_PROP_SHAREISCSI), usercred); crfree(usercred); return (error); +#else + return (ENOTSUP); +#endif /* HAVE_ZPL */ } /* @@ -1835,6 +1843,7 @@ zfs_ioc_remove_minor(zfs_cmd_t *zc) static vfs_t * zfs_get_vfs(const char *resource) { +#ifdef HAVE_ZPL struct vfs *vfsp; struct vfs *vfs_found = NULL; @@ -1850,6 +1859,9 @@ zfs_get_vfs(const char *resource) } while (vfsp != rootvfs); vfs_list_unlock(); return (vfs_found); +#else + return NULL; +#endif /* HAVE_ZPL */ } /* ARGSUSED */ @@ -2225,6 +2237,7 @@ zfs_ioc_snapshot(zfs_cmd_t *zc) int zfs_unmount_snap(char *name, void *arg) { +#ifdef HAVE_ZPL vfs_t *vfsp = NULL; if (arg) { @@ -2256,6 +2269,7 @@ zfs_unmount_snap(char *name, void *arg) if ((err = dounmount(vfsp, flag, kcred)) != 0) return (err); } +#endif /* HAVE_ZPL */ return (0); } @@ -2308,6 +2322,7 @@ zfs_ioc_destroy(zfs_cmd_t *zc) static int zfs_ioc_rollback(zfs_cmd_t *zc) { +#ifdef HAVE_ZPL objset_t *os; int error; zfsvfs_t *zfsvfs = NULL; @@ -2353,6 +2368,9 @@ zfs_ioc_rollback(zfs_cmd_t *zc) /* Note, the dmu_objset_rollback() releases the objset for us. */ return (error); +#else + return (ENOTSUP); +#endif /* HAVE_ZPL */ } /* @@ -2423,7 +2441,9 @@ static int zfs_ioc_recv(zfs_cmd_t *zc) { file_t *fp; +#ifdef HAVE_ZPL objset_t *os; +#endif /* HAVE_ZPL */ dmu_recv_cookie_t drc; zfsvfs_t *zfsvfs = NULL; boolean_t force = (boolean_t)zc->zc_guid; @@ -2457,6 +2477,7 @@ zfs_ioc_recv(zfs_cmd_t *zc) return (EBADF); } +#ifdef HAVE_ZPL if (dmu_objset_open(tofs, DMU_OST_ANY, DS_MODE_USER | DS_MODE_READONLY, &os) == 0) { /* @@ -2486,6 +2507,7 @@ zfs_ioc_recv(zfs_cmd_t *zc) dmu_objset_close(os); } +#endif /* HAVE_ZPL */ if (zc->zc_string[0]) { error = dmu_objset_open(zc->zc_string, DMU_OST_ANY, @@ -2551,7 +2573,9 @@ zfs_ioc_recv(zfs_cmd_t *zc) out: if (zfsvfs) { mutex_exit(&zfsvfs->z_online_recv_lock); +#ifdef HAVE_ZPL VFS_RELE(zfsvfs->z_vfs); +#endif /* HAVE_ZPL */ } nvlist_free(props); nvlist_free(origprops); @@ -2760,6 +2784,7 @@ zfs_ioc_promote(zfs_cmd_t *zc) * the first file system is shared. * Neither sharefs, nfs or smbsrv are unloadable modules. */ +#ifdef HAVE_ZPL int (*znfsexport_fs)(void *arg); int (*zshare_fs)(enum sharefs_sys_op, share_t *, uint32_t); int (*zsmbexport_fs)(void *arg, boolean_t add_share); @@ -2791,10 +2816,12 @@ zfs_init_sharefs() } return (0); } +#endif /* HAVE_ZPL */ static int zfs_ioc_share(zfs_cmd_t *zc) { +#ifdef HAVE_ZPL int error; int opcode; @@ -2884,9 +2911,12 @@ zfs_ioc_share(zfs_cmd_t *zc) zc->zc_share.z_sharemax); return (error); - +#else + return (ENOTSUP); +#endif /* HAVE_ZPL */ } + /* * pool create, destroy, and export don't log the history as part of * zfsdev_ioctl, but rather zfs_ioc_pool_create, and zfs_ioc_pool_export @@ -3138,7 +3168,9 @@ _init(void) error = ldi_ident_from_mod(&modlinkage, &zfs_li); ASSERT(error == 0); +#ifdef HAVE_ZPL mutex_init(&zfs_share_lock, NULL, MUTEX_DEFAULT, NULL); +#endif /* HAVE_ZPL */ return (0); } @@ -3157,6 +3189,7 @@ _fini(void) zvol_fini(); zfs_fini(); spa_fini(); +#ifdef HAVE_ZPL if (zfs_nfsshare_inited) (void) ddi_modclose(nfs_mod); if (zfs_smbshare_inited) @@ -3164,10 +3197,12 @@ _fini(void) if (zfs_nfsshare_inited || zfs_smbshare_inited) (void) ddi_modclose(sharefs_mod); + mutex_destroy(&zfs_share_lock); +#endif /* HAVE_ZPL */ + tsd_destroy(&zfs_fsyncer_key); ldi_ident_release(zfs_li); zfs_li = NULL; - mutex_destroy(&zfs_share_lock); return (error); } diff --git a/module/zfs/zfs_vfsops.c b/module/zfs/zfs_vfsops.c index 5abf8751b5..4aab6fb12c 100644 --- a/module/zfs/zfs_vfsops.c +++ b/module/zfs/zfs_vfsops.c @@ -1521,6 +1521,7 @@ zfs_vfsinit(int fstype, char *name) void zfs_init(void) { +#ifdef HAVE_ZPL /* * Initialize .zfs directory structures */ @@ -1530,19 +1531,26 @@ zfs_init(void) * Initialize znode cache, vnode ops, etc... */ zfs_znode_init(); +#endif /* HAVE_ZPL */ } void zfs_fini(void) { +#ifdef HAVE_ZPL zfsctl_fini(); zfs_znode_fini(); +#endif /* HAVE_ZPL */ } int zfs_busy(void) { +#ifdef HAVE_ZPL return (zfs_active_fs_count != 0); +#else + return 0; +#endif /* HAVE_ZPL */ } int