zfs: merge openzfs/zfs@cb01da680
Notable upstream pull request merges:
#12438 Avoid panic with recordsize > 128k, raw sending and no large_blocks
#13015 Fix dnode byteswapping
#13256 Add a "zstream decompress" subcommand
#13555 Scrub mirror children without BPs
#13576 Several sorted scrub optimizations
#13579 Fix and disable blocks statistics during scrub
#13582 Several B-tree optimizations
#13591 Avoid two 64-bit divisions per scanned block
#13606 Avoid memory copies during mirror scrub
#13613 Avoid memory copy when verifying raidz/draid parity
Obtained from: OpenZFS
OpenZFS commit: cb01da6805
This commit is contained in:
commit
a0b956f5ac
@ -11,6 +11,7 @@ MLINKS= zstream.8 zstreamdump.8
|
||||
INCS= zstream.h
|
||||
SRCS= \
|
||||
zstream.c \
|
||||
zstream_decompress.c \
|
||||
zstream_dump.c \
|
||||
zstream_redup.c \
|
||||
zstream_token.c
|
||||
|
@ -108,20 +108,21 @@ mtab_is_writeable(void)
|
||||
}
|
||||
|
||||
static int
|
||||
mtab_update(char *dataset, char *mntpoint, char *type, char *mntopts)
|
||||
mtab_update(const char *dataset, const char *mntpoint, const char *type,
|
||||
const char *mntopts)
|
||||
{
|
||||
struct mntent mnt;
|
||||
FILE *fp;
|
||||
int error;
|
||||
|
||||
mnt.mnt_fsname = dataset;
|
||||
mnt.mnt_dir = mntpoint;
|
||||
mnt.mnt_type = type;
|
||||
mnt.mnt_opts = mntopts ? mntopts : "";
|
||||
mnt.mnt_fsname = (char *)dataset;
|
||||
mnt.mnt_dir = (char *)mntpoint;
|
||||
mnt.mnt_type = (char *)type;
|
||||
mnt.mnt_opts = (char *)(mntopts ?: "");
|
||||
mnt.mnt_freq = 0;
|
||||
mnt.mnt_passno = 0;
|
||||
|
||||
fp = setmntent("/etc/mtab", "a+");
|
||||
fp = setmntent("/etc/mtab", "a+e");
|
||||
if (!fp) {
|
||||
(void) fprintf(stderr, gettext(
|
||||
"filesystem '%s' was mounted, but /etc/mtab "
|
||||
|
@ -69,7 +69,7 @@ static void sig_handler(int signo)
|
||||
|
||||
static void print_opts(raidz_test_opts_t *opts, boolean_t force)
|
||||
{
|
||||
char *verbose;
|
||||
const char *verbose;
|
||||
switch (opts->rto_v) {
|
||||
case D_ALL:
|
||||
verbose = "no";
|
||||
|
@ -102,7 +102,7 @@
|
||||
#define ZDB_MAP_OBJECT_ID(obj) (obj)
|
||||
#endif
|
||||
|
||||
static char *
|
||||
static const char *
|
||||
zdb_ot_name(dmu_object_type_t type)
|
||||
{
|
||||
if (type < DMU_OT_NUMTYPES)
|
||||
@ -2922,7 +2922,7 @@ dsl_deadlist_entry_dump(void *arg, dsl_deadlist_entry_t *dle)
|
||||
}
|
||||
|
||||
static void
|
||||
dump_blkptr_list(dsl_deadlist_t *dl, char *name)
|
||||
dump_blkptr_list(dsl_deadlist_t *dl, const char *name)
|
||||
{
|
||||
char bytes[32];
|
||||
char comp[32];
|
||||
@ -2963,7 +2963,7 @@ dump_blkptr_list(dsl_deadlist_t *dl, char *name)
|
||||
if (dump_opt['d'] < 4)
|
||||
return;
|
||||
|
||||
(void) printf("\n");
|
||||
(void) putchar('\n');
|
||||
|
||||
dsl_deadlist_iterate(dl, dsl_deadlist_entry_dump, NULL);
|
||||
}
|
||||
@ -3024,7 +3024,7 @@ static objset_t *sa_os = NULL;
|
||||
static sa_attr_type_t *sa_attr_table = NULL;
|
||||
|
||||
static int
|
||||
open_objset(const char *path, void *tag, objset_t **osp)
|
||||
open_objset(const char *path, const void *tag, objset_t **osp)
|
||||
{
|
||||
int err;
|
||||
uint64_t sa_attrs = 0;
|
||||
@ -3068,7 +3068,7 @@ open_objset(const char *path, void *tag, objset_t **osp)
|
||||
}
|
||||
|
||||
static void
|
||||
close_objset(objset_t *os, void *tag)
|
||||
close_objset(objset_t *os, const void *tag)
|
||||
{
|
||||
VERIFY3P(os, ==, sa_os);
|
||||
if (os->os_sa != NULL)
|
||||
@ -3098,9 +3098,8 @@ static void
|
||||
print_idstr(uint64_t id, const char *id_type)
|
||||
{
|
||||
if (FUID_INDEX(id)) {
|
||||
char *domain;
|
||||
|
||||
domain = zfs_fuid_idx_domain(&idx_tree, FUID_INDEX(id));
|
||||
const char *domain =
|
||||
zfs_fuid_idx_domain(&idx_tree, FUID_INDEX(id));
|
||||
(void) printf("\t%s %llx [%s-%d]\n", id_type,
|
||||
(u_longlong_t)id, domain, (int)FUID_RID(id));
|
||||
} else {
|
||||
@ -3643,7 +3642,7 @@ count_ds_mos_objects(dsl_dataset_t *ds)
|
||||
}
|
||||
}
|
||||
|
||||
static const char *objset_types[DMU_OST_NUMTYPES] = {
|
||||
static const char *const objset_types[DMU_OST_NUMTYPES] = {
|
||||
"NONE", "META", "ZPL", "ZVOL", "OTHER", "ANY" };
|
||||
|
||||
/*
|
||||
@ -3653,7 +3652,7 @@ static const char *objset_types[DMU_OST_NUMTYPES] = {
|
||||
* pointer to point to a descriptive error message.
|
||||
*/
|
||||
static int
|
||||
parse_object_range(char *range, zopt_object_range_t *zor, char **msg)
|
||||
parse_object_range(char *range, zopt_object_range_t *zor, const char **msg)
|
||||
{
|
||||
uint64_t flags = 0;
|
||||
char *p, *s, *dup, *flagstr, *tmp = NULL;
|
||||
@ -4236,13 +4235,13 @@ first_label(cksum_record_t *rec)
|
||||
}
|
||||
|
||||
static void
|
||||
print_label_numbers(char *prefix, cksum_record_t *rec)
|
||||
print_label_numbers(const char *prefix, const cksum_record_t *rec)
|
||||
{
|
||||
printf("%s", prefix);
|
||||
fputs(prefix, stdout);
|
||||
for (int i = 0; i < VDEV_LABELS; i++)
|
||||
if (rec->labels[i] == B_TRUE)
|
||||
printf("%d ", i);
|
||||
printf("\n");
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
#define MAX_UBERBLOCK_COUNT (VDEV_UBERBLOCK_RING >> UBERBLOCK_SHIFT)
|
||||
@ -5126,7 +5125,7 @@ same_metaslab(spa_t *spa, uint64_t vdev, uint64_t off1, uint64_t off2)
|
||||
* Used to simplify reporting of the histogram data.
|
||||
*/
|
||||
typedef struct one_histo {
|
||||
char *name;
|
||||
const char *name;
|
||||
uint64_t *count;
|
||||
uint64_t *len;
|
||||
uint64_t cumulative;
|
||||
@ -8093,32 +8092,33 @@ zdb_read_block(char *thing, spa_t *spa)
|
||||
vdev_t *vd;
|
||||
abd_t *pabd;
|
||||
void *lbuf, *buf;
|
||||
char *s, *p, *dup, *vdev, *flagstr, *sizes, *tmp = NULL;
|
||||
char *s, *p, *dup, *flagstr, *sizes, *tmp = NULL;
|
||||
const char *vdev, *errmsg = NULL;
|
||||
int i, error;
|
||||
boolean_t borrowed = B_FALSE, found = B_FALSE;
|
||||
|
||||
dup = strdup(thing);
|
||||
s = strtok_r(dup, ":", &tmp);
|
||||
vdev = s ? s : "";
|
||||
vdev = s ?: "";
|
||||
s = strtok_r(NULL, ":", &tmp);
|
||||
offset = strtoull(s ? s : "", NULL, 16);
|
||||
sizes = strtok_r(NULL, ":", &tmp);
|
||||
s = strtok_r(NULL, ":", &tmp);
|
||||
flagstr = strdup(s ? s : "");
|
||||
flagstr = strdup(s ?: "");
|
||||
|
||||
s = NULL;
|
||||
tmp = NULL;
|
||||
if (!zdb_parse_block_sizes(sizes, &lsize, &psize))
|
||||
s = "invalid size(s)";
|
||||
errmsg = "invalid size(s)";
|
||||
if (!IS_P2ALIGNED(psize, DEV_BSIZE) || !IS_P2ALIGNED(lsize, DEV_BSIZE))
|
||||
s = "size must be a multiple of sector size";
|
||||
errmsg = "size must be a multiple of sector size";
|
||||
if (!IS_P2ALIGNED(offset, DEV_BSIZE))
|
||||
s = "offset must be a multiple of sector size";
|
||||
if (s) {
|
||||
(void) printf("Invalid block specifier: %s - %s\n", thing, s);
|
||||
errmsg = "offset must be a multiple of sector size";
|
||||
if (errmsg) {
|
||||
(void) printf("Invalid block specifier: %s - %s\n",
|
||||
thing, errmsg);
|
||||
goto done;
|
||||
}
|
||||
|
||||
tmp = NULL;
|
||||
for (s = strtok_r(flagstr, ":", &tmp);
|
||||
s != NULL;
|
||||
s = strtok_r(NULL, ":", &tmp)) {
|
||||
@ -8930,13 +8930,13 @@ main(int argc, char **argv)
|
||||
sizeof (zopt_object_range_t));
|
||||
for (unsigned i = 0; i < zopt_object_args; i++) {
|
||||
int err;
|
||||
char *msg = NULL;
|
||||
const char *msg = NULL;
|
||||
|
||||
err = parse_object_range(argv[i],
|
||||
&zopt_object_ranges[i], &msg);
|
||||
if (err != 0)
|
||||
fatal("Bad object or range: '%s': %s\n",
|
||||
argv[i], msg ? msg : "");
|
||||
argv[i], msg ?: "");
|
||||
}
|
||||
} else if (argc > 0 && dump_opt['m']) {
|
||||
zopt_metaslab_args = argc;
|
||||
|
@ -389,7 +389,8 @@ zed_log_fault(nvlist_t *nvl, const char *uuid, const char *code)
|
||||
static const char *
|
||||
fmd_fault_mkcode(nvlist_t *fault)
|
||||
{
|
||||
char *class, *code = "-";
|
||||
char *class;
|
||||
const char *code = "-";
|
||||
|
||||
/*
|
||||
* Note: message codes come from: openzfs/usr/src/cmd/fm/dicts/ZFS.po
|
||||
|
@ -471,7 +471,7 @@ safe_realloc(void *data, size_t size)
|
||||
}
|
||||
|
||||
static char *
|
||||
safe_strdup(char *str)
|
||||
safe_strdup(const char *str)
|
||||
{
|
||||
char *dupstr = strdup(str);
|
||||
|
||||
@ -690,7 +690,8 @@ parse_depth(char *opt, int *flags)
|
||||
|
||||
#define PROGRESS_DELAY 2 /* seconds */
|
||||
|
||||
static char *pt_reverse = "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b";
|
||||
static const char *pt_reverse =
|
||||
"\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b";
|
||||
static time_t pt_begin;
|
||||
static char *pt_header = NULL;
|
||||
static boolean_t pt_shown;
|
||||
@ -703,7 +704,7 @@ start_progress_timer(void)
|
||||
}
|
||||
|
||||
static void
|
||||
set_progress_header(char *header)
|
||||
set_progress_header(const char *header)
|
||||
{
|
||||
assert(pt_header == NULL);
|
||||
pt_header = safe_strdup(header);
|
||||
@ -714,7 +715,7 @@ set_progress_header(char *header)
|
||||
}
|
||||
|
||||
static void
|
||||
update_progress(char *update)
|
||||
update_progress(const char *update)
|
||||
{
|
||||
if (!pt_shown && time(NULL) > pt_begin) {
|
||||
int len = strlen(update);
|
||||
@ -732,10 +733,10 @@ update_progress(char *update)
|
||||
}
|
||||
|
||||
static void
|
||||
finish_progress(char *done)
|
||||
finish_progress(const char *done)
|
||||
{
|
||||
if (pt_shown) {
|
||||
(void) printf("%s\n", done);
|
||||
(void) puts(done);
|
||||
(void) fflush(stdout);
|
||||
}
|
||||
free(pt_header);
|
||||
@ -1903,8 +1904,8 @@ get_callback(zfs_handle_t *zhp, void *data)
|
||||
nvlist_t *user_props = zfs_get_user_props(zhp);
|
||||
zprop_list_t *pl = cbp->cb_proplist;
|
||||
nvlist_t *propval;
|
||||
char *strval;
|
||||
char *sourceval;
|
||||
const char *strval;
|
||||
const char *sourceval;
|
||||
boolean_t received = is_recvd_column(cbp);
|
||||
|
||||
for (; pl != NULL; pl = pl->pl_next) {
|
||||
@ -1973,10 +1974,10 @@ get_callback(zfs_handle_t *zhp, void *data)
|
||||
sourcetype = ZPROP_SRC_NONE;
|
||||
strval = "-";
|
||||
} else {
|
||||
verify(nvlist_lookup_string(propval,
|
||||
ZPROP_VALUE, &strval) == 0);
|
||||
verify(nvlist_lookup_string(propval,
|
||||
ZPROP_SOURCE, &sourceval) == 0);
|
||||
strval = fnvlist_lookup_string(propval,
|
||||
ZPROP_VALUE);
|
||||
sourceval = fnvlist_lookup_string(propval,
|
||||
ZPROP_SOURCE);
|
||||
|
||||
if (strcmp(sourceval,
|
||||
zfs_get_name(zhp)) == 0) {
|
||||
@ -2441,7 +2442,7 @@ upgrade_set_callback(zfs_handle_t *zhp, void *data)
|
||||
|
||||
/* upgrade */
|
||||
if (version < cb->cb_version) {
|
||||
char verstr[16];
|
||||
char verstr[24];
|
||||
(void) snprintf(verstr, sizeof (verstr),
|
||||
"%llu", (u_longlong_t)cb->cb_version);
|
||||
if (cb->cb_lastfs[0] && !same_pool(zhp, cb->cb_lastfs)) {
|
||||
@ -2618,9 +2619,9 @@ enum us_field_types {
|
||||
USFIELD_OBJUSED,
|
||||
USFIELD_OBJQUOTA
|
||||
};
|
||||
static char *us_field_hdr[] = { "TYPE", "NAME", "USED", "QUOTA",
|
||||
static const char *const us_field_hdr[] = { "TYPE", "NAME", "USED", "QUOTA",
|
||||
"OBJUSED", "OBJQUOTA" };
|
||||
static char *us_field_names[] = { "type", "name", "used", "quota",
|
||||
static const char *const us_field_names[] = { "type", "name", "used", "quota",
|
||||
"objused", "objquota" };
|
||||
#define USFIELD_LAST (sizeof (us_field_names) / sizeof (char *))
|
||||
|
||||
@ -2640,8 +2641,8 @@ static int us_type_bits[] = {
|
||||
USTYPE_SMB_USR,
|
||||
USTYPE_ALL
|
||||
};
|
||||
static char *us_type_names[] = { "posixgroup", "posixuser", "smbgroup",
|
||||
"smbuser", "all" };
|
||||
static const char *const us_type_names[] = { "posixgroup", "posixuser",
|
||||
"smbgroup", "smbuser", "all" };
|
||||
|
||||
typedef struct us_node {
|
||||
nvlist_t *usn_nvl;
|
||||
@ -2669,11 +2670,9 @@ typedef struct {
|
||||
} us_sort_info_t;
|
||||
|
||||
static int
|
||||
us_field_index(char *field)
|
||||
us_field_index(const char *field)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < USFIELD_LAST; i++) {
|
||||
for (int i = 0; i < USFIELD_LAST; i++) {
|
||||
if (strcmp(field, us_field_names[i]) == 0)
|
||||
return (i);
|
||||
}
|
||||
@ -2695,8 +2694,8 @@ us_compare(const void *larg, const void *rarg, void *unused)
|
||||
boolean_t lvb, rvb;
|
||||
|
||||
for (; sortcol != NULL; sortcol = sortcol->sc_next) {
|
||||
char *lvstr = "";
|
||||
char *rvstr = "";
|
||||
char *lvstr = (char *)"";
|
||||
char *rvstr = (char *)"";
|
||||
uint32_t lv32 = 0;
|
||||
uint32_t rv32 = 0;
|
||||
uint64_t lv64 = 0;
|
||||
@ -2818,7 +2817,7 @@ userspace_cb(void *arg, const char *domain, uid_t rid, uint64_t space)
|
||||
us_cbdata_t *cb = (us_cbdata_t *)arg;
|
||||
zfs_userquota_prop_t prop = cb->cb_prop;
|
||||
char *name = NULL;
|
||||
char *propname;
|
||||
const char *propname;
|
||||
char sizebuf[32];
|
||||
us_node_t *node;
|
||||
uu_avl_pool_t *avl_pool = cb->cb_avl_pool;
|
||||
@ -3018,26 +3017,25 @@ print_us_node(boolean_t scripted, boolean_t parsable, int *fields, int types,
|
||||
while ((field = fields[cfield]) != USFIELD_LAST) {
|
||||
nvpair_t *nvp = NULL;
|
||||
data_type_t type;
|
||||
uint32_t val32;
|
||||
uint64_t val64;
|
||||
char *strval = "-";
|
||||
uint32_t val32 = -1;
|
||||
uint64_t val64 = -1;
|
||||
const char *strval = "-";
|
||||
|
||||
while ((nvp = nvlist_next_nvpair(nvl, nvp)) != NULL) {
|
||||
while ((nvp = nvlist_next_nvpair(nvl, nvp)) != NULL)
|
||||
if (strcmp(nvpair_name(nvp),
|
||||
us_field_names[field]) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
type = nvp == NULL ? DATA_TYPE_UNKNOWN : nvpair_type(nvp);
|
||||
switch (type) {
|
||||
case DATA_TYPE_UINT32:
|
||||
(void) nvpair_value_uint32(nvp, &val32);
|
||||
val32 = fnvpair_value_uint32(nvp);
|
||||
break;
|
||||
case DATA_TYPE_UINT64:
|
||||
(void) nvpair_value_uint64(nvp, &val64);
|
||||
val64 = fnvpair_value_uint64(nvp);
|
||||
break;
|
||||
case DATA_TYPE_STRING:
|
||||
(void) nvpair_value_string(nvp, &strval);
|
||||
strval = fnvpair_value_string(nvp);
|
||||
break;
|
||||
case DATA_TYPE_UNKNOWN:
|
||||
break;
|
||||
@ -3048,7 +3046,7 @@ print_us_node(boolean_t scripted, boolean_t parsable, int *fields, int types,
|
||||
switch (field) {
|
||||
case USFIELD_TYPE:
|
||||
if (type == DATA_TYPE_UINT32)
|
||||
strval = (char *)us_type2str(val32);
|
||||
strval = us_type2str(val32);
|
||||
break;
|
||||
case USFIELD_NAME:
|
||||
if (type == DATA_TYPE_UINT64) {
|
||||
@ -3095,12 +3093,12 @@ print_us_node(boolean_t scripted, boolean_t parsable, int *fields, int types,
|
||||
|
||||
if (!first) {
|
||||
if (scripted)
|
||||
(void) printf("\t");
|
||||
(void) putchar('\t');
|
||||
else
|
||||
(void) printf(" ");
|
||||
(void) fputs(" ", stdout);
|
||||
}
|
||||
if (scripted)
|
||||
(void) printf("%s", strval);
|
||||
(void) fputs(strval, stdout);
|
||||
else if (field == USFIELD_TYPE || field == USFIELD_NAME)
|
||||
(void) printf("%-*s", (int)width[field], strval);
|
||||
else
|
||||
@ -3110,7 +3108,7 @@ print_us_node(boolean_t scripted, boolean_t parsable, int *fields, int types,
|
||||
cfield++;
|
||||
}
|
||||
|
||||
(void) printf("\n");
|
||||
(void) putchar('\n');
|
||||
}
|
||||
|
||||
static void
|
||||
@ -3476,15 +3474,15 @@ print_dataset(zfs_handle_t *zhp, list_cbdata_t *cb)
|
||||
char property[ZFS_MAXPROPLEN];
|
||||
nvlist_t *userprops = zfs_get_user_props(zhp);
|
||||
nvlist_t *propval;
|
||||
char *propstr;
|
||||
const char *propstr;
|
||||
boolean_t right_justify;
|
||||
|
||||
for (; pl != NULL; pl = pl->pl_next) {
|
||||
if (!first) {
|
||||
if (cb->cb_scripted)
|
||||
(void) printf("\t");
|
||||
(void) putchar('\t');
|
||||
else
|
||||
(void) printf(" ");
|
||||
(void) fputs(" ", stdout);
|
||||
} else {
|
||||
first = B_FALSE;
|
||||
}
|
||||
@ -3521,8 +3519,8 @@ print_dataset(zfs_handle_t *zhp, list_cbdata_t *cb)
|
||||
pl->pl_user_prop, &propval) != 0)
|
||||
propstr = "-";
|
||||
else
|
||||
verify(nvlist_lookup_string(propval,
|
||||
ZPROP_VALUE, &propstr) == 0);
|
||||
propstr = fnvlist_lookup_string(propval,
|
||||
ZPROP_VALUE);
|
||||
right_justify = B_FALSE;
|
||||
}
|
||||
|
||||
@ -3532,14 +3530,14 @@ print_dataset(zfs_handle_t *zhp, list_cbdata_t *cb)
|
||||
* format specifier.
|
||||
*/
|
||||
if (cb->cb_scripted || (pl->pl_next == NULL && !right_justify))
|
||||
(void) printf("%s", propstr);
|
||||
(void) fputs(propstr, stdout);
|
||||
else if (right_justify)
|
||||
(void) printf("%*s", (int)pl->pl_width, propstr);
|
||||
else
|
||||
(void) printf("%-*s", (int)pl->pl_width, propstr);
|
||||
}
|
||||
|
||||
(void) printf("\n");
|
||||
(void) putchar('\n');
|
||||
}
|
||||
|
||||
/*
|
||||
@ -6419,7 +6417,7 @@ print_holds(boolean_t scripted, int nwidth, int tagwidth, nvlist_t *nvl)
|
||||
{
|
||||
int i;
|
||||
nvpair_t *nvp = NULL;
|
||||
char *hdr_cols[] = { "NAME", "TAG", "TIMESTAMP" };
|
||||
const char *const hdr_cols[] = { "NAME", "TAG", "TIMESTAMP" };
|
||||
const char *col;
|
||||
|
||||
if (!scripted) {
|
||||
@ -6440,7 +6438,7 @@ print_holds(boolean_t scripted, int nwidth, int tagwidth, nvlist_t *nvl)
|
||||
(void) nvpair_value_nvlist(nvp, &nvl2);
|
||||
while ((nvp2 = nvlist_next_nvpair(nvl2, nvp2)) != NULL) {
|
||||
char tsbuf[DATETIME_BUF_LEN];
|
||||
char *tagname = nvpair_name(nvp2);
|
||||
const char *tagname = nvpair_name(nvp2);
|
||||
uint64_t val = 0;
|
||||
time_t time;
|
||||
struct tm t;
|
||||
@ -6607,7 +6605,7 @@ typedef struct get_all_state {
|
||||
static int
|
||||
get_one_dataset(zfs_handle_t *zhp, void *data)
|
||||
{
|
||||
static char *spin[] = { "-", "\\", "|", "/" };
|
||||
static const char *const spin[] = { "-", "\\", "|", "/" };
|
||||
static int spinval = 0;
|
||||
static int spincheck = 0;
|
||||
static time_t last_spin_time = (time_t)0;
|
||||
@ -6893,10 +6891,7 @@ share_mount_one(zfs_handle_t *zhp, int op, int flags, enum sa_protocol protocol,
|
||||
break;
|
||||
|
||||
case OP_MOUNT:
|
||||
if (options == NULL)
|
||||
mnt.mnt_mntopts = "";
|
||||
else
|
||||
mnt.mnt_mntopts = (char *)options;
|
||||
mnt.mnt_mntopts = (char *)(options ?: "");
|
||||
|
||||
if (!hasmntopt(&mnt, MNTOPT_REMOUNT) &&
|
||||
zfs_is_mounted(zhp, NULL)) {
|
||||
@ -7616,7 +7611,7 @@ zfs_do_unshare(int argc, char **argv)
|
||||
}
|
||||
|
||||
static int
|
||||
find_command_idx(char *command, int *idx)
|
||||
find_command_idx(const char *command, int *idx)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -7881,7 +7876,6 @@ static int
|
||||
zfs_do_channel_program(int argc, char **argv)
|
||||
{
|
||||
int ret, fd, c;
|
||||
char *progbuf, *filename, *poolname;
|
||||
size_t progsize, progread;
|
||||
nvlist_t *outnvl = NULL;
|
||||
uint64_t instrlimit = ZCP_DEFAULT_INSTRLIMIT;
|
||||
@ -7938,8 +7932,8 @@ zfs_do_channel_program(int argc, char **argv)
|
||||
goto usage;
|
||||
}
|
||||
|
||||
poolname = argv[0];
|
||||
filename = argv[1];
|
||||
const char *poolname = argv[0];
|
||||
const char *filename = argv[1];
|
||||
if (strcmp(filename, "-") == 0) {
|
||||
fd = 0;
|
||||
filename = "standard input";
|
||||
@ -7964,7 +7958,7 @@ zfs_do_channel_program(int argc, char **argv)
|
||||
*/
|
||||
progread = 0;
|
||||
progsize = 1024;
|
||||
progbuf = safe_malloc(progsize);
|
||||
char *progbuf = safe_malloc(progsize);
|
||||
do {
|
||||
ret = read(fd, progbuf + progread, progsize - progread);
|
||||
progread += ret;
|
||||
@ -8010,14 +8004,17 @@ zfs_do_channel_program(int argc, char **argv)
|
||||
* exists. Otherwise, generate an appropriate error message,
|
||||
* falling back on strerror() for an unexpected return code.
|
||||
*/
|
||||
char *errstring = NULL;
|
||||
const char *errstring = NULL;
|
||||
const char *msg = gettext("Channel program execution failed");
|
||||
uint64_t instructions = 0;
|
||||
if (outnvl != NULL && nvlist_exists(outnvl, ZCP_RET_ERROR)) {
|
||||
char *es = NULL;
|
||||
(void) nvlist_lookup_string(outnvl,
|
||||
ZCP_RET_ERROR, &errstring);
|
||||
if (errstring == NULL)
|
||||
ZCP_RET_ERROR, &es);
|
||||
if (es == NULL)
|
||||
errstring = strerror(ret);
|
||||
else
|
||||
errstring = es;
|
||||
if (ret == ETIME) {
|
||||
(void) nvlist_lookup_uint64(outnvl,
|
||||
ZCP_ARG_INSTRLIMIT, &instructions);
|
||||
@ -8601,7 +8598,7 @@ main(int argc, char **argv)
|
||||
{
|
||||
int ret = 0;
|
||||
int i = 0;
|
||||
char *cmdname;
|
||||
const char *cmdname;
|
||||
char **newargv;
|
||||
|
||||
(void) setlocale(LC_ALL, "");
|
||||
|
@ -207,7 +207,6 @@ static int
|
||||
zfs_project_handle_dir(const char *name, zfs_project_control_t *zpc,
|
||||
list_t *head)
|
||||
{
|
||||
char fullname[PATH_MAX];
|
||||
struct dirent *ent;
|
||||
DIR *dir;
|
||||
int ret = 0;
|
||||
@ -227,21 +226,28 @@ zfs_project_handle_dir(const char *name, zfs_project_control_t *zpc,
|
||||
zpc->zpc_ignore_noent = B_TRUE;
|
||||
errno = 0;
|
||||
while (!ret && (ent = readdir(dir)) != NULL) {
|
||||
char *fullname;
|
||||
|
||||
/* skip "." and ".." */
|
||||
if (strcmp(ent->d_name, ".") == 0 ||
|
||||
strcmp(ent->d_name, "..") == 0)
|
||||
continue;
|
||||
|
||||
if (strlen(ent->d_name) + strlen(name) >=
|
||||
sizeof (fullname) + 1) {
|
||||
if (strlen(ent->d_name) + strlen(name) + 1 >= PATH_MAX) {
|
||||
errno = ENAMETOOLONG;
|
||||
break;
|
||||
}
|
||||
|
||||
sprintf(fullname, "%s/%s", name, ent->d_name);
|
||||
if (asprintf(&fullname, "%s/%s", name, ent->d_name) == -1) {
|
||||
errno = ENOMEM;
|
||||
break;
|
||||
}
|
||||
|
||||
ret = zfs_project_handle_one(fullname, zpc);
|
||||
if (!ret && zpc->zpc_recursive && ent->d_type == DT_DIR)
|
||||
zfs_project_item_alloc(head, fullname);
|
||||
|
||||
free(fullname);
|
||||
}
|
||||
|
||||
if (errno && !ret) {
|
||||
|
@ -88,7 +88,7 @@ usage(void)
|
||||
|
||||
|
||||
static __attribute__((format(printf, 3, 4))) __attribute__((noreturn)) void
|
||||
fatal(spa_t *spa, void *tag, const char *fmt, ...)
|
||||
fatal(spa_t *spa, const void *tag, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@ -166,7 +166,7 @@ zhack_import(char *target, boolean_t readonly)
|
||||
}
|
||||
|
||||
static void
|
||||
zhack_spa_open(char *target, boolean_t readonly, void *tag, spa_t **spa)
|
||||
zhack_spa_open(char *target, boolean_t readonly, const void *tag, spa_t **spa)
|
||||
{
|
||||
int err;
|
||||
|
||||
|
@ -442,9 +442,8 @@ static void
|
||||
vdev_run_cmd(vdev_cmd_data_t *data, char *cmd)
|
||||
{
|
||||
int rc;
|
||||
char *argv[2] = {cmd, 0};
|
||||
char *env[5] = {"PATH=/bin:/sbin:/usr/bin:/usr/sbin", NULL, NULL, NULL,
|
||||
NULL};
|
||||
char *argv[2] = {cmd};
|
||||
char *env[5] = {(char *)"PATH=/bin:/sbin:/usr/bin:/usr/sbin"};
|
||||
char **lines = NULL;
|
||||
int lines_cnt = 0;
|
||||
int i;
|
||||
|
@ -711,7 +711,7 @@ print_vdev_tree(zpool_handle_t *zhp, const char *name, nvlist_t *nv, int indent,
|
||||
|
||||
for (c = 0; c < children; c++) {
|
||||
uint64_t is_log = B_FALSE, is_hole = B_FALSE;
|
||||
char *class = "";
|
||||
char *class = (char *)"";
|
||||
|
||||
(void) nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_HOLE,
|
||||
&is_hole);
|
||||
@ -723,7 +723,7 @@ print_vdev_tree(zpool_handle_t *zhp, const char *name, nvlist_t *nv, int indent,
|
||||
(void) nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_LOG,
|
||||
&is_log);
|
||||
if (is_log)
|
||||
class = VDEV_ALLOC_BIAS_LOG;
|
||||
class = (char *)VDEV_ALLOC_BIAS_LOG;
|
||||
(void) nvlist_lookup_string(child[c],
|
||||
ZPOOL_CONFIG_ALLOCATION_BIAS, &class);
|
||||
if (strcmp(match, class) != 0)
|
||||
@ -804,7 +804,7 @@ prop_list_contains_feature(nvlist_t *proplist)
|
||||
* Add a property pair (name, string-value) into a property nvlist.
|
||||
*/
|
||||
static int
|
||||
add_prop_list(const char *propname, char *propval, nvlist_t **props,
|
||||
add_prop_list(const char *propname, const char *propval, nvlist_t **props,
|
||||
boolean_t poolprop)
|
||||
{
|
||||
zpool_prop_t prop = ZPOOL_PROP_INVAL;
|
||||
@ -905,7 +905,8 @@ add_prop_list(const char *propname, char *propval, nvlist_t **props,
|
||||
* Set a default property pair (name, string-value) in a property nvlist
|
||||
*/
|
||||
static int
|
||||
add_prop_list_default(const char *propname, char *propval, nvlist_t **props)
|
||||
add_prop_list_default(const char *propname, const char *propval,
|
||||
nvlist_t **props)
|
||||
{
|
||||
char *pval;
|
||||
|
||||
@ -2069,15 +2070,13 @@ typedef struct status_cbdata {
|
||||
} status_cbdata_t;
|
||||
|
||||
/* Return 1 if string is NULL, empty, or whitespace; return 0 otherwise. */
|
||||
static int
|
||||
is_blank_str(char *str)
|
||||
static boolean_t
|
||||
is_blank_str(const char *str)
|
||||
{
|
||||
while (str != NULL && *str != '\0') {
|
||||
for (; str != NULL && *str != '\0'; ++str)
|
||||
if (!isblank(*str))
|
||||
return (0);
|
||||
str++;
|
||||
}
|
||||
return (1);
|
||||
return (B_FALSE);
|
||||
return (B_TRUE);
|
||||
}
|
||||
|
||||
/* Print command output lines for specific vdev in a specific pool */
|
||||
@ -2086,7 +2085,7 @@ zpool_print_cmd(vdev_cmd_data_list_t *vcdl, const char *pool, char *path)
|
||||
{
|
||||
vdev_cmd_data_t *data;
|
||||
int i, j;
|
||||
char *val;
|
||||
const char *val;
|
||||
|
||||
for (i = 0; i < vcdl->count; i++) {
|
||||
if ((strcmp(vcdl->data[i].path, path) != 0) ||
|
||||
@ -2117,17 +2116,17 @@ zpool_print_cmd(vdev_cmd_data_list_t *vcdl, const char *pool, char *path)
|
||||
|
||||
printf("%*s", vcdl->uniq_cols_width[j], val);
|
||||
if (j < vcdl->uniq_cols_cnt - 1)
|
||||
printf(" ");
|
||||
fputs(" ", stdout);
|
||||
}
|
||||
|
||||
/* Print out any values that aren't in a column at the end */
|
||||
for (j = data->cols_cnt; j < data->lines_cnt; j++) {
|
||||
/* Did we have any columns? If so print a spacer. */
|
||||
if (vcdl->uniq_cols_cnt > 0)
|
||||
printf(" ");
|
||||
fputs(" ", stdout);
|
||||
|
||||
val = data->lines[j];
|
||||
printf("%s", val ? val : "");
|
||||
fputs(val ?: "", stdout);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -2240,7 +2239,7 @@ print_status_trim(vdev_stat_t *vs, boolean_t verbose)
|
||||
* Return the color associated with a health string. This includes returning
|
||||
* NULL for no color change.
|
||||
*/
|
||||
static char *
|
||||
static const char *
|
||||
health_str_to_color(const char *health)
|
||||
{
|
||||
if (strcmp(health, gettext("FAULTED")) == 0 ||
|
||||
@ -2276,7 +2275,7 @@ print_status_config(zpool_handle_t *zhp, status_cbdata_t *cb, const char *name,
|
||||
const char *state;
|
||||
char *type;
|
||||
char *path = NULL;
|
||||
char *rcolor = NULL, *wcolor = NULL, *ccolor = NULL;
|
||||
const char *rcolor = NULL, *wcolor = NULL, *ccolor = NULL;
|
||||
|
||||
if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN,
|
||||
&child, &children) != 0)
|
||||
@ -2318,13 +2317,13 @@ print_status_config(zpool_handle_t *zhp, status_cbdata_t *cb, const char *name,
|
||||
ccolor = ANSI_RED;
|
||||
|
||||
if (cb->cb_literal) {
|
||||
printf(" ");
|
||||
fputc(' ', stdout);
|
||||
printf_color(rcolor, "%5llu",
|
||||
(u_longlong_t)vs->vs_read_errors);
|
||||
printf(" ");
|
||||
fputc(' ', stdout);
|
||||
printf_color(wcolor, "%5llu",
|
||||
(u_longlong_t)vs->vs_write_errors);
|
||||
printf(" ");
|
||||
fputc(' ', stdout);
|
||||
printf_color(ccolor, "%5llu",
|
||||
(u_longlong_t)vs->vs_checksum_errors);
|
||||
} else {
|
||||
@ -2332,11 +2331,11 @@ print_status_config(zpool_handle_t *zhp, status_cbdata_t *cb, const char *name,
|
||||
zfs_nicenum(vs->vs_write_errors, wbuf, sizeof (wbuf));
|
||||
zfs_nicenum(vs->vs_checksum_errors, cbuf,
|
||||
sizeof (cbuf));
|
||||
printf(" ");
|
||||
fputc(' ', stdout);
|
||||
printf_color(rcolor, "%5s", rbuf);
|
||||
printf(" ");
|
||||
fputc(' ', stdout);
|
||||
printf_color(wcolor, "%5s", wbuf);
|
||||
printf(" ");
|
||||
fputc(' ', stdout);
|
||||
printf_color(ccolor, "%5s", cbuf);
|
||||
}
|
||||
if (cb->cb_print_slow_ios) {
|
||||
@ -2671,7 +2670,7 @@ print_class_vdevs(zpool_handle_t *zhp, status_cbdata_t *cb, nvlist_t *nv,
|
||||
&is_log);
|
||||
|
||||
if (is_log) {
|
||||
bias = VDEV_ALLOC_CLASS_LOGS;
|
||||
bias = (char *)VDEV_ALLOC_CLASS_LOGS;
|
||||
} else {
|
||||
(void) nvlist_lookup_string(child[c],
|
||||
ZPOOL_CONFIG_ALLOCATION_BIAS, &bias);
|
||||
@ -2711,8 +2710,8 @@ show_import(nvlist_t *config, boolean_t report_error)
|
||||
char *name;
|
||||
uint64_t guid;
|
||||
uint64_t hostid = 0;
|
||||
char *msgid;
|
||||
char *hostname = "unknown";
|
||||
const char *msgid;
|
||||
const char *hostname = "unknown";
|
||||
nvlist_t *nvroot, *nvinfo;
|
||||
zpool_status_t reason;
|
||||
zpool_errata_t errata;
|
||||
@ -3252,7 +3251,7 @@ import_pools(nvlist_t *pools, nvlist_t *props, char *mntopts, int flags,
|
||||
if (first)
|
||||
first = B_FALSE;
|
||||
else if (!do_all)
|
||||
(void) putchar('\n');
|
||||
(void) fputc('\n', stdout);
|
||||
|
||||
if (do_all) {
|
||||
err |= do_import(config, NULL, mntopts,
|
||||
@ -4848,7 +4847,7 @@ print_vdev_stats(zpool_handle_t *zhp, const char *name, nvlist_t *oldnv,
|
||||
(void) nvlist_lookup_uint64(newchild[c],
|
||||
ZPOOL_CONFIG_IS_LOG, &islog);
|
||||
if (islog) {
|
||||
bias = VDEV_ALLOC_CLASS_LOGS;
|
||||
bias = (char *)VDEV_ALLOC_CLASS_LOGS;
|
||||
} else {
|
||||
(void) nvlist_lookup_string(newchild[c],
|
||||
ZPOOL_CONFIG_ALLOCATION_BIAS, &bias);
|
||||
@ -5382,7 +5381,7 @@ terminal_height(void)
|
||||
static void
|
||||
print_zpool_script_help(char *name, char *path)
|
||||
{
|
||||
char *argv[] = {path, "-h", NULL};
|
||||
char *argv[] = {path, (char *)"-h", NULL};
|
||||
char **lines = NULL;
|
||||
int lines_cnt = 0;
|
||||
int rc;
|
||||
@ -5434,7 +5433,7 @@ print_zpool_dir_scripts(char *dirpath)
|
||||
* Print out help text for all zpool status/iostat -c scripts.
|
||||
*/
|
||||
static void
|
||||
print_zpool_script_list(char *subcommand)
|
||||
print_zpool_script_list(const char *subcommand)
|
||||
{
|
||||
char *dir, *sp, *tmp;
|
||||
|
||||
@ -5979,7 +5978,7 @@ print_pool(zpool_handle_t *zhp, list_cbdata_t *cb)
|
||||
zprop_list_t *pl = cb->cb_proplist;
|
||||
boolean_t first = B_TRUE;
|
||||
char property[ZPOOL_MAXPROPLEN];
|
||||
char *propstr;
|
||||
const char *propstr;
|
||||
boolean_t right_justify;
|
||||
size_t width;
|
||||
|
||||
@ -6214,7 +6213,7 @@ print_list_stats(zpool_handle_t *zhp, const char *name, nvlist_t *nv,
|
||||
|
||||
if (nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_LOG,
|
||||
&islog) == 0 && islog) {
|
||||
bias = VDEV_ALLOC_CLASS_LOGS;
|
||||
bias = (char *)VDEV_ALLOC_CLASS_LOGS;
|
||||
} else {
|
||||
(void) nvlist_lookup_string(child[c],
|
||||
ZPOOL_CONFIG_ALLOCATION_BIAS, &bias);
|
||||
@ -8118,7 +8117,7 @@ status_callback(zpool_handle_t *zhp, void *data)
|
||||
{
|
||||
status_cbdata_t *cbp = data;
|
||||
nvlist_t *config, *nvroot;
|
||||
char *msgid;
|
||||
const char *msgid;
|
||||
zpool_status_t reason;
|
||||
zpool_errata_t errata;
|
||||
const char *health;
|
||||
@ -8163,12 +8162,12 @@ status_callback(zpool_handle_t *zhp, void *data)
|
||||
printf(" ");
|
||||
printf_color(ANSI_BOLD, gettext("pool:"));
|
||||
printf(" %s\n", zpool_get_name(zhp));
|
||||
printf(" ");
|
||||
fputc(' ', stdout);
|
||||
printf_color(ANSI_BOLD, gettext("state: "));
|
||||
|
||||
printf_color(health_str_to_color(health), "%s", health);
|
||||
|
||||
printf("\n");
|
||||
fputc('\n', stdout);
|
||||
|
||||
switch (reason) {
|
||||
case ZPOOL_STATUS_MISSING_DEV_R:
|
||||
@ -10485,8 +10484,8 @@ print_wait_status_row(wait_data_t *wd, zpool_handle_t *zhp, int row)
|
||||
pool_checkpoint_stat_t *pcs = NULL;
|
||||
pool_scan_stat_t *pss = NULL;
|
||||
pool_removal_stat_t *prs = NULL;
|
||||
char *headers[] = {"DISCARD", "FREE", "INITIALIZE", "REPLACE",
|
||||
"REMOVE", "RESILVER", "SCRUB", "TRIM"};
|
||||
const char *const headers[] = {"DISCARD", "FREE", "INITIALIZE",
|
||||
"REPLACE", "REMOVE", "RESILVER", "SCRUB", "TRIM"};
|
||||
int col_widths[ZPOOL_WAIT_NUM_ACTIVITIES];
|
||||
|
||||
/* Calculate the width of each column */
|
||||
@ -10508,7 +10507,7 @@ print_wait_status_row(wait_data_t *wd, zpool_handle_t *zhp, int row)
|
||||
if (wd->wd_enabled[i])
|
||||
(void) printf("%*s", col_widths[i], headers[i]);
|
||||
}
|
||||
(void) printf("\n");
|
||||
(void) fputc('\n', stdout);
|
||||
}
|
||||
|
||||
/* Bytes of work remaining in each activity */
|
||||
@ -10795,11 +10794,9 @@ found:;
|
||||
}
|
||||
|
||||
static int
|
||||
find_command_idx(char *command, int *idx)
|
||||
find_command_idx(const char *command, int *idx)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NCOMMAND; i++) {
|
||||
for (int i = 0; i < NCOMMAND; ++i) {
|
||||
if (command_table[i].name == NULL)
|
||||
continue;
|
||||
|
||||
|
@ -274,7 +274,7 @@ make_leaf_vdev(nvlist_t *props, const char *arg, boolean_t is_primary)
|
||||
char path[MAXPATHLEN];
|
||||
struct stat64 statbuf;
|
||||
nvlist_t *vdev = NULL;
|
||||
char *type = NULL;
|
||||
const char *type = NULL;
|
||||
boolean_t wholedisk = B_FALSE;
|
||||
uint64_t ashift = 0;
|
||||
int err;
|
||||
|
@ -90,7 +90,7 @@ char metric_data_type = 'u';
|
||||
uint64_t metric_value_mask = UINT64_MAX;
|
||||
uint64_t timestamp = 0;
|
||||
int complained_about_sync = 0;
|
||||
char *tags = "";
|
||||
const char *tags = "";
|
||||
|
||||
typedef int (*stat_printer_f)(nvlist_t *, const char *, const char *);
|
||||
|
||||
@ -131,7 +131,7 @@ escape_string(const char *s)
|
||||
* print key=value where value is a uint64_t
|
||||
*/
|
||||
static void
|
||||
print_kv(char *key, uint64_t value)
|
||||
print_kv(const char *key, uint64_t value)
|
||||
{
|
||||
printf("%s=%llu%c", key,
|
||||
(u_longlong_t)value & metric_value_mask, metric_data_type);
|
||||
@ -152,9 +152,9 @@ print_scan_status(nvlist_t *nvroot, const char *pool_name)
|
||||
uint64_t remaining_time;
|
||||
pool_scan_stat_t *ps = NULL;
|
||||
double pct_done;
|
||||
char *state[DSS_NUM_STATES] = {
|
||||
const char *const state[DSS_NUM_STATES] = {
|
||||
"none", "scanning", "finished", "canceled"};
|
||||
char *func;
|
||||
const char *func;
|
||||
|
||||
(void) nvlist_lookup_uint64_array(nvroot,
|
||||
ZPOOL_CONFIG_SCAN_STATS,
|
||||
@ -262,17 +262,15 @@ static char *
|
||||
get_vdev_name(nvlist_t *nvroot, const char *parent_name)
|
||||
{
|
||||
static char vdev_name[256];
|
||||
char *vdev_type = NULL;
|
||||
uint64_t vdev_id = 0;
|
||||
|
||||
if (nvlist_lookup_string(nvroot, ZPOOL_CONFIG_TYPE,
|
||||
&vdev_type) != 0) {
|
||||
vdev_type = "unknown";
|
||||
}
|
||||
char *vdev_type = (char *)"unknown";
|
||||
nvlist_lookup_string(nvroot, ZPOOL_CONFIG_TYPE, &vdev_type);
|
||||
|
||||
if (nvlist_lookup_uint64(
|
||||
nvroot, ZPOOL_CONFIG_ID, &vdev_id) != 0) {
|
||||
nvroot, ZPOOL_CONFIG_ID, &vdev_id) != 0)
|
||||
vdev_id = UINT64_MAX;
|
||||
}
|
||||
|
||||
if (parent_name == NULL) {
|
||||
(void) snprintf(vdev_name, sizeof (vdev_name), "%s",
|
||||
vdev_type);
|
||||
@ -298,22 +296,15 @@ static char *
|
||||
get_vdev_desc(nvlist_t *nvroot, const char *parent_name)
|
||||
{
|
||||
static char vdev_desc[2 * MAXPATHLEN];
|
||||
char *vdev_type = NULL;
|
||||
uint64_t vdev_id = 0;
|
||||
char vdev_value[MAXPATHLEN];
|
||||
char *vdev_path = NULL;
|
||||
char *s, *t;
|
||||
|
||||
if (nvlist_lookup_string(nvroot, ZPOOL_CONFIG_TYPE, &vdev_type) != 0) {
|
||||
vdev_type = "unknown";
|
||||
}
|
||||
if (nvlist_lookup_uint64(nvroot, ZPOOL_CONFIG_ID, &vdev_id) != 0) {
|
||||
vdev_id = UINT64_MAX;
|
||||
}
|
||||
if (nvlist_lookup_string(
|
||||
nvroot, ZPOOL_CONFIG_PATH, &vdev_path) != 0) {
|
||||
vdev_path = NULL;
|
||||
}
|
||||
char *vdev_type = (char *)"unknown";
|
||||
uint64_t vdev_id = UINT64_MAX;
|
||||
char *vdev_path = NULL;
|
||||
nvlist_lookup_string(nvroot, ZPOOL_CONFIG_TYPE, &vdev_type);
|
||||
nvlist_lookup_uint64(nvroot, ZPOOL_CONFIG_ID, &vdev_id);
|
||||
nvlist_lookup_string(nvroot, ZPOOL_CONFIG_PATH, &vdev_path);
|
||||
|
||||
if (parent_name == NULL) {
|
||||
s = escape_string(vdev_type);
|
||||
@ -393,8 +384,8 @@ print_vdev_latency_stats(nvlist_t *nvroot, const char *pool_name,
|
||||
|
||||
/* short_names become part of the metric name and are influxdb-ready */
|
||||
struct lat_lookup {
|
||||
char *name;
|
||||
char *short_name;
|
||||
const char *name;
|
||||
const char *short_name;
|
||||
uint64_t sum;
|
||||
uint64_t *array;
|
||||
};
|
||||
@ -487,8 +478,8 @@ print_vdev_size_stats(nvlist_t *nvroot, const char *pool_name,
|
||||
|
||||
/* short_names become the field name */
|
||||
struct size_lookup {
|
||||
char *name;
|
||||
char *short_name;
|
||||
const char *name;
|
||||
const char *short_name;
|
||||
uint64_t sum;
|
||||
uint64_t *array;
|
||||
};
|
||||
@ -579,8 +570,8 @@ print_queue_stats(nvlist_t *nvroot, const char *pool_name,
|
||||
|
||||
/* short_names are used for the field name */
|
||||
struct queue_lookup {
|
||||
char *name;
|
||||
char *short_name;
|
||||
const char *name;
|
||||
const char *short_name;
|
||||
};
|
||||
struct queue_lookup queue_type[] = {
|
||||
{ZPOOL_CONFIG_VDEV_SYNC_R_ACTIVE_QUEUE, "sync_r_active"},
|
||||
@ -632,8 +623,8 @@ print_top_level_vdev_stats(nvlist_t *nvroot, const char *pool_name)
|
||||
|
||||
/* short_names become part of the metric name */
|
||||
struct queue_lookup {
|
||||
char *name;
|
||||
char *short_name;
|
||||
const char *name;
|
||||
const char *short_name;
|
||||
};
|
||||
struct queue_lookup queue_type[] = {
|
||||
{ZPOOL_CONFIG_VDEV_SYNC_R_ACTIVE_QUEUE, "sync_r_active_queue"},
|
||||
@ -789,7 +780,7 @@ main(int argc, char *argv[])
|
||||
{
|
||||
int opt;
|
||||
int ret = 8;
|
||||
char *line = NULL;
|
||||
char *line = NULL, *ttags = NULL;
|
||||
size_t len, tagslen = 0;
|
||||
struct option long_options[] = {
|
||||
{"execd", no_argument, NULL, 'e'},
|
||||
@ -817,15 +808,17 @@ main(int argc, char *argv[])
|
||||
sum_histogram_buckets = 1;
|
||||
break;
|
||||
case 't':
|
||||
free(ttags);
|
||||
tagslen = strlen(optarg) + 2;
|
||||
tags = calloc(1, tagslen);
|
||||
if (tags == NULL) {
|
||||
ttags = calloc(1, tagslen);
|
||||
if (ttags == NULL) {
|
||||
fprintf(stderr,
|
||||
"error: cannot allocate memory "
|
||||
"for tags\n");
|
||||
exit(1);
|
||||
}
|
||||
(void) snprintf(tags, tagslen, ",%s", optarg);
|
||||
(void) snprintf(ttags, tagslen, ",%s", optarg);
|
||||
tags = ttags;
|
||||
break;
|
||||
default:
|
||||
usage(argv[0]);
|
||||
|
@ -4,6 +4,7 @@ CPPCHECKTARGETS += zstream
|
||||
zstream_SOURCES = \
|
||||
%D%/zstream.c \
|
||||
%D%/zstream.h \
|
||||
%D%/zstream_decompress.c \
|
||||
%D%/zstream_dump.c \
|
||||
%D%/zstream_redup.c \
|
||||
%D%/zstream_token.c
|
||||
@ -11,6 +12,7 @@ zstream_SOURCES = \
|
||||
zstream_LDADD = \
|
||||
libzfs.la \
|
||||
libzfs_core.la \
|
||||
libzpool.la \
|
||||
libnvpair.la
|
||||
|
||||
PHONY += install-exec-hook
|
||||
|
@ -40,6 +40,8 @@ zstream_usage(void)
|
||||
"\tzstream dump [-vCd] FILE\n"
|
||||
"\t... | zstream dump [-vCd]\n"
|
||||
"\n"
|
||||
"\tzstream decompress [-v] [OBJECT,OFFSET[,TYPE]] ...\n"
|
||||
"\n"
|
||||
"\tzstream token resume_token\n"
|
||||
"\n"
|
||||
"\tzstream redup [-v] FILE | ...\n");
|
||||
@ -61,6 +63,8 @@ main(int argc, char *argv[])
|
||||
|
||||
if (strcmp(subcommand, "dump") == 0) {
|
||||
return (zstream_do_dump(argc - 1, argv + 1));
|
||||
} else if (strcmp(subcommand, "decompress") == 0) {
|
||||
return (zstream_do_decompress(argc - 1, argv + 1));
|
||||
} else if (strcmp(subcommand, "token") == 0) {
|
||||
return (zstream_do_token(argc - 1, argv + 1));
|
||||
} else if (strcmp(subcommand, "redup") == 0) {
|
||||
|
@ -24,8 +24,12 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void *safe_calloc(size_t n);
|
||||
extern int sfread(void *buf, size_t size, FILE *fp);
|
||||
extern void *safe_malloc(size_t size);
|
||||
extern int zstream_do_redup(int, char *[]);
|
||||
extern int zstream_do_dump(int, char *[]);
|
||||
extern int zstream_do_decompress(int argc, char *argv[]);
|
||||
extern int zstream_do_token(int, char *[]);
|
||||
extern void zstream_usage(void);
|
||||
|
||||
|
359
sys/contrib/openzfs/cmd/zstream/zstream_decompress.c
Normal file
359
sys/contrib/openzfs/cmd/zstream/zstream_decompress.c
Normal file
@ -0,0 +1,359 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2022 Axcient. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#include <err.h>
|
||||
#include <search.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/zfs_ioctl.h>
|
||||
#include <sys/zio_checksum.h>
|
||||
#include <sys/zstd/zstd.h>
|
||||
#include "zfs_fletcher.h"
|
||||
#include "zstream.h"
|
||||
|
||||
static int
|
||||
dump_record(dmu_replay_record_t *drr, void *payload, int payload_len,
|
||||
zio_cksum_t *zc, int outfd)
|
||||
{
|
||||
assert(offsetof(dmu_replay_record_t, drr_u.drr_checksum.drr_checksum)
|
||||
== sizeof (dmu_replay_record_t) - sizeof (zio_cksum_t));
|
||||
fletcher_4_incremental_native(drr,
|
||||
offsetof(dmu_replay_record_t, drr_u.drr_checksum.drr_checksum), zc);
|
||||
if (drr->drr_type != DRR_BEGIN) {
|
||||
assert(ZIO_CHECKSUM_IS_ZERO(&drr->drr_u.
|
||||
drr_checksum.drr_checksum));
|
||||
drr->drr_u.drr_checksum.drr_checksum = *zc;
|
||||
}
|
||||
fletcher_4_incremental_native(&drr->drr_u.drr_checksum.drr_checksum,
|
||||
sizeof (zio_cksum_t), zc);
|
||||
if (write(outfd, drr, sizeof (*drr)) == -1)
|
||||
return (errno);
|
||||
if (payload_len != 0) {
|
||||
fletcher_4_incremental_native(payload, payload_len, zc);
|
||||
if (write(outfd, payload, payload_len) == -1)
|
||||
return (errno);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
zstream_do_decompress(int argc, char *argv[])
|
||||
{
|
||||
const int KEYSIZE = 64;
|
||||
int bufsz = SPA_MAXBLOCKSIZE;
|
||||
char *buf = safe_malloc(bufsz);
|
||||
dmu_replay_record_t thedrr;
|
||||
dmu_replay_record_t *drr = &thedrr;
|
||||
zio_cksum_t stream_cksum;
|
||||
int c;
|
||||
boolean_t verbose = B_FALSE;
|
||||
|
||||
while ((c = getopt(argc, argv, "v")) != -1) {
|
||||
switch (c) {
|
||||
case 'v':
|
||||
verbose = B_TRUE;
|
||||
break;
|
||||
case '?':
|
||||
(void) fprintf(stderr, "invalid option '%c'\n",
|
||||
optopt);
|
||||
zstream_usage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (argc < 0)
|
||||
zstream_usage();
|
||||
|
||||
if (hcreate(argc) == 0)
|
||||
errx(1, "hcreate");
|
||||
for (int i = 0; i < argc; i++) {
|
||||
uint64_t object, offset;
|
||||
char *obj_str;
|
||||
char *offset_str;
|
||||
char *key;
|
||||
char *end;
|
||||
enum zio_compress type = ZIO_COMPRESS_LZ4;
|
||||
|
||||
obj_str = strsep(&argv[i], ",");
|
||||
if (argv[i] == NULL) {
|
||||
zstream_usage();
|
||||
exit(2);
|
||||
}
|
||||
errno = 0;
|
||||
object = strtoull(obj_str, &end, 0);
|
||||
if (errno || *end != '\0')
|
||||
errx(1, "invalid value for object");
|
||||
offset_str = strsep(&argv[i], ",");
|
||||
offset = strtoull(offset_str, &end, 0);
|
||||
if (errno || *end != '\0')
|
||||
errx(1, "invalid value for offset");
|
||||
if (argv[i]) {
|
||||
if (0 == strcmp("lz4", argv[i]))
|
||||
type = ZIO_COMPRESS_LZ4;
|
||||
else if (0 == strcmp("lzjb", argv[i]))
|
||||
type = ZIO_COMPRESS_LZJB;
|
||||
else if (0 == strcmp("gzip", argv[i]))
|
||||
type = ZIO_COMPRESS_GZIP_1;
|
||||
else if (0 == strcmp("zle", argv[i]))
|
||||
type = ZIO_COMPRESS_ZLE;
|
||||
else if (0 == strcmp("zstd", argv[i]))
|
||||
type = ZIO_COMPRESS_ZSTD;
|
||||
else {
|
||||
fprintf(stderr, "Invalid compression type %s.\n"
|
||||
"Supported types are lz4, lzjb, gzip, zle, "
|
||||
"and zstd\n",
|
||||
argv[i]);
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
if (asprintf(&key, "%llu,%llu", (u_longlong_t)object,
|
||||
(u_longlong_t)offset) < 0) {
|
||||
err(1, "asprintf");
|
||||
}
|
||||
ENTRY e = {.key = key};
|
||||
ENTRY *p;
|
||||
|
||||
p = hsearch(e, ENTER);
|
||||
if (p == NULL)
|
||||
errx(1, "hsearch");
|
||||
p->data = (void*)type;
|
||||
}
|
||||
|
||||
if (isatty(STDIN_FILENO)) {
|
||||
(void) fprintf(stderr,
|
||||
"Error: The send stream is a binary format "
|
||||
"and can not be read from a\n"
|
||||
"terminal. Standard input must be redirected.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fletcher_4_init();
|
||||
while (sfread(drr, sizeof (*drr), stdin) != 0) {
|
||||
struct drr_write *drrw;
|
||||
uint64_t payload_size = 0;
|
||||
|
||||
/*
|
||||
* We need to regenerate the checksum.
|
||||
*/
|
||||
if (drr->drr_type != DRR_BEGIN) {
|
||||
memset(&drr->drr_u.drr_checksum.drr_checksum, 0,
|
||||
sizeof (drr->drr_u.drr_checksum.drr_checksum));
|
||||
}
|
||||
|
||||
switch (drr->drr_type) {
|
||||
case DRR_BEGIN:
|
||||
{
|
||||
ZIO_SET_CHECKSUM(&stream_cksum, 0, 0, 0, 0);
|
||||
|
||||
int sz = drr->drr_payloadlen;
|
||||
if (sz != 0) {
|
||||
if (sz > bufsz) {
|
||||
buf = realloc(buf, sz);
|
||||
if (buf == NULL)
|
||||
err(1, "realloc");
|
||||
bufsz = sz;
|
||||
}
|
||||
(void) sfread(buf, sz, stdin);
|
||||
}
|
||||
payload_size = sz;
|
||||
break;
|
||||
}
|
||||
case DRR_END:
|
||||
{
|
||||
struct drr_end *drre = &drr->drr_u.drr_end;
|
||||
/*
|
||||
* Use the recalculated checksum, unless this is
|
||||
* the END record of a stream package, which has
|
||||
* no checksum.
|
||||
*/
|
||||
if (!ZIO_CHECKSUM_IS_ZERO(&drre->drr_checksum))
|
||||
drre->drr_checksum = stream_cksum;
|
||||
break;
|
||||
}
|
||||
|
||||
case DRR_OBJECT:
|
||||
{
|
||||
struct drr_object *drro = &drr->drr_u.drr_object;
|
||||
|
||||
if (drro->drr_bonuslen > 0) {
|
||||
payload_size = DRR_OBJECT_PAYLOAD_SIZE(drro);
|
||||
(void) sfread(buf, payload_size, stdin);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case DRR_SPILL:
|
||||
{
|
||||
struct drr_spill *drrs = &drr->drr_u.drr_spill;
|
||||
payload_size = DRR_SPILL_PAYLOAD_SIZE(drrs);
|
||||
(void) sfread(buf, payload_size, stdin);
|
||||
break;
|
||||
}
|
||||
|
||||
case DRR_WRITE_BYREF:
|
||||
fprintf(stderr,
|
||||
"Deduplicated streams are not supported\n");
|
||||
exit(1);
|
||||
break;
|
||||
|
||||
case DRR_WRITE:
|
||||
{
|
||||
drrw = &thedrr.drr_u.drr_write;
|
||||
payload_size = DRR_WRITE_PAYLOAD_SIZE(drrw);
|
||||
ENTRY *p;
|
||||
char key[KEYSIZE];
|
||||
|
||||
snprintf(key, KEYSIZE, "%llu,%llu",
|
||||
(u_longlong_t)drrw->drr_object,
|
||||
(u_longlong_t)drrw->drr_offset);
|
||||
ENTRY e = {.key = key};
|
||||
|
||||
p = hsearch(e, FIND);
|
||||
if (p != NULL) {
|
||||
zio_decompress_func_t *xfunc = NULL;
|
||||
switch ((enum zio_compress)(intptr_t)p->data) {
|
||||
case ZIO_COMPRESS_LZJB:
|
||||
xfunc = lzjb_decompress;
|
||||
break;
|
||||
case ZIO_COMPRESS_GZIP_1:
|
||||
xfunc = gzip_decompress;
|
||||
break;
|
||||
case ZIO_COMPRESS_ZLE:
|
||||
xfunc = zle_decompress;
|
||||
break;
|
||||
case ZIO_COMPRESS_LZ4:
|
||||
xfunc = lz4_decompress_zfs;
|
||||
break;
|
||||
case ZIO_COMPRESS_ZSTD:
|
||||
xfunc = zfs_zstd_decompress;
|
||||
break;
|
||||
default:
|
||||
assert(B_FALSE);
|
||||
}
|
||||
assert(xfunc != NULL);
|
||||
|
||||
|
||||
/*
|
||||
* Read and decompress the block
|
||||
*/
|
||||
char *lzbuf = safe_calloc(payload_size);
|
||||
(void) sfread(lzbuf, payload_size, stdin);
|
||||
if (0 != xfunc(lzbuf, buf,
|
||||
payload_size, payload_size, 0)) {
|
||||
/*
|
||||
* The block must not be compressed,
|
||||
* possibly because it gets written
|
||||
* multiple times in this stream.
|
||||
*/
|
||||
warnx("decompression failed for "
|
||||
"ino %llu offset %llu",
|
||||
(u_longlong_t)drrw->drr_object,
|
||||
(u_longlong_t)drrw->drr_offset);
|
||||
memcpy(buf, lzbuf, payload_size);
|
||||
} else if (verbose) {
|
||||
fprintf(stderr, "successfully "
|
||||
"decompressed ino %llu "
|
||||
"offset %llu\n",
|
||||
(u_longlong_t)drrw->drr_object,
|
||||
(u_longlong_t)drrw->drr_offset);
|
||||
}
|
||||
free(lzbuf);
|
||||
} else {
|
||||
/*
|
||||
* Read the contents of the block unaltered
|
||||
*/
|
||||
(void) sfread(buf, payload_size, stdin);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case DRR_WRITE_EMBEDDED:
|
||||
{
|
||||
struct drr_write_embedded *drrwe =
|
||||
&drr->drr_u.drr_write_embedded;
|
||||
payload_size =
|
||||
P2ROUNDUP((uint64_t)drrwe->drr_psize, 8);
|
||||
(void) sfread(buf, payload_size, stdin);
|
||||
break;
|
||||
}
|
||||
|
||||
case DRR_FREEOBJECTS:
|
||||
case DRR_FREE:
|
||||
case DRR_OBJECT_RANGE:
|
||||
break;
|
||||
|
||||
default:
|
||||
(void) fprintf(stderr, "INVALID record type 0x%x\n",
|
||||
drr->drr_type);
|
||||
/* should never happen, so assert */
|
||||
assert(B_FALSE);
|
||||
}
|
||||
|
||||
if (feof(stdout)) {
|
||||
fprintf(stderr, "Error: unexpected end-of-file\n");
|
||||
exit(1);
|
||||
}
|
||||
if (ferror(stdout)) {
|
||||
fprintf(stderr, "Error while reading file: %s\n",
|
||||
strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* We need to recalculate the checksum, and it needs to be
|
||||
* initially zero to do that. BEGIN records don't have
|
||||
* a checksum.
|
||||
*/
|
||||
if (drr->drr_type != DRR_BEGIN) {
|
||||
memset(&drr->drr_u.drr_checksum.drr_checksum, 0,
|
||||
sizeof (drr->drr_u.drr_checksum.drr_checksum));
|
||||
}
|
||||
if (dump_record(drr, buf, payload_size,
|
||||
&stream_cksum, STDOUT_FILENO) != 0)
|
||||
break;
|
||||
if (drr->drr_type == DRR_END) {
|
||||
/*
|
||||
* Typically the END record is either the last
|
||||
* thing in the stream, or it is followed
|
||||
* by a BEGIN record (which also zeros the checksum).
|
||||
* However, a stream package ends with two END
|
||||
* records. The last END record's checksum starts
|
||||
* from zero.
|
||||
*/
|
||||
ZIO_SET_CHECKSUM(&stream_cksum, 0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
free(buf);
|
||||
fletcher_4_fini();
|
||||
hdestroy();
|
||||
|
||||
return (0);
|
||||
}
|
@ -59,7 +59,7 @@ FILE *send_stream = 0;
|
||||
boolean_t do_byteswap = B_FALSE;
|
||||
boolean_t do_cksum = B_TRUE;
|
||||
|
||||
static void *
|
||||
void *
|
||||
safe_malloc(size_t size)
|
||||
{
|
||||
void *rv = malloc(size);
|
||||
|
@ -65,7 +65,7 @@ highbit64(uint64_t i)
|
||||
return (NBBY * sizeof (uint64_t) - __builtin_clzll(i));
|
||||
}
|
||||
|
||||
static void *
|
||||
void *
|
||||
safe_calloc(size_t n)
|
||||
{
|
||||
void *rv = calloc(1, n);
|
||||
@ -81,7 +81,7 @@ safe_calloc(size_t n)
|
||||
/*
|
||||
* Safe version of fread(), exits on error.
|
||||
*/
|
||||
static int
|
||||
int
|
||||
sfread(void *buf, size_t size, FILE *fp)
|
||||
{
|
||||
int rv = fread(buf, size, 1, fp);
|
||||
|
@ -264,7 +264,7 @@ extern unsigned long zfs_reconstruct_indirect_damage_fraction;
|
||||
|
||||
static ztest_shared_opts_t *ztest_shared_opts;
|
||||
static ztest_shared_opts_t ztest_opts;
|
||||
static char *ztest_wkeydata = "abcdefghijklmnopqrstuvwxyz012345";
|
||||
static const char *const ztest_wkeydata = "abcdefghijklmnopqrstuvwxyz012345";
|
||||
|
||||
typedef struct ztest_shared_ds {
|
||||
uint64_t zd_seq;
|
||||
@ -623,10 +623,10 @@ static void sig_handler(int signo)
|
||||
|
||||
#define FATAL_MSG_SZ 1024
|
||||
|
||||
char *fatal_msg;
|
||||
static const char *fatal_msg;
|
||||
|
||||
static __attribute__((format(printf, 2, 3))) __attribute__((noreturn)) void
|
||||
fatal(int do_perror, char *message, ...)
|
||||
fatal(int do_perror, const char *message, ...)
|
||||
{
|
||||
va_list args;
|
||||
int save_errno = errno;
|
||||
@ -724,7 +724,7 @@ typedef struct ztest_option {
|
||||
const char *long_opt_param;
|
||||
const char *comment;
|
||||
unsigned int default_int;
|
||||
char *default_str;
|
||||
const char *default_str;
|
||||
} ztest_option_t;
|
||||
|
||||
/*
|
||||
@ -1200,30 +1200,31 @@ ztest_is_draid_spare(const char *name)
|
||||
}
|
||||
|
||||
static nvlist_t *
|
||||
make_vdev_file(char *path, char *aux, char *pool, size_t size, uint64_t ashift)
|
||||
make_vdev_file(const char *path, const char *aux, const char *pool,
|
||||
size_t size, uint64_t ashift)
|
||||
{
|
||||
char *pathbuf;
|
||||
char *pathbuf = NULL;
|
||||
uint64_t vdev;
|
||||
nvlist_t *file;
|
||||
boolean_t draid_spare = B_FALSE;
|
||||
|
||||
pathbuf = umem_alloc(MAXPATHLEN, UMEM_NOFAIL);
|
||||
|
||||
if (ashift == 0)
|
||||
ashift = ztest_get_ashift();
|
||||
|
||||
if (path == NULL) {
|
||||
pathbuf = umem_alloc(MAXPATHLEN, UMEM_NOFAIL);
|
||||
path = pathbuf;
|
||||
|
||||
if (aux != NULL) {
|
||||
vdev = ztest_shared->zs_vdev_aux;
|
||||
(void) snprintf(path, MAXPATHLEN,
|
||||
(void) snprintf(pathbuf, MAXPATHLEN,
|
||||
ztest_aux_template, ztest_opts.zo_dir,
|
||||
pool == NULL ? ztest_opts.zo_pool : pool,
|
||||
aux, vdev);
|
||||
} else {
|
||||
vdev = ztest_shared->zs_vdev_next_leaf++;
|
||||
(void) snprintf(path, MAXPATHLEN,
|
||||
(void) snprintf(pathbuf, MAXPATHLEN,
|
||||
ztest_dev_template, ztest_opts.zo_dir,
|
||||
pool == NULL ? ztest_opts.zo_pool : pool, vdev);
|
||||
}
|
||||
@ -1251,7 +1252,7 @@ make_vdev_file(char *path, char *aux, char *pool, size_t size, uint64_t ashift)
|
||||
}
|
||||
|
||||
static nvlist_t *
|
||||
make_vdev_raid(char *path, char *aux, char *pool, size_t size,
|
||||
make_vdev_raid(const char *path, const char *aux, const char *pool, size_t size,
|
||||
uint64_t ashift, int r)
|
||||
{
|
||||
nvlist_t *raid, **child;
|
||||
@ -1302,8 +1303,8 @@ make_vdev_raid(char *path, char *aux, char *pool, size_t size,
|
||||
}
|
||||
|
||||
static nvlist_t *
|
||||
make_vdev_mirror(char *path, char *aux, char *pool, size_t size,
|
||||
uint64_t ashift, int r, int m)
|
||||
make_vdev_mirror(const char *path, const char *aux, const char *pool,
|
||||
size_t size, uint64_t ashift, int r, int m)
|
||||
{
|
||||
nvlist_t *mirror, **child;
|
||||
int c;
|
||||
@ -1330,8 +1331,8 @@ make_vdev_mirror(char *path, char *aux, char *pool, size_t size,
|
||||
}
|
||||
|
||||
static nvlist_t *
|
||||
make_vdev_root(char *path, char *aux, char *pool, size_t size, uint64_t ashift,
|
||||
const char *class, int r, int m, int t)
|
||||
make_vdev_root(const char *path, const char *aux, const char *pool, size_t size,
|
||||
uint64_t ashift, const char *class, int r, int m, int t)
|
||||
{
|
||||
nvlist_t *root, **child;
|
||||
int c;
|
||||
@ -1536,7 +1537,7 @@ ztest_spa_prop_set_uint64(zpool_prop_t prop, uint64_t value)
|
||||
|
||||
static int
|
||||
ztest_dmu_objset_own(const char *name, dmu_objset_type_t type,
|
||||
boolean_t readonly, boolean_t decrypt, void *tag, objset_t **osp)
|
||||
boolean_t readonly, boolean_t decrypt, const void *tag, objset_t **osp)
|
||||
{
|
||||
int err;
|
||||
char *cp = NULL;
|
||||
@ -2809,7 +2810,7 @@ ztest_io(ztest_ds_t *zd, uint64_t object, uint64_t offset)
|
||||
* Initialize an object description template.
|
||||
*/
|
||||
static void
|
||||
ztest_od_init(ztest_od_t *od, uint64_t id, char *tag, uint64_t index,
|
||||
ztest_od_init(ztest_od_t *od, uint64_t id, const char *tag, uint64_t index,
|
||||
dmu_object_type_t type, uint64_t blocksize, uint64_t dnodesize,
|
||||
uint64_t gen)
|
||||
{
|
||||
@ -3371,7 +3372,7 @@ ztest_vdev_aux_add_remove(ztest_ds_t *zd, uint64_t id)
|
||||
spa_t *spa = ztest_spa;
|
||||
vdev_t *rvd = spa->spa_root_vdev;
|
||||
spa_aux_vdev_t *sav;
|
||||
char *aux;
|
||||
const char *aux;
|
||||
char *path;
|
||||
uint64_t guid = 0;
|
||||
int error, ignore_err = 0;
|
||||
@ -5271,7 +5272,7 @@ ztest_zap(ztest_ds_t *zd, uint64_t id)
|
||||
dmu_tx_t *tx;
|
||||
char propname[100], txgname[100];
|
||||
int error;
|
||||
char *hc[2] = { "s.acl.h", ".s.open.h.hyLZlg" };
|
||||
const char *const hc[2] = { "s.acl.h", ".s.open.h.hyLZlg" };
|
||||
|
||||
od = umem_alloc(sizeof (ztest_od_t), UMEM_NOFAIL);
|
||||
ztest_od_init(od, id, FTAG, 0, DMU_OT_ZAP_OTHER, 0, 0, 0);
|
||||
@ -6636,11 +6637,8 @@ ztest_global_vars_to_zdb_args(void)
|
||||
char **args = calloc(2*ztest_opts.zo_gvars_count + 1, sizeof (char *));
|
||||
char **cur = args;
|
||||
for (size_t i = 0; i < ztest_opts.zo_gvars_count; i++) {
|
||||
char *kv = ztest_opts.zo_gvars[i];
|
||||
*cur = "-o";
|
||||
cur++;
|
||||
*cur = strdup(kv);
|
||||
cur++;
|
||||
*cur++ = (char *)"-o";
|
||||
*cur++ = ztest_opts.zo_gvars[i];
|
||||
}
|
||||
ASSERT3P(cur, ==, &args[2*ztest_opts.zo_gvars_count]);
|
||||
*cur = NULL;
|
||||
@ -6891,7 +6889,7 @@ ztest_trim(ztest_ds_t *zd, uint64_t id)
|
||||
* Verify pool integrity by running zdb.
|
||||
*/
|
||||
static void
|
||||
ztest_run_zdb(char *pool)
|
||||
ztest_run_zdb(const char *pool)
|
||||
{
|
||||
int status;
|
||||
char *bin;
|
||||
@ -6949,12 +6947,12 @@ ztest_run_zdb(char *pool)
|
||||
}
|
||||
|
||||
static void
|
||||
ztest_walk_pool_directory(char *header)
|
||||
ztest_walk_pool_directory(const char *header)
|
||||
{
|
||||
spa_t *spa = NULL;
|
||||
|
||||
if (ztest_opts.zo_verbose >= 6)
|
||||
(void) printf("%s\n", header);
|
||||
(void) puts(header);
|
||||
|
||||
mutex_enter(&spa_namespace_lock);
|
||||
while ((spa = spa_next(spa)) != NULL)
|
||||
@ -7206,7 +7204,7 @@ ztest_thread(void *arg)
|
||||
}
|
||||
|
||||
static void
|
||||
ztest_dataset_name(char *dsname, char *pool, int d)
|
||||
ztest_dataset_name(char *dsname, const char *pool, int d)
|
||||
{
|
||||
(void) snprintf(dsname, ZFS_MAX_DATASET_NAME_LEN, "%s/ds_%d", pool, d);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ AM_CPPFLAGS = \
|
||||
|
||||
AM_LIBTOOLFLAGS = --silent
|
||||
|
||||
AM_CFLAGS = -std=gnu99 -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wno-sign-compare -Wno-missing-field-initializers
|
||||
AM_CFLAGS = -std=gnu99 -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wno-sign-compare -Wno-missing-field-initializers
|
||||
AM_CFLAGS += -fno-strict-aliasing
|
||||
AM_CFLAGS += $(NO_OMIT_FRAME_POINTER)
|
||||
AM_CFLAGS += $(IMPLICIT_FALLTHROUGH)
|
||||
|
@ -204,6 +204,29 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_IMPLICIT_FALLTHROUGH], [
|
||||
AC_SUBST([IMPLICIT_FALLTHROUGH])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # Check if cc supports -Winfinite-recursion option.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_INFINITE_RECURSION], [
|
||||
AC_MSG_CHECKING([whether $CC supports -Winfinite-recursion])
|
||||
|
||||
saved_flags="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Werror -Winfinite-recursion"
|
||||
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [
|
||||
INFINITE_RECURSION=-Winfinite-recursion
|
||||
AC_DEFINE([HAVE_INFINITE_RECURSION], 1,
|
||||
[Define if compiler supports -Winfinite-recursion])
|
||||
AC_MSG_RESULT([yes])
|
||||
], [
|
||||
INFINITE_RECURSION=
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
|
||||
CFLAGS="$saved_flags"
|
||||
AC_SUBST([INFINITE_RECURSION])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # Check if cc supports -fno-omit-frame-pointer option.
|
||||
dnl #
|
||||
|
@ -210,6 +210,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [
|
||||
AC_SUBST(CPU_COUNT)
|
||||
|
||||
ZFS_AC_CONFIG_ALWAYS_CC_NO_CLOBBERED
|
||||
ZFS_AC_CONFIG_ALWAYS_CC_INFINITE_RECURSION
|
||||
ZFS_AC_CONFIG_ALWAYS_CC_IMPLICIT_FALLTHROUGH
|
||||
ZFS_AC_CONFIG_ALWAYS_CC_FRAME_LARGER_THAN
|
||||
ZFS_AC_CONFIG_ALWAYS_CC_NO_FORMAT_TRUNCATION
|
||||
|
@ -82,7 +82,7 @@ ZFS_DATASET="${ZFS_DATASET:-${root}}"
|
||||
ZFS_POOL="${ZFS_DATASET%%/*}"
|
||||
|
||||
|
||||
if ! zpool get -Ho name "${ZFS_POOL}" > /dev/null 2>&1; then
|
||||
if ! zpool get -Ho value name "${ZFS_POOL}" > /dev/null 2>&1; then
|
||||
info "ZFS: Importing pool ${ZFS_POOL}..."
|
||||
# shellcheck disable=SC2086
|
||||
if ! zpool import -N ${ZPOOL_IMPORT_OPTS} "${ZFS_POOL}"; then
|
||||
|
@ -88,11 +88,11 @@ decode_root_args() {
|
||||
return
|
||||
fi
|
||||
|
||||
root=$(getarg root=)
|
||||
xroot=$(getarg root=)
|
||||
rootfstype=$(getarg rootfstype=)
|
||||
|
||||
# shellcheck disable=SC2249
|
||||
case "$root" in
|
||||
case "$xroot" in
|
||||
""|zfs|zfs:|zfs:AUTO)
|
||||
root=zfs:AUTO
|
||||
rootfstype=zfs
|
||||
@ -100,7 +100,7 @@ decode_root_args() {
|
||||
;;
|
||||
|
||||
ZFS=*|zfs:*)
|
||||
root="${root#zfs:}"
|
||||
root="${xroot#zfs:}"
|
||||
root="${root#ZFS=}"
|
||||
root=$(echo "$root" | tr '+' ' ')
|
||||
rootfstype=zfs
|
||||
@ -109,9 +109,9 @@ decode_root_args() {
|
||||
esac
|
||||
|
||||
if [ "$rootfstype" = "zfs" ]; then
|
||||
case "$root" in
|
||||
case "$xroot" in
|
||||
"") root=zfs:AUTO ;;
|
||||
*) root=$(echo "$root" | tr '+' ' ') ;;
|
||||
*) root=$(echo "$xroot" | tr '+' ' ') ;;
|
||||
esac
|
||||
return 0
|
||||
fi
|
||||
|
@ -8,5 +8,5 @@ ConditionKernelCommandLine=bootfs.rollback
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/bin/sh -c '. /lib/dracut-zfs-lib.sh; decode_root_args || exit; [ "$root" = "zfs:AUTO" ] && root="$BOOTFS" SNAPNAME="$(getarg bootfs.rollback)"; exec @sbindir@/zfs rollback -Rf "$root@${SNAPNAME:-%v}"'
|
||||
ExecStart=/bin/sh -c '. /lib/dracut-zfs-lib.sh; decode_root_args || exit; [ "$root" = "zfs:AUTO" ] && root="$BOOTFS"; SNAPNAME="$(getarg bootfs.rollback)"; exec @sbindir@/zfs rollback -Rf "$root@${SNAPNAME:-%v}"'
|
||||
RemainAfterExit=yes
|
||||
|
@ -8,5 +8,5 @@ ConditionKernelCommandLine=bootfs.snapshot
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/bin/sh -c '. /lib/dracut-zfs-lib.sh; decode_root_args || exit; [ "$root" = "zfs:AUTO" ] && root="$BOOTFS" SNAPNAME="$(getarg bootfs.snapshot)"; exec @sbindir@/zfs snapshot "$root@${SNAPNAME:-%v}"'
|
||||
ExecStart=/bin/sh -c '. /lib/dracut-zfs-lib.sh; decode_root_args || exit; [ "$root" = "zfs:AUTO" ] && root="$BOOTFS"; SNAPNAME="$(getarg bootfs.snapshot)"; exec @sbindir@/zfs snapshot "$root@${SNAPNAME:-%v}"'
|
||||
RemainAfterExit=yes
|
||||
|
@ -38,7 +38,7 @@ For complete documentation, see `dracut.zfs(7)`.
|
||||
after pool import but before the rootfs is mounted.
|
||||
Failure to create the snapshot is noted, but booting continues.
|
||||
|
||||
4. `bootfs.rollback`, `bootfs.rollback=snapshot-name`: enables `zfs-snapshot-bootfs.service`,
|
||||
4. `bootfs.rollback`, `bootfs.rollback=snapshot-name`: enables `zfs-rollback-bootfs.service`,
|
||||
which `-Rf` rolls back to `$root_dataset@$(uname -r)` (or, in the second form, `$root_dataset@snapshot-name`)
|
||||
after pool import but before the rootfs is mounted.
|
||||
Failure to roll back will fall down to the rescue shell.
|
||||
|
@ -681,25 +681,28 @@ line_worker(char *line, const char *cachefile)
|
||||
}
|
||||
*(tofree++) = linktgt;
|
||||
|
||||
char *dependencies[][2] = {
|
||||
struct dep {
|
||||
const char *type;
|
||||
char *list;
|
||||
} deps[] = {
|
||||
{"wants", wantedby},
|
||||
{"requires", requiredby},
|
||||
{}
|
||||
};
|
||||
for (__typeof__(&*dependencies) dep = &*dependencies; **dep; ++dep) {
|
||||
if (!(*dep)[1])
|
||||
for (struct dep *dep = deps; dep->type; ++dep) {
|
||||
if (!dep->list)
|
||||
continue;
|
||||
|
||||
for (char *reqby = strtok_r((*dep)[1], " ", &toktmp);
|
||||
for (char *reqby = strtok_r(dep->list, " ", &toktmp);
|
||||
reqby;
|
||||
reqby = strtok_r(NULL, " ", &toktmp)) {
|
||||
char *depdir;
|
||||
if (asprintf(
|
||||
&depdir, "%s.%s", reqby, (*dep)[0]) == -1) {
|
||||
&depdir, "%s.%s", reqby, dep->type) == -1) {
|
||||
fprintf(stderr, PROGNAME "[%d]: %s: "
|
||||
"out of memory for dependent dir name "
|
||||
"\"%s.%s\"!\n",
|
||||
getpid(), dataset, reqby, (*dep)[0]);
|
||||
getpid(), dataset, reqby, dep->type);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -423,9 +423,9 @@ typedef enum {
|
||||
ZPOOL_STATUS_OK
|
||||
} zpool_status_t;
|
||||
|
||||
_LIBZFS_H zpool_status_t zpool_get_status(zpool_handle_t *, char **,
|
||||
_LIBZFS_H zpool_status_t zpool_get_status(zpool_handle_t *, const char **,
|
||||
zpool_errata_t *);
|
||||
_LIBZFS_H zpool_status_t zpool_import_status(nvlist_t *, char **,
|
||||
_LIBZFS_H zpool_status_t zpool_import_status(nvlist_t *, const char **,
|
||||
zpool_errata_t *);
|
||||
|
||||
/*
|
||||
@ -870,8 +870,9 @@ _LIBZFS_H int zfs_unmountall(zfs_handle_t *, int);
|
||||
_LIBZFS_H int zfs_mount_delegation_check(void);
|
||||
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
_LIBZFS_H int zfs_parse_mount_options(char *mntopts, unsigned long *mntflags,
|
||||
unsigned long *zfsflags, int sloppy, char *badopt, char *mtabopt);
|
||||
_LIBZFS_H int zfs_parse_mount_options(const char *mntopts,
|
||||
unsigned long *mntflags, unsigned long *zfsflags, int sloppy, char *badopt,
|
||||
char *mtabopt);
|
||||
_LIBZFS_H void zfs_adjust_mount_options(zfs_handle_t *zhp, const char *mntpoint,
|
||||
char *mntopts, char *mtabopt);
|
||||
#endif
|
||||
@ -910,7 +911,7 @@ _LIBZFS_H int libzfs_run_process_get_stdout_nopath(const char *, char *[],
|
||||
|
||||
_LIBZFS_H void libzfs_free_str_array(char **, int);
|
||||
|
||||
_LIBZFS_H int libzfs_envvar_is_set(char *);
|
||||
_LIBZFS_H boolean_t libzfs_envvar_is_set(const char *);
|
||||
|
||||
/*
|
||||
* Utility functions for zfs version
|
||||
|
@ -155,9 +155,9 @@ struct zfs_cmd;
|
||||
#define ANSI_RESET "\033[0m"
|
||||
#define ANSI_BOLD "\033[1m"
|
||||
|
||||
_LIBZUTIL_H void color_start(char *color);
|
||||
_LIBZUTIL_H void color_start(const char *color);
|
||||
_LIBZUTIL_H void color_end(void);
|
||||
_LIBZUTIL_H int printf_color(char *color, char *format, ...);
|
||||
_LIBZUTIL_H int printf_color(const char *color, const char *format, ...);
|
||||
|
||||
_LIBZUTIL_H const char *zfs_basename(const char *path);
|
||||
_LIBZUTIL_H ssize_t zfs_dirnamelen(const char *path);
|
||||
|
@ -73,7 +73,7 @@ extern uint64_t spl_kmem_cache_entry_size(kmem_cache_t *cache);
|
||||
void *zfs_kmem_alloc(size_t size, int kmflags);
|
||||
void zfs_kmem_free(void *buf, size_t size);
|
||||
uint64_t kmem_size(void);
|
||||
kmem_cache_t *kmem_cache_create(char *name, size_t bufsize, size_t align,
|
||||
kmem_cache_t *kmem_cache_create(const char *name, size_t bufsize, size_t align,
|
||||
int (*constructor)(void *, void *, int), void (*destructor)(void *, void *),
|
||||
void (*reclaim)(void *) __unused, void *private, vmem_t *vmp, int cflags);
|
||||
void kmem_cache_destroy(kmem_cache_t *cache);
|
||||
|
@ -78,9 +78,6 @@ typedef id_t ctid_t;
|
||||
typedef mode_t o_mode_t;
|
||||
typedef uint64_t pgcnt_t;
|
||||
|
||||
#define B_FALSE 0
|
||||
#define B_TRUE 1
|
||||
|
||||
typedef short index_t;
|
||||
typedef off_t offset_t;
|
||||
#ifndef _PTRDIFF_T_DECLARED
|
||||
@ -90,13 +87,17 @@ typedef __ptrdiff_t ptrdiff_t; /* pointer difference */
|
||||
typedef int64_t rlim64_t;
|
||||
typedef int major_t;
|
||||
|
||||
#else
|
||||
#ifdef NEED_SOLARIS_BOOLEAN
|
||||
#if defined(__XOPEN_OR_POSIX)
|
||||
typedef enum { _B_FALSE, _B_TRUE } boolean_t;
|
||||
#else
|
||||
typedef enum { B_FALSE, B_TRUE } boolean_t;
|
||||
#endif /* defined(__XOPEN_OR_POSIX) */
|
||||
#else
|
||||
|
||||
#define B_FALSE 0
|
||||
#define B_TRUE 1
|
||||
|
||||
#endif
|
||||
|
||||
typedef u_longlong_t u_offset_t;
|
||||
|
@ -183,7 +183,7 @@ typedef struct spl_kmem_cache {
|
||||
} spl_kmem_cache_t;
|
||||
#define kmem_cache_t spl_kmem_cache_t
|
||||
|
||||
extern spl_kmem_cache_t *spl_kmem_cache_create(char *name, size_t size,
|
||||
extern spl_kmem_cache_t *spl_kmem_cache_create(const char *name, size_t size,
|
||||
size_t align, spl_kmem_ctor_t ctor, spl_kmem_dtor_t dtor,
|
||||
void *reclaim, void *priv, void *vmp, int flags);
|
||||
extern void spl_kmem_cache_set_move(spl_kmem_cache_t *,
|
||||
|
@ -264,12 +264,12 @@ int arc_untransform(arc_buf_t *buf, spa_t *spa, const zbookmark_phys_t *zb,
|
||||
void arc_convert_to_raw(arc_buf_t *buf, uint64_t dsobj, boolean_t byteorder,
|
||||
dmu_object_type_t ot, const uint8_t *salt, const uint8_t *iv,
|
||||
const uint8_t *mac);
|
||||
arc_buf_t *arc_alloc_buf(spa_t *spa, void *tag, arc_buf_contents_t type,
|
||||
arc_buf_t *arc_alloc_buf(spa_t *spa, const void *tag, arc_buf_contents_t type,
|
||||
int32_t size);
|
||||
arc_buf_t *arc_alloc_compressed_buf(spa_t *spa, void *tag,
|
||||
arc_buf_t *arc_alloc_compressed_buf(spa_t *spa, const void *tag,
|
||||
uint64_t psize, uint64_t lsize, enum zio_compress compression_type,
|
||||
uint8_t complevel);
|
||||
arc_buf_t *arc_alloc_raw_buf(spa_t *spa, void *tag, uint64_t dsobj,
|
||||
arc_buf_t *arc_alloc_raw_buf(spa_t *spa, const void *tag, uint64_t dsobj,
|
||||
boolean_t byteorder, const uint8_t *salt, const uint8_t *iv,
|
||||
const uint8_t *mac, dmu_object_type_t ot, uint64_t psize, uint64_t lsize,
|
||||
enum zio_compress compression_type, uint8_t complevel);
|
||||
@ -281,14 +281,14 @@ arc_buf_t *arc_loan_raw_buf(spa_t *spa, uint64_t dsobj, boolean_t byteorder,
|
||||
const uint8_t *salt, const uint8_t *iv, const uint8_t *mac,
|
||||
dmu_object_type_t ot, uint64_t psize, uint64_t lsize,
|
||||
enum zio_compress compression_type, uint8_t complevel);
|
||||
void arc_return_buf(arc_buf_t *buf, void *tag);
|
||||
void arc_loan_inuse_buf(arc_buf_t *buf, void *tag);
|
||||
void arc_buf_destroy(arc_buf_t *buf, void *tag);
|
||||
void arc_return_buf(arc_buf_t *buf, const void *tag);
|
||||
void arc_loan_inuse_buf(arc_buf_t *buf, const void *tag);
|
||||
void arc_buf_destroy(arc_buf_t *buf, const void *tag);
|
||||
void arc_buf_info(arc_buf_t *buf, arc_buf_info_t *abi, int state_index);
|
||||
uint64_t arc_buf_size(arc_buf_t *buf);
|
||||
uint64_t arc_buf_lsize(arc_buf_t *buf);
|
||||
void arc_buf_access(arc_buf_t *buf);
|
||||
void arc_release(arc_buf_t *buf, void *tag);
|
||||
void arc_release(arc_buf_t *buf, const void *tag);
|
||||
int arc_released(arc_buf_t *buf);
|
||||
void arc_buf_sigsegv(int sig, siginfo_t *si, void *unused);
|
||||
void arc_buf_freeze(arc_buf_t *buf);
|
||||
|
@ -72,7 +72,11 @@ extern kmem_cache_t *zfs_btree_leaf_cache;
|
||||
|
||||
typedef struct zfs_btree_hdr {
|
||||
struct zfs_btree_core *bth_parent;
|
||||
boolean_t bth_core;
|
||||
/*
|
||||
* Set to -1 to indicate core nodes. Other values represent first
|
||||
* valid element offset for leaf nodes.
|
||||
*/
|
||||
uint32_t bth_first;
|
||||
/*
|
||||
* For both leaf and core nodes, represents the number of elements in
|
||||
* the node. For core nodes, they will have bth_count + 1 children.
|
||||
@ -91,9 +95,12 @@ typedef struct zfs_btree_leaf {
|
||||
uint8_t btl_elems[];
|
||||
} zfs_btree_leaf_t;
|
||||
|
||||
#define BTREE_LEAF_ESIZE (BTREE_LEAF_SIZE - \
|
||||
offsetof(zfs_btree_leaf_t, btl_elems))
|
||||
|
||||
typedef struct zfs_btree_index {
|
||||
zfs_btree_hdr_t *bti_node;
|
||||
uint64_t bti_offset;
|
||||
uint32_t bti_offset;
|
||||
/*
|
||||
* True if the location is before the list offset, false if it's at
|
||||
* the listed offset.
|
||||
@ -105,6 +112,7 @@ typedef struct btree {
|
||||
zfs_btree_hdr_t *bt_root;
|
||||
int64_t bt_height;
|
||||
size_t bt_elem_size;
|
||||
uint32_t bt_leaf_cap;
|
||||
uint64_t bt_num_elems;
|
||||
uint64_t bt_num_nodes;
|
||||
zfs_btree_leaf_t *bt_bulk; // non-null if bulk loading
|
||||
|
@ -339,12 +339,12 @@ int dbuf_spill_set_blksz(dmu_buf_t *db, uint64_t blksz, dmu_tx_t *tx);
|
||||
|
||||
void dbuf_rm_spill(struct dnode *dn, dmu_tx_t *tx);
|
||||
|
||||
dmu_buf_impl_t *dbuf_hold(struct dnode *dn, uint64_t blkid, void *tag);
|
||||
dmu_buf_impl_t *dbuf_hold(struct dnode *dn, uint64_t blkid, const void *tag);
|
||||
dmu_buf_impl_t *dbuf_hold_level(struct dnode *dn, int level, uint64_t blkid,
|
||||
void *tag);
|
||||
const void *tag);
|
||||
int dbuf_hold_impl(struct dnode *dn, uint8_t level, uint64_t blkid,
|
||||
boolean_t fail_sparse, boolean_t fail_uncached,
|
||||
void *tag, dmu_buf_impl_t **dbp);
|
||||
const void *tag, dmu_buf_impl_t **dbp);
|
||||
|
||||
int dbuf_prefetch_impl(struct dnode *dn, int64_t level, uint64_t blkid,
|
||||
zio_priority_t prio, arc_flags_t aflags, dbuf_prefetch_fn cb,
|
||||
@ -352,13 +352,14 @@ int dbuf_prefetch_impl(struct dnode *dn, int64_t level, uint64_t blkid,
|
||||
int dbuf_prefetch(struct dnode *dn, int64_t level, uint64_t blkid,
|
||||
zio_priority_t prio, arc_flags_t aflags);
|
||||
|
||||
void dbuf_add_ref(dmu_buf_impl_t *db, void *tag);
|
||||
void dbuf_add_ref(dmu_buf_impl_t *db, const void *tag);
|
||||
boolean_t dbuf_try_add_ref(dmu_buf_t *db, objset_t *os, uint64_t obj,
|
||||
uint64_t blkid, void *tag);
|
||||
uint64_t blkid, const void *tag);
|
||||
uint64_t dbuf_refcount(dmu_buf_impl_t *db);
|
||||
|
||||
void dbuf_rele(dmu_buf_impl_t *db, void *tag);
|
||||
void dbuf_rele_and_unlock(dmu_buf_impl_t *db, void *tag, boolean_t evicting);
|
||||
void dbuf_rele(dmu_buf_impl_t *db, const void *tag);
|
||||
void dbuf_rele_and_unlock(dmu_buf_impl_t *db, const void *tag,
|
||||
boolean_t evicting);
|
||||
|
||||
dmu_buf_impl_t *dbuf_find(struct objset *os, uint64_t object, uint8_t level,
|
||||
uint64_t blkid);
|
||||
@ -385,8 +386,10 @@ void dbuf_destroy(dmu_buf_impl_t *db);
|
||||
void dbuf_unoverride(dbuf_dirty_record_t *dr);
|
||||
void dbuf_sync_list(list_t *list, int level, dmu_tx_t *tx);
|
||||
void dbuf_release_bp(dmu_buf_impl_t *db);
|
||||
db_lock_type_t dmu_buf_lock_parent(dmu_buf_impl_t *db, krw_t rw, void *tag);
|
||||
void dmu_buf_unlock_parent(dmu_buf_impl_t *db, db_lock_type_t type, void *tag);
|
||||
db_lock_type_t dmu_buf_lock_parent(dmu_buf_impl_t *db, krw_t rw,
|
||||
const void *tag);
|
||||
void dmu_buf_unlock_parent(dmu_buf_impl_t *db, db_lock_type_t type,
|
||||
const void *tag);
|
||||
|
||||
void dbuf_free_range(struct dnode *dn, uint64_t start, uint64_t end,
|
||||
struct dmu_tx *);
|
||||
|
@ -319,11 +319,12 @@ void zfs_znode_byteswap(void *buf, size_t size);
|
||||
typedef void dmu_objset_create_sync_func_t(objset_t *os, void *arg,
|
||||
cred_t *cr, dmu_tx_t *tx);
|
||||
|
||||
int dmu_objset_hold(const char *name, void *tag, objset_t **osp);
|
||||
int dmu_objset_hold(const char *name, const void *tag, objset_t **osp);
|
||||
int dmu_objset_own(const char *name, dmu_objset_type_t type,
|
||||
boolean_t readonly, boolean_t key_required, void *tag, objset_t **osp);
|
||||
void dmu_objset_rele(objset_t *os, void *tag);
|
||||
void dmu_objset_disown(objset_t *os, boolean_t key_required, void *tag);
|
||||
boolean_t readonly, boolean_t key_required, const void *tag,
|
||||
objset_t **osp);
|
||||
void dmu_objset_rele(objset_t *os, const void *tag);
|
||||
void dmu_objset_disown(objset_t *os, boolean_t key_required, const void *tag);
|
||||
int dmu_objset_open_ds(struct dsl_dataset *ds, objset_t **osp);
|
||||
|
||||
void dmu_objset_evict_dbufs(objset_t *os);
|
||||
@ -407,7 +408,7 @@ uint64_t dmu_object_alloc_dnsize(objset_t *os, dmu_object_type_t ot,
|
||||
int dnodesize, dmu_tx_t *tx);
|
||||
uint64_t dmu_object_alloc_hold(objset_t *os, dmu_object_type_t ot,
|
||||
int blocksize, int indirect_blockshift, dmu_object_type_t bonustype,
|
||||
int bonuslen, int dnodesize, dnode_t **allocated_dnode, void *tag,
|
||||
int bonuslen, int dnodesize, dnode_t **allocated_dnode, const void *tag,
|
||||
dmu_tx_t *tx);
|
||||
int dmu_object_claim(objset_t *os, uint64_t object, dmu_object_type_t ot,
|
||||
int blocksize, dmu_object_type_t bonus_type, int bonus_len, dmu_tx_t *tx);
|
||||
@ -524,8 +525,9 @@ void dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp,
|
||||
*
|
||||
* Returns ENOENT, EIO, or 0.
|
||||
*/
|
||||
int dmu_bonus_hold(objset_t *os, uint64_t object, void *tag, dmu_buf_t **dbp);
|
||||
int dmu_bonus_hold_by_dnode(dnode_t *dn, void *tag, dmu_buf_t **dbp,
|
||||
int dmu_bonus_hold(objset_t *os, uint64_t object, const void *tag,
|
||||
dmu_buf_t **dbp);
|
||||
int dmu_bonus_hold_by_dnode(dnode_t *dn, const void *tag, dmu_buf_t **dbp,
|
||||
uint32_t flags);
|
||||
int dmu_bonus_max(void);
|
||||
int dmu_set_bonus(dmu_buf_t *, int, dmu_tx_t *);
|
||||
@ -537,11 +539,11 @@ int dmu_rm_spill(objset_t *, uint64_t, dmu_tx_t *);
|
||||
* Special spill buffer support used by "SA" framework
|
||||
*/
|
||||
|
||||
int dmu_spill_hold_by_bonus(dmu_buf_t *bonus, uint32_t flags, void *tag,
|
||||
int dmu_spill_hold_by_bonus(dmu_buf_t *bonus, uint32_t flags, const void *tag,
|
||||
dmu_buf_t **dbp);
|
||||
int dmu_spill_hold_by_dnode(dnode_t *dn, uint32_t flags,
|
||||
void *tag, dmu_buf_t **dbp);
|
||||
int dmu_spill_hold_existing(dmu_buf_t *bonus, void *tag, dmu_buf_t **dbp);
|
||||
const void *tag, dmu_buf_t **dbp);
|
||||
int dmu_spill_hold_existing(dmu_buf_t *bonus, const void *tag, dmu_buf_t **dbp);
|
||||
|
||||
/*
|
||||
* Obtain the DMU buffer from the specified object which contains the
|
||||
@ -558,19 +560,20 @@ int dmu_spill_hold_existing(dmu_buf_t *bonus, void *tag, dmu_buf_t **dbp);
|
||||
* The object number must be a valid, allocated object number.
|
||||
*/
|
||||
int dmu_buf_hold(objset_t *os, uint64_t object, uint64_t offset,
|
||||
void *tag, dmu_buf_t **, int flags);
|
||||
const void *tag, dmu_buf_t **, int flags);
|
||||
int dmu_buf_hold_array(objset_t *os, uint64_t object, uint64_t offset,
|
||||
uint64_t length, int read, void *tag, int *numbufsp, dmu_buf_t ***dbpp);
|
||||
uint64_t length, int read, const void *tag, int *numbufsp,
|
||||
dmu_buf_t ***dbpp);
|
||||
int dmu_buf_hold_by_dnode(dnode_t *dn, uint64_t offset,
|
||||
void *tag, dmu_buf_t **dbp, int flags);
|
||||
const void *tag, dmu_buf_t **dbp, int flags);
|
||||
int dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset,
|
||||
uint64_t length, boolean_t read, void *tag, int *numbufsp,
|
||||
uint64_t length, boolean_t read, const void *tag, int *numbufsp,
|
||||
dmu_buf_t ***dbpp, uint32_t flags);
|
||||
/*
|
||||
* Add a reference to a dmu buffer that has already been held via
|
||||
* dmu_buf_hold() in the current context.
|
||||
*/
|
||||
void dmu_buf_add_ref(dmu_buf_t *db, void* tag);
|
||||
void dmu_buf_add_ref(dmu_buf_t *db, const void *tag);
|
||||
|
||||
/*
|
||||
* Attempt to add a reference to a dmu buffer that is in an unknown state,
|
||||
@ -580,9 +583,9 @@ void dmu_buf_add_ref(dmu_buf_t *db, void* tag);
|
||||
* one hold by a user other than the syncer.
|
||||
*/
|
||||
boolean_t dmu_buf_try_add_ref(dmu_buf_t *, objset_t *os, uint64_t object,
|
||||
uint64_t blkid, void *tag);
|
||||
uint64_t blkid, const void *tag);
|
||||
|
||||
void dmu_buf_rele(dmu_buf_t *db, void *tag);
|
||||
void dmu_buf_rele(dmu_buf_t *db, const void *tag);
|
||||
uint64_t dmu_buf_refcount(dmu_buf_t *db);
|
||||
uint64_t dmu_buf_user_refcount(dmu_buf_t *db);
|
||||
|
||||
@ -597,9 +600,9 @@ uint64_t dmu_buf_user_refcount(dmu_buf_t *db);
|
||||
* individually with dmu_buf_rele.
|
||||
*/
|
||||
int dmu_buf_hold_array_by_bonus(dmu_buf_t *db, uint64_t offset,
|
||||
uint64_t length, boolean_t read, void *tag,
|
||||
uint64_t length, boolean_t read, const void *tag,
|
||||
int *numbufsp, dmu_buf_t ***dbpp);
|
||||
void dmu_buf_rele_array(dmu_buf_t **, int numbufs, void *tag);
|
||||
void dmu_buf_rele_array(dmu_buf_t **, int numbufs, const void *tag);
|
||||
|
||||
typedef void dmu_buf_evict_func_t(void *user_ptr);
|
||||
|
||||
@ -895,12 +898,12 @@ typedef struct dmu_object_type_info {
|
||||
boolean_t ot_metadata;
|
||||
boolean_t ot_dbuf_metadata_cache;
|
||||
boolean_t ot_encrypt;
|
||||
char *ot_name;
|
||||
const char *ot_name;
|
||||
} dmu_object_type_info_t;
|
||||
|
||||
typedef const struct dmu_object_byteswap_info {
|
||||
arc_byteswap_func_t ob_func;
|
||||
char *ob_name;
|
||||
const char *ob_name;
|
||||
} dmu_object_byteswap_info_t;
|
||||
|
||||
extern const dmu_object_type_info_t dmu_ot[DMU_OT_NUMTYPES];
|
||||
|
@ -248,7 +248,7 @@ typedef struct dmu_sendstatus {
|
||||
void dmu_object_zapify(objset_t *, uint64_t, dmu_object_type_t, dmu_tx_t *);
|
||||
void dmu_object_free_zapified(objset_t *, uint64_t, dmu_tx_t *);
|
||||
int dmu_buf_hold_noread(objset_t *, uint64_t, uint64_t,
|
||||
void *, dmu_buf_t **);
|
||||
const void *, dmu_buf_t **);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -201,19 +201,19 @@ struct objset {
|
||||
#define DMU_PROJECTUSED_DNODE(os) ((os)->os_projectused_dnode.dnh_dnode)
|
||||
|
||||
/* called from zpl */
|
||||
int dmu_objset_hold(const char *name, void *tag, objset_t **osp);
|
||||
int dmu_objset_hold_flags(const char *name, boolean_t decrypt, void *tag,
|
||||
int dmu_objset_hold(const char *name, const void *tag, objset_t **osp);
|
||||
int dmu_objset_hold_flags(const char *name, boolean_t decrypt, const void *tag,
|
||||
objset_t **osp);
|
||||
int dmu_objset_own(const char *name, dmu_objset_type_t type,
|
||||
boolean_t readonly, boolean_t decrypt, void *tag, objset_t **osp);
|
||||
boolean_t readonly, boolean_t decrypt, const void *tag, objset_t **osp);
|
||||
int dmu_objset_own_obj(struct dsl_pool *dp, uint64_t obj,
|
||||
dmu_objset_type_t type, boolean_t readonly, boolean_t decrypt,
|
||||
void *tag, objset_t **osp);
|
||||
const void *tag, objset_t **osp);
|
||||
void dmu_objset_refresh_ownership(struct dsl_dataset *ds,
|
||||
struct dsl_dataset **newds, boolean_t decrypt, void *tag);
|
||||
void dmu_objset_rele(objset_t *os, void *tag);
|
||||
void dmu_objset_rele_flags(objset_t *os, boolean_t decrypt, void *tag);
|
||||
void dmu_objset_disown(objset_t *os, boolean_t decrypt, void *tag);
|
||||
struct dsl_dataset **newds, boolean_t decrypt, const void *tag);
|
||||
void dmu_objset_rele(objset_t *os, const void *tag);
|
||||
void dmu_objset_rele_flags(objset_t *os, boolean_t decrypt, const void *tag);
|
||||
void dmu_objset_disown(objset_t *os, boolean_t decrypt, const void *tag);
|
||||
int dmu_objset_from_ds(struct dsl_dataset *ds, objset_t **osp);
|
||||
|
||||
void dmu_objset_stats(objset_t *os, nvlist_t *nv);
|
||||
|
@ -334,7 +334,7 @@ struct dnode {
|
||||
kcondvar_t dn_notxholds;
|
||||
kcondvar_t dn_nodnholds;
|
||||
enum dnode_dirtycontext dn_dirtyctx;
|
||||
void *dn_dirtyctx_firstset; /* dbg: contents meaningless */
|
||||
const void *dn_dirtyctx_firstset; /* dbg: contents meaningless */
|
||||
|
||||
/* protected by own devices */
|
||||
zfs_refcount_t dn_tx_holds;
|
||||
@ -418,16 +418,16 @@ void dnode_setbonus_type(dnode_t *dn, dmu_object_type_t, dmu_tx_t *tx);
|
||||
void dnode_rm_spill(dnode_t *dn, dmu_tx_t *tx);
|
||||
|
||||
int dnode_hold(struct objset *dd, uint64_t object,
|
||||
void *ref, dnode_t **dnp);
|
||||
const void *ref, dnode_t **dnp);
|
||||
int dnode_hold_impl(struct objset *dd, uint64_t object, int flag, int dn_slots,
|
||||
void *ref, dnode_t **dnp);
|
||||
boolean_t dnode_add_ref(dnode_t *dn, void *ref);
|
||||
void dnode_rele(dnode_t *dn, void *ref);
|
||||
void dnode_rele_and_unlock(dnode_t *dn, void *tag, boolean_t evicting);
|
||||
const void *ref, dnode_t **dnp);
|
||||
boolean_t dnode_add_ref(dnode_t *dn, const void *ref);
|
||||
void dnode_rele(dnode_t *dn, const void *ref);
|
||||
void dnode_rele_and_unlock(dnode_t *dn, const void *tag, boolean_t evicting);
|
||||
int dnode_try_claim(objset_t *os, uint64_t object, int slots);
|
||||
boolean_t dnode_is_dirty(dnode_t *dn);
|
||||
void dnode_setdirty(dnode_t *dn, dmu_tx_t *tx);
|
||||
void dnode_set_dirtyctx(dnode_t *dn, dmu_tx_t *tx, void *tag);
|
||||
void dnode_set_dirtyctx(dnode_t *dn, dmu_tx_t *tx, const void *tag);
|
||||
void dnode_sync(dnode_t *dn, dmu_tx_t *tx);
|
||||
void dnode_allocate(dnode_t *dn, dmu_object_type_t ot, int blocksize, int ibs,
|
||||
dmu_object_type_t bonustype, int bonuslen, int dn_slots, dmu_tx_t *tx);
|
||||
|
@ -114,7 +114,7 @@ typedef struct dsl_bookmark_create_redacted_arg {
|
||||
redaction_list_t **dbcra_rl;
|
||||
uint64_t dbcra_numsnaps;
|
||||
uint64_t *dbcra_snaps;
|
||||
void *dbcra_tag;
|
||||
const void *dbcra_tag;
|
||||
} dsl_bookmark_create_redacted_arg_t;
|
||||
|
||||
int dsl_bookmark_create(nvlist_t *, nvlist_t *);
|
||||
@ -122,7 +122,7 @@ int dsl_bookmark_create_nvl_validate(nvlist_t *);
|
||||
int dsl_bookmark_create_check(void *arg, dmu_tx_t *tx);
|
||||
void dsl_bookmark_create_sync(void *arg, dmu_tx_t *tx);
|
||||
int dsl_bookmark_create_redacted(const char *, const char *, uint64_t,
|
||||
uint64_t *, void *, redaction_list_t **);
|
||||
uint64_t *, const void *, redaction_list_t **);
|
||||
int dsl_get_bookmarks(const char *, nvlist_t *, nvlist_t *);
|
||||
int dsl_get_bookmarks_impl(dsl_dataset_t *, nvlist_t *, nvlist_t *);
|
||||
int dsl_get_bookmark_props(const char *, const char *, nvlist_t *);
|
||||
@ -131,12 +131,12 @@ int dsl_bookmark_lookup(struct dsl_pool *, const char *,
|
||||
struct dsl_dataset *, zfs_bookmark_phys_t *);
|
||||
int dsl_bookmark_lookup_impl(dsl_dataset_t *, const char *,
|
||||
zfs_bookmark_phys_t *);
|
||||
int dsl_redaction_list_hold_obj(struct dsl_pool *, uint64_t, void *,
|
||||
int dsl_redaction_list_hold_obj(struct dsl_pool *, uint64_t, const void *,
|
||||
redaction_list_t **);
|
||||
void dsl_redaction_list_rele(redaction_list_t *, void *);
|
||||
void dsl_redaction_list_rele(redaction_list_t *, const void *);
|
||||
void dsl_redaction_list_long_hold(struct dsl_pool *, redaction_list_t *,
|
||||
void *);
|
||||
void dsl_redaction_list_long_rele(redaction_list_t *, void *);
|
||||
const void *);
|
||||
void dsl_redaction_list_long_rele(redaction_list_t *, const void *);
|
||||
boolean_t dsl_redaction_list_long_held(redaction_list_t *);
|
||||
int dsl_bookmark_init_ds(dsl_dataset_t *);
|
||||
void dsl_bookmark_fini_ds(dsl_dataset_t *);
|
||||
|
@ -174,19 +174,20 @@ boolean_t dsl_dir_incompatible_encryption_version(dsl_dir_t *dd);
|
||||
void spa_keystore_init(spa_keystore_t *sk);
|
||||
void spa_keystore_fini(spa_keystore_t *sk);
|
||||
|
||||
void spa_keystore_dsl_key_rele(spa_t *spa, dsl_crypto_key_t *dck, void *tag);
|
||||
void spa_keystore_dsl_key_rele(spa_t *spa, dsl_crypto_key_t *dck,
|
||||
const void *tag);
|
||||
int spa_keystore_load_wkey_impl(spa_t *spa, dsl_wrapping_key_t *wkey);
|
||||
int spa_keystore_load_wkey(const char *dsname, dsl_crypto_params_t *dcp,
|
||||
boolean_t noop);
|
||||
int spa_keystore_unload_wkey_impl(spa_t *spa, uint64_t ddobj);
|
||||
int spa_keystore_unload_wkey(const char *dsname);
|
||||
|
||||
int spa_keystore_create_mapping(spa_t *spa, struct dsl_dataset *ds, void *tag,
|
||||
dsl_key_mapping_t **km_out);
|
||||
int spa_keystore_remove_mapping(spa_t *spa, uint64_t dsobj, void *tag);
|
||||
void key_mapping_add_ref(dsl_key_mapping_t *km, void *tag);
|
||||
void key_mapping_rele(spa_t *spa, dsl_key_mapping_t *km, void *tag);
|
||||
int spa_keystore_lookup_key(spa_t *spa, uint64_t dsobj, void *tag,
|
||||
int spa_keystore_create_mapping(spa_t *spa, struct dsl_dataset *ds,
|
||||
const void *tag, dsl_key_mapping_t **km_out);
|
||||
int spa_keystore_remove_mapping(spa_t *spa, uint64_t dsobj, const void *tag);
|
||||
void key_mapping_add_ref(dsl_key_mapping_t *km, const void *tag);
|
||||
void key_mapping_rele(spa_t *spa, dsl_key_mapping_t *km, const void *tag);
|
||||
int spa_keystore_lookup_key(spa_t *spa, uint64_t dsobj, const void *tag,
|
||||
dsl_crypto_key_t **dck_out);
|
||||
|
||||
int dsl_crypto_populate_key_nvlist(struct objset *os,
|
||||
|
@ -220,7 +220,7 @@ typedef struct dsl_dataset {
|
||||
kmutex_t ds_lock;
|
||||
objset_t *ds_objset;
|
||||
uint64_t ds_userrefs;
|
||||
void *ds_owner;
|
||||
const void *ds_owner;
|
||||
|
||||
/*
|
||||
* Long holds prevent the ds from being destroyed; they allow the
|
||||
@ -319,32 +319,34 @@ typedef enum ds_hold_flags {
|
||||
DS_HOLD_FLAG_DECRYPT = 1 << 0 /* needs access to encrypted data */
|
||||
} ds_hold_flags_t;
|
||||
|
||||
int dsl_dataset_hold(struct dsl_pool *dp, const char *name, void *tag,
|
||||
int dsl_dataset_hold(struct dsl_pool *dp, const char *name, const void *tag,
|
||||
dsl_dataset_t **dsp);
|
||||
int dsl_dataset_hold_flags(struct dsl_pool *dp, const char *name,
|
||||
ds_hold_flags_t flags, void *tag, dsl_dataset_t **dsp);
|
||||
ds_hold_flags_t flags, const void *tag, dsl_dataset_t **dsp);
|
||||
boolean_t dsl_dataset_try_add_ref(struct dsl_pool *dp, dsl_dataset_t *ds,
|
||||
void *tag);
|
||||
const void *tag);
|
||||
int dsl_dataset_create_key_mapping(dsl_dataset_t *ds);
|
||||
int dsl_dataset_hold_obj_flags(struct dsl_pool *dp, uint64_t dsobj,
|
||||
ds_hold_flags_t flags, void *tag, dsl_dataset_t **);
|
||||
ds_hold_flags_t flags, const void *tag, dsl_dataset_t **);
|
||||
void dsl_dataset_remove_key_mapping(dsl_dataset_t *ds);
|
||||
int dsl_dataset_hold_obj(struct dsl_pool *dp, uint64_t dsobj,
|
||||
void *tag, dsl_dataset_t **);
|
||||
const void *tag, dsl_dataset_t **);
|
||||
void dsl_dataset_rele_flags(dsl_dataset_t *ds, ds_hold_flags_t flags,
|
||||
void *tag);
|
||||
void dsl_dataset_rele(dsl_dataset_t *ds, void *tag);
|
||||
const void *tag);
|
||||
void dsl_dataset_rele(dsl_dataset_t *ds, const void *tag);
|
||||
int dsl_dataset_own(struct dsl_pool *dp, const char *name,
|
||||
ds_hold_flags_t flags, void *tag, dsl_dataset_t **dsp);
|
||||
ds_hold_flags_t flags, const void *tag, dsl_dataset_t **dsp);
|
||||
int dsl_dataset_own_force(struct dsl_pool *dp, const char *name,
|
||||
ds_hold_flags_t flags, void *tag, dsl_dataset_t **dsp);
|
||||
ds_hold_flags_t flags, const void *tag, dsl_dataset_t **dsp);
|
||||
int dsl_dataset_own_obj(struct dsl_pool *dp, uint64_t dsobj,
|
||||
ds_hold_flags_t flags, void *tag, dsl_dataset_t **dsp);
|
||||
ds_hold_flags_t flags, const void *tag, dsl_dataset_t **dsp);
|
||||
int dsl_dataset_own_obj_force(struct dsl_pool *dp, uint64_t dsobj,
|
||||
ds_hold_flags_t flags, void *tag, dsl_dataset_t **dsp);
|
||||
void dsl_dataset_disown(dsl_dataset_t *ds, ds_hold_flags_t flags, void *tag);
|
||||
ds_hold_flags_t flags, const void *tag, dsl_dataset_t **dsp);
|
||||
void dsl_dataset_disown(dsl_dataset_t *ds, ds_hold_flags_t flags,
|
||||
const void *tag);
|
||||
void dsl_dataset_name(dsl_dataset_t *ds, char *name);
|
||||
boolean_t dsl_dataset_tryown(dsl_dataset_t *ds, void *tag, boolean_t override);
|
||||
boolean_t dsl_dataset_tryown(dsl_dataset_t *ds, const void *tag,
|
||||
boolean_t override);
|
||||
int dsl_dataset_namelen(dsl_dataset_t *ds);
|
||||
boolean_t dsl_dataset_has_owner(dsl_dataset_t *ds);
|
||||
uint64_t dsl_dataset_create_sync(dsl_dir_t *pds, const char *lastname,
|
||||
@ -373,6 +375,7 @@ boolean_t dsl_dataset_modified_since_snap(dsl_dataset_t *ds,
|
||||
void dsl_dataset_sync(dsl_dataset_t *ds, zio_t *zio, dmu_tx_t *tx);
|
||||
void dsl_dataset_sync_done(dsl_dataset_t *ds, dmu_tx_t *tx);
|
||||
|
||||
void dsl_dataset_feature_set_activation(const blkptr_t *bp, dsl_dataset_t *ds);
|
||||
void dsl_dataset_block_born(dsl_dataset_t *ds, const blkptr_t *bp,
|
||||
dmu_tx_t *tx);
|
||||
int dsl_dataset_block_kill(dsl_dataset_t *ds, const blkptr_t *bp,
|
||||
|
@ -136,12 +136,12 @@ dsl_dir_phys(dsl_dir_t *dd)
|
||||
return (dd->dd_dbuf->db_data);
|
||||
}
|
||||
|
||||
void dsl_dir_rele(dsl_dir_t *dd, void *tag);
|
||||
void dsl_dir_async_rele(dsl_dir_t *dd, void *tag);
|
||||
int dsl_dir_hold(dsl_pool_t *dp, const char *name, void *tag,
|
||||
void dsl_dir_rele(dsl_dir_t *dd, const void *tag);
|
||||
void dsl_dir_async_rele(dsl_dir_t *dd, const void *tag);
|
||||
int dsl_dir_hold(dsl_pool_t *dp, const char *name, const void *tag,
|
||||
dsl_dir_t **, const char **tail);
|
||||
int dsl_dir_hold_obj(dsl_pool_t *dp, uint64_t ddobj,
|
||||
const char *tail, void *tag, dsl_dir_t **);
|
||||
const char *tail, const void *tag, dsl_dir_t **);
|
||||
void dsl_dir_name(dsl_dir_t *dd, char *buf);
|
||||
int dsl_dir_namelen(dsl_dir_t *dd);
|
||||
uint64_t dsl_dir_create_sync(dsl_pool_t *dp, dsl_dir_t *pds,
|
||||
|
@ -83,7 +83,6 @@ typedef struct zfs_blkstat {
|
||||
|
||||
typedef struct zfs_all_blkstats {
|
||||
zfs_blkstat_t zab_type[DN_MAX_LEVELS + 1][DMU_OT_TOTAL + 1];
|
||||
kmutex_t zab_lock;
|
||||
} zfs_all_blkstats_t;
|
||||
|
||||
|
||||
@ -178,9 +177,9 @@ void dsl_pool_mos_diduse_space(dsl_pool_t *dp,
|
||||
void dsl_pool_ckpoint_diduse_space(dsl_pool_t *dp,
|
||||
int64_t used, int64_t comp, int64_t uncomp);
|
||||
boolean_t dsl_pool_need_dirty_delay(dsl_pool_t *dp);
|
||||
void dsl_pool_config_enter(dsl_pool_t *dp, void *tag);
|
||||
void dsl_pool_config_enter_prio(dsl_pool_t *dp, void *tag);
|
||||
void dsl_pool_config_exit(dsl_pool_t *dp, void *tag);
|
||||
void dsl_pool_config_enter(dsl_pool_t *dp, const void *tag);
|
||||
void dsl_pool_config_enter_prio(dsl_pool_t *dp, const void *tag);
|
||||
void dsl_pool_config_exit(dsl_pool_t *dp, const void *tag);
|
||||
boolean_t dsl_pool_config_held(dsl_pool_t *dp);
|
||||
boolean_t dsl_pool_config_held_writer(dsl_pool_t *dp);
|
||||
|
||||
@ -193,8 +192,8 @@ int dsl_pool_user_release(dsl_pool_t *dp, uint64_t dsobj,
|
||||
const char *tag, dmu_tx_t *tx);
|
||||
void dsl_pool_clean_tmp_userrefs(dsl_pool_t *dp);
|
||||
int dsl_pool_open_special_dir(dsl_pool_t *dp, const char *name, dsl_dir_t **);
|
||||
int dsl_pool_hold(const char *name, void *tag, dsl_pool_t **dp);
|
||||
void dsl_pool_rele(dsl_pool_t *dp, void *tag);
|
||||
int dsl_pool_hold(const char *name, const void *tag, dsl_pool_t **dp);
|
||||
void dsl_pool_rele(dsl_pool_t *dp, const void *tag);
|
||||
|
||||
void dsl_pool_create_obsolete_bpobj(dsl_pool_t *dp, dmu_tx_t *tx);
|
||||
void dsl_pool_destroy_obsolete_bpobj(dsl_pool_t *dp, dmu_tx_t *tx);
|
||||
|
@ -155,7 +155,7 @@ typedef struct dsl_scan {
|
||||
dsl_scan_phys_t scn_phys; /* on disk representation of scan */
|
||||
dsl_scan_phys_t scn_phys_cached;
|
||||
avl_tree_t scn_queue; /* queue of datasets to scan */
|
||||
uint64_t scn_bytes_pending; /* outstanding data to issue */
|
||||
uint64_t scn_queues_pending; /* outstanding data to issue */
|
||||
} dsl_scan_t;
|
||||
|
||||
typedef struct dsl_scan_io_queue dsl_scan_io_queue_t;
|
||||
|
@ -131,9 +131,9 @@ uint64_t metaslab_group_get_space(metaslab_group_t *);
|
||||
void metaslab_group_histogram_verify(metaslab_group_t *);
|
||||
uint64_t metaslab_group_fragmentation(metaslab_group_t *);
|
||||
void metaslab_group_histogram_remove(metaslab_group_t *, metaslab_t *);
|
||||
void metaslab_group_alloc_decrement(spa_t *, uint64_t, void *, int, int,
|
||||
void metaslab_group_alloc_decrement(spa_t *, uint64_t, const void *, int, int,
|
||||
boolean_t);
|
||||
void metaslab_group_alloc_verify(spa_t *, const blkptr_t *, void *, int);
|
||||
void metaslab_group_alloc_verify(spa_t *, const blkptr_t *, const void *, int);
|
||||
void metaslab_recalculate_weight_and_sort(metaslab_t *);
|
||||
void metaslab_disable(metaslab_t *);
|
||||
void metaslab_enable(metaslab_t *, boolean_t, boolean_t);
|
||||
|
@ -64,11 +64,7 @@ typedef struct range_tree {
|
||||
uint8_t rt_shift;
|
||||
uint64_t rt_start;
|
||||
const range_tree_ops_t *rt_ops;
|
||||
|
||||
/* rt_btree_compare should only be set if rt_arg is a b-tree */
|
||||
void *rt_arg;
|
||||
int (*rt_btree_compare)(const void *, const void *);
|
||||
|
||||
uint64_t rt_gap; /* allowable inter-segment gap */
|
||||
|
||||
/*
|
||||
@ -278,9 +274,9 @@ rs_set_fill(range_seg_t *rs, range_tree_t *rt, uint64_t fill)
|
||||
|
||||
typedef void range_tree_func_t(void *arg, uint64_t start, uint64_t size);
|
||||
|
||||
range_tree_t *range_tree_create_impl(const range_tree_ops_t *ops,
|
||||
range_tree_t *range_tree_create_gap(const range_tree_ops_t *ops,
|
||||
range_seg_type_t type, void *arg, uint64_t start, uint64_t shift,
|
||||
int (*zfs_btree_compare) (const void *, const void *), uint64_t gap);
|
||||
uint64_t gap);
|
||||
range_tree_t *range_tree_create(const range_tree_ops_t *ops,
|
||||
range_seg_type_t type, void *arg, uint64_t start, uint64_t shift);
|
||||
void range_tree_destroy(range_tree_t *rt);
|
||||
@ -316,13 +312,6 @@ void range_tree_remove_xor_add_segment(uint64_t start, uint64_t end,
|
||||
void range_tree_remove_xor_add(range_tree_t *rt, range_tree_t *removefrom,
|
||||
range_tree_t *addto);
|
||||
|
||||
void rt_btree_create(range_tree_t *rt, void *arg);
|
||||
void rt_btree_destroy(range_tree_t *rt, void *arg);
|
||||
void rt_btree_add(range_tree_t *rt, range_seg_t *rs, void *arg);
|
||||
void rt_btree_remove(range_tree_t *rt, range_seg_t *rs, void *arg);
|
||||
void rt_btree_vacate(range_tree_t *rt, void *arg);
|
||||
extern const range_tree_ops_t rt_btree_ops;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -72,11 +72,11 @@ typedef struct rrwlock {
|
||||
*/
|
||||
void rrw_init(rrwlock_t *rrl, boolean_t track_all);
|
||||
void rrw_destroy(rrwlock_t *rrl);
|
||||
void rrw_enter(rrwlock_t *rrl, krw_t rw, void *tag);
|
||||
void rrw_enter_read(rrwlock_t *rrl, void *tag);
|
||||
void rrw_enter_read_prio(rrwlock_t *rrl, void *tag);
|
||||
void rrw_enter(rrwlock_t *rrl, krw_t rw, const void *tag);
|
||||
void rrw_enter_read(rrwlock_t *rrl, const void *tag);
|
||||
void rrw_enter_read_prio(rrwlock_t *rrl, const void *tag);
|
||||
void rrw_enter_write(rrwlock_t *rrl);
|
||||
void rrw_exit(rrwlock_t *rrl, void *tag);
|
||||
void rrw_exit(rrwlock_t *rrl, const void *tag);
|
||||
boolean_t rrw_held(rrwlock_t *rrl, krw_t rw);
|
||||
void rrw_tsd_destroy(void *arg);
|
||||
|
||||
@ -99,10 +99,10 @@ typedef struct rrmlock {
|
||||
|
||||
void rrm_init(rrmlock_t *rrl, boolean_t track_all);
|
||||
void rrm_destroy(rrmlock_t *rrl);
|
||||
void rrm_enter(rrmlock_t *rrl, krw_t rw, void *tag);
|
||||
void rrm_enter_read(rrmlock_t *rrl, void *tag);
|
||||
void rrm_enter(rrmlock_t *rrl, krw_t rw, const void *tag);
|
||||
void rrm_enter_read(rrmlock_t *rrl, const void *tag);
|
||||
void rrm_enter_write(rrmlock_t *rrl);
|
||||
void rrm_exit(rrmlock_t *rrl, void *tag);
|
||||
void rrm_exit(rrmlock_t *rrl, const void *tag);
|
||||
boolean_t rrm_held(rrmlock_t *rrl, krw_t rw);
|
||||
|
||||
#define RRM_READ_HELD(x) rrm_held(x, RW_READER)
|
||||
|
@ -49,7 +49,7 @@ typedef uint16_t sa_attr_type_t;
|
||||
* Attribute to register support for.
|
||||
*/
|
||||
typedef struct sa_attr_reg {
|
||||
char *sa_name; /* attribute name */
|
||||
const char *sa_name; /* attribute name */
|
||||
uint16_t sa_length;
|
||||
sa_bswap_type_t sa_byteswap; /* bswap function enum */
|
||||
sa_attr_type_t sa_attr; /* filled in during registration */
|
||||
@ -124,8 +124,8 @@ int sa_handle_get(objset_t *, uint64_t, void *userp,
|
||||
int sa_handle_get_from_db(objset_t *, dmu_buf_t *, void *userp,
|
||||
sa_handle_type_t, sa_handle_t **);
|
||||
void sa_handle_destroy(sa_handle_t *);
|
||||
int sa_buf_hold(objset_t *, uint64_t, void *, dmu_buf_t **);
|
||||
void sa_buf_rele(dmu_buf_t *, void *);
|
||||
int sa_buf_hold(objset_t *, uint64_t, const void *, dmu_buf_t **);
|
||||
void sa_buf_rele(dmu_buf_t *, const void *);
|
||||
int sa_lookup(sa_handle_t *, sa_attr_type_t, void *buf, uint32_t buflen);
|
||||
int sa_update(sa_handle_t *, sa_attr_type_t, void *buf,
|
||||
uint32_t buflen, dmu_tx_t *);
|
||||
|
@ -606,7 +606,7 @@ typedef struct blkptr {
|
||||
|
||||
#define SNPRINTF_BLKPTR(func, ws, buf, size, bp, type, checksum, compress) \
|
||||
{ \
|
||||
static const char *copyname[] = \
|
||||
static const char *const copyname[] = \
|
||||
{ "zero", "single", "double", "triple" }; \
|
||||
int len = 0; \
|
||||
int copies = 0; \
|
||||
@ -743,8 +743,8 @@ typedef enum trim_type {
|
||||
} trim_type_t;
|
||||
|
||||
/* state manipulation functions */
|
||||
extern int spa_open(const char *pool, spa_t **, void *tag);
|
||||
extern int spa_open_rewind(const char *pool, spa_t **, void *tag,
|
||||
extern int spa_open(const char *pool, spa_t **, const void *tag);
|
||||
extern int spa_open_rewind(const char *pool, spa_t **, const void *tag,
|
||||
nvlist_t *policy, nvlist_t **config);
|
||||
extern int spa_get_stats(const char *pool, nvlist_t **config, char *altroot,
|
||||
size_t buflen);
|
||||
@ -801,8 +801,8 @@ extern int spa_vdev_trim(spa_t *spa, nvlist_t *nv, uint64_t cmd_type,
|
||||
uint64_t rate, boolean_t partial, boolean_t secure, nvlist_t *vdev_errlist);
|
||||
extern int spa_vdev_setpath(spa_t *spa, uint64_t guid, const char *newpath);
|
||||
extern int spa_vdev_setfru(spa_t *spa, uint64_t guid, const char *newfru);
|
||||
extern int spa_vdev_split_mirror(spa_t *spa, char *newname, nvlist_t *config,
|
||||
nvlist_t *props, boolean_t exp);
|
||||
extern int spa_vdev_split_mirror(spa_t *spa, const char *newname,
|
||||
nvlist_t *config, nvlist_t *props, boolean_t exp);
|
||||
|
||||
/* spare state (which is global across all pools) */
|
||||
extern void spa_spare_add(vdev_t *vd);
|
||||
@ -860,9 +860,9 @@ extern void spa_remove(spa_t *spa);
|
||||
extern spa_t *spa_next(spa_t *prev);
|
||||
|
||||
/* Refcount functions */
|
||||
extern void spa_open_ref(spa_t *spa, void *tag);
|
||||
extern void spa_close(spa_t *spa, void *tag);
|
||||
extern void spa_async_close(spa_t *spa, void *tag);
|
||||
extern void spa_open_ref(spa_t *spa, const void *tag);
|
||||
extern void spa_close(spa_t *spa, const void *tag);
|
||||
extern void spa_async_close(spa_t *spa, const void *tag);
|
||||
extern boolean_t spa_refcount_zero(spa_t *spa);
|
||||
|
||||
#define SCL_NONE 0x00
|
||||
@ -971,7 +971,8 @@ extern int spa_import_progress_set_state(uint64_t pool_guid,
|
||||
spa_load_state_t spa_load_state);
|
||||
|
||||
/* Pool configuration locks */
|
||||
extern int spa_config_tryenter(spa_t *spa, int locks, void *tag, krw_t rw);
|
||||
extern int spa_config_tryenter(spa_t *spa, int locks, const void *tag,
|
||||
krw_t rw);
|
||||
extern void spa_config_enter(spa_t *spa, int locks, const void *tag, krw_t rw);
|
||||
extern void spa_config_exit(spa_t *spa, int locks, const void *tag);
|
||||
extern int spa_config_held(spa_t *spa, int locks, krw_t rw);
|
||||
@ -981,7 +982,7 @@ extern uint64_t spa_vdev_enter(spa_t *spa);
|
||||
extern uint64_t spa_vdev_detach_enter(spa_t *spa, uint64_t guid);
|
||||
extern uint64_t spa_vdev_config_enter(spa_t *spa);
|
||||
extern void spa_vdev_config_exit(spa_t *spa, vdev_t *vd, uint64_t txg,
|
||||
int error, char *tag);
|
||||
int error, const char *tag);
|
||||
extern int spa_vdev_exit(spa_t *spa, vdev_t *vd, uint64_t txg, int error);
|
||||
|
||||
/* Pool vdev state change lock */
|
||||
|
@ -104,7 +104,7 @@ extern void vdev_metaslab_fini(vdev_t *vd);
|
||||
extern void vdev_metaslab_set_size(vdev_t *);
|
||||
extern void vdev_expand(vdev_t *vd, uint64_t txg);
|
||||
extern void vdev_split(vdev_t *vd);
|
||||
extern void vdev_deadman(vdev_t *vd, char *tag);
|
||||
extern void vdev_deadman(vdev_t *vd, const char *tag);
|
||||
|
||||
typedef void vdev_xlate_func_t(void *arg, range_seg64_t *physical_rs);
|
||||
|
||||
|
@ -139,7 +139,7 @@ uint64_t zap_create_flags_dnsize(objset_t *os, int normflags,
|
||||
uint64_t zap_create_hold(objset_t *os, int normflags, zap_flags_t flags,
|
||||
dmu_object_type_t ot, int leaf_blockshift, int indirect_blockshift,
|
||||
dmu_object_type_t bonustype, int bonuslen, int dnodesize,
|
||||
dnode_t **allocated_dnode, void *tag, dmu_tx_t *tx);
|
||||
dnode_t **allocated_dnode, const void *tag, dmu_tx_t *tx);
|
||||
|
||||
uint64_t zap_create_link(objset_t *os, dmu_object_type_t ot,
|
||||
uint64_t parent_obj, const char *name, dmu_tx_t *tx);
|
||||
|
@ -199,8 +199,9 @@ typedef struct zap_name {
|
||||
|
||||
boolean_t zap_match(zap_name_t *zn, const char *matchname);
|
||||
int zap_lockdir(objset_t *os, uint64_t obj, dmu_tx_t *tx,
|
||||
krw_t lti, boolean_t fatreader, boolean_t adding, void *tag, zap_t **zapp);
|
||||
void zap_unlockdir(zap_t *zap, void *tag);
|
||||
krw_t lti, boolean_t fatreader, boolean_t adding, const void *tag,
|
||||
zap_t **zapp);
|
||||
void zap_unlockdir(zap_t *zap, const void *tag);
|
||||
void zap_evict_sync(void *dbu);
|
||||
zap_name_t *zap_name_alloc(zap_t *zap, const char *key, matchtype_t mt);
|
||||
void zap_name_free(zap_name_t *zn);
|
||||
@ -217,10 +218,10 @@ int fzap_lookup(zap_name_t *zn,
|
||||
char *realname, int rn_len, boolean_t *normalization_conflictp);
|
||||
void fzap_prefetch(zap_name_t *zn);
|
||||
int fzap_add(zap_name_t *zn, uint64_t integer_size, uint64_t num_integers,
|
||||
const void *val, void *tag, dmu_tx_t *tx);
|
||||
const void *val, const void *tag, dmu_tx_t *tx);
|
||||
int fzap_update(zap_name_t *zn,
|
||||
int integer_size, uint64_t num_integers, const void *val,
|
||||
void *tag, dmu_tx_t *tx);
|
||||
const void *tag, dmu_tx_t *tx);
|
||||
int fzap_length(zap_name_t *zn,
|
||||
uint64_t *integer_size, uint64_t *num_integers);
|
||||
int fzap_remove(zap_name_t *zn, dmu_tx_t *tx);
|
||||
@ -230,7 +231,7 @@ void zap_put_leaf(struct zap_leaf *l);
|
||||
|
||||
int fzap_add_cd(zap_name_t *zn,
|
||||
uint64_t integer_size, uint64_t num_integers,
|
||||
const void *val, uint32_t cd, void *tag, dmu_tx_t *tx);
|
||||
const void *val, uint32_t cd, const void *tag, dmu_tx_t *tx);
|
||||
void fzap_upgrade(zap_t *zap, dmu_tx_t *tx, zap_flags_t flags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -177,7 +177,7 @@ void zcp_parse_args(lua_State *, const char *, const zcp_arg_t *,
|
||||
int zcp_nvlist_to_lua(lua_State *, nvlist_t *, char *, int);
|
||||
int zcp_dataset_hold_error(lua_State *, dsl_pool_t *, const char *, int);
|
||||
struct dsl_dataset *zcp_dataset_hold(lua_State *, dsl_pool_t *,
|
||||
const char *, void *);
|
||||
const char *, const void *);
|
||||
|
||||
typedef int (zcp_lib_func_t)(lua_State *);
|
||||
typedef struct zcp_lib_info {
|
||||
|
@ -112,15 +112,13 @@ extern zfs_fuid_info_t *zfs_fuid_info_alloc(void);
|
||||
extern void zfs_fuid_info_free(zfs_fuid_info_t *);
|
||||
extern boolean_t zfs_groupmember(zfsvfs_t *, uint64_t, cred_t *);
|
||||
void zfs_fuid_sync(zfsvfs_t *, dmu_tx_t *);
|
||||
extern int zfs_fuid_find_by_domain(zfsvfs_t *, const char *domain,
|
||||
char **retdomain, boolean_t addok);
|
||||
extern const char *zfs_fuid_find_by_idx(zfsvfs_t *zfsvfs, uint32_t idx);
|
||||
extern void zfs_fuid_txhold(zfsvfs_t *zfsvfs, dmu_tx_t *tx);
|
||||
extern int zfs_id_to_fuidstr(zfsvfs_t *zfsvfs, const char *domain, uid_t rid,
|
||||
char *buf, size_t len, boolean_t addok);
|
||||
#endif
|
||||
|
||||
char *zfs_fuid_idx_domain(avl_tree_t *, uint32_t);
|
||||
const char *zfs_fuid_idx_domain(avl_tree_t *, uint32_t);
|
||||
void zfs_fuid_avl_tree_create(avl_tree_t *, avl_tree_t *);
|
||||
uint64_t zfs_fuid_table_load(objset_t *, uint64_t, avl_tree_t *, avl_tree_t *);
|
||||
void zfs_fuid_table_destroy(avl_tree_t *, avl_tree_t *);
|
||||
|
@ -223,6 +223,15 @@ typedef struct {
|
||||
uint64_t lr_foid; /* object id */
|
||||
} lr_ooo_t;
|
||||
|
||||
/*
|
||||
* Additional lr_attr_t fields.
|
||||
*/
|
||||
typedef struct {
|
||||
uint64_t lr_attr_attrs; /* all of the attributes */
|
||||
uint64_t lr_attr_crtime[2]; /* create time */
|
||||
uint8_t lr_attr_scanstamp[32];
|
||||
} lr_attr_end_t;
|
||||
|
||||
/*
|
||||
* Handle option extended vattr attributes.
|
||||
*
|
||||
@ -233,7 +242,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
uint32_t lr_attr_masksize; /* number of elements in array */
|
||||
uint32_t lr_attr_bitmap; /* First entry of array */
|
||||
/* remainder of array and any additional fields */
|
||||
/* remainder of array and additional lr_attr_end_t fields */
|
||||
} lr_attr_t;
|
||||
|
||||
/*
|
||||
|
@ -589,7 +589,7 @@ extern void zio_execute(void *zio);
|
||||
extern void zio_interrupt(void *zio);
|
||||
extern void zio_delay_init(zio_t *zio);
|
||||
extern void zio_delay_interrupt(zio_t *zio);
|
||||
extern void zio_deadman(zio_t *zio, char *tag);
|
||||
extern void zio_deadman(zio_t *zio, const char *tag);
|
||||
|
||||
extern zio_t *zio_walk_parents(zio_t *cio, zio_link_t **);
|
||||
extern zio_t *zio_walk_children(zio_t *pio, zio_link_t **);
|
||||
@ -657,7 +657,8 @@ extern int zio_inject_fault(char *name, int flags, int *id,
|
||||
extern int zio_inject_list_next(int *id, char *name, size_t buflen,
|
||||
struct zinject_record *record);
|
||||
extern int zio_clear_fault(int id);
|
||||
extern void zio_handle_panic_injection(spa_t *spa, char *tag, uint64_t type);
|
||||
extern void zio_handle_panic_injection(spa_t *spa, const char *tag,
|
||||
uint64_t type);
|
||||
extern int zio_handle_decrypt_injection(spa_t *spa, const zbookmark_phys_t *zb,
|
||||
uint64_t type, int error);
|
||||
extern int zio_handle_fault_injection(zio_t *zio, int error);
|
||||
|
@ -90,7 +90,7 @@ typedef const struct zio_checksum_info {
|
||||
zio_checksum_tmpl_init_t *ci_tmpl_init;
|
||||
zio_checksum_tmpl_free_t *ci_tmpl_free;
|
||||
zio_checksum_flags_t ci_flags;
|
||||
char *ci_name; /* descriptive name */
|
||||
const char *ci_name; /* descriptive name */
|
||||
} zio_checksum_info_t;
|
||||
|
||||
typedef struct zio_bad_cksum {
|
||||
@ -102,7 +102,7 @@ typedef struct zio_bad_cksum {
|
||||
uint8_t zbc_has_cksum; /* expected/actual valid */
|
||||
} zio_bad_cksum_t;
|
||||
|
||||
_SYS_ZIO_CHECKSUM_H zio_checksum_info_t
|
||||
_SYS_ZIO_CHECKSUM_H const zio_checksum_info_t
|
||||
zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS];
|
||||
|
||||
/*
|
||||
|
@ -145,14 +145,14 @@ typedef int zio_decompress_abd_func_t(abd_t *src, void *dst,
|
||||
* Information about each compression function.
|
||||
*/
|
||||
typedef const struct zio_compress_info {
|
||||
char *ci_name;
|
||||
const char *ci_name;
|
||||
int ci_level;
|
||||
zio_compress_func_t *ci_compress;
|
||||
zio_decompress_func_t *ci_decompress;
|
||||
zio_decompresslevel_func_t *ci_decompress_level;
|
||||
} zio_compress_info_t;
|
||||
|
||||
extern zio_compress_info_t zio_compress_table[ZIO_COMPRESS_FUNCTIONS];
|
||||
extern const zio_compress_info_t zio_compress_table[ZIO_COMPRESS_FUNCTIONS];
|
||||
|
||||
/*
|
||||
* lz4 compression init & free
|
||||
|
@ -67,7 +67,7 @@ typedef struct zio_crypt_info {
|
||||
size_t ci_keylen;
|
||||
|
||||
/* human-readable name of the encryption algorithm */
|
||||
char *ci_name;
|
||||
const char *ci_name;
|
||||
} zio_crypt_info_t;
|
||||
|
||||
extern const zio_crypt_info_t zio_crypt_table[ZIO_CRYPT_FUNCTIONS];
|
||||
|
@ -34,7 +34,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
_ZFS_COMUTIL_H boolean_t zfs_allocatable_devs(nvlist_t *);
|
||||
_ZFS_COMUTIL_H boolean_t zfs_special_devs(nvlist_t *, char *);
|
||||
_ZFS_COMUTIL_H boolean_t zfs_special_devs(nvlist_t *, const char *);
|
||||
_ZFS_COMUTIL_H void zpool_get_load_policy(nvlist_t *, zpool_load_policy_t *);
|
||||
|
||||
_ZFS_COMUTIL_H int zfs_zpl_version_map(int spa_version);
|
||||
|
@ -81,7 +81,7 @@ typedef enum {
|
||||
} zfs_deleg_note_t;
|
||||
|
||||
typedef struct zfs_deleg_perm_tab {
|
||||
char *z_perm;
|
||||
const char *z_perm;
|
||||
zfs_deleg_note_t z_note;
|
||||
} zfs_deleg_perm_tab_t;
|
||||
|
||||
|
@ -79,7 +79,7 @@ extern int _sol_getmntent(FILE *fp, struct mnttab *mp);
|
||||
extern int getextmntent(const char *path, struct extmnttab *entry,
|
||||
struct stat64 *statbuf);
|
||||
extern void statfs2mnttab(struct statfs *sfs, struct mnttab *mp);
|
||||
extern char *hasmntopt(struct mnttab *mnt, char *opt);
|
||||
extern char *hasmntopt(struct mnttab *mnt, const char *opt);
|
||||
extern int getmntent(FILE *fp, struct mnttab *mp);
|
||||
|
||||
#endif
|
||||
|
@ -74,7 +74,7 @@ extern int getmntany(FILE *fp, struct mnttab *mp, struct mnttab *mpref);
|
||||
extern int _sol_getmntent(FILE *fp, struct mnttab *mp);
|
||||
extern int getextmntent(const char *path, struct extmnttab *mp,
|
||||
struct stat64 *statbuf);
|
||||
static inline char *_sol_hasmntopt(struct mnttab *mnt, char *opt)
|
||||
static inline char *_sol_hasmntopt(struct mnttab *mnt, const char *opt)
|
||||
{
|
||||
struct mntent mnt_new;
|
||||
|
||||
|
@ -140,7 +140,7 @@ umem_nofail_callback(umem_nofail_callback_t *cb __maybe_unused)
|
||||
|
||||
static inline umem_cache_t *
|
||||
umem_cache_create(
|
||||
char *name, size_t bufsize, size_t align,
|
||||
const char *name, size_t bufsize, size_t align,
|
||||
umem_constructor_t *constructor,
|
||||
umem_destructor_t *destructor,
|
||||
umem_reclaim_t *reclaim,
|
||||
|
@ -67,7 +67,7 @@ mntopt(char **p)
|
||||
}
|
||||
|
||||
char *
|
||||
hasmntopt(struct mnttab *mnt, char *opt)
|
||||
hasmntopt(struct mnttab *mnt, const char *opt)
|
||||
{
|
||||
char tmpopts[MNT_LINE_MAX];
|
||||
char *f, *opts = tmpopts;
|
||||
|
@ -849,7 +849,8 @@ encryption_feature_is_enabled(zpool_handle_t *zph)
|
||||
static int
|
||||
populate_create_encryption_params_nvlists(libzfs_handle_t *hdl,
|
||||
zfs_handle_t *zhp, boolean_t newkey, zfs_keyformat_t keyformat,
|
||||
char *keylocation, nvlist_t *props, uint8_t **wkeydata, uint_t *wkeylen)
|
||||
const char *keylocation, nvlist_t *props, uint8_t **wkeydata,
|
||||
uint_t *wkeylen)
|
||||
{
|
||||
int ret;
|
||||
uint64_t iters = 0, salt = 0;
|
||||
@ -1121,7 +1122,7 @@ zfs_crypto_create(libzfs_handle_t *hdl, char *parent_name, nvlist_t *props,
|
||||
|
||||
/* default to prompt if no keylocation is specified */
|
||||
if (keyformat != ZFS_KEYFORMAT_NONE && keylocation == NULL) {
|
||||
keylocation = "prompt";
|
||||
keylocation = (char *)"prompt";
|
||||
ret = nvlist_add_string(props,
|
||||
zfs_prop_to_name(ZFS_PROP_KEYLOCATION), keylocation);
|
||||
if (ret != 0)
|
||||
@ -1699,7 +1700,7 @@ zfs_crypto_rewrap(zfs_handle_t *zhp, nvlist_t *raw_props, boolean_t inheritkey)
|
||||
|
||||
/* default to prompt if no keylocation is specified */
|
||||
if (keylocation == NULL) {
|
||||
keylocation = "prompt";
|
||||
keylocation = (char *)"prompt";
|
||||
ret = nvlist_add_string(props,
|
||||
zfs_prop_to_name(ZFS_PROP_KEYLOCATION),
|
||||
keylocation);
|
||||
|
@ -882,7 +882,7 @@ libzfs_mnttab_find(libzfs_handle_t *hdl, const char *fsname,
|
||||
return (ENOENT);
|
||||
|
||||
srch.mnt_special = (char *)fsname;
|
||||
srch.mnt_fstype = MNTTYPE_ZFS;
|
||||
srch.mnt_fstype = (char *)MNTTYPE_ZFS;
|
||||
ret = getmntany(mnttab, entry, &srch) ? ENOENT : 0;
|
||||
(void) fclose(mnttab);
|
||||
return (ret);
|
||||
@ -2051,7 +2051,7 @@ getprop_uint64(zfs_handle_t *zhp, zfs_prop_t prop, char **source)
|
||||
verify(!zhp->zfs_props_table ||
|
||||
zhp->zfs_props_table[prop] == B_TRUE);
|
||||
value = zfs_prop_default_numeric(prop);
|
||||
*source = "";
|
||||
*source = (char *)"";
|
||||
}
|
||||
|
||||
return (value);
|
||||
@ -2072,7 +2072,7 @@ getprop_string(zfs_handle_t *zhp, zfs_prop_t prop, char **source)
|
||||
verify(!zhp->zfs_props_table ||
|
||||
zhp->zfs_props_table[prop] == B_TRUE);
|
||||
value = zfs_prop_default_string(prop);
|
||||
*source = "";
|
||||
*source = (char *)"";
|
||||
}
|
||||
|
||||
return (value);
|
||||
@ -2114,8 +2114,8 @@ get_numeric_property(zfs_handle_t *zhp, zfs_prop_t prop, zprop_source_t *src,
|
||||
zfs_cmd_t zc = {"\0"};
|
||||
nvlist_t *zplprops = NULL;
|
||||
struct mnttab mnt;
|
||||
char *mntopt_on = NULL;
|
||||
char *mntopt_off = NULL;
|
||||
const char *mntopt_on = NULL;
|
||||
const char *mntopt_off = NULL;
|
||||
boolean_t received = zfs_is_recvd_props_mode(zhp);
|
||||
|
||||
*source = NULL;
|
||||
@ -2194,7 +2194,7 @@ get_numeric_property(zfs_handle_t *zhp, zfs_prop_t prop, zprop_source_t *src,
|
||||
}
|
||||
|
||||
if (zhp->zfs_mntopts == NULL)
|
||||
mnt.mnt_mntopts = "";
|
||||
mnt.mnt_mntopts = (char *)"";
|
||||
else
|
||||
mnt.mnt_mntopts = zhp->zfs_mntopts;
|
||||
|
||||
|
@ -223,7 +223,7 @@ typedef struct differ_info {
|
||||
int datafd;
|
||||
} differ_info_t;
|
||||
|
||||
extern int do_mount(zfs_handle_t *zhp, const char *mntpt, char *opts,
|
||||
extern int do_mount(zfs_handle_t *zhp, const char *mntpt, const char *opts,
|
||||
int flags);
|
||||
extern int do_unmount(zfs_handle_t *zhp, const char *mntpt, int flags);
|
||||
extern int libzfs_load_module(void);
|
||||
|
@ -289,7 +289,7 @@ zfs_is_mountable(zfs_handle_t *zhp, char *buf, size_t buflen,
|
||||
|
||||
static int
|
||||
zfs_add_option(zfs_handle_t *zhp, char *options, int len,
|
||||
zfs_prop_t prop, char *on, char *off)
|
||||
zfs_prop_t prop, const char *on, const char *off)
|
||||
{
|
||||
char *source;
|
||||
uint64_t value;
|
||||
|
@ -119,7 +119,7 @@ zpool_get_prop_string(zpool_handle_t *zhp, zpool_prop_t prop,
|
||||
zprop_source_t *src)
|
||||
{
|
||||
nvlist_t *nv, *nvl;
|
||||
char *value;
|
||||
const char *value;
|
||||
zprop_source_t source;
|
||||
|
||||
nvl = zhp->zpool_props;
|
||||
@ -128,7 +128,7 @@ zpool_get_prop_string(zpool_handle_t *zhp, zpool_prop_t prop,
|
||||
value = fnvlist_lookup_string(nv, ZPROP_VALUE);
|
||||
} else {
|
||||
source = ZPROP_SRC_DEFAULT;
|
||||
if ((value = (char *)zpool_prop_default_string(prop)) == NULL)
|
||||
if ((value = zpool_prop_default_string(prop)) == NULL)
|
||||
value = "-";
|
||||
}
|
||||
|
||||
@ -2111,7 +2111,7 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
|
||||
case EREMOTEIO:
|
||||
if (nv != NULL && nvlist_lookup_nvlist(nv,
|
||||
ZPOOL_CONFIG_LOAD_INFO, &nvinfo) == 0) {
|
||||
char *hostname = "<unknown>";
|
||||
const char *hostname = "<unknown>";
|
||||
uint64_t hostid = 0;
|
||||
mmp_state_t mmp_state;
|
||||
|
||||
@ -5029,7 +5029,7 @@ zpool_get_vdev_prop_value(nvlist_t *nvprop, vdev_prop_t prop, char *prop_name,
|
||||
char *buf, size_t len, zprop_source_t *srctype, boolean_t literal)
|
||||
{
|
||||
nvlist_t *nv;
|
||||
char *strval;
|
||||
const char *strval;
|
||||
uint64_t intval;
|
||||
zprop_source_t src = ZPROP_SRC_NONE;
|
||||
|
||||
@ -5059,8 +5059,7 @@ zpool_get_vdev_prop_value(nvlist_t *nvprop, vdev_prop_t prop, char *prop_name,
|
||||
strval = fnvlist_lookup_string(nv, ZPROP_VALUE);
|
||||
} else {
|
||||
src = ZPROP_SRC_DEFAULT;
|
||||
if ((strval = (char *)vdev_prop_default_string(prop))
|
||||
== NULL)
|
||||
if ((strval = vdev_prop_default_string(prop)) == NULL)
|
||||
strval = "-";
|
||||
}
|
||||
(void) strlcpy(buf, strval, len);
|
||||
|
@ -851,6 +851,11 @@ dump_ioctl(zfs_handle_t *zhp, const char *fromsnap, uint64_t fromsnap_obj,
|
||||
case EINVAL:
|
||||
zfs_error_aux(hdl, "%s", strerror(errno));
|
||||
return (zfs_error(hdl, EZFS_BADBACKUP, errbuf));
|
||||
case ENOTSUP:
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"large blocks detected but large_blocks feature "
|
||||
"is inactive; raw send unsupported"));
|
||||
return (zfs_error(hdl, EZFS_NOTSUP, errbuf));
|
||||
|
||||
default:
|
||||
return (zfs_standard_error(hdl, errno, errbuf));
|
||||
@ -2060,7 +2065,7 @@ send_prelim_records(zfs_handle_t *zhp, const char *from, int fd,
|
||||
/* name of filesystem/volume that contains snapshot we are sending */
|
||||
char tofs[ZFS_MAX_DATASET_NAME_LEN];
|
||||
/* short name of snap we are sending */
|
||||
char *tosnap = "";
|
||||
const char *tosnap = "";
|
||||
|
||||
char errbuf[ERRBUFLEN];
|
||||
(void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
|
||||
@ -2674,6 +2679,11 @@ zfs_send_one_cb_impl(zfs_handle_t *zhp, const char *from, int fd,
|
||||
case EROFS:
|
||||
zfs_error_aux(hdl, "%s", strerror(errno));
|
||||
return (zfs_error(hdl, EZFS_BADBACKUP, errbuf));
|
||||
case ENOTSUP:
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"large blocks detected but large_blocks feature "
|
||||
"is inactive; raw send unsupported"));
|
||||
return (zfs_error(hdl, EZFS_NOTSUP, errbuf));
|
||||
|
||||
default:
|
||||
return (zfs_standard_error(hdl, errno, errbuf));
|
||||
|
@ -56,7 +56,7 @@
|
||||
* in include/libzfs.h. Note that there are some status results which go past
|
||||
* the end of this table, and hence have no associated message ID.
|
||||
*/
|
||||
static char *zfs_msgid_table[] = {
|
||||
static const char *const zfs_msgid_table[] = {
|
||||
"ZFS-8000-14", /* ZPOOL_STATUS_CORRUPT_CACHE */
|
||||
"ZFS-8000-2Q", /* ZPOOL_STATUS_MISSING_DEV_R */
|
||||
"ZFS-8000-3C", /* ZPOOL_STATUS_MISSING_DEV_NR */
|
||||
@ -495,7 +495,8 @@ check_status(nvlist_t *config, boolean_t isimport,
|
||||
}
|
||||
|
||||
zpool_status_t
|
||||
zpool_get_status(zpool_handle_t *zhp, char **msgid, zpool_errata_t *errata)
|
||||
zpool_get_status(zpool_handle_t *zhp, const char **msgid,
|
||||
zpool_errata_t *errata)
|
||||
{
|
||||
/*
|
||||
* pass in the desired feature set, as
|
||||
@ -519,7 +520,8 @@ zpool_get_status(zpool_handle_t *zhp, char **msgid, zpool_errata_t *errata)
|
||||
}
|
||||
|
||||
zpool_status_t
|
||||
zpool_import_status(nvlist_t *config, char **msgid, zpool_errata_t *errata)
|
||||
zpool_import_status(nvlist_t *config, const char **msgid,
|
||||
zpool_errata_t *errata)
|
||||
{
|
||||
zpool_status_t ret = check_status(config, B_TRUE, errata, NULL);
|
||||
|
||||
|
@ -999,16 +999,13 @@ libzfs_free_str_array(char **strs, int count)
|
||||
*
|
||||
* Returns 0 otherwise.
|
||||
*/
|
||||
int
|
||||
libzfs_envvar_is_set(char *envvar)
|
||||
boolean_t
|
||||
libzfs_envvar_is_set(const char *envvar)
|
||||
{
|
||||
char *env = getenv(envvar);
|
||||
if (env && (strtoul(env, NULL, 0) > 0 ||
|
||||
return (env && (strtoul(env, NULL, 0) > 0 ||
|
||||
(!strncasecmp(env, "YES", 3) && strnlen(env, 4) == 3) ||
|
||||
(!strncasecmp(env, "ON", 2) && strnlen(env, 3) == 2)))
|
||||
return (1);
|
||||
|
||||
return (0);
|
||||
(!strncasecmp(env, "ON", 2) && strnlen(env, 3) == 2)));
|
||||
}
|
||||
|
||||
libzfs_handle_t *
|
||||
@ -2002,22 +1999,22 @@ use_color(void)
|
||||
* color_end();
|
||||
*/
|
||||
void
|
||||
color_start(char *color)
|
||||
color_start(const char *color)
|
||||
{
|
||||
if (use_color())
|
||||
printf("%s", color);
|
||||
fputs(color, stdout);
|
||||
}
|
||||
|
||||
void
|
||||
color_end(void)
|
||||
{
|
||||
if (use_color())
|
||||
printf(ANSI_RESET);
|
||||
fputs(ANSI_RESET, stdout);
|
||||
}
|
||||
|
||||
/* printf() with a color. If color is NULL, then do a normal printf. */
|
||||
int
|
||||
printf_color(char *color, char *format, ...)
|
||||
printf_color(const char *color, const char *format, ...)
|
||||
{
|
||||
va_list aptr;
|
||||
int rc;
|
||||
|
@ -74,8 +74,8 @@ build_iovec(struct iovec **iov, int *iovlen, const char *name, void *val,
|
||||
}
|
||||
|
||||
static int
|
||||
do_mount_(const char *spec, const char *dir, int mflag, char *fstype,
|
||||
char *dataptr, int datalen, char *optptr, int optlen)
|
||||
do_mount_(const char *spec, const char *dir, int mflag,
|
||||
char *dataptr, int datalen, const char *optptr, int optlen)
|
||||
{
|
||||
struct iovec *iov;
|
||||
char *optstr, *p, *tofree;
|
||||
@ -83,8 +83,6 @@ do_mount_(const char *spec, const char *dir, int mflag, char *fstype,
|
||||
|
||||
assert(spec != NULL);
|
||||
assert(dir != NULL);
|
||||
assert(fstype != NULL);
|
||||
assert(strcmp(fstype, MNTTYPE_ZFS) == 0);
|
||||
assert(dataptr == NULL), (void) dataptr;
|
||||
assert(datalen == 0), (void) datalen;
|
||||
assert(optptr != NULL);
|
||||
@ -99,7 +97,8 @@ do_mount_(const char *spec, const char *dir, int mflag, char *fstype,
|
||||
build_iovec(&iov, &iovlen, "update", NULL, 0);
|
||||
if (mflag & MS_RDONLY)
|
||||
build_iovec(&iov, &iovlen, "ro", NULL, 0);
|
||||
build_iovec(&iov, &iovlen, "fstype", fstype, (size_t)-1);
|
||||
build_iovec(&iov, &iovlen, "fstype", __DECONST(char *, MNTTYPE_ZFS),
|
||||
(size_t)-1);
|
||||
build_iovec(&iov, &iovlen, "fspath", __DECONST(char *, dir),
|
||||
(size_t)-1);
|
||||
build_iovec(&iov, &iovlen, "from", __DECONST(char *, spec), (size_t)-1);
|
||||
@ -113,10 +112,10 @@ do_mount_(const char *spec, const char *dir, int mflag, char *fstype,
|
||||
}
|
||||
|
||||
int
|
||||
do_mount(zfs_handle_t *zhp, const char *mntpt, char *opts, int flags)
|
||||
do_mount(zfs_handle_t *zhp, const char *mntpt, const char *opts, int flags)
|
||||
{
|
||||
|
||||
return (do_mount_(zfs_get_name(zhp), mntpt, flags, MNTTYPE_ZFS, NULL, 0,
|
||||
return (do_mount_(zfs_get_name(zhp), mntpt, flags, NULL, 0,
|
||||
opts, sizeof (mntpt)));
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,7 @@ parse_option(char *mntopt, unsigned long *mntflags,
|
||||
* otherwise they are considered fatal are copied in to badopt.
|
||||
*/
|
||||
int
|
||||
zfs_parse_mount_options(char *mntopts, unsigned long *mntflags,
|
||||
zfs_parse_mount_options(const char *mntopts, unsigned long *mntflags,
|
||||
unsigned long *zfsflags, int sloppy, char *badopt, char *mtabopt)
|
||||
{
|
||||
int error = 0, quote = 0, flag = 0, count = 0;
|
||||
@ -320,7 +320,7 @@ zfs_adjust_mount_options(zfs_handle_t *zhp, const char *mntpoint,
|
||||
* make due with return value from the mount process.
|
||||
*/
|
||||
int
|
||||
do_mount(zfs_handle_t *zhp, const char *mntpt, char *opts, int flags)
|
||||
do_mount(zfs_handle_t *zhp, const char *mntpt, const char *opts, int flags)
|
||||
{
|
||||
const char *src = zfs_get_name(zhp);
|
||||
int error = 0;
|
||||
@ -341,10 +341,10 @@ do_mount(zfs_handle_t *zhp, const char *mntpt, char *opts, int flags)
|
||||
}
|
||||
} else {
|
||||
char *argv[9] = {
|
||||
"/bin/mount",
|
||||
"--no-canonicalize",
|
||||
"-t", MNTTYPE_ZFS,
|
||||
"-o", opts,
|
||||
(char *)"/bin/mount",
|
||||
(char *)"--no-canonicalize",
|
||||
(char *)"-t", (char *)MNTTYPE_ZFS,
|
||||
(char *)"-o", (char *)opts,
|
||||
(char *)src,
|
||||
(char *)mntpt,
|
||||
(char *)NULL };
|
||||
@ -384,23 +384,17 @@ do_unmount(zfs_handle_t *zhp, const char *mntpt, int flags)
|
||||
return (rv < 0 ? errno : 0);
|
||||
}
|
||||
|
||||
char force_opt[] = "-f";
|
||||
char lazy_opt[] = "-l";
|
||||
char *argv[7] = {
|
||||
"/bin/umount",
|
||||
"-t", MNTTYPE_ZFS,
|
||||
(char *)"/bin/umount",
|
||||
(char *)"-t", (char *)MNTTYPE_ZFS,
|
||||
NULL, NULL, NULL, NULL };
|
||||
int rc, count = 3;
|
||||
|
||||
if (flags & MS_FORCE) {
|
||||
argv[count] = force_opt;
|
||||
count++;
|
||||
}
|
||||
if (flags & MS_FORCE)
|
||||
argv[count++] = (char *)"-f";
|
||||
|
||||
if (flags & MS_DETACH) {
|
||||
argv[count] = lazy_opt;
|
||||
count++;
|
||||
}
|
||||
if (flags & MS_DETACH)
|
||||
argv[count++] = (char *)"-l";
|
||||
|
||||
argv[count] = (char *)mntpt;
|
||||
rc = libzfs_run_process(argv[0], argv, STDOUT_VERBOSE|STDERR_VERBOSE);
|
||||
|
@ -99,7 +99,7 @@ libzfs_load_module(void)
|
||||
return (0);
|
||||
|
||||
if (access(ZFS_SYSFS_DIR, F_OK) != 0) {
|
||||
char *argv[] = {"modprobe", "zfs", NULL};
|
||||
char *argv[] = {(char *)"modprobe", (char *)"zfs", NULL};
|
||||
if (libzfs_run_process("modprobe", argv, 0))
|
||||
return (ENOEXEC);
|
||||
|
||||
@ -259,7 +259,7 @@ zfs_userns(zfs_handle_t *zhp, const char *nspath, int attach)
|
||||
"pools can not be namespaced"));
|
||||
return (zfs_error(hdl, EZFS_BADTYPE, errbuf));
|
||||
case ZFS_TYPE_FILESYSTEM:
|
||||
zfs_fallthrough;
|
||||
break;
|
||||
}
|
||||
assert(zhp->zfs_type == ZFS_TYPE_FILESYSTEM);
|
||||
|
||||
|
@ -1002,8 +1002,6 @@ kmem_cache_reap_active(void)
|
||||
return (0);
|
||||
}
|
||||
|
||||
void *zvol_tag = "zvol_tag";
|
||||
|
||||
void
|
||||
zvol_create_minor(const char *name)
|
||||
{
|
||||
|
@ -64,7 +64,8 @@ show_vdev_stats(const char *desc, const char *ctype, nvlist_t *nv, int indent)
|
||||
}
|
||||
|
||||
if (desc != NULL) {
|
||||
char *suffix = "", *bias = NULL;
|
||||
const char *suffix = "";
|
||||
char *bias = NULL;
|
||||
char bias_suffix[32];
|
||||
|
||||
(void) nvlist_lookup_uint64(nv, ZPOOL_CONFIG_IS_LOG, &is_log);
|
||||
@ -117,7 +118,7 @@ show_vdev_stats(const char *desc, const char *ctype, nvlist_t *nv, int indent)
|
||||
int len;
|
||||
if (nvlist_lookup_string(cnv, ZPOOL_CONFIG_PATH, &cname) &&
|
||||
nvlist_lookup_string(cnv, ZPOOL_CONFIG_TYPE, &cname))
|
||||
cname = "<unknown>";
|
||||
cname = (char *)"<unknown>";
|
||||
len = strlen(cname) + 2;
|
||||
tname = umem_zalloc(len, UMEM_NOFAIL);
|
||||
(void) strlcpy(tname, cname, len);
|
||||
|
@ -328,7 +328,9 @@ zpool_find_import_blkid(libpc_handle_t *hdl, pthread_mutex_t *lock,
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
error = blkid_dev_set_search(iter, "TYPE", "zfs_member");
|
||||
/* Only const char *s since 2.32 */
|
||||
error = blkid_dev_set_search(iter,
|
||||
(char *)"TYPE", (char *)"zfs_member");
|
||||
if (error != 0) {
|
||||
blkid_dev_iterate_end(iter);
|
||||
blkid_put_cache(cache);
|
||||
|
@ -1543,7 +1543,7 @@ discover_cached_paths(libpc_handle_t *hdl, nvlist_t *nv,
|
||||
*/
|
||||
if (nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0) {
|
||||
if ((dl = zfs_dirnamelen(path)) == -1)
|
||||
path = ".";
|
||||
path = (char *)".";
|
||||
else
|
||||
path[dl] = '\0';
|
||||
return (zpool_find_import_scan_dir(hdl, lock, cache,
|
||||
|
@ -18,7 +18,7 @@
|
||||
.\" Copyright (c) 2019, Allan Jude
|
||||
.\" Copyright (c) 2021, Colm Buckley <colm@tuatha.org>
|
||||
.\"
|
||||
.Dd May 31, 2021
|
||||
.Dd June 23, 2022
|
||||
.Dt ZPOOL-FEATURES 7
|
||||
.Os
|
||||
.
|
||||
@ -27,8 +27,10 @@
|
||||
.Nd description of ZFS pool features
|
||||
.
|
||||
.Sh DESCRIPTION
|
||||
ZFS pool on-disk format versions are specified via "features" which replace
|
||||
the old on-disk format numbers (the last supported on-disk format number is 28).
|
||||
ZFS pool on-disk format versions are specified via
|
||||
.Dq features
|
||||
which replace the old on-disk format numbers
|
||||
.Pq the last supported on-disk format number is 28 .
|
||||
To enable a feature on a pool use the
|
||||
.Nm zpool Cm upgrade ,
|
||||
or set the
|
||||
@ -62,10 +64,12 @@ implementation that created the pool for information about those features.
|
||||
Each supported feature also has a short name.
|
||||
By convention a feature's short name is the portion of its GUID which follows the
|
||||
.Sq \&:
|
||||
(i.e.
|
||||
.Po
|
||||
i.e.
|
||||
.Ar com.example : Ns Ar feature-name
|
||||
would have the short name
|
||||
.Ar feature-name ) ,
|
||||
.Ar feature-name
|
||||
.Pc ,
|
||||
however a feature's short name may differ across ZFS implementations if
|
||||
following the convention would result in name conflicts.
|
||||
.
|
||||
@ -110,9 +114,11 @@ These features are referred to as
|
||||
If all unsupported features on a pool are read-only compatible,
|
||||
the pool can be imported in read-only mode by setting the
|
||||
.Sy readonly
|
||||
property during import (see
|
||||
property during import
|
||||
.Po see
|
||||
.Xr zpool-import 8
|
||||
for details on importing pools).
|
||||
for details on importing pools
|
||||
.Pc .
|
||||
.
|
||||
.Ss Unsupported features
|
||||
For each unsupported feature enabled on an imported pool, a pool property
|
||||
@ -143,15 +149,19 @@ The
|
||||
feature facilitates this by allowing feature sets to be read from text files.
|
||||
When set to
|
||||
.Sy off
|
||||
(the default), compatibility feature sets are disabled
|
||||
(i.e. all features are enabled); when set to
|
||||
.Pq the default ,
|
||||
compatibility feature sets are disabled
|
||||
.Pq i.e. all features are enabled ;
|
||||
when set to
|
||||
.Sy legacy ,
|
||||
no features are enabled.
|
||||
When set to a comma-separated list of filenames
|
||||
(each filename may either be an absolute path, or relative to
|
||||
.Po
|
||||
each filename may either be an absolute path, or relative to
|
||||
.Pa /etc/zfs/compatibility.d
|
||||
or
|
||||
.Pa /usr/share/zfs/compatibility.d ) ,
|
||||
.Pa /usr/share/zfs/compatibility.d
|
||||
.Pc ,
|
||||
the lists of requested features are read from those files,
|
||||
separated by whitespace and/or commas.
|
||||
Only features present in all files are enabled.
|
||||
@ -291,7 +301,9 @@ This feature enables support for separate allocation classes.
|
||||
.Pp
|
||||
This feature becomes
|
||||
.Sy active
|
||||
when a dedicated allocation class vdev (dedup or special) is created with the
|
||||
when a dedicated allocation class vdev
|
||||
.Pq dedup or special
|
||||
is created with the
|
||||
.Nm zpool Cm create No or Nm zpool Cm add No commands .
|
||||
With device removal, it can be returned to the
|
||||
.Sy enabled
|
||||
@ -356,8 +368,9 @@ state when all v2 bookmarks are destroyed.
|
||||
.feature com.delphix bookmark_written no bookmark extensible_dataset bookmark_v2
|
||||
This feature enables additional bookmark accounting fields, enabling the
|
||||
.Sy written Ns # Ns Ar bookmark
|
||||
property (space written since a bookmark) and estimates of
|
||||
send stream sizes for incrementals from bookmarks.
|
||||
property
|
||||
.Pq space written since a bookmark
|
||||
and estimates of send stream sizes for incrementals from bookmarks.
|
||||
.Pp
|
||||
This feature becomes
|
||||
.Sy active
|
||||
@ -372,7 +385,8 @@ This feature enables the ability for the
|
||||
and
|
||||
.Nm zpool Cm replace
|
||||
commands to perform sequential reconstruction
|
||||
(instead of healing reconstruction) when resilvering.
|
||||
.Pq instead of healing reconstruction
|
||||
when resilvering.
|
||||
.Pp
|
||||
Sequential reconstruction resilvers a device in LBA order without immediately
|
||||
verifying the checksums.
|
||||
@ -424,8 +438,10 @@ vdev to an existing pool.
|
||||
.
|
||||
.feature org.illumos edonr no extensible_dataset
|
||||
This feature enables the use of the Edon-R hash algorithm for checksum,
|
||||
including for nopwrite (if compression is also enabled, an overwrite of
|
||||
a block whose checksum matches the data being written will be ignored).
|
||||
including for nopwrite
|
||||
.Po if compression is also enabled, an overwrite of
|
||||
a block whose checksum matches the data being written will be ignored
|
||||
.Pc .
|
||||
In an abundance of caution, Edon-R requires verification when used with
|
||||
dedup:
|
||||
.Nm zfs Cm set Sy dedup Ns = Ns Sy edonr , Ns Sy verify
|
||||
@ -433,13 +449,15 @@ dedup:
|
||||
.Pp
|
||||
Edon-R is a very high-performance hash algorithm that was part
|
||||
of the NIST SHA-3 competition.
|
||||
It provides extremely high hash performance (over 350% faster than SHA-256),
|
||||
It provides extremely high hash performance
|
||||
.Pq over 350% faster than SHA-256 ,
|
||||
but was not selected because of its unsuitability
|
||||
as a general purpose secure hash algorithm.
|
||||
This implementation utilizes the new salted checksumming functionality
|
||||
in ZFS, which means that the checksum is pre-seeded with a secret
|
||||
256-bit random key (stored on the pool) before being fed the data block
|
||||
to be checksummed.
|
||||
256-bit random key
|
||||
.Pq stored on the pool
|
||||
before being fed the data block to be checksummed.
|
||||
Thus the produced checksums are unique to a given pool,
|
||||
preventing hash collision attacks on systems with dedup.
|
||||
.Pp
|
||||
@ -452,10 +470,15 @@ Blocks whose contents can compress to 112 bytes
|
||||
or smaller can take advantage of this feature.
|
||||
.Pp
|
||||
When this feature is enabled, the contents of highly-compressible blocks are
|
||||
stored in the block "pointer" itself (a misnomer in this case, as it contains
|
||||
the compressed data, rather than a pointer to its location on disk).
|
||||
Thus the space of the block (one sector, typically 512 B or 4 KiB) is saved,
|
||||
and no additional I/O is needed to read and write the data block.
|
||||
stored in the block
|
||||
.Dq pointer
|
||||
itself
|
||||
.Po a misnomer in this case, as it contains
|
||||
the compressed data, rather than a pointer to its location on disk
|
||||
.Pc .
|
||||
Thus the space of the block
|
||||
.Pq one sector, typically 512 B or 4 KiB
|
||||
is saved, and no additional I/O is needed to read and write the data block.
|
||||
.
|
||||
\*[instant-never]
|
||||
.
|
||||
@ -465,7 +488,9 @@ number of snapshots of a single filesystem or volume, and also reduces
|
||||
the disk space required.
|
||||
.Pp
|
||||
When there are many snapshots, each snapshot uses many Block Pointer
|
||||
Objects (bpobjs) to track blocks associated with that snapshot.
|
||||
Objects
|
||||
.Pq bpobjs
|
||||
to track blocks associated with that snapshot.
|
||||
However, in common use cases, most of these bpobjs are empty.
|
||||
This feature allows us to create each bpobj on-demand,
|
||||
thus eliminating the empty bpobjs.
|
||||
@ -536,7 +561,12 @@ will not match the source.
|
||||
Its use by
|
||||
.Nm zfs Cm send Fl i
|
||||
has been disabled by default
|
||||
.Pq see Sy send_holes_without_birth_time No in Xr zfs 4 .
|
||||
.Po
|
||||
see
|
||||
.Sy send_holes_without_birth_time
|
||||
in
|
||||
.Xr zfs 4
|
||||
.Pc .
|
||||
.Pp
|
||||
This feature improves performance of incremental sends
|
||||
.Pq Nm zfs Cm send Fl i
|
||||
@ -549,8 +579,10 @@ contains information about every block that changed between
|
||||
.Sy A No and Sy B .
|
||||
Blocks which did not change between those snapshots can be
|
||||
identified and omitted from the stream using a piece of metadata called
|
||||
the "block birth time", but birth times are not recorded for holes
|
||||
(blocks filled only with zeroes).
|
||||
the
|
||||
.Dq block birth time ,
|
||||
but birth times are not recorded for holes
|
||||
.Pq blocks filled only with zeroes .
|
||||
Since holes created after
|
||||
.Sy A No cannot be distinguished from holes created before Sy A ,
|
||||
information about every hole in the entire filesystem or zvol
|
||||
@ -558,9 +590,9 @@ is included in the send stream.
|
||||
.Pp
|
||||
For workloads where holes are rare this is not a problem.
|
||||
However, when incrementally replicating filesystems or zvols with many holes
|
||||
(for example a zvol formatted with another filesystem) a lot of time will
|
||||
be spent sending and receiving unnecessary information about holes that
|
||||
already exist on the receiving side.
|
||||
.Pq for example a zvol formatted with another filesystem
|
||||
a lot of time will be spent sending and receiving unnecessary information
|
||||
about holes that already exist on the receiving side.
|
||||
.Pp
|
||||
Once the
|
||||
.Sy hole_birth
|
||||
@ -657,7 +689,7 @@ When the
|
||||
feature is set to
|
||||
.Sy enabled ,
|
||||
the administrator can use
|
||||
.Xr dumpadm 1M
|
||||
.Xr dumpadm 8
|
||||
to configure a dump device on a pool comprised of multiple vdevs.
|
||||
.Pp
|
||||
Under
|
||||
@ -677,7 +709,9 @@ This feature is an enhancement of
|
||||
.Sy device_removal ,
|
||||
which will over time reduce the memory used to track removed devices.
|
||||
When indirect blocks are freed or remapped,
|
||||
we note that their part of the indirect mapping is "obsolete" – no longer needed.
|
||||
we note that their part of the indirect mapping is
|
||||
.Dq obsolete
|
||||
– no longer needed.
|
||||
.Pp
|
||||
This feature becomes
|
||||
.Sy active
|
||||
@ -688,7 +722,8 @@ command is used on a top-level vdev, and will never return to being
|
||||
.
|
||||
.feature org.zfsonlinux project_quota yes extensible_dataset
|
||||
This feature allows administrators to account the spaces and objects usage
|
||||
information against the project identifier (ID).
|
||||
information against the project identifier
|
||||
.Pq ID .
|
||||
.Pp
|
||||
The project ID is an object-based attribute.
|
||||
When upgrading an existing filesystem,
|
||||
@ -698,7 +733,8 @@ their parent directories' project ID if the parent's inherit flag is set
|
||||
.Pq via Nm chattr Sy [+-]P No or Nm zfs Cm project Fl s Ns | Ns Fl C .
|
||||
Otherwise, the new object's project ID will be zero.
|
||||
An object's project ID can be changed at any time by the owner
|
||||
(or privileged user) via
|
||||
.Pq or privileged user
|
||||
via
|
||||
.Nm chattr Fl p Ar prjid
|
||||
or
|
||||
.Nm zfs Cm project Fl p Ar prjid .
|
||||
@ -740,7 +776,8 @@ when the deferred resilver begins.
|
||||
.
|
||||
.feature org.illumos sha512 no extensible_dataset
|
||||
This feature enables the use of the SHA-512/256 truncated hash algorithm
|
||||
(FIPS 180-4) for checksum and dedup.
|
||||
.Pq FIPS 180-4
|
||||
for checksum and dedup.
|
||||
The native 64-bit arithmetic of SHA-512 provides an approximate 50%
|
||||
performance boost over SHA-256 on 64-bit hardware
|
||||
and is thus a good minimum-change replacement candidate
|
||||
@ -756,11 +793,12 @@ This feature enables the use of the Skein hash algorithm for checksum and dedup.
|
||||
Skein is a high-performance secure hash algorithm that was a
|
||||
finalist in the NIST SHA-3 competition.
|
||||
It provides a very high security margin and high performance on 64-bit hardware
|
||||
(80% faster than SHA-256).
|
||||
.Pq 80% faster than SHA-256 .
|
||||
This implementation also utilizes the new salted checksumming
|
||||
functionality in ZFS, which means that the checksum is pre-seeded with a
|
||||
secret 256-bit random key (stored on the pool) before being fed the data
|
||||
block to be checksummed.
|
||||
secret 256-bit random key
|
||||
.Pq stored on the pool
|
||||
before being fed the data block to be checksummed.
|
||||
Thus the produced checksums are unique to a given pool,
|
||||
preventing hash collision attacks on systems with dedup.
|
||||
.Pp
|
||||
@ -778,7 +816,9 @@ and never returns back to being
|
||||
.
|
||||
.feature com.delphix spacemap_v2 yes
|
||||
This feature enables the use of the new space map encoding which
|
||||
consists of two words (instead of one) whenever it is advantageous.
|
||||
consists of two words
|
||||
.Pq instead of one
|
||||
whenever it is advantageous.
|
||||
The new encoding allows space maps to represent large regions of
|
||||
space more efficiently on-disk while also increasing their maximum
|
||||
addressable offset.
|
||||
@ -872,4 +912,5 @@ are destroyed.
|
||||
.El
|
||||
.
|
||||
.Sh SEE ALSO
|
||||
.Xr zfs 8 ,
|
||||
.Xr zpool 8
|
||||
|
@ -20,7 +20,7 @@
|
||||
.\"
|
||||
.\" Copyright (c) 2020 by Delphix. All rights reserved.
|
||||
.\"
|
||||
.Dd May 8, 2021
|
||||
.Dd March 25, 2022
|
||||
.Dt ZSTREAM 8
|
||||
.Os
|
||||
.
|
||||
@ -33,6 +33,10 @@
|
||||
.Op Fl Cvd
|
||||
.Op Ar file
|
||||
.Nm
|
||||
.Cm decompress
|
||||
.Op Fl v
|
||||
.Op Ar object Ns Sy \&, Ns Ar offset Ns Op Sy \&, Ns Ar type Ns ...
|
||||
.Nm
|
||||
.Cm redup
|
||||
.Op Fl v
|
||||
.Ar file
|
||||
@ -82,6 +86,36 @@ alias is provided for compatibility and is equivalent to running
|
||||
Dumps zfs resume token information
|
||||
.It Xo
|
||||
.Nm
|
||||
.Cm decompress
|
||||
.Op Fl v
|
||||
.Op Ar object Ns Sy \&, Ns Ar offset Ns Op Sy \&, Ns Ar type Ns ...
|
||||
.Xc
|
||||
Decompress selected records in a ZFS send stream provided on standard input,
|
||||
when the compression type recorded in ZFS metadata may be incorrect.
|
||||
Specify the object number and byte offset of each record that you wish to
|
||||
decompress.
|
||||
Optionally specify the compression type.
|
||||
Valid compression types include
|
||||
.Sy gzip ,
|
||||
.Sy lz4 ,
|
||||
.Sy lzjb ,
|
||||
.Sy zstd ,
|
||||
and
|
||||
.Sy zle .
|
||||
The default is
|
||||
.Sy lz4 .
|
||||
Every record for that object beginning at that offset will be decompressed, if
|
||||
possible.
|
||||
It may not be possible, because the record may be corrupted in some but not
|
||||
all of the stream's snapshots.
|
||||
The repaired stream will be written to standard output.
|
||||
.Bl -tag -width "-v"
|
||||
.It Fl v
|
||||
Verbose.
|
||||
Print summary of decompressed records.
|
||||
.El
|
||||
.It Xo
|
||||
.Nm
|
||||
.Cm redup
|
||||
.Op Fl v
|
||||
.Ar file
|
||||
@ -111,7 +145,24 @@ Print summary of converted records.
|
||||
.El
|
||||
.El
|
||||
.
|
||||
.Sh EXAMPLES
|
||||
Heal a dataset that was corrupted due to OpenZFS bug #12762.
|
||||
First, determine which records are corrupt.
|
||||
That cannot be done automatically; it requires information beyond ZFS's
|
||||
metadata.
|
||||
If object
|
||||
.Sy 128
|
||||
is corrupted at offset
|
||||
.Sy 0
|
||||
and is compressed using
|
||||
.Sy lz4 ,
|
||||
then run this command:
|
||||
.Bd -literal
|
||||
.No # Nm zfs Ar send Fl c Ar … | Nm zstream decompress Ar 128,0,lz4 | \
|
||||
Nm zfs recv Ar …
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr zfs 8 ,
|
||||
.Xr zfs-receive 8 ,
|
||||
.Xr zfs-send 8
|
||||
.Xr zfs-send 8 ,
|
||||
.Lk https://github.com/openzfs/zfs/issues/12762
|
||||
|
@ -337,7 +337,7 @@ aes_impl_init(void)
|
||||
}
|
||||
|
||||
static const struct {
|
||||
char *name;
|
||||
const char *name;
|
||||
uint32_t sel;
|
||||
} aes_impl_opts[] = {
|
||||
{ "cycle", IMPL_CYCLE },
|
||||
|
@ -491,7 +491,7 @@ EdonRInit(EdonRState *state, size_t hashbitlen)
|
||||
state->hashbitlen = 512;
|
||||
state->bits_processed = 0;
|
||||
state->unprocessed_bits = 0;
|
||||
memcpy(hashState224(state)->DoublePipe, i512p2,
|
||||
memcpy(hashState512(state)->DoublePipe, i512p2,
|
||||
sizeof (i512p2));
|
||||
break;
|
||||
}
|
||||
|
@ -907,7 +907,7 @@ gcm_impl_init(void)
|
||||
}
|
||||
|
||||
static const struct {
|
||||
char *name;
|
||||
const char *name;
|
||||
uint32_t sel;
|
||||
} gcm_impl_opts[] = {
|
||||
{ "cycle", IMPL_CYCLE },
|
||||
|
@ -208,7 +208,7 @@ _key_expansion_256a_local:
|
||||
pxor %xmm1, %xmm0
|
||||
movups %xmm0, (%rcx)
|
||||
add $0x10, %rcx
|
||||
ret
|
||||
RET
|
||||
nop
|
||||
SET_SIZE(_key_expansion_128)
|
||||
SET_SIZE(_key_expansion_256a)
|
||||
@ -236,7 +236,7 @@ _key_expansion_192a_local:
|
||||
shufps $0b01001110, %xmm2, %xmm1
|
||||
movups %xmm1, 0x10(%rcx)
|
||||
add $0x20, %rcx
|
||||
ret
|
||||
RET
|
||||
SET_SIZE(_key_expansion_192a)
|
||||
|
||||
|
||||
@ -257,7 +257,7 @@ _key_expansion_192b_local:
|
||||
|
||||
movups %xmm0, (%rcx)
|
||||
add $0x10, %rcx
|
||||
ret
|
||||
RET
|
||||
SET_SIZE(_key_expansion_192b)
|
||||
|
||||
|
||||
@ -271,7 +271,7 @@ _key_expansion_256b_local:
|
||||
pxor %xmm1, %xmm2
|
||||
movups %xmm2, (%rcx)
|
||||
add $0x10, %rcx
|
||||
ret
|
||||
RET
|
||||
SET_SIZE(_key_expansion_256b)
|
||||
|
||||
|
||||
@ -376,7 +376,7 @@ rijndael_key_setup_enc_intel_local:
|
||||
mov $14, %rax // return # rounds = 14
|
||||
#endif
|
||||
FRAME_END
|
||||
ret
|
||||
RET
|
||||
|
||||
.align 4
|
||||
.Lenc_key192:
|
||||
@ -413,7 +413,7 @@ rijndael_key_setup_enc_intel_local:
|
||||
mov $12, %rax // return # rounds = 12
|
||||
#endif
|
||||
FRAME_END
|
||||
ret
|
||||
RET
|
||||
|
||||
.align 4
|
||||
.Lenc_key128:
|
||||
@ -453,13 +453,13 @@ rijndael_key_setup_enc_intel_local:
|
||||
mov $10, %rax // return # rounds = 10
|
||||
#endif
|
||||
FRAME_END
|
||||
ret
|
||||
RET
|
||||
|
||||
.Lenc_key_invalid_param:
|
||||
#ifdef OPENSSL_INTERFACE
|
||||
mov $-1, %rax // user key or AES key pointer is NULL
|
||||
FRAME_END
|
||||
ret
|
||||
RET
|
||||
#else
|
||||
/* FALLTHROUGH */
|
||||
#endif /* OPENSSL_INTERFACE */
|
||||
@ -471,7 +471,7 @@ rijndael_key_setup_enc_intel_local:
|
||||
xor %rax, %rax // a key pointer is NULL or invalid keysize
|
||||
#endif /* OPENSSL_INTERFACE */
|
||||
FRAME_END
|
||||
ret
|
||||
RET
|
||||
SET_SIZE(rijndael_key_setup_enc_intel)
|
||||
|
||||
|
||||
@ -548,7 +548,7 @@ FRAME_BEGIN
|
||||
// OpenSolaris: rax = # rounds (10, 12, or 14) or 0 for error
|
||||
// OpenSSL: rax = 0 for OK, or non-zero for error
|
||||
FRAME_END
|
||||
ret
|
||||
RET
|
||||
SET_SIZE(rijndael_key_setup_dec_intel)
|
||||
|
||||
|
||||
@ -655,7 +655,7 @@ ENTRY_NP(aes_encrypt_intel)
|
||||
aesenclast %KEY, %STATE // last round
|
||||
movups %STATE, (%OUTP) // output
|
||||
|
||||
ret
|
||||
RET
|
||||
SET_SIZE(aes_encrypt_intel)
|
||||
|
||||
|
||||
@ -738,7 +738,7 @@ ENTRY_NP(aes_decrypt_intel)
|
||||
aesdeclast %KEY, %STATE // last round
|
||||
movups %STATE, (%OUTP) // output
|
||||
|
||||
ret
|
||||
RET
|
||||
SET_SIZE(aes_decrypt_intel)
|
||||
|
||||
#endif /* lint || __lint */
|
||||
|
@ -785,7 +785,7 @@ ENTRY_NP(aes_encrypt_amd64)
|
||||
mov 2*8(%rsp), %rbp
|
||||
mov 3*8(%rsp), %r12
|
||||
add $[4*8], %rsp
|
||||
ret
|
||||
RET
|
||||
|
||||
SET_SIZE(aes_encrypt_amd64)
|
||||
|
||||
@ -896,7 +896,7 @@ ENTRY_NP(aes_decrypt_amd64)
|
||||
mov 2*8(%rsp), %rbp
|
||||
mov 3*8(%rsp), %r12
|
||||
add $[4*8], %rsp
|
||||
ret
|
||||
RET
|
||||
|
||||
SET_SIZE(aes_decrypt_amd64)
|
||||
#endif /* lint || __lint */
|
||||
|
@ -1334,7 +1334,7 @@ zfs_blake3_hash_many_avx2:
|
||||
pop r13
|
||||
pop r14
|
||||
pop r15
|
||||
ret
|
||||
RET
|
||||
.p2align 5
|
||||
3:
|
||||
mov rbx, qword ptr [rbp+0x50]
|
||||
|
@ -1116,7 +1116,7 @@ zfs_blake3_hash_many_avx512:
|
||||
pop r13
|
||||
pop r14
|
||||
pop r15
|
||||
ret
|
||||
RET
|
||||
.p2align 6
|
||||
3:
|
||||
test esi, 0x8
|
||||
@ -2487,7 +2487,7 @@ zfs_blake3_compress_in_place_avx512:
|
||||
vpxor xmm1, xmm1, xmm3
|
||||
vmovdqu xmmword ptr [rdi], xmm0
|
||||
vmovdqu xmmword ptr [rdi+0x10], xmm1
|
||||
ret
|
||||
RET
|
||||
|
||||
.p2align 6
|
||||
zfs_blake3_compress_xof_avx512:
|
||||
@ -2573,7 +2573,7 @@ zfs_blake3_compress_xof_avx512:
|
||||
vmovdqu xmmword ptr [r9+0x10], xmm1
|
||||
vmovdqu xmmword ptr [r9+0x20], xmm2
|
||||
vmovdqu xmmword ptr [r9+0x30], xmm3
|
||||
ret
|
||||
RET
|
||||
|
||||
.size zfs_blake3_hash_many_avx512, . - zfs_blake3_hash_many_avx512
|
||||
.size zfs_blake3_compress_in_place_avx512, . - zfs_blake3_compress_in_place_avx512
|
||||
|
@ -1671,7 +1671,7 @@ zfs_blake3_hash_many_sse2:
|
||||
pop r13
|
||||
pop r14
|
||||
pop r15
|
||||
ret
|
||||
RET
|
||||
.p2align 5
|
||||
3:
|
||||
test esi, 0x2
|
||||
@ -2157,7 +2157,7 @@ zfs_blake3_compress_in_place_sse2:
|
||||
pxor xmm1, xmm3
|
||||
movups xmmword ptr [rdi], xmm0
|
||||
movups xmmword ptr [rdi+0x10], xmm1
|
||||
ret
|
||||
RET
|
||||
|
||||
.p2align 6
|
||||
zfs_blake3_compress_xof_sse2:
|
||||
@ -2276,7 +2276,7 @@ zfs_blake3_compress_xof_sse2:
|
||||
movups xmmword ptr [r9+0x10], xmm1
|
||||
movups xmmword ptr [r9+0x20], xmm2
|
||||
movups xmmword ptr [r9+0x30], xmm3
|
||||
ret
|
||||
RET
|
||||
|
||||
.size zfs_blake3_hash_many_sse2, . - zfs_blake3_hash_many_sse2
|
||||
.size zfs_blake3_compress_in_place_sse2, . - zfs_blake3_compress_in_place_sse2
|
||||
|
@ -1475,7 +1475,7 @@ zfs_blake3_hash_many_sse41:
|
||||
pop r13
|
||||
pop r14
|
||||
pop r15
|
||||
ret
|
||||
RET
|
||||
.p2align 5
|
||||
3:
|
||||
test esi, 0x2
|
||||
@ -1908,7 +1908,7 @@ zfs_blake3_compress_in_place_sse41:
|
||||
pxor xmm1, xmm3
|
||||
movups xmmword ptr [rdi], xmm0
|
||||
movups xmmword ptr [rdi+0x10], xmm1
|
||||
ret
|
||||
RET
|
||||
.p2align 6
|
||||
zfs_blake3_compress_xof_sse41:
|
||||
_CET_ENDBR
|
||||
@ -2015,7 +2015,7 @@ zfs_blake3_compress_xof_sse41:
|
||||
movups xmmword ptr [r9+0x10], xmm1
|
||||
movups xmmword ptr [r9+0x20], xmm2
|
||||
movups xmmword ptr [r9+0x30], xmm3
|
||||
ret
|
||||
RET
|
||||
|
||||
.size zfs_blake3_hash_many_sse41, . - zfs_blake3_hash_many_sse41
|
||||
.size zfs_blake3_compress_in_place_sse41, . - zfs_blake3_compress_in_place_sse41
|
||||
|
@ -1201,7 +1201,7 @@ aesni_gcm_encrypt:
|
||||
.align 32
|
||||
clear_fpu_regs_avx:
|
||||
vzeroall
|
||||
ret
|
||||
RET
|
||||
.size clear_fpu_regs_avx,.-clear_fpu_regs_avx
|
||||
|
||||
/*
|
||||
@ -1219,7 +1219,7 @@ gcm_xor_avx:
|
||||
movdqu (%rsi), %xmm1
|
||||
pxor %xmm1, %xmm0
|
||||
movdqu %xmm0, (%rsi)
|
||||
ret
|
||||
RET
|
||||
.size gcm_xor_avx,.-gcm_xor_avx
|
||||
|
||||
/*
|
||||
@ -1236,7 +1236,7 @@ atomic_toggle_boolean_nv:
|
||||
jz 1f
|
||||
movl $1, %eax
|
||||
1:
|
||||
ret
|
||||
RET
|
||||
.size atomic_toggle_boolean_nv,.-atomic_toggle_boolean_nv
|
||||
|
||||
.align 64
|
||||
|
@ -244,7 +244,7 @@ ENTRY_NP(gcm_mul_pclmulqdq)
|
||||
//
|
||||
// Return
|
||||
//
|
||||
ret
|
||||
RET
|
||||
SET_SIZE(gcm_mul_pclmulqdq)
|
||||
|
||||
#endif /* lint || __lint */
|
||||
|
@ -2058,7 +2058,7 @@ ENTRY_NP(SHA256TransformBlocks)
|
||||
.cfi_adjust_cfa_offset -8
|
||||
.cfi_restore %rbx
|
||||
|
||||
ret
|
||||
RET
|
||||
.cfi_endproc
|
||||
SET_SIZE(SHA256TransformBlocks)
|
||||
|
||||
|
@ -2059,7 +2059,7 @@ ENTRY_NP(SHA512TransformBlocks)
|
||||
.cfi_adjust_cfa_offset -8
|
||||
.cfi_restore %rbx
|
||||
|
||||
ret
|
||||
RET
|
||||
.cfi_endproc
|
||||
SET_SIZE(SHA512TransformBlocks)
|
||||
|
||||
|
@ -30,6 +30,12 @@
|
||||
#include <sys/stack.h>
|
||||
#include <sys/trap.h>
|
||||
|
||||
#if defined(__linux__) && defined(CONFIG_SLS)
|
||||
#define RET ret; int3
|
||||
#else
|
||||
#define RET ret
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -167,6 +167,13 @@ static void seterrorobj (lua_State *L, int errcode, StkId oldtop) {
|
||||
L->top = oldtop + 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Silence infinite recursion warning which was added to -Wall in gcc 12.1
|
||||
*/
|
||||
#if defined(HAVE_INFINITE_RECURSION)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Winfinite-recursion"
|
||||
#endif
|
||||
|
||||
l_noret luaD_throw (lua_State *L, int errcode) {
|
||||
if (L->errorJmp) { /* thread has an error handler? */
|
||||
@ -189,6 +196,10 @@ l_noret luaD_throw (lua_State *L, int errcode) {
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(HAVE_INFINITE_RECURSION)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
||||
int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) {
|
||||
unsigned short oldnCcalls = L->nCcalls;
|
||||
|
@ -35,6 +35,12 @@ x:
|
||||
.size x, [.-x]
|
||||
|
||||
|
||||
#if defined(__linux__) && defined(CONFIG_SLS)
|
||||
#define RET ret; int3
|
||||
#else
|
||||
#define RET ret
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Setjmp and longjmp implement non-local gotos using state vectors
|
||||
* type label_t.
|
||||
@ -52,7 +58,7 @@ x:
|
||||
movq 0(%rsp), %rdx /* return address */
|
||||
movq %rdx, 56(%rdi) /* rip */
|
||||
xorl %eax, %eax /* return 0 */
|
||||
ret
|
||||
RET
|
||||
SET_SIZE(setjmp)
|
||||
|
||||
ENTRY(longjmp)
|
||||
@ -67,7 +73,7 @@ x:
|
||||
movq %rdx, 0(%rsp)
|
||||
xorl %eax, %eax
|
||||
incl %eax /* return 1 */
|
||||
ret
|
||||
RET
|
||||
SET_SIZE(longjmp)
|
||||
|
||||
#ifdef __ELF__
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user