Changeset View
Changeset View
Standalone View
Standalone View
sys/contrib/openzfs/cmd/zpool/zpool_main.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 1,647 Lines • ▼ Show 20 Lines | for (i = 0; i < SPA_FEATURES; i++) { | ||||
* remove from the nvlist every ZFS_FEATURE_DISABLED | * remove from the nvlist every ZFS_FEATURE_DISABLED | ||||
* value and add every missing ZFS_FEATURE_ENABLED if | * value and add every missing ZFS_FEATURE_ENABLED if | ||||
* enable_all_pool_feat is set. | * enable_all_pool_feat is set. | ||||
*/ | */ | ||||
if (!nvlist_lookup_string(props, propname, &propval)) { | if (!nvlist_lookup_string(props, propname, &propval)) { | ||||
if (strcmp(propval, ZFS_FEATURE_DISABLED) == 0) | if (strcmp(propval, ZFS_FEATURE_DISABLED) == 0) | ||||
(void) nvlist_remove_all(props, | (void) nvlist_remove_all(props, | ||||
propname); | propname); | ||||
} else if (enable_all_pool_feat) { | } else if (enable_all_pool_feat && | ||||
feat->fi_zfs_mod_supported) { | |||||
ret = add_prop_list(propname, | ret = add_prop_list(propname, | ||||
ZFS_FEATURE_ENABLED, &props, B_TRUE); | ZFS_FEATURE_ENABLED, &props, B_TRUE); | ||||
if (ret != 0) | if (ret != 0) | ||||
goto errout; | goto errout; | ||||
} | } | ||||
} | } | ||||
ret = 1; | ret = 1; | ||||
▲ Show 20 Lines • Show All 339 Lines • ▼ Show 20 Lines | for (j = 0; j < vcdl->uniq_cols_cnt; j++) { | ||||
val = data->lines[k]; | val = data->lines[k]; | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* Mark empty values with dashes to make output | * Mark empty values with dashes to make output | ||||
* awk-able. | * awk-able. | ||||
*/ | */ | ||||
if (is_blank_str(val)) | if (val == NULL || is_blank_str(val)) | ||||
val = "-"; | val = "-"; | ||||
printf("%*s", vcdl->uniq_cols_width[j], val); | printf("%*s", vcdl->uniq_cols_width[j], val); | ||||
if (j < vcdl->uniq_cols_cnt - 1) | if (j < vcdl->uniq_cols_cnt - 1) | ||||
printf(" "); | printf(" "); | ||||
} | } | ||||
/* Print out any values that aren't in a column at the end */ | /* Print out any values that aren't in a column at the end */ | ||||
▲ Show 20 Lines • Show All 7,037 Lines • ▼ Show 20 Lines | print_history_records(nvlist_t *nvhis, hist_cbdata_t *cb) | ||||
nvlist_t **records; | nvlist_t **records; | ||||
uint_t numrecords; | uint_t numrecords; | ||||
int i; | int i; | ||||
verify(nvlist_lookup_nvlist_array(nvhis, ZPOOL_HIST_RECORD, | verify(nvlist_lookup_nvlist_array(nvhis, ZPOOL_HIST_RECORD, | ||||
&records, &numrecords) == 0); | &records, &numrecords) == 0); | ||||
for (i = 0; i < numrecords; i++) { | for (i = 0; i < numrecords; i++) { | ||||
nvlist_t *rec = records[i]; | nvlist_t *rec = records[i]; | ||||
char tbuf[30] = ""; | char tbuf[64] = ""; | ||||
if (nvlist_exists(rec, ZPOOL_HIST_TIME)) { | if (nvlist_exists(rec, ZPOOL_HIST_TIME)) { | ||||
time_t tsec; | time_t tsec; | ||||
struct tm t; | struct tm t; | ||||
tsec = fnvlist_lookup_uint64(records[i], | tsec = fnvlist_lookup_uint64(records[i], | ||||
ZPOOL_HIST_TIME); | ZPOOL_HIST_TIME); | ||||
(void) localtime_r(&tsec, &t); | (void) localtime_r(&tsec, &t); | ||||
(void) strftime(tbuf, sizeof (tbuf), "%F.%T", &t); | (void) strftime(tbuf, sizeof (tbuf), "%F.%T", &t); | ||||
} | |||||
if (nvlist_exists(rec, ZPOOL_HIST_ELAPSED_NS)) { | |||||
uint64_t elapsed_ns = fnvlist_lookup_int64(records[i], | |||||
ZPOOL_HIST_ELAPSED_NS); | |||||
(void) snprintf(tbuf + strlen(tbuf), | |||||
sizeof (tbuf) - strlen(tbuf), | |||||
" (%lldms)", (long long)elapsed_ns / 1000 / 1000); | |||||
} | } | ||||
if (nvlist_exists(rec, ZPOOL_HIST_CMD)) { | if (nvlist_exists(rec, ZPOOL_HIST_CMD)) { | ||||
(void) printf("%s %s", tbuf, | (void) printf("%s %s", tbuf, | ||||
fnvlist_lookup_string(rec, ZPOOL_HIST_CMD)); | fnvlist_lookup_string(rec, ZPOOL_HIST_CMD)); | ||||
} else if (nvlist_exists(rec, ZPOOL_HIST_INT_EVENT)) { | } else if (nvlist_exists(rec, ZPOOL_HIST_INT_EVENT)) { | ||||
int ievent = | int ievent = | ||||
fnvlist_lookup_uint64(rec, ZPOOL_HIST_INT_EVENT); | fnvlist_lookup_uint64(rec, ZPOOL_HIST_INT_EVENT); | ||||
▲ Show 20 Lines • Show All 1,357 Lines • Show Last 20 Lines |