Lines Matching refs:cb
400 usage_prop_cb(int prop, void *cb) in usage_prop_cb() argument
402 FILE *fp = cb; in usage_prop_cb()
1027 destroy_cbdata_t *cb = data; in destroy_callback() local
1030 if (cb->cb_verbose) { in destroy_callback()
1031 if (cb->cb_parsable) { in destroy_callback()
1033 } else if (cb->cb_dryrun) { in destroy_callback()
1051 if (cb->cb_dryrun) { in destroy_callback()
1063 fnvlist_add_boolean(cb->cb_batchedsnaps, name); in destroy_callback()
1066 cb->cb_batchedsnaps, B_FALSE); in destroy_callback()
1067 fnvlist_free(cb->cb_batchedsnaps); in destroy_callback()
1068 cb->cb_batchedsnaps = fnvlist_alloc(); in destroy_callback()
1071 zfs_unmount(zhp, NULL, cb->cb_force ? MS_FORCE : 0) != 0 || in destroy_callback()
1072 zfs_destroy(zhp, cb->cb_defer_destroy) != 0) { in destroy_callback()
1085 destroy_cbdata_t *cb = arg; in destroy_print_cb() local
1089 if (nvlist_exists(cb->cb_nvl, name)) { in destroy_print_cb()
1090 if (cb->cb_firstsnap == NULL) in destroy_print_cb()
1091 cb->cb_firstsnap = strdup(name); in destroy_print_cb()
1092 if (cb->cb_prevsnap != NULL) in destroy_print_cb()
1093 free(cb->cb_prevsnap); in destroy_print_cb()
1095 cb->cb_prevsnap = strdup(name); in destroy_print_cb()
1096 if (cb->cb_firstsnap == NULL || cb->cb_prevsnap == NULL) in destroy_print_cb()
1098 if (cb->cb_verbose) { in destroy_print_cb()
1099 if (cb->cb_parsable) { in destroy_print_cb()
1101 } else if (cb->cb_dryrun) { in destroy_print_cb()
1109 } else if (cb->cb_firstsnap != NULL) { in destroy_print_cb()
1112 err = lzc_snaprange_space(cb->cb_firstsnap, in destroy_print_cb()
1113 cb->cb_prevsnap, &used); in destroy_print_cb()
1114 cb->cb_snapused += used; in destroy_print_cb()
1115 free(cb->cb_firstsnap); in destroy_print_cb()
1116 cb->cb_firstsnap = NULL; in destroy_print_cb()
1117 free(cb->cb_prevsnap); in destroy_print_cb()
1118 cb->cb_prevsnap = NULL; in destroy_print_cb()
1125 destroy_print_snapshots(zfs_handle_t *fs_zhp, destroy_cbdata_t *cb) in destroy_print_snapshots() argument
1128 assert(cb->cb_firstsnap == NULL); in destroy_print_snapshots()
1129 assert(cb->cb_prevsnap == NULL); in destroy_print_snapshots()
1130 err = zfs_iter_snapshots_sorted(fs_zhp, destroy_print_cb, cb); in destroy_print_snapshots()
1131 if (cb->cb_firstsnap != NULL) { in destroy_print_snapshots()
1134 err = lzc_snaprange_space(cb->cb_firstsnap, in destroy_print_snapshots()
1135 cb->cb_prevsnap, &used); in destroy_print_snapshots()
1137 cb->cb_snapused += used; in destroy_print_snapshots()
1138 free(cb->cb_firstsnap); in destroy_print_snapshots()
1139 cb->cb_firstsnap = NULL; in destroy_print_snapshots()
1140 free(cb->cb_prevsnap); in destroy_print_snapshots()
1141 cb->cb_prevsnap = NULL; in destroy_print_snapshots()
1149 destroy_cbdata_t *cb = arg; in snapshot_to_nvl_cb() local
1153 if (!cb->cb_doclones && !cb->cb_defer_destroy) { in snapshot_to_nvl_cb()
1154 cb->cb_target = zhp; in snapshot_to_nvl_cb()
1155 cb->cb_first = B_TRUE; in snapshot_to_nvl_cb()
1157 destroy_check_dependent, cb); in snapshot_to_nvl_cb()
1161 if (nvlist_add_boolean(cb->cb_nvl, zfs_get_name(zhp))) in snapshot_to_nvl_cb()
1171 destroy_cbdata_t *cb = arg; in gather_snapshots() local
1174 err = zfs_iter_snapspec(zhp, cb->cb_snapspec, snapshot_to_nvl_cb, cb); in gather_snapshots()
1180 if (cb->cb_verbose) { in gather_snapshots()
1181 err = destroy_print_snapshots(zhp, cb); in gather_snapshots()
1186 if (cb->cb_recurse) in gather_snapshots()
1187 err = zfs_iter_filesystems(zhp, gather_snapshots, cb); in gather_snapshots()
1195 destroy_clones(destroy_cbdata_t *cb) in destroy_clones() argument
1198 for (pair = nvlist_next_nvpair(cb->cb_nvl, NULL); in destroy_clones()
1200 pair = nvlist_next_nvpair(cb->cb_nvl, pair)) { in destroy_clones()
1204 boolean_t defer = cb->cb_defer_destroy; in destroy_clones()
1211 cb->cb_defer_destroy = B_FALSE; in destroy_clones()
1213 destroy_callback, cb); in destroy_clones()
1214 cb->cb_defer_destroy = defer; in destroy_clones()
1226 destroy_cbdata_t cb = { 0 }; in zfs_do_destroy() local
1238 cb.cb_verbose = B_TRUE; in zfs_do_destroy()
1241 cb.cb_verbose = B_TRUE; in zfs_do_destroy()
1242 cb.cb_parsable = B_TRUE; in zfs_do_destroy()
1245 cb.cb_dryrun = B_TRUE; in zfs_do_destroy()
1248 cb.cb_defer_destroy = B_TRUE; in zfs_do_destroy()
1252 cb.cb_force = B_TRUE; in zfs_do_destroy()
1255 cb.cb_recurse = B_TRUE; in zfs_do_destroy()
1258 cb.cb_recurse = B_TRUE; in zfs_do_destroy()
1259 cb.cb_doclones = B_TRUE; in zfs_do_destroy()
1287 cb.cb_nvl = fnvlist_alloc(); in zfs_do_destroy()
1295 cb.cb_snapspec = at + 1; in zfs_do_destroy()
1296 if (gather_snapshots(zfs_handle_dup(zhp), &cb) != 0 || in zfs_do_destroy()
1297 cb.cb_error) { in zfs_do_destroy()
1302 if (nvlist_empty(cb.cb_nvl)) { in zfs_do_destroy()
1309 if (cb.cb_verbose) { in zfs_do_destroy()
1311 zfs_nicenum(cb.cb_snapused, buf, sizeof (buf)); in zfs_do_destroy()
1312 if (cb.cb_parsable) { in zfs_do_destroy()
1314 cb.cb_snapused); in zfs_do_destroy()
1315 } else if (cb.cb_dryrun) { in zfs_do_destroy()
1324 if (!cb.cb_dryrun) { in zfs_do_destroy()
1325 if (cb.cb_doclones) { in zfs_do_destroy()
1326 cb.cb_batchedsnaps = fnvlist_alloc(); in zfs_do_destroy()
1327 err = destroy_clones(&cb); in zfs_do_destroy()
1330 cb.cb_batchedsnaps, B_FALSE); in zfs_do_destroy()
1338 err = zfs_destroy_snaps_nvl(g_zfs, cb.cb_nvl, in zfs_do_destroy()
1339 cb.cb_defer_destroy); in zfs_do_destroy()
1349 if (cb.cb_dryrun) { in zfs_do_destroy()
1355 if (cb.cb_defer_destroy) { in zfs_do_destroy()
1361 if (cb.cb_recurse) { in zfs_do_destroy()
1382 nvlist_free(cb.cb_nvl); in zfs_do_destroy()
1390 cb.cb_target = zhp; in zfs_do_destroy()
1395 if (!cb.cb_recurse && strchr(zfs_get_name(zhp), '/') == NULL && in zfs_do_destroy()
1412 cb.cb_first = B_TRUE; in zfs_do_destroy()
1413 if (!cb.cb_doclones && in zfs_do_destroy()
1415 &cb) != 0) { in zfs_do_destroy()
1420 if (cb.cb_error) { in zfs_do_destroy()
1425 cb.cb_batchedsnaps = fnvlist_alloc(); in zfs_do_destroy()
1427 &cb) != 0) { in zfs_do_destroy()
1436 err = destroy_callback(zhp, &cb); in zfs_do_destroy()
1440 cb.cb_batchedsnaps, cb.cb_defer_destroy); in zfs_do_destroy()
1447 fnvlist_free(cb.cb_batchedsnaps); in zfs_do_destroy()
1448 fnvlist_free(cb.cb_nvl); in zfs_do_destroy()
1605 zprop_get_cbdata_t cb = { 0 }; in zfs_do_get() local
1616 cb.cb_sources = ZPROP_SRC_ALL; in zfs_do_get()
1617 cb.cb_columns[0] = GET_COL_NAME; in zfs_do_get()
1618 cb.cb_columns[1] = GET_COL_PROPERTY; in zfs_do_get()
1619 cb.cb_columns[2] = GET_COL_VALUE; in zfs_do_get()
1620 cb.cb_columns[3] = GET_COL_SOURCE; in zfs_do_get()
1621 cb.cb_type = ZFS_TYPE_DATASET; in zfs_do_get()
1627 cb.cb_literal = B_TRUE; in zfs_do_get()
1636 cb.cb_scripted = B_TRUE; in zfs_do_get()
1648 bzero(&cb.cb_columns, sizeof (cb.cb_columns)); in zfs_do_get()
1665 cb.cb_columns[i++] = GET_COL_NAME; in zfs_do_get()
1668 cb.cb_columns[i++] = GET_COL_PROPERTY; in zfs_do_get()
1671 cb.cb_columns[i++] = GET_COL_VALUE; in zfs_do_get()
1674 cb.cb_columns[i++] = GET_COL_RECVD; in zfs_do_get()
1678 cb.cb_columns[i++] = GET_COL_SOURCE; in zfs_do_get()
1688 cb.cb_columns[0] = GET_COL_NAME; in zfs_do_get()
1689 cb.cb_columns[1] = GET_COL_PROPERTY; in zfs_do_get()
1690 cb.cb_columns[2] = GET_COL_VALUE; in zfs_do_get()
1691 cb.cb_columns[3] = GET_COL_RECVD; in zfs_do_get()
1692 cb.cb_columns[4] = GET_COL_SOURCE; in zfs_do_get()
1706 cb.cb_sources = 0; in zfs_do_get()
1716 cb.cb_sources |= ZPROP_SRC_LOCAL; in zfs_do_get()
1719 cb.cb_sources |= ZPROP_SRC_DEFAULT; in zfs_do_get()
1722 cb.cb_sources |= ZPROP_SRC_INHERITED; in zfs_do_get()
1725 cb.cb_sources |= ZPROP_SRC_RECEIVED; in zfs_do_get()
1728 cb.cb_sources |= ZPROP_SRC_TEMPORARY; in zfs_do_get()
1731 cb.cb_sources |= ZPROP_SRC_NONE; in zfs_do_get()
1796 if (zprop_get_list(g_zfs, fields, &cb.cb_proplist, ZFS_TYPE_DATASET) in zfs_do_get()
1811 if (cb.cb_proplist != NULL) { in zfs_do_get()
1814 fake_name.pl_next = cb.cb_proplist; in zfs_do_get()
1815 cb.cb_proplist = &fake_name; in zfs_do_get()
1818 cb.cb_first = B_TRUE; in zfs_do_get()
1822 &cb.cb_proplist, limit, get_callback, &cb); in zfs_do_get()
1824 if (cb.cb_proplist == &fake_name) in zfs_do_get()
1827 zprop_free_list(cb.cb_proplist); in zfs_do_get()
1853 inherit_cbdata_t *cb = data; in inherit_recurse_cb() local
1854 zfs_prop_t prop = zfs_name_to_prop(cb->cb_propname); in inherit_recurse_cb()
1864 return (zfs_prop_inherit(zhp, cb->cb_propname, cb->cb_received) != 0); in inherit_recurse_cb()
1870 inherit_cbdata_t *cb = data; in inherit_cb() local
1872 return (zfs_prop_inherit(zhp, cb->cb_propname, cb->cb_received) != 0); in inherit_cb()
1880 inherit_cbdata_t cb = { 0 }; in zfs_do_inherit() local
1954 cb.cb_propname = propname; in zfs_do_inherit()
1955 cb.cb_received = received; in zfs_do_inherit()
1959 NULL, NULL, 0, inherit_recurse_cb, &cb); in zfs_do_inherit()
1962 NULL, NULL, 0, inherit_cb, &cb); in zfs_do_inherit()
1993 upgrade_cbdata_t *cb = data; in upgrade_list_callback() local
1997 if ((!cb->cb_newer && version < ZPL_VERSION) || in upgrade_list_callback()
1998 (cb->cb_newer && version > ZPL_VERSION)) { in upgrade_list_callback()
2000 if (cb->cb_newer) { in upgrade_list_callback()
2013 if (!cb->cb_foundone) { in upgrade_list_callback()
2017 cb->cb_foundone = B_TRUE; in upgrade_list_callback()
2029 upgrade_cbdata_t *cb = data; in upgrade_set_callback() local
2037 needed_spa_version = zfs_spa_version_map(cb->cb_version); in upgrade_set_callback()
2048 cb->cb_numfailed++; in upgrade_set_callback()
2053 if (version < cb->cb_version) { in upgrade_set_callback()
2056 "%llu", cb->cb_version); in upgrade_set_callback()
2057 if (cb->cb_lastfs[0] && !same_pool(zhp, cb->cb_lastfs)) { in upgrade_set_callback()
2068 cb->cb_numupgraded++; in upgrade_set_callback()
2070 cb->cb_numfailed++; in upgrade_set_callback()
2071 (void) strcpy(cb->cb_lastfs, zfs_get_name(zhp)); in upgrade_set_callback()
2072 } else if (version > cb->cb_version) { in upgrade_set_callback()
2077 cb->cb_numfailed++; in upgrade_set_callback()
2079 cb->cb_numsamegraded++; in upgrade_set_callback()
2095 upgrade_cbdata_t cb = { 0 }; in zfs_do_upgrade() local
2110 optarg, &cb.cb_version) != 0) { in zfs_do_upgrade()
2130 if ((!all && !argc) && ((flags & ZFS_ITER_RECURSE) | cb.cb_version)) in zfs_do_upgrade()
2133 cb.cb_version || argc)) in zfs_do_upgrade()
2160 if (cb.cb_version == 0) in zfs_do_upgrade()
2161 cb.cb_version = ZPL_VERSION; in zfs_do_upgrade()
2163 NULL, NULL, 0, upgrade_set_callback, &cb); in zfs_do_upgrade()
2165 cb.cb_numupgraded); in zfs_do_upgrade()
2166 if (cb.cb_numsamegraded) { in zfs_do_upgrade()
2169 cb.cb_numsamegraded); in zfs_do_upgrade()
2171 if (cb.cb_numfailed != 0) in zfs_do_upgrade()
2181 NULL, NULL, 0, upgrade_list_callback, &cb); in zfs_do_upgrade()
2183 found = cb.cb_foundone; in zfs_do_upgrade()
2184 cb.cb_foundone = B_FALSE; in zfs_do_upgrade()
2185 cb.cb_newer = B_TRUE; in zfs_do_upgrade()
2188 NULL, NULL, 0, upgrade_list_callback, &cb); in zfs_do_upgrade()
2190 if (!cb.cb_foundone && !found) { in zfs_do_upgrade()
2389 us_cbdata_t *cb = (us_cbdata_t *)arg; in userspace_cb() local
2390 zfs_userquota_prop_t prop = cb->cb_prop; in userspace_cb()
2395 uu_avl_pool_t *avl_pool = cb->cb_avl_pool; in userspace_cb()
2396 uu_avl_t *avl = cb->cb_avl; in userspace_cb()
2400 zfs_sort_column_t *sortcol = cb->cb_sortcol; in userspace_cb()
2407 us_sort_info_t sortinfo = { sortcol, cb->cb_numname }; in userspace_cb()
2437 if (!cb->cb_sid2posix) { in userspace_cb()
2451 if (cb->cb_sid2posix || domain == NULL || domain[0] == '\0') { in userspace_cb()
2455 if (!cb->cb_numname) { in userspace_cb()
2463 if (!cb->cb_numname) { in userspace_cb()
2477 if (cb->cb_sid2posix && in userspace_cb()
2485 if (typelen > cb->cb_width[typeidx]) in userspace_cb()
2486 cb->cb_width[typeidx] = typelen; in userspace_cb()
2491 if ((cb->cb_numname && cb->cb_sid2posix) || name == NULL) { in userspace_cb()
2501 if (namelen > cb->cb_width[nameidx]) in userspace_cb()
2502 cb->cb_width[nameidx] = namelen; in userspace_cb()
2518 if (cb->cb_nicenum) in userspace_cb()
2533 if (sizelen > cb->cb_width[sizeidx]) in userspace_cb()
2534 cb->cb_width[sizeidx] = sizelen; in userspace_cb()
2691 us_cbdata_t cb; in zfs_do_userspace() local
2815 cb.cb_sortcol = sortcol; in zfs_do_userspace()
2816 cb.cb_numname = prtnum; in zfs_do_userspace()
2817 cb.cb_nicenum = !parsable; in zfs_do_userspace()
2818 cb.cb_avl_pool = avl_pool; in zfs_do_userspace()
2819 cb.cb_avl = avl_tree; in zfs_do_userspace()
2820 cb.cb_sid2posix = sid2posix; in zfs_do_userspace()
2823 cb.cb_width[i] = strlen(gettext(us_field_hdr[i])); in zfs_do_userspace()
2831 cb.cb_prop = p; in zfs_do_userspace()
2832 if ((ret = zfs_userspace(zhp, p, userspace_cb, &cb)) != 0) in zfs_do_userspace()
2857 us_sort_info_t sortinfo = { sortcol, cb.cb_numname }; in zfs_do_userspace()
2867 print_us(scripted, parsable, fields, types, cb.cb_width, B_TRUE, in zfs_do_userspace()
2868 cb.cb_avl); in zfs_do_userspace()
2873 if ((walk = uu_avl_walk_start(cb.cb_avl, UU_WALK_ROBUST)) == NULL) in zfs_do_userspace()
2877 uu_avl_remove(cb.cb_avl, node); in zfs_do_userspace()
2916 print_header(list_cbdata_t *cb) in print_header() argument
2918 zprop_list_t *pl = cb->cb_proplist; in print_header()
2959 print_dataset(zfs_handle_t *zhp, list_cbdata_t *cb) in print_dataset() argument
2961 zprop_list_t *pl = cb->cb_proplist; in print_dataset()
2971 if (cb->cb_scripted) in print_dataset()
2982 cb->cb_literal) != 0) in print_dataset()
2989 property, sizeof (property), cb->cb_literal) != 0) in print_dataset()
2996 property, sizeof (property), cb->cb_literal) != 0) in print_dataset()
3016 if (cb->cb_scripted || (pl->pl_next == NULL && !right_justify)) in print_dataset()
3055 list_cbdata_t cb = { 0 }; in zfs_do_list() local
3069 cb.cb_literal = B_TRUE; in zfs_do_list()
3079 cb.cb_scripted = B_TRUE; in zfs_do_list()
3162 if (zprop_get_list(g_zfs, fields, &cb.cb_proplist, ZFS_TYPE_DATASET) in zfs_do_list()
3166 cb.cb_first = B_TRUE; in zfs_do_list()
3168 ret = zfs_for_each(argc, argv, flags, types, sortcol, &cb.cb_proplist, in zfs_do_list()
3169 limit, list_callback, &cb); in zfs_do_list()
3171 zprop_free_list(cb.cb_proplist); in zfs_do_list()
3174 if (ret == 0 && cb.cb_first && !cb.cb_scripted) in zfs_do_list()
3401 rollback_cbdata_t cb = { 0 }; in zfs_do_rollback() local
3410 cb.cb_recurse = 1; in zfs_do_rollback()
3413 cb.cb_recurse = 1; in zfs_do_rollback()
3414 cb.cb_doclones = 1; in zfs_do_rollback()
3456 cb.cb_target = argv[0]; in zfs_do_rollback()
3457 cb.cb_create = zfs_prop_get_int(snap, ZFS_PROP_CREATETXG); in zfs_do_rollback()
3458 cb.cb_first = B_TRUE; in zfs_do_rollback()
3459 cb.cb_error = 0; in zfs_do_rollback()
3460 if ((ret = zfs_iter_snapshots(zhp, rollback_check, &cb)) != 0) in zfs_do_rollback()
3462 if ((ret = zfs_iter_bookmarks(zhp, rollback_check, &cb)) != 0) in zfs_do_rollback()
3465 if ((ret = cb.cb_error) != 0) in zfs_do_rollback()
5580 holds_cbdata_t cb = { 0 }; in zfs_do_holds() local
5633 cb.cb_recursive = recursive; in zfs_do_holds()
5634 cb.cb_snapname = snapname; in zfs_do_holds()
5635 cb.cb_nvlp = &nvl; in zfs_do_holds()
5641 holds_callback, &cb); in zfs_do_holds()
5649 print_holds(scripted, cb.cb_max_namelen, cb.cb_max_taglen, nvl); in zfs_do_holds()
5708 get_all_cb_t cb = { 0 }; in get_all_datasets() local
5709 cb.cb_verbose = verbose; in get_all_datasets()
5710 cb.cb_getone = get_one_dataset; in get_all_datasets()
5714 (void) zfs_iter_root(g_zfs, get_one_dataset, &cb); in get_all_datasets()
5716 *dslist = cb.cb_handles; in get_all_datasets()
5717 *count = cb.cb_used; in get_all_datasets()