Lines Matching defs:zhp

228 zfs_is_mounted(zfs_handle_t *zhp, char **where)
230 return (is_mounted(zhp->zfs_hdl, zfs_get_name(zhp), where));
238 zfs_is_mountable(zfs_handle_t *zhp, char *buf, size_t buflen,
244 if (!zfs_prop_valid_for_type(ZFS_PROP_MOUNTPOINT, zhp->zfs_type))
247 verify(zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, buf, buflen,
254 if (zfs_prop_get_int(zhp, ZFS_PROP_CANMOUNT) == ZFS_CANMOUNT_OFF)
257 if (zfs_prop_get_int(zhp, ZFS_PROP_ZONED) &&
271 zfs_mount(zfs_handle_t *zhp, const char *options, int flags)
276 libzfs_handle_t *hdl = zhp->zfs_hdl;
286 if (zpool_get_prop_int(zhp->zpool_hdl, ZPOOL_PROP_READONLY, NULL))
289 if (!zfs_is_mountable(zhp, mountpoint, sizeof (mountpoint), NULL))
321 if (zmount(zfs_get_name(zhp), mountpoint, flags,
338 VERIFY(zfs_spa_version(zhp, &spa_version) == 0);
343 (u_longlong_t)zfs_prop_get_int(zhp,
351 zhp->zfs_name));
355 libzfs_mnttab_add(hdl, zfs_get_name(zhp), mountpoint,
380 zfs_unmount(zfs_handle_t *zhp, const char *mountpoint, int flags)
382 libzfs_handle_t *hdl = zhp->zfs_hdl;
387 if (mountpoint != NULL || ((zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM) &&
388 libzfs_mnttab_find(hdl, zhp->zfs_name, &entry) == 0)) {
403 if (zfs_unshare_proto(zhp, mntpt, share_all_proto) != 0)
408 (void) zfs_shareall(zhp);
411 libzfs_mnttab_remove(hdl, zhp->zfs_name);
424 zfs_unmountall(zfs_handle_t *zhp, int flags)
429 clp = changelist_gather(zhp, ZFS_PROP_MOUNTPOINT, 0, flags);
440 zfs_is_shared(zfs_handle_t *zhp)
445 if (ZFS_IS_VOLUME(zhp))
450 rc |= zfs_is_shared_proto(zhp, NULL, *curr_proto);
456 zfs_share(zfs_handle_t *zhp)
458 assert(!ZFS_IS_VOLUME(zhp));
459 return (zfs_share_proto(zhp, share_all_proto));
463 zfs_unshare(zfs_handle_t *zhp)
465 assert(!ZFS_IS_VOLUME(zhp));
466 return (zfs_unshareall(zhp));
473 zfs_is_shared_proto(zfs_handle_t *zhp, char **where, zfs_share_proto_t proto)
478 if (!zfs_is_mounted(zhp, &mountpoint))
481 if ((rc = is_shared(zhp->zfs_hdl, mountpoint, proto))
495 zfs_is_shared_nfs(zfs_handle_t *zhp, char **where)
497 return (zfs_is_shared_proto(zhp, where,
502 zfs_is_shared_smb(zfs_handle_t *zhp, char **where)
504 return (zfs_is_shared_proto(zhp, where,
731 zfs_share_proto(zfs_handle_t *zhp, zfs_share_proto_t *proto)
736 libzfs_handle_t *hdl = zhp->zfs_hdl;
741 if (!zfs_is_mountable(zhp, mountpoint, sizeof (mountpoint), NULL))
748 if (zfs_prop_get(zhp, proto_table[*curr_proto].p_prop,
759 zfs_get_name(zhp), _sa_errorstr != NULL ?
771 if (zfs_prop_get_int(zhp, ZFS_PROP_ZONED))
789 shareopts, sourcestr, zhp->zfs_name) != SA_OK) {
793 zfs_get_name(zhp));
808 zfs_get_name(zhp));
829 zfs_get_name(zhp));
839 zfs_share_nfs(zfs_handle_t *zhp)
841 return (zfs_share_proto(zhp, nfs_only));
845 zfs_share_smb(zfs_handle_t *zhp)
847 return (zfs_share_proto(zhp, smb_only));
851 zfs_shareall(zfs_handle_t *zhp)
853 return (zfs_share_proto(zhp, share_all_proto));
923 zfs_unshare_proto(zfs_handle_t *zhp, const char *mountpoint,
926 libzfs_handle_t *hdl = zhp->zfs_hdl;
931 rewind(zhp->zfs_hdl->libzfs_mnttab);
935 if (mountpoint != NULL || ((zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM) &&
936 libzfs_mnttab_find(hdl, zfs_get_name(zhp), &entry) == 0)) {
940 mntpt = zfs_strdup(zhp->zfs_hdl, entry.mnt_mountp);
946 unshare_one(hdl, zhp->zfs_name,
961 zfs_unshare_nfs(zfs_handle_t *zhp, const char *mountpoint)
963 return (zfs_unshare_proto(zhp, mountpoint, nfs_only));
967 zfs_unshare_smb(zfs_handle_t *zhp, const char *mountpoint)
969 return (zfs_unshare_proto(zhp, mountpoint, smb_only));
976 zfs_unshareall_proto(zfs_handle_t *zhp, zfs_share_proto_t *proto)
981 clp = changelist_gather(zhp, ZFS_PROP_SHARENFS, 0, 0);
992 zfs_unshareall_nfs(zfs_handle_t *zhp)
994 return (zfs_unshareall_proto(zhp, nfs_only));
998 zfs_unshareall_smb(zfs_handle_t *zhp)
1000 return (zfs_unshareall_proto(zhp, smb_only));
1004 zfs_unshareall(zfs_handle_t *zhp)
1006 return (zfs_unshareall_proto(zhp, share_all_proto));
1010 zfs_unshareall_bypath(zfs_handle_t *zhp, const char *mountpoint)
1012 return (zfs_unshare_proto(zhp, mountpoint, share_all_proto));
1027 remove_mountpoint(zfs_handle_t *zhp)
1032 if (!zfs_is_mountable(zhp, mountpoint, sizeof (mountpoint),
1049 libzfs_add_handle(get_all_cb_t *cbp, zfs_handle_t *zhp)
1056 ptr = zfs_realloc(zhp->zfs_hdl,
1062 cbp->cb_handles[cbp->cb_used++] = zhp;
1066 mount_cb(zfs_handle_t *zhp, void *data)
1070 if (!(zfs_get_type(zhp) & ZFS_TYPE_FILESYSTEM)) {
1071 zfs_close(zhp);
1075 if (zfs_prop_get_int(zhp, ZFS_PROP_CANMOUNT) == ZFS_CANMOUNT_NOAUTO) {
1076 zfs_close(zhp);
1084 if (zfs_prop_get_int(zhp, ZFS_PROP_INCONSISTENT) &&
1085 zfs_prop_get(zhp, ZFS_PROP_RECEIVE_RESUME_TOKEN,
1087 zfs_close(zhp);
1091 libzfs_add_handle(cbp, zhp);
1092 if (zfs_iter_filesystems(zhp, mount_cb, cbp) != 0) {
1093 zfs_close(zhp);
1136 zpool_enable_datasets(zpool_handle_t *zhp, const char *mntopts, int flags)
1139 libzfs_handle_t *hdl = zhp->zpool_hdl;
1147 if ((zfsp = zfs_open(hdl, zhp->zpool_name, ZFS_TYPE_DATASET)) == NULL)
1163 if ((good = zfs_alloc(zhp->zpool_hdl,
1215 zpool_disable_datasets(zpool_handle_t *zhp, boolean_t force)
1222 libzfs_handle_t *hdl = zhp->zpool_hdl;
1227 namelen = strlen(zhp->zpool_name);
1243 strncmp(entry.mnt_special, zhp->zpool_name, namelen) != 0 ||