这篇教程C++ zpool_close函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中zpool_close函数的典型用法代码示例。如果您正苦于以下问题:C++ zpool_close函数的具体用法?C++ zpool_close怎么用?C++ zpool_close使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了zpool_close函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: add_pool/* * Callback function for pool_list_get(). Adds the given pool to the AVL tree * of known pools. */static intadd_pool(zpool_handle_t *zhp, void *data){ zpool_list_t *zlp = data; zpool_node_t *node = safe_malloc(sizeof (zpool_node_t)); uu_avl_index_t idx; node->zn_handle = zhp; uu_avl_node_init(node, &node->zn_avlnode, zlp->zl_pool); if (uu_avl_find(zlp->zl_avl, node, NULL, &idx) == NULL) { if (zlp->zl_proplist && zpool_expand_proplist(zhp, zlp->zl_proplist) != 0) { zpool_close(zhp); free(node); return (-1); } uu_avl_insert(zlp->zl_avl, node, idx); } else { zpool_close(zhp); free(node); return (-1); } return (0);}
开发者ID:ElCoyote27,项目名称:zfs-fuse,代码行数:29,
示例2: zfs_mark_pool/*ARGSUSED*/static intzfs_mark_pool(zpool_handle_t *zhp, void *unused){ zfs_case_t *zcp; uint64_t pool_guid; nvlist_t *config, *vd; int ret; pool_guid = zpool_get_prop_int(zhp, ZPOOL_PROP_GUID, NULL); /* * Mark any cases associated with just this pool. */ for (zcp = uu_list_first(zfs_cases); zcp != NULL; zcp = uu_list_next(zfs_cases, zcp)) { if (zcp->zc_data.zc_pool_guid == pool_guid && zcp->zc_data.zc_vdev_guid == 0) zcp->zc_present = B_TRUE; } if ((config = zpool_get_config(zhp, NULL)) == NULL) { zpool_close(zhp); return (-1); } ret = nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &vd); assert(ret == 0); zfs_mark_vdev(pool_guid, vd); zpool_close(zhp); return (0);}
开发者ID:CoryXie,项目名称:opensolaris,代码行数:34,
示例3: fmd_fmri_presentintfmd_fmri_present(nvlist_t *nvl){ uint64_t pool_guid, vdev_guid; cbdata_t cb; int ret; (void) nvlist_lookup_uint64(nvl, FM_FMRI_ZFS_POOL, &pool_guid); cb.cb_guid = pool_guid; cb.cb_pool = NULL; if (zpool_iter(g_zfs, find_pool, &cb) != 1) return (0); if (nvlist_lookup_uint64(nvl, FM_FMRI_ZFS_VDEV, &vdev_guid) != 0) { zpool_close(cb.cb_pool); return (1); } ret = (find_vdev(cb.cb_pool, vdev_guid) != NULL); zpool_close(cb.cb_pool); return (ret);}
开发者ID:CoryXie,项目名称:opensolaris,代码行数:26,
示例4: zpool_open_silent/* * Like the above, but silent on error. Used when iterating over pools (because * the configuration cache may be out of date). */intzpool_open_silent(libzfs_handle_t *hdl, const char *pool, zpool_handle_t **ret){ zpool_handle_t *zhp; boolean_t missing; if ((zhp = zfs_alloc(hdl, sizeof (zpool_handle_t))) == NULL) return (-1); zhp->zpool_hdl = hdl; (void) strlcpy(zhp->zpool_name, pool, sizeof (zhp->zpool_name)); if (zpool_refresh_stats(zhp, &missing) != 0) { zpool_close(zhp); return (-1); } if (missing) { zpool_close(zhp); *ret = NULL; return (0); } *ret = zhp; return (0);}
开发者ID:andreiw,项目名称:polaris,代码行数:30,
示例5: fmd_fmri_replacedintfmd_fmri_replaced(nvlist_t *nvl){ uint64_t pool_guid, vdev_guid; cbdata_t cb; int ret; (void) nvlist_lookup_uint64(nvl, FM_FMRI_ZFS_POOL, &pool_guid); cb.cb_guid = pool_guid; cb.cb_pool = NULL; if (zpool_iter(g_zfs, find_pool, &cb) != 1) return (FMD_OBJ_STATE_NOT_PRESENT); if (nvlist_lookup_uint64(nvl, FM_FMRI_ZFS_VDEV, &vdev_guid) != 0) { zpool_close(cb.cb_pool); return (FMD_OBJ_STATE_STILL_PRESENT); } ret = (find_vdev(cb.cb_pool, vdev_guid) != NULL) ? FMD_OBJ_STATE_STILL_PRESENT : FMD_OBJ_STATE_NOT_PRESENT; zpool_close(cb.cb_pool); return (ret);}
开发者ID:CoryXie,项目名称:opensolaris,代码行数:27,
示例6: set_bootfs/* * Function: set_bootfs * Description: Sets the bootfs property on the boot pool to be the * root dataset of the activated BE. * Parameters: * boot_pool - The pool we're setting bootfs in. * be_root_ds - The main dataset for the BE. * Return: * BE_SUCCESS - Success * be_errno_t - Failure * Scope: * Private */static intset_bootfs(char *boot_rpool, char *be_root_ds){ zpool_handle_t *zhp; int err = BE_SUCCESS; if ((zhp = zpool_open(g_zfs, boot_rpool)) == NULL) { be_print_err(gettext("set_bootfs: failed to open pool " "(%s): %s/n"), boot_rpool, libzfs_error_description(g_zfs)); err = zfs_err_to_be_err(g_zfs); return (err); } err = zpool_set_prop(zhp, "bootfs", be_root_ds); if (err) { be_print_err(gettext("set_bootfs: failed to set " "bootfs property for pool %s: %s/n"), boot_rpool, libzfs_error_description(g_zfs)); err = zfs_err_to_be_err(g_zfs); zpool_close(zhp); return (err); } zpool_close(zhp); return (BE_SUCCESS);}
开发者ID:kele,项目名称:illumos-fsd,代码行数:39,
示例7: ztop/* * given the path to a zvol, return the cXtYdZ name * returns < 0 on error, 0 if it isn't a zvol, > 1 on success */static intztop(char *arg, char *diskname){ zpool_handle_t *zpool_handle; nvlist_t *config, *nvroot; nvlist_t **child; uint_t children; libzfs_handle_t *lzfs; char *vname; char *p; char pool_name[MAXPATHLEN]; if (strncmp(arg, "/dev/zvol/dsk/", 14)) { return (0); } arg += 14; (void) strncpy(pool_name, arg, MAXPATHLEN); if ((p = strchr(pool_name, '/')) != NULL) *p = '/0'; STRCPYLIM(new_cc.cf_fs, p + 1, "statefile path"); if ((lzfs = libzfs_init()) == NULL) { mesg(MERR, "failed to initialize ZFS library/n"); return (-1); } if ((zpool_handle = zpool_open(lzfs, pool_name)) == NULL) { mesg(MERR, "couldn't open pool '%s'/n", pool_name); libzfs_fini(lzfs); return (-1); } config = zpool_get_config(zpool_handle, NULL); if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &nvroot) != 0) { zpool_close(zpool_handle); libzfs_fini(lzfs); return (-1); } verify(nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN, &child, &children) == 0); if (children != 1) { mesg(MERR, "expected one vdev, got %d/n", children); zpool_close(zpool_handle); libzfs_fini(lzfs); return (-1); } vname = zpool_vdev_name(lzfs, zpool_handle, child[0], B_FALSE); if (vname == NULL) { mesg(MERR, "couldn't determine vdev name/n"); zpool_close(zpool_handle); libzfs_fini(lzfs); return (-1); } (void) strcpy(diskname, "/dev/dsk/"); (void) strcat(diskname, vname); free(vname); zpool_close(zpool_handle); libzfs_fini(lzfs); return (1);}
开发者ID:arekinath,项目名称:illumos-joyent,代码行数:63,
示例8: zfsdle_vdev_onlinestatic intzfsdle_vdev_online(zpool_handle_t *zhp, void *data){ char *devname = data; boolean_t avail_spare, l2cache; vdev_state_t newstate; nvlist_t *tgt; zed_log_msg(LOG_INFO, "zfsdle_vdev_online: searching for '%s' in '%s'", devname, zpool_get_name(zhp)); if ((tgt = zpool_find_vdev_by_physpath(zhp, devname, &avail_spare, &l2cache, NULL)) != NULL) { char *path, fullpath[MAXPATHLEN]; uint64_t wholedisk = 0ULL; verify(nvlist_lookup_string(tgt, ZPOOL_CONFIG_PATH, &path) == 0); verify(nvlist_lookup_uint64(tgt, ZPOOL_CONFIG_WHOLE_DISK, &wholedisk) == 0); (void) strlcpy(fullpath, path, sizeof (fullpath)); if (wholedisk) { char *spath = zfs_strip_partition(fullpath); if (!spath) { zed_log_msg(LOG_INFO, "%s: Can't alloc", __func__); return (0); } (void) strlcpy(fullpath, spath, sizeof (fullpath)); free(spath); /* * We need to reopen the pool associated with this * device so that the kernel can update the size * of the expanded device. */ (void) zpool_reopen(zhp); } if (zpool_get_prop_int(zhp, ZPOOL_PROP_AUTOEXPAND, NULL)) { zed_log_msg(LOG_INFO, "zfsdle_vdev_online: setting " "device '%s' to ONLINE state in pool '%s'", fullpath, zpool_get_name(zhp)); if (zpool_get_state(zhp) != POOL_STATE_UNAVAIL) (void) zpool_vdev_online(zhp, fullpath, 0, &newstate); } zpool_close(zhp); return (1); } zpool_close(zhp); return (0);}
开发者ID:behlendorf,项目名称:zfs,代码行数:55,
示例9: zfs_mark_pool/*ARGSUSED*/static intzfs_mark_pool(zpool_handle_t *zhp, void *unused){ zfs_case_t *zcp; uint64_t pool_guid; uint64_t *tod; er_timeval_t loaded = { 0 }; nvlist_t *config, *vd; uint_t nelem = 0; int ret; pool_guid = zpool_get_prop_int(zhp, ZPOOL_PROP_GUID, NULL); /* * Mark any cases associated with just this pool. */ for (zcp = uu_list_first(zfs_cases); zcp != NULL; zcp = uu_list_next(zfs_cases, zcp)) { if (zcp->zc_data.zc_pool_guid == pool_guid && zcp->zc_data.zc_vdev_guid == 0) zcp->zc_present = B_TRUE; } if ((config = zpool_get_config(zhp, NULL)) == NULL) { zpool_close(zhp); return (-1); } (void) nvlist_lookup_uint64_array(config, ZPOOL_CONFIG_LOADED_TIME, &tod, &nelem); if (nelem == 2) { loaded.ertv_sec = tod[0]; loaded.ertv_nsec = tod[1]; for (zcp = uu_list_first(zfs_cases); zcp != NULL; zcp = uu_list_next(zfs_cases, zcp)) { if (zcp->zc_data.zc_pool_guid == pool_guid && zcp->zc_data.zc_vdev_guid == 0) { zcp->zc_when = loaded; } } } ret = nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &vd); if (ret) { zpool_close(zhp); return (-1); } zfs_mark_vdev(pool_guid, vd, &loaded); zpool_close(zhp); return (0);}
开发者ID:DeHackEd,项目名称:zfs,代码行数:54,
示例10: name_or_guid_existsstatic intname_or_guid_exists(zpool_handle_t *zhp, void *data){ importargs_t *import = data; int found = 0; if (import->poolname != NULL) { char *pool_name; verify(nvlist_lookup_string(zhp->zpool_config, ZPOOL_CONFIG_POOL_NAME, &pool_name) == 0); if (strcmp(pool_name, import->poolname) == 0) found = 1; } else { uint64_t pool_guid; verify(nvlist_lookup_uint64(zhp->zpool_config, ZPOOL_CONFIG_POOL_GUID, &pool_guid) == 0); if (pool_guid == import->guid) found = 1; } zpool_close(zhp); return (found);}
开发者ID:cbreak-black,项目名称:zfs,代码行数:25,
示例11: find_auxstatic intfind_aux(zpool_handle_t *zhp, void *data){ aux_cbdata_t *cbp = data; nvlist_t **list; uint_t i, count; uint64_t guid; nvlist_t *nvroot; verify(nvlist_lookup_nvlist(zhp->zpool_config, ZPOOL_CONFIG_VDEV_TREE, &nvroot) == 0); if (nvlist_lookup_nvlist_array(nvroot, cbp->cb_type, &list, &count) == 0) { for (i = 0; i < count; i++) { verify(nvlist_lookup_uint64(list[i], ZPOOL_CONFIG_GUID, &guid) == 0); if (guid == cbp->cb_guid) { cbp->cb_zhp = zhp; return (1); } } } zpool_close(zhp); return (0);}
开发者ID:cbreak-black,项目名称:zfs,代码行数:27,
示例12: zpool_find_load_timestatic intzpool_find_load_time(zpool_handle_t *zhp, void *arg){ struct load_time_arg *lta = arg; uint64_t pool_guid; uint64_t *tod; nvlist_t *config; uint_t nelem; if (lta->lt_found) return (0); pool_guid = zpool_get_prop_int(zhp, ZPOOL_PROP_GUID, NULL); if (pool_guid != lta->lt_guid) return (0); if ((config = zpool_get_config(zhp, NULL)) == NULL) { zpool_close(zhp); return (-1); } if (nvlist_lookup_uint64_array(config, ZPOOL_CONFIG_LOADED_TIME, &tod, &nelem) == 0 && nelem == 2) { lta->lt_found = B_TRUE; lta->lt_time->ertv_sec = tod[0]; lta->lt_time->ertv_nsec = tod[1]; } return (0);}
开发者ID:AlainODea,项目名称:illumos-gate,代码行数:30,
示例13: zfs_enable_dsvoidzfs_enable_ds(void *arg){ unavailpool_t *pool = (unavailpool_t *)arg; (void) zpool_enable_datasets(pool->uap_zhp, NULL, 0); zpool_close(pool->uap_zhp); free(pool);}
开发者ID:DeHackEd,项目名称:zfs,代码行数:9,
示例14: pool_list_remove/* * Remove the given pool from the list. When running iostat, we want to remove * those pools that no longer exist. */voidpool_list_remove(zpool_list_t *zlp, zpool_handle_t *zhp){ zpool_node_t search, *node; search.zn_handle = zhp; if ((node = uu_avl_find(zlp->zl_avl, &search, NULL, NULL)) != NULL) { uu_avl_remove(zlp->zl_avl, node); zpool_close(node->zn_handle); free(node); }}
开发者ID:ElCoyote27,项目名称:zfs-fuse,代码行数:16,
示例15: find_poolstatic intfind_pool(zpool_handle_t *zhp, void *data){ find_cbdata_t *cbp = data; if (cbp->cb_guid == zpool_get_guid(zhp)) { cbp->cb_zhp = zhp; return (1); } zpool_close(zhp); return (0);}
开发者ID:andreiw,项目名称:polaris,代码行数:13,
示例16: zpool_open_canfail/* * Open a handle to the given pool, even if the pool is currently in the FAULTED * state. */zpool_handle_t *zpool_open_canfail(libzfs_handle_t *hdl, const char *pool){ zpool_handle_t *zhp; boolean_t missing; /* * Make sure the pool name is valid. */ if (!zpool_name_valid(hdl, B_TRUE, pool)) { (void) zfs_error(hdl, EZFS_INVALIDNAME, dgettext(TEXT_DOMAIN, "cannot open '%s'"), pool); return (NULL); } if ((zhp = zfs_alloc(hdl, sizeof (zpool_handle_t))) == NULL) return (NULL); zhp->zpool_hdl = hdl; (void) strlcpy(zhp->zpool_name, pool, sizeof (zhp->zpool_name)); if (zpool_refresh_stats(zhp, &missing) != 0) { zpool_close(zhp); return (NULL); } if (missing) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "no such pool")); (void) zfs_error(hdl, EZFS_NOENT, dgettext(TEXT_DOMAIN, "cannot open '%s'"), pool); zpool_close(zhp); return (NULL); } return (zhp);}
开发者ID:andreiw,项目名称:polaris,代码行数:43,
示例17: fmd_fmri_unusableintfmd_fmri_unusable(nvlist_t *nvl){ uint64_t pool_guid, vdev_guid; cbdata_t cb; nvlist_t *vd; int ret; (void) nvlist_lookup_uint64(nvl, FM_FMRI_ZFS_POOL, &pool_guid); cb.cb_guid = pool_guid; cb.cb_pool = NULL; if (zpool_iter(g_zfs, find_pool, &cb) != 1) return (1); if (nvlist_lookup_uint64(nvl, FM_FMRI_ZFS_VDEV, &vdev_guid) != 0) { ret = (zpool_get_state(cb.cb_pool) == POOL_STATE_UNAVAIL); zpool_close(cb.cb_pool); return (ret); } vd = find_vdev(cb.cb_pool, vdev_guid); if (vd == NULL) { ret = 1; } else { vdev_stat_t *vs; uint_t c; (void) nvlist_lookup_uint64_array(vd, ZPOOL_CONFIG_STATS, (uint64_t **)&vs, &c); ret = (vs->vs_state < VDEV_STATE_DEGRADED); } zpool_close(cb.cb_pool); return (ret);}
开发者ID:CoryXie,项目名称:opensolaris,代码行数:39,
示例18: zfs_enable_dsstatic void *zfs_enable_ds(void *arg){ unavailpool_t *pool = (unavailpool_t *)arg; assert(pool->uap_enable_tid = pthread_self()); (void) zpool_enable_datasets(pool->uap_zhp, NULL, 0); zpool_close(pool->uap_zhp); pool->uap_zhp = NULL; /* Note: zfs_slm_fini() will cleanup this pool entry on exit */ return (NULL);}
开发者ID:pyavdr,项目名称:zfs,代码行数:14,
示例19: find_poolstatic intfind_pool(zpool_handle_t *zhp, void *data){ cbdata_t *cbp = data; if (zpool_get_prop_int(zhp, ZPOOL_PROP_GUID, NULL) == cbp->cb_guid) { cbp->cb_pool = zhp; return (1); } zpool_close(zhp); return (0);}
开发者ID:CoryXie,项目名称:opensolaris,代码行数:14,
示例20: find_root_device_from_libzfsstatic char *find_root_device_from_libzfs (const char *dir){ char *device; char *poolname; char *poolfs; grub_find_zpool_from_dir (dir, &poolname, &poolfs); if (! poolname) return NULL; { zpool_handle_t *zpool; libzfs_handle_t *libzfs; nvlist_t *nvlist; nvlist_t **nvlist_array; unsigned int nvlist_count; libzfs = grub_get_libzfs_handle (); if (! libzfs) return NULL; zpool = zpool_open (libzfs, poolname); nvlist = zpool_get_config (zpool, NULL); if (nvlist_lookup_nvlist (nvlist, "vdev_tree", &nvlist) != 0) error (1, errno, "nvlist_lookup_nvlist (/"vdev_tree/")"); if (nvlist_lookup_nvlist_array (nvlist, "children", &nvlist_array, &nvlist_count) != 0) error (1, errno, "nvlist_lookup_nvlist_array (/"children/")"); do { assert (nvlist_count > 0); } while (nvlist_lookup_nvlist_array (nvlist_array[0], "children", &nvlist_array, &nvlist_count) == 0); if (nvlist_lookup_string (nvlist_array[0], "path", &device) != 0) error (1, errno, "nvlist_lookup_string (/"path/")"); zpool_close (zpool); } free (poolname); if (poolfs) free (poolfs); return device;}
开发者ID:TemmeR,项目名称:grub2,代码行数:49,
示例21: zfs_iter_poolstatic intzfs_iter_pool(zpool_handle_t *zhp, void *data){ nvlist_t *config, *nvl; dev_data_t *dp = data; uint64_t pool_guid; unavailpool_t *pool; zed_log_msg(LOG_INFO, "zfs_iter_pool: evaluating vdevs on %s (by %s)", zpool_get_name(zhp), dp->dd_vdev_guid ? "GUID" : dp->dd_prop); /* * For each vdev in this pool, look for a match to apply dd_func */ if ((config = zpool_get_config(zhp, NULL)) != NULL) { if (dp->dd_pool_guid == 0 || (nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID, &pool_guid) == 0 && pool_guid == dp->dd_pool_guid)) { (void) nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &nvl); zfs_iter_vdev(zhp, nvl, data); } } /* * if this pool was originally unavailable, * then enable its datasets asynchronously */ if (g_enumeration_done) { for (pool = list_head(&g_pool_list); pool != NULL; pool = list_next(&g_pool_list, pool)) { if (pool->uap_enable_tid != 0) continue; /* entry already processed */ if (strcmp(zpool_get_name(zhp), zpool_get_name(pool->uap_zhp))) continue; if (zfs_toplevel_state(zhp) >= VDEV_STATE_DEGRADED) { /* send to a background thread; keep on list */ (void) pthread_create(&pool->uap_enable_tid, NULL, zfs_enable_ds, pool); break; } } } zpool_close(zhp); return (dp->dd_found); /* cease iteration after a match */}
开发者ID:pyavdr,项目名称:zfs,代码行数:49,
示例22: zfs_unavail_poolstatic intzfs_unavail_pool(zpool_handle_t *zhp, void *data){ zed_log_msg(LOG_INFO, "zfs_unavail_pool: examining '%s' (state %d)", zpool_get_name(zhp), (int)zfs_toplevel_state(zhp)); if (zfs_toplevel_state(zhp) < VDEV_STATE_DEGRADED) { unavailpool_t *uap; uap = malloc(sizeof (unavailpool_t)); uap->uap_zhp = zhp; list_insert_tail((list_t *)data, uap); } else { zpool_close(zhp); } return (0);}
开发者ID:DeHackEd,项目名称:zfs,代码行数:16,
示例23: zpool_open/* * Similar to zpool_open_canfail(), but refuses to open pools in the faulted * state. */zpool_handle_t *zpool_open(libzfs_handle_t *hdl, const char *pool){ zpool_handle_t *zhp; if ((zhp = zpool_open_canfail(hdl, pool)) == NULL) return (NULL); if (zhp->zpool_state == POOL_STATE_UNAVAIL) { (void) zfs_error(hdl, EZFS_POOLUNAVAIL, dgettext(TEXT_DOMAIN, "cannot open '%s'"), zhp->zpool_name); zpool_close(zhp); return (NULL); } return (zhp);}
开发者ID:andreiw,项目名称:polaris,代码行数:21,
示例24: lzwu_find_spareint lzwu_find_spare(zpool_handle_t *p_zpool, void *data){ spare_cbdata_t *cbp = (spare_cbdata_t*)data; nvlist_t *config, *pnv_root; config = zpool_get_config(p_zpool, NULL); verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &pnv_root) == 0); if(lzwu_zpool_find_vdev(pnv_root, cbp->cb_guid)) { cbp->cb_zhp = p_zpool; return 1; } zpool_close(p_zpool); return 0;}
开发者ID:Anuradha-Talur,项目名称:nfs-ganesha,代码行数:18,
示例25: zpool_get_statsintzpool_get_stats(zpool_handle_t * zhp, void * data) { config_t * cnf = (config_t *)data; uint_t c; boolean_t missing; nvlist_t * nv, * config; vdev_stat_t * vs; if (zpool_refresh_stats(zhp, &missing) != 0) return 1; config = zpool_get_config(zhp, NULL); if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &nv) != 0) { return 1; } if (nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS, (uint64_t **)&vs, &c) != 0) { return 1; } if (!strcmp(zpool_get_name(zhp), cnf->zname)) { cnf->zpool.read_ops = vs->vs_ops[ZIO_TYPE_READ]; cnf->zpool.write_ops = vs->vs_ops[ZIO_TYPE_WRITE]; cnf->zpool.read_bts = vs->vs_bytes[ZIO_TYPE_READ]; cnf->zpool.write_bts = vs->vs_bytes[ZIO_TYPE_WRITE]; cnf->zpool.alloc = vs->vs_alloc; cnf->zpool.free = vs->vs_space - vs->vs_alloc; cnf->zpool.health = zpool_get_health(zhp); cnf->zpool.dedupratio = zpool_get_dedupratio(zhp); cnf->zpool.name = zpool_get_poolname(zhp); cnf->zpool.ddt_memory = get_dedup_stats(config); } zpool_close(zhp); return 0;}
开发者ID:matusso,项目名称:zabbix-modules,代码行数:40,
示例26: pool_active/* * Returns true if the named pool matches the given GUID. */static intpool_active(libzfs_handle_t *hdl, const char *name, uint64_t guid, boolean_t *isactive){ zpool_handle_t *zhp; uint64_t theguid; if (zpool_open_silent(hdl, name, &zhp) != 0) return (-1); if (zhp == NULL) { *isactive = B_FALSE; return (0); } verify(nvlist_lookup_uint64(zhp->zpool_config, ZPOOL_CONFIG_POOL_GUID, &theguid) == 0); zpool_close(zhp); *isactive = (theguid == guid); return (0);}
开发者ID:cbreak-black,项目名称:zfs,代码行数:26,
示例27: fmd_fmri_nvl2strssize_tfmd_fmri_nvl2str(nvlist_t *nvl, char *buf, size_t buflen){ uint64_t pool_guid, vdev_guid; cbdata_t cb; ssize_t len; const char *name; char guidbuf[64]; (void) nvlist_lookup_uint64(nvl, FM_FMRI_ZFS_POOL, &pool_guid); /* * Attempt to convert the pool guid to a name. */ cb.cb_guid = pool_guid; cb.cb_pool = NULL; if (zpool_iter(g_zfs, find_pool, &cb) == 1) { name = zpool_get_name(cb.cb_pool); } else { (void) snprintf(guidbuf, sizeof (guidbuf), "%llx", pool_guid); name = guidbuf; } if (nvlist_lookup_uint64(nvl, FM_FMRI_ZFS_VDEV, &vdev_guid) == 0) len = snprintf(buf, buflen, "%s://pool=%s/vdev=%llx", FM_FMRI_SCHEME_ZFS, name, vdev_guid); else len = snprintf(buf, buflen, "%s://pool=%s", FM_FMRI_SCHEME_ZFS, name); if (cb.cb_pool) zpool_close(cb.cb_pool); return (len);}
开发者ID:CoryXie,项目名称:opensolaris,代码行数:36,
注:本文中的zpool_close函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ zprintf函数代码示例 C++ zpoller_new函数代码示例 |