400 return (gettext("\tsync [pool] ...\n"));
401 }
402
403 abort();
404 /* NOTREACHED */
405 }
406
407 static void
408 zpool_collect_leaves(zpool_handle_t *zhp, nvlist_t *nvroot, nvlist_t *res)
409 {
410 uint_t children = 0;
411 nvlist_t **child;
412 uint_t i;
413
414 (void) nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN,
415 &child, &children);
416
417 if (children == 0) {
418 char *path = zpool_vdev_name(g_zfs, zhp, nvroot, 0);
419
420 if (strcmp(path, VDEV_TYPE_INDIRECT) != 0)
421 fnvlist_add_boolean(res, path);
422
423 free(path);
424 return;
425 }
426
427 for (i = 0; i < children; i++) {
428 zpool_collect_leaves(zhp, child[i], res);
429 }
430 }
431
432 /*
433 * Callback routine that will print out a pool property value.
434 */
435 static int
436 print_prop_cb(int prop, void *cb)
437 {
438 FILE *fp = cb;
439
440 (void) fprintf(fp, "\t%-19s ", zpool_prop_to_name(prop));
|
400 return (gettext("\tsync [pool] ...\n"));
401 }
402
403 abort();
404 /* NOTREACHED */
405 }
406
407 static void
408 zpool_collect_leaves(zpool_handle_t *zhp, nvlist_t *nvroot, nvlist_t *res)
409 {
410 uint_t children = 0;
411 nvlist_t **child;
412 uint_t i;
413
414 (void) nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN,
415 &child, &children);
416
417 if (children == 0) {
418 char *path = zpool_vdev_name(g_zfs, zhp, nvroot, 0);
419
420 if (strcmp(path, VDEV_TYPE_INDIRECT) != 0 &&
421 strcmp(path, VDEV_TYPE_HOLE) != 0)
422 fnvlist_add_boolean(res, path);
423
424 free(path);
425 return;
426 }
427
428 for (i = 0; i < children; i++) {
429 zpool_collect_leaves(zhp, child[i], res);
430 }
431 }
432
433 /*
434 * Callback routine that will print out a pool property value.
435 */
436 static int
437 print_prop_cb(int prop, void *cb)
438 {
439 FILE *fp = cb;
440
441 (void) fprintf(fp, "\t%-19s ", zpool_prop_to_name(prop));
|