mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 01:51:00 +03:00
Enable -Wwrite-strings
Also, fix leak from ztest_global_vars_to_zdb_args() Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #13348
This commit is contained in:
parent
e7d90362e5
commit
a926aab902
@ -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);
|
||||
}
|
||||
@ -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 @@ retry_lookup:
|
||||
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) {
|
||||
@ -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) {
|
||||
@ -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, "");
|
||||
|
@ -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 @@ children:
|
||||
(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]);
|
||||
|
48
cmd/ztest.c
48
cmd/ztest.c
@ -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;
|
||||
@ -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 @@ out:
|
||||
}
|
||||
|
||||
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)
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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,13 +560,14 @@ 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
|
||||
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -177,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);
|
||||
|
||||
@ -192,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);
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
@ -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 *);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -2065,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,
|
||||
|
@ -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,7 +74,7 @@ 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,
|
||||
do_mount_(const char *spec, const char *dir, int mflag,
|
||||
char *dataptr, int datalen, char *optptr, int optlen)
|
||||
{
|
||||
struct iovec *iov;
|
||||
@ -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 @@ out:
|
||||
* 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);
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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 },
|
||||
|
@ -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 },
|
||||
|
@ -156,7 +156,7 @@ kmem_std_destructor(void *mem, int size __unused, void *private)
|
||||
}
|
||||
|
||||
kmem_cache_t *
|
||||
kmem_cache_create(char *name, size_t bufsize, size_t align,
|
||||
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)
|
||||
{
|
||||
|
@ -679,7 +679,7 @@ spl_magazine_destroy(spl_kmem_cache_t *skc)
|
||||
* KMC_NODEBUG Disable debugging (unsupported)
|
||||
*/
|
||||
spl_kmem_cache_t *
|
||||
spl_kmem_cache_create(char *name, size_t size, size_t align,
|
||||
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)
|
||||
{
|
||||
|
@ -68,7 +68,7 @@ zfs_allocatable_devs(nvlist_t *nv)
|
||||
* Are there special vdevs?
|
||||
*/
|
||||
boolean_t
|
||||
zfs_special_devs(nvlist_t *nv, char *type)
|
||||
zfs_special_devs(nvlist_t *nv, const char *type)
|
||||
{
|
||||
char *bias;
|
||||
uint_t c;
|
||||
@ -84,11 +84,9 @@ zfs_special_devs(nvlist_t *nv, char *type)
|
||||
&bias) == 0) {
|
||||
if (strcmp(bias, VDEV_ALLOC_BIAS_SPECIAL) == 0 ||
|
||||
strcmp(bias, VDEV_ALLOC_BIAS_DEDUP) == 0) {
|
||||
if (type != NULL && strcmp(bias, type) == 0) {
|
||||
if (type == NULL ||
|
||||
(type != NULL && strcmp(bias, type) == 0))
|
||||
return (B_TRUE);
|
||||
} else if (type == NULL) {
|
||||
return (B_TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2280,7 +2280,7 @@ arc_evictable_space_decrement(arc_buf_hdr_t *hdr, arc_state_t *state)
|
||||
* it is not evictable.
|
||||
*/
|
||||
static void
|
||||
add_reference(arc_buf_hdr_t *hdr, void *tag)
|
||||
add_reference(arc_buf_hdr_t *hdr, const void *tag)
|
||||
{
|
||||
arc_state_t *state;
|
||||
|
||||
@ -2740,8 +2740,8 @@ arc_can_share(arc_buf_hdr_t *hdr, arc_buf_t *buf)
|
||||
*/
|
||||
static int
|
||||
arc_buf_alloc_impl(arc_buf_hdr_t *hdr, spa_t *spa, const zbookmark_phys_t *zb,
|
||||
void *tag, boolean_t encrypted, boolean_t compressed, boolean_t noauth,
|
||||
boolean_t fill, arc_buf_t **ret)
|
||||
const void *tag, boolean_t encrypted, boolean_t compressed,
|
||||
boolean_t noauth, boolean_t fill, arc_buf_t **ret)
|
||||
{
|
||||
arc_buf_t *buf;
|
||||
arc_fill_flags_t flags = ARC_FILL_LOCKED;
|
||||
@ -2841,7 +2841,7 @@ arc_buf_alloc_impl(arc_buf_hdr_t *hdr, spa_t *spa, const zbookmark_phys_t *zb,
|
||||
return (0);
|
||||
}
|
||||
|
||||
static char *arc_onloan_tag = "onloan";
|
||||
static const char *arc_onloan_tag = "onloan";
|
||||
|
||||
static inline void
|
||||
arc_loaned_bytes_update(int64_t delta)
|
||||
@ -3589,7 +3589,8 @@ arc_convert_to_raw(arc_buf_t *buf, uint64_t dsobj, boolean_t byteorder,
|
||||
* The buf is returned thawed since we expect the consumer to modify it.
|
||||
*/
|
||||
arc_buf_t *
|
||||
arc_alloc_buf(spa_t *spa, void *tag, arc_buf_contents_t type, int32_t size)
|
||||
arc_alloc_buf(spa_t *spa, const void *tag, arc_buf_contents_t type,
|
||||
int32_t size)
|
||||
{
|
||||
arc_buf_hdr_t *hdr = arc_hdr_alloc(spa_load_guid(spa), size, size,
|
||||
B_FALSE, ZIO_COMPRESS_OFF, 0, type);
|
||||
@ -3607,8 +3608,8 @@ arc_alloc_buf(spa_t *spa, void *tag, arc_buf_contents_t type, int32_t size)
|
||||
* for bufs containing metadata.
|
||||
*/
|
||||
arc_buf_t *
|
||||
arc_alloc_compressed_buf(spa_t *spa, void *tag, uint64_t psize, uint64_t lsize,
|
||||
enum zio_compress compression_type, uint8_t complevel)
|
||||
arc_alloc_compressed_buf(spa_t *spa, const void *tag, uint64_t psize,
|
||||
uint64_t lsize, enum zio_compress compression_type, uint8_t complevel)
|
||||
{
|
||||
ASSERT3U(lsize, >, 0);
|
||||
ASSERT3U(lsize, >=, psize);
|
||||
@ -3635,9 +3636,9 @@ arc_alloc_compressed_buf(spa_t *spa, void *tag, uint64_t psize, uint64_t lsize,
|
||||
}
|
||||
|
||||
arc_buf_t *
|
||||
arc_alloc_raw_buf(spa_t *spa, 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,
|
||||
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)
|
||||
{
|
||||
arc_buf_hdr_t *hdr;
|
||||
|
@ -1297,7 +1297,7 @@ dbuf_whichblock(const dnode_t *dn, const int64_t level, const uint64_t offset)
|
||||
* used when modifying or reading db_blkptr.
|
||||
*/
|
||||
db_lock_type_t
|
||||
dmu_buf_lock_parent(dmu_buf_impl_t *db, krw_t rw, void *tag)
|
||||
dmu_buf_lock_parent(dmu_buf_impl_t *db, krw_t rw, const void *tag)
|
||||
{
|
||||
enum db_lock_type ret = DLT_NONE;
|
||||
if (db->db_parent != NULL) {
|
||||
@ -1322,7 +1322,7 @@ dmu_buf_lock_parent(dmu_buf_impl_t *db, krw_t rw, void *tag)
|
||||
* panic if we didn't pass the lock type in.
|
||||
*/
|
||||
void
|
||||
dmu_buf_unlock_parent(dmu_buf_impl_t *db, db_lock_type_t type, void *tag)
|
||||
dmu_buf_unlock_parent(dmu_buf_impl_t *db, db_lock_type_t type, const void *tag)
|
||||
{
|
||||
if (type == DLT_PARENT)
|
||||
rw_exit(&db->db_parent->db_rwlock);
|
||||
@ -1522,7 +1522,7 @@ dbuf_read_verify_dnode_crypt(dmu_buf_impl_t *db, uint32_t flags)
|
||||
*/
|
||||
static int
|
||||
dbuf_read_impl(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags,
|
||||
db_lock_type_t dblt, void *tag)
|
||||
db_lock_type_t dblt, const void *tag)
|
||||
{
|
||||
dnode_t *dn;
|
||||
zbookmark_phys_t zb;
|
||||
@ -3532,7 +3532,7 @@ dbuf_hold_copy(dnode_t *dn, dmu_buf_impl_t *db)
|
||||
int
|
||||
dbuf_hold_impl(dnode_t *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)
|
||||
{
|
||||
dmu_buf_impl_t *db, *parent = NULL;
|
||||
|
||||
@ -3637,13 +3637,13 @@ dbuf_hold_impl(dnode_t *dn, uint8_t level, uint64_t blkid,
|
||||
}
|
||||
|
||||
dmu_buf_impl_t *
|
||||
dbuf_hold(dnode_t *dn, uint64_t blkid, void *tag)
|
||||
dbuf_hold(dnode_t *dn, uint64_t blkid, const void *tag)
|
||||
{
|
||||
return (dbuf_hold_level(dn, 0, blkid, tag));
|
||||
}
|
||||
|
||||
dmu_buf_impl_t *
|
||||
dbuf_hold_level(dnode_t *dn, int level, uint64_t blkid, void *tag)
|
||||
dbuf_hold_level(dnode_t *dn, int level, uint64_t blkid, const void *tag)
|
||||
{
|
||||
dmu_buf_impl_t *db;
|
||||
int err = dbuf_hold_impl(dn, level, blkid, FALSE, FALSE, tag, &db);
|
||||
@ -3684,7 +3684,7 @@ dbuf_rm_spill(dnode_t *dn, dmu_tx_t *tx)
|
||||
|
||||
#pragma weak dmu_buf_add_ref = dbuf_add_ref
|
||||
void
|
||||
dbuf_add_ref(dmu_buf_impl_t *db, void *tag)
|
||||
dbuf_add_ref(dmu_buf_impl_t *db, const void *tag)
|
||||
{
|
||||
int64_t holds = zfs_refcount_add(&db->db_holds, tag);
|
||||
VERIFY3S(holds, >, 1);
|
||||
@ -3693,7 +3693,7 @@ dbuf_add_ref(dmu_buf_impl_t *db, void *tag)
|
||||
#pragma weak dmu_buf_try_add_ref = dbuf_try_add_ref
|
||||
boolean_t
|
||||
dbuf_try_add_ref(dmu_buf_t *db_fake, objset_t *os, uint64_t obj, uint64_t blkid,
|
||||
void *tag)
|
||||
const void *tag)
|
||||
{
|
||||
dmu_buf_impl_t *db = (dmu_buf_impl_t *)db_fake;
|
||||
dmu_buf_impl_t *found_db;
|
||||
@ -3722,14 +3722,14 @@ dbuf_try_add_ref(dmu_buf_t *db_fake, objset_t *os, uint64_t obj, uint64_t blkid,
|
||||
* dnode's parent dbuf evicting its dnode handles.
|
||||
*/
|
||||
void
|
||||
dbuf_rele(dmu_buf_impl_t *db, void *tag)
|
||||
dbuf_rele(dmu_buf_impl_t *db, const void *tag)
|
||||
{
|
||||
mutex_enter(&db->db_mtx);
|
||||
dbuf_rele_and_unlock(db, tag, B_FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
dmu_buf_rele(dmu_buf_t *db, void *tag)
|
||||
dmu_buf_rele(dmu_buf_t *db, const void *tag)
|
||||
{
|
||||
dbuf_rele((dmu_buf_impl_t *)db, tag);
|
||||
}
|
||||
@ -3748,7 +3748,7 @@ dmu_buf_rele(dmu_buf_t *db, void *tag)
|
||||
*
|
||||
*/
|
||||
void
|
||||
dbuf_rele_and_unlock(dmu_buf_impl_t *db, void *tag, boolean_t evicting)
|
||||
dbuf_rele_and_unlock(dmu_buf_impl_t *db, const void *tag, boolean_t evicting)
|
||||
{
|
||||
int64_t holds;
|
||||
uint64_t size;
|
||||
|
@ -160,7 +160,7 @@ const dmu_object_byteswap_info_t dmu_ot_byteswap[DMU_BSWAP_NUMFUNCS] = {
|
||||
|
||||
static int
|
||||
dmu_buf_hold_noread_by_dnode(dnode_t *dn, uint64_t offset,
|
||||
void *tag, dmu_buf_t **dbp)
|
||||
const void *tag, dmu_buf_t **dbp)
|
||||
{
|
||||
uint64_t blkid;
|
||||
dmu_buf_impl_t *db;
|
||||
@ -180,7 +180,7 @@ dmu_buf_hold_noread_by_dnode(dnode_t *dn, uint64_t offset,
|
||||
}
|
||||
int
|
||||
dmu_buf_hold_noread(objset_t *os, uint64_t object, uint64_t offset,
|
||||
void *tag, dmu_buf_t **dbp)
|
||||
const void *tag, dmu_buf_t **dbp)
|
||||
{
|
||||
dnode_t *dn;
|
||||
uint64_t blkid;
|
||||
@ -207,7 +207,7 @@ dmu_buf_hold_noread(objset_t *os, uint64_t object, uint64_t offset,
|
||||
|
||||
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 err;
|
||||
int db_flags = DB_RF_CANFAIL;
|
||||
@ -232,7 +232,7 @@ dmu_buf_hold_by_dnode(dnode_t *dn, uint64_t offset,
|
||||
|
||||
int
|
||||
dmu_buf_hold(objset_t *os, uint64_t object, uint64_t offset,
|
||||
void *tag, dmu_buf_t **dbp, int flags)
|
||||
const void *tag, dmu_buf_t **dbp, int flags)
|
||||
{
|
||||
int err;
|
||||
int db_flags = DB_RF_CANFAIL;
|
||||
@ -342,7 +342,7 @@ dmu_rm_spill(objset_t *os, uint64_t object, dmu_tx_t *tx)
|
||||
* has not yet been allocated a new bonus dbuf a will be allocated.
|
||||
* Returns ENOENT, EIO, or 0.
|
||||
*/
|
||||
int dmu_bonus_hold_by_dnode(dnode_t *dn, 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)
|
||||
{
|
||||
dmu_buf_impl_t *db;
|
||||
@ -389,7 +389,7 @@ 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, void *tag, dmu_buf_t **dbp)
|
||||
dmu_bonus_hold(objset_t *os, uint64_t object, const void *tag, dmu_buf_t **dbp)
|
||||
{
|
||||
dnode_t *dn;
|
||||
int error;
|
||||
@ -414,7 +414,8 @@ dmu_bonus_hold(objset_t *os, uint64_t object, void *tag, dmu_buf_t **dbp)
|
||||
* dmu_spill_hold_existing() should be used.
|
||||
*/
|
||||
int
|
||||
dmu_spill_hold_by_dnode(dnode_t *dn, uint32_t flags, void *tag, dmu_buf_t **dbp)
|
||||
dmu_spill_hold_by_dnode(dnode_t *dn, uint32_t flags, const void *tag,
|
||||
dmu_buf_t **dbp)
|
||||
{
|
||||
dmu_buf_impl_t *db = NULL;
|
||||
int err;
|
||||
@ -442,7 +443,7 @@ 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)
|
||||
dmu_spill_hold_existing(dmu_buf_t *bonus, const void *tag, dmu_buf_t **dbp)
|
||||
{
|
||||
dmu_buf_impl_t *db = (dmu_buf_impl_t *)bonus;
|
||||
dnode_t *dn;
|
||||
@ -471,7 +472,7 @@ dmu_spill_hold_existing(dmu_buf_t *bonus, void *tag, dmu_buf_t **dbp)
|
||||
}
|
||||
|
||||
int
|
||||
dmu_spill_hold_by_bonus(dmu_buf_t *bonus, uint32_t flags, void *tag,
|
||||
dmu_spill_hold_by_bonus(dmu_buf_t *bonus, uint32_t flags, const void *tag,
|
||||
dmu_buf_t **dbp)
|
||||
{
|
||||
dmu_buf_impl_t *db = (dmu_buf_impl_t *)bonus;
|
||||
@ -498,7 +499,8 @@ dmu_spill_hold_by_bonus(dmu_buf_t *bonus, uint32_t flags, void *tag,
|
||||
*/
|
||||
int
|
||||
dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset, uint64_t length,
|
||||
boolean_t read, void *tag, int *numbufsp, dmu_buf_t ***dbpp, uint32_t flags)
|
||||
boolean_t read, const void *tag, int *numbufsp, dmu_buf_t ***dbpp,
|
||||
uint32_t flags)
|
||||
{
|
||||
dmu_buf_t **dbp;
|
||||
zstream_t *zs = NULL;
|
||||
@ -619,7 +621,8 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset, uint64_t length,
|
||||
|
||||
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)
|
||||
{
|
||||
dnode_t *dn;
|
||||
int err;
|
||||
@ -638,7 +641,7 @@ dmu_buf_hold_array(objset_t *os, uint64_t object, uint64_t offset,
|
||||
|
||||
int
|
||||
dmu_buf_hold_array_by_bonus(dmu_buf_t *db_fake, 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)
|
||||
{
|
||||
dmu_buf_impl_t *db = (dmu_buf_impl_t *)db_fake;
|
||||
@ -655,7 +658,7 @@ dmu_buf_hold_array_by_bonus(dmu_buf_t *db_fake, uint64_t offset,
|
||||
}
|
||||
|
||||
void
|
||||
dmu_buf_rele_array(dmu_buf_t **dbp_fake, int numbufs, void *tag)
|
||||
dmu_buf_rele_array(dmu_buf_t **dbp_fake, int numbufs, const void *tag)
|
||||
{
|
||||
int i;
|
||||
dmu_buf_impl_t **dbp = (dmu_buf_impl_t **)dbp_fake;
|
||||
|
@ -46,7 +46,7 @@ int dmu_object_alloc_chunk_shift = 7;
|
||||
static uint64_t
|
||||
dmu_object_alloc_impl(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, dmu_tx_t *tx)
|
||||
int dnodesize, dnode_t **allocated_dnode, const void *tag, dmu_tx_t *tx)
|
||||
{
|
||||
uint64_t object;
|
||||
uint64_t L1_dnode_count = DNODES_PER_BLOCK <<
|
||||
@ -255,7 +255,7 @@ dmu_object_alloc_dnsize(objset_t *os, dmu_object_type_t ot, int blocksize,
|
||||
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, dmu_tx_t *tx)
|
||||
int dnodesize, dnode_t **allocated_dnode, const void *tag, dmu_tx_t *tx)
|
||||
{
|
||||
return (dmu_object_alloc_impl(os, ot, blocksize, indirect_blockshift,
|
||||
bonustype, bonuslen, dnodesize, allocated_dnode, tag, tx));
|
||||
|
@ -714,7 +714,7 @@ dmu_objset_from_ds(dsl_dataset_t *ds, objset_t **osp)
|
||||
* can be held at a time.
|
||||
*/
|
||||
int
|
||||
dmu_objset_hold_flags(const char *name, boolean_t decrypt, void *tag,
|
||||
dmu_objset_hold_flags(const char *name, boolean_t decrypt, const void *tag,
|
||||
objset_t **osp)
|
||||
{
|
||||
dsl_pool_t *dp;
|
||||
@ -742,14 +742,14 @@ dmu_objset_hold_flags(const char *name, boolean_t decrypt, void *tag,
|
||||
}
|
||||
|
||||
int
|
||||
dmu_objset_hold(const char *name, void *tag, objset_t **osp)
|
||||
dmu_objset_hold(const char *name, const void *tag, objset_t **osp)
|
||||
{
|
||||
return (dmu_objset_hold_flags(name, B_FALSE, tag, osp));
|
||||
}
|
||||
|
||||
static int
|
||||
dmu_objset_own_impl(dsl_dataset_t *ds, 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)
|
||||
{
|
||||
(void) tag;
|
||||
|
||||
@ -789,7 +789,7 @@ dmu_objset_own_impl(dsl_dataset_t *ds, dmu_objset_type_t type,
|
||||
*/
|
||||
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)
|
||||
{
|
||||
dsl_pool_t *dp;
|
||||
dsl_dataset_t *ds;
|
||||
@ -834,7 +834,7 @@ dmu_objset_own(const char *name, dmu_objset_type_t type,
|
||||
|
||||
int
|
||||
dmu_objset_own_obj(dsl_pool_t *dp, uint64_t obj, 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)
|
||||
{
|
||||
dsl_dataset_t *ds;
|
||||
int err;
|
||||
@ -855,7 +855,7 @@ dmu_objset_own_obj(dsl_pool_t *dp, uint64_t obj, dmu_objset_type_t type,
|
||||
}
|
||||
|
||||
void
|
||||
dmu_objset_rele_flags(objset_t *os, boolean_t decrypt, void *tag)
|
||||
dmu_objset_rele_flags(objset_t *os, boolean_t decrypt, const void *tag)
|
||||
{
|
||||
ds_hold_flags_t flags;
|
||||
dsl_pool_t *dp = dmu_objset_pool(os);
|
||||
@ -866,7 +866,7 @@ dmu_objset_rele_flags(objset_t *os, boolean_t decrypt, void *tag)
|
||||
}
|
||||
|
||||
void
|
||||
dmu_objset_rele(objset_t *os, void *tag)
|
||||
dmu_objset_rele(objset_t *os, const void *tag)
|
||||
{
|
||||
dmu_objset_rele_flags(os, B_FALSE, tag);
|
||||
}
|
||||
@ -884,7 +884,7 @@ dmu_objset_rele(objset_t *os, void *tag)
|
||||
*/
|
||||
void
|
||||
dmu_objset_refresh_ownership(dsl_dataset_t *ds, dsl_dataset_t **newds,
|
||||
boolean_t decrypt, void *tag)
|
||||
boolean_t decrypt, const void *tag)
|
||||
{
|
||||
dsl_pool_t *dp;
|
||||
char name[ZFS_MAX_DATASET_NAME_LEN];
|
||||
@ -904,7 +904,7 @@ dmu_objset_refresh_ownership(dsl_dataset_t *ds, dsl_dataset_t **newds,
|
||||
}
|
||||
|
||||
void
|
||||
dmu_objset_disown(objset_t *os, boolean_t decrypt, void *tag)
|
||||
dmu_objset_disown(objset_t *os, boolean_t decrypt, const void *tag)
|
||||
{
|
||||
ds_hold_flags_t flags;
|
||||
|
||||
|
@ -68,7 +68,7 @@ static int zfs_recv_queue_length = SPA_MAXBLOCKSIZE;
|
||||
static int zfs_recv_queue_ff = 20;
|
||||
static int zfs_recv_write_batch_size = 1024 * 1024;
|
||||
|
||||
static void *const dmu_recv_tag = "dmu_recv_tag";
|
||||
static const void *const dmu_recv_tag = "dmu_recv_tag";
|
||||
const char *const recv_clone_name = "%recv";
|
||||
|
||||
static int receive_read_payload_and_next_header(dmu_recv_cookie_t *ra, int len,
|
||||
|
@ -1268,7 +1268,7 @@ dnode_buf_evict_async(void *dbu)
|
||||
*/
|
||||
int
|
||||
dnode_hold_impl(objset_t *os, uint64_t object, int flag, int slots,
|
||||
void *tag, dnode_t **dnp)
|
||||
const void *tag, dnode_t **dnp)
|
||||
{
|
||||
int epb, idx, err;
|
||||
int drop_struct_lock = FALSE;
|
||||
@ -1562,7 +1562,7 @@ dnode_hold_impl(objset_t *os, uint64_t object, int flag, int slots,
|
||||
* Return held dnode if the object is allocated, NULL if not.
|
||||
*/
|
||||
int
|
||||
dnode_hold(objset_t *os, uint64_t object, void *tag, dnode_t **dnp)
|
||||
dnode_hold(objset_t *os, uint64_t object, const void *tag, dnode_t **dnp)
|
||||
{
|
||||
return (dnode_hold_impl(os, object, DNODE_MUST_BE_ALLOCATED, 0, tag,
|
||||
dnp));
|
||||
@ -1574,7 +1574,7 @@ dnode_hold(objset_t *os, uint64_t object, void *tag, dnode_t **dnp)
|
||||
* new reference.
|
||||
*/
|
||||
boolean_t
|
||||
dnode_add_ref(dnode_t *dn, void *tag)
|
||||
dnode_add_ref(dnode_t *dn, const void *tag)
|
||||
{
|
||||
mutex_enter(&dn->dn_mtx);
|
||||
if (zfs_refcount_is_zero(&dn->dn_holds)) {
|
||||
@ -1587,14 +1587,14 @@ dnode_add_ref(dnode_t *dn, void *tag)
|
||||
}
|
||||
|
||||
void
|
||||
dnode_rele(dnode_t *dn, void *tag)
|
||||
dnode_rele(dnode_t *dn, const void *tag)
|
||||
{
|
||||
mutex_enter(&dn->dn_mtx);
|
||||
dnode_rele_and_unlock(dn, tag, B_FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
dnode_rele_and_unlock(dnode_t *dn, void *tag, boolean_t evicting)
|
||||
dnode_rele_and_unlock(dnode_t *dn, const void *tag, boolean_t evicting)
|
||||
{
|
||||
uint64_t refs;
|
||||
/* Get while the hold prevents the dnode from moving. */
|
||||
@ -2029,7 +2029,7 @@ dnode_dirty_l1range(dnode_t *dn, uint64_t start_blkid, uint64_t end_blkid,
|
||||
}
|
||||
|
||||
void
|
||||
dnode_set_dirtyctx(dnode_t *dn, dmu_tx_t *tx, void *tag)
|
||||
dnode_set_dirtyctx(dnode_t *dn, dmu_tx_t *tx, const void *tag)
|
||||
{
|
||||
/*
|
||||
* Don't set dirtyctx to SYNC if we're just modifying this as we
|
||||
|
@ -1291,7 +1291,7 @@ dsl_bookmark_ds_destroyed(dsl_dataset_t *ds, dmu_tx_t *tx)
|
||||
* The empty-string name can't be in the AVL, and it compares
|
||||
* before any entries with this TXG.
|
||||
*/
|
||||
search.dbn_name = "";
|
||||
search.dbn_name = (char *)"";
|
||||
VERIFY3P(avl_find(&head->ds_bookmarks, &search, &idx), ==, NULL);
|
||||
dsl_bookmark_node_t *dbn =
|
||||
avl_nearest(&head->ds_bookmarks, idx, AVL_AFTER);
|
||||
@ -1418,7 +1418,7 @@ dsl_bookmark_next_changed(dsl_dataset_t *head, dsl_dataset_t *origin,
|
||||
* The empty-string name can't be in the AVL, and it compares
|
||||
* before any entries with this TXG.
|
||||
*/
|
||||
search.dbn_name = "";
|
||||
search.dbn_name = (char *)"";
|
||||
VERIFY3P(avl_find(&head->ds_bookmarks, &search, &idx), ==, NULL);
|
||||
dsl_bookmark_node_t *dbn =
|
||||
avl_nearest(&head->ds_bookmarks, idx, AVL_AFTER);
|
||||
|
@ -1506,7 +1506,7 @@ spa_keystore_change_key_sync(void *arg, dmu_tx_t *tx)
|
||||
dsl_crypto_params_t *dcp = skcka->skcka_cp;
|
||||
dsl_wrapping_key_t *wkey = NULL, *found_wkey;
|
||||
dsl_wrapping_key_t wkey_search;
|
||||
char *keylocation = dcp->cp_keylocation;
|
||||
const char *keylocation = dcp->cp_keylocation;
|
||||
uint64_t rddobj, new_rddobj;
|
||||
|
||||
/* create and initialize the wrapping key */
|
||||
@ -2229,7 +2229,7 @@ dsl_crypto_recv_raw_key_sync(dsl_dataset_t *ds, nvlist_t *nvl, dmu_tx_t *tx)
|
||||
uint8_t *keydata, *hmac_keydata, *iv, *mac;
|
||||
uint64_t crypt, key_guid, keyformat, iters, salt;
|
||||
uint64_t version = ZIO_CRYPT_KEY_CURRENT_VERSION;
|
||||
char *keylocation = "prompt";
|
||||
const char *keylocation = "prompt";
|
||||
|
||||
/* lookup the values we need to create the DSL Crypto Key */
|
||||
crypt = fnvlist_lookup_uint64(nvl, DSL_CRYPTO_KEY_CRYPTO_SUITE);
|
||||
|
@ -551,7 +551,7 @@ dsl_dataset_snap_remove(dsl_dataset_t *ds, const char *name, dmu_tx_t *tx,
|
||||
}
|
||||
|
||||
boolean_t
|
||||
dsl_dataset_try_add_ref(dsl_pool_t *dp, dsl_dataset_t *ds, void *tag)
|
||||
dsl_dataset_try_add_ref(dsl_pool_t *dp, dsl_dataset_t *ds, const void *tag)
|
||||
{
|
||||
dmu_buf_t *dbuf = ds->ds_dbuf;
|
||||
boolean_t result = B_FALSE;
|
||||
@ -569,7 +569,7 @@ dsl_dataset_try_add_ref(dsl_pool_t *dp, dsl_dataset_t *ds, void *tag)
|
||||
}
|
||||
|
||||
int
|
||||
dsl_dataset_hold_obj(dsl_pool_t *dp, uint64_t dsobj, void *tag,
|
||||
dsl_dataset_hold_obj(dsl_pool_t *dp, uint64_t dsobj, const void *tag,
|
||||
dsl_dataset_t **dsp)
|
||||
{
|
||||
objset_t *mos = dp->dp_meta_objset;
|
||||
@ -758,7 +758,7 @@ dsl_dataset_create_key_mapping(dsl_dataset_t *ds)
|
||||
|
||||
int
|
||||
dsl_dataset_hold_obj_flags(dsl_pool_t *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 err;
|
||||
|
||||
@ -779,7 +779,7 @@ dsl_dataset_hold_obj_flags(dsl_pool_t *dp, uint64_t dsobj,
|
||||
|
||||
int
|
||||
dsl_dataset_hold_flags(dsl_pool_t *dp, const char *name, ds_hold_flags_t flags,
|
||||
void *tag, dsl_dataset_t **dsp)
|
||||
const void *tag, dsl_dataset_t **dsp)
|
||||
{
|
||||
dsl_dir_t *dd;
|
||||
const char *snapname;
|
||||
@ -832,7 +832,7 @@ dsl_dataset_hold_flags(dsl_pool_t *dp, const char *name, ds_hold_flags_t flags,
|
||||
}
|
||||
|
||||
int
|
||||
dsl_dataset_hold(dsl_pool_t *dp, const char *name, void *tag,
|
||||
dsl_dataset_hold(dsl_pool_t *dp, const char *name, const void *tag,
|
||||
dsl_dataset_t **dsp)
|
||||
{
|
||||
return (dsl_dataset_hold_flags(dp, name, 0, tag, dsp));
|
||||
@ -840,7 +840,7 @@ dsl_dataset_hold(dsl_pool_t *dp, const char *name, void *tag,
|
||||
|
||||
static int
|
||||
dsl_dataset_own_obj_impl(dsl_pool_t *dp, uint64_t dsobj, ds_hold_flags_t flags,
|
||||
void *tag, boolean_t override, dsl_dataset_t **dsp)
|
||||
const void *tag, boolean_t override, dsl_dataset_t **dsp)
|
||||
{
|
||||
int err = dsl_dataset_hold_obj_flags(dp, dsobj, flags, tag, dsp);
|
||||
if (err != 0)
|
||||
@ -856,21 +856,21 @@ dsl_dataset_own_obj_impl(dsl_pool_t *dp, uint64_t dsobj, ds_hold_flags_t flags,
|
||||
|
||||
int
|
||||
dsl_dataset_own_obj(dsl_pool_t *dp, uint64_t dsobj, ds_hold_flags_t flags,
|
||||
void *tag, dsl_dataset_t **dsp)
|
||||
const void *tag, dsl_dataset_t **dsp)
|
||||
{
|
||||
return (dsl_dataset_own_obj_impl(dp, dsobj, flags, tag, B_FALSE, dsp));
|
||||
}
|
||||
|
||||
int
|
||||
dsl_dataset_own_obj_force(dsl_pool_t *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)
|
||||
{
|
||||
return (dsl_dataset_own_obj_impl(dp, dsobj, flags, tag, B_TRUE, dsp));
|
||||
}
|
||||
|
||||
static int
|
||||
dsl_dataset_own_impl(dsl_pool_t *dp, const char *name, ds_hold_flags_t flags,
|
||||
void *tag, boolean_t override, dsl_dataset_t **dsp)
|
||||
const void *tag, boolean_t override, dsl_dataset_t **dsp)
|
||||
{
|
||||
int err = dsl_dataset_hold_flags(dp, name, flags, tag, dsp);
|
||||
if (err != 0)
|
||||
@ -884,14 +884,14 @@ dsl_dataset_own_impl(dsl_pool_t *dp, const char *name, ds_hold_flags_t flags,
|
||||
|
||||
int
|
||||
dsl_dataset_own_force(dsl_pool_t *dp, const char *name, ds_hold_flags_t flags,
|
||||
void *tag, dsl_dataset_t **dsp)
|
||||
const void *tag, dsl_dataset_t **dsp)
|
||||
{
|
||||
return (dsl_dataset_own_impl(dp, name, flags, tag, B_TRUE, dsp));
|
||||
}
|
||||
|
||||
int
|
||||
dsl_dataset_own(dsl_pool_t *dp, const char *name, ds_hold_flags_t flags,
|
||||
void *tag, dsl_dataset_t **dsp)
|
||||
const void *tag, dsl_dataset_t **dsp)
|
||||
{
|
||||
return (dsl_dataset_own_impl(dp, name, flags, tag, B_FALSE, dsp));
|
||||
}
|
||||
@ -970,7 +970,7 @@ dsl_dataset_namelen(dsl_dataset_t *ds)
|
||||
}
|
||||
|
||||
void
|
||||
dsl_dataset_rele(dsl_dataset_t *ds, void *tag)
|
||||
dsl_dataset_rele(dsl_dataset_t *ds, const void *tag)
|
||||
{
|
||||
dmu_buf_rele(ds->ds_dbuf, tag);
|
||||
}
|
||||
@ -988,7 +988,8 @@ dsl_dataset_remove_key_mapping(dsl_dataset_t *ds)
|
||||
}
|
||||
|
||||
void
|
||||
dsl_dataset_rele_flags(dsl_dataset_t *ds, ds_hold_flags_t flags, void *tag)
|
||||
dsl_dataset_rele_flags(dsl_dataset_t *ds, ds_hold_flags_t flags,
|
||||
const void *tag)
|
||||
{
|
||||
if (flags & DS_HOLD_FLAG_DECRYPT)
|
||||
dsl_dataset_remove_key_mapping(ds);
|
||||
@ -997,7 +998,7 @@ dsl_dataset_rele_flags(dsl_dataset_t *ds, ds_hold_flags_t flags, void *tag)
|
||||
}
|
||||
|
||||
void
|
||||
dsl_dataset_disown(dsl_dataset_t *ds, ds_hold_flags_t flags, void *tag)
|
||||
dsl_dataset_disown(dsl_dataset_t *ds, ds_hold_flags_t flags, const void *tag)
|
||||
{
|
||||
ASSERT3P(ds->ds_owner, ==, tag);
|
||||
ASSERT(ds->ds_dbuf != NULL);
|
||||
@ -1010,7 +1011,7 @@ dsl_dataset_disown(dsl_dataset_t *ds, ds_hold_flags_t flags, void *tag)
|
||||
}
|
||||
|
||||
boolean_t
|
||||
dsl_dataset_tryown(dsl_dataset_t *ds, void *tag, boolean_t override)
|
||||
dsl_dataset_tryown(dsl_dataset_t *ds, const void *tag, boolean_t override)
|
||||
{
|
||||
boolean_t gotit = FALSE;
|
||||
|
||||
@ -3278,8 +3279,8 @@ struct promotenode {
|
||||
|
||||
static int snaplist_space(list_t *l, uint64_t mintxg, uint64_t *spacep);
|
||||
static int promote_hold(dsl_dataset_promote_arg_t *ddpa, dsl_pool_t *dp,
|
||||
void *tag);
|
||||
static void promote_rele(dsl_dataset_promote_arg_t *ddpa, void *tag);
|
||||
const void *tag);
|
||||
static void promote_rele(dsl_dataset_promote_arg_t *ddpa, const void *tag);
|
||||
|
||||
int
|
||||
dsl_dataset_promote_check(void *arg, dmu_tx_t *tx)
|
||||
@ -3739,7 +3740,7 @@ dsl_dataset_promote_sync(void *arg, dmu_tx_t *tx)
|
||||
*/
|
||||
static int
|
||||
snaplist_make(dsl_pool_t *dp,
|
||||
uint64_t first_obj, uint64_t last_obj, list_t *l, void *tag)
|
||||
uint64_t first_obj, uint64_t last_obj, list_t *l, const void *tag)
|
||||
{
|
||||
uint64_t obj = last_obj;
|
||||
|
||||
@ -3784,7 +3785,7 @@ snaplist_space(list_t *l, uint64_t mintxg, uint64_t *spacep)
|
||||
}
|
||||
|
||||
static void
|
||||
snaplist_destroy(list_t *l, void *tag)
|
||||
snaplist_destroy(list_t *l, const void *tag)
|
||||
{
|
||||
struct promotenode *snap;
|
||||
|
||||
@ -3800,7 +3801,7 @@ snaplist_destroy(list_t *l, void *tag)
|
||||
}
|
||||
|
||||
static int
|
||||
promote_hold(dsl_dataset_promote_arg_t *ddpa, dsl_pool_t *dp, void *tag)
|
||||
promote_hold(dsl_dataset_promote_arg_t *ddpa, dsl_pool_t *dp, const void *tag)
|
||||
{
|
||||
int error;
|
||||
dsl_dir_t *dd;
|
||||
@ -3850,7 +3851,7 @@ out:
|
||||
}
|
||||
|
||||
static void
|
||||
promote_rele(dsl_dataset_promote_arg_t *ddpa, void *tag)
|
||||
promote_rele(dsl_dataset_promote_arg_t *ddpa, const void *tag)
|
||||
{
|
||||
snaplist_destroy(&ddpa->shared_snaps, tag);
|
||||
snaplist_destroy(&ddpa->clone_snaps, tag);
|
||||
|
@ -801,7 +801,7 @@ dsl_fs_ss_limit_check(dsl_dir_t *dd, uint64_t delta, zfs_prop_t prop,
|
||||
{
|
||||
objset_t *os = dd->dd_pool->dp_meta_objset;
|
||||
uint64_t limit, count;
|
||||
char *count_prop;
|
||||
const char *count_prop;
|
||||
enforce_res_t enforce;
|
||||
int err = 0;
|
||||
|
||||
|
@ -1387,7 +1387,7 @@ dsl_pool_user_release(dsl_pool_t *dp, uint64_t dsobj, const char *tag,
|
||||
*/
|
||||
|
||||
int
|
||||
dsl_pool_hold(const char *name, void *tag, dsl_pool_t **dp)
|
||||
dsl_pool_hold(const char *name, const void *tag, dsl_pool_t **dp)
|
||||
{
|
||||
spa_t *spa;
|
||||
int error;
|
||||
@ -1401,14 +1401,14 @@ dsl_pool_hold(const char *name, void *tag, dsl_pool_t **dp)
|
||||
}
|
||||
|
||||
void
|
||||
dsl_pool_rele(dsl_pool_t *dp, void *tag)
|
||||
dsl_pool_rele(dsl_pool_t *dp, const void *tag)
|
||||
{
|
||||
dsl_pool_config_exit(dp, tag);
|
||||
spa_close(dp->dp_spa, tag);
|
||||
}
|
||||
|
||||
void
|
||||
dsl_pool_config_enter(dsl_pool_t *dp, void *tag)
|
||||
dsl_pool_config_enter(dsl_pool_t *dp, const void *tag)
|
||||
{
|
||||
/*
|
||||
* We use a "reentrant" reader-writer lock, but not reentrantly.
|
||||
@ -1427,14 +1427,14 @@ dsl_pool_config_enter(dsl_pool_t *dp, void *tag)
|
||||
}
|
||||
|
||||
void
|
||||
dsl_pool_config_enter_prio(dsl_pool_t *dp, void *tag)
|
||||
dsl_pool_config_enter_prio(dsl_pool_t *dp, const void *tag)
|
||||
{
|
||||
ASSERT(!rrw_held(&dp->dp_config_rwlock, RW_READER));
|
||||
rrw_enter_read_prio(&dp->dp_config_rwlock, tag);
|
||||
}
|
||||
|
||||
void
|
||||
dsl_pool_config_exit(dsl_pool_t *dp, void *tag)
|
||||
dsl_pool_config_exit(dsl_pool_t *dp, const void *tag)
|
||||
{
|
||||
rrw_exit(&dp->dp_config_rwlock, tag);
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ dsl_dataset_user_hold(nvlist_t *holds, minor_t cleanup_minor, nvlist_t *errlist)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
typedef int (dsl_holdfunc_t)(dsl_pool_t *dp, const char *name, void *tag,
|
||||
typedef int (dsl_holdfunc_t)(dsl_pool_t *dp, const char *name, const void *tag,
|
||||
dsl_dataset_t **dsp);
|
||||
|
||||
typedef struct dsl_dataset_user_release_arg {
|
||||
@ -359,7 +359,7 @@ typedef struct dsl_dataset_user_release_arg {
|
||||
|
||||
/* Place a dataset hold on the snapshot identified by passed dsobj string */
|
||||
static int
|
||||
dsl_dataset_hold_obj_string(dsl_pool_t *dp, const char *dsobj, void *tag,
|
||||
dsl_dataset_hold_obj_string(dsl_pool_t *dp, const char *dsobj, const void *tag,
|
||||
dsl_dataset_t **dsp)
|
||||
{
|
||||
return (dsl_dataset_hold_obj(dp, zfs_strtonum(dsobj, NULL), tag, dsp));
|
||||
|
@ -186,7 +186,7 @@ uint_t zfs_multihost_import_intervals = MMP_DEFAULT_IMPORT_INTERVALS;
|
||||
*/
|
||||
uint_t zfs_multihost_fail_intervals = MMP_DEFAULT_FAIL_INTERVALS;
|
||||
|
||||
static void *const mmp_tag = "mmp_write_uberblock";
|
||||
static const void *const mmp_tag = "mmp_write_uberblock";
|
||||
static __attribute__((noreturn)) void mmp_thread(void *arg);
|
||||
|
||||
void
|
||||
|
@ -77,7 +77,7 @@ uint_t rrw_tsd_key;
|
||||
typedef struct rrw_node {
|
||||
struct rrw_node *rn_next;
|
||||
rrwlock_t *rn_rrl;
|
||||
void *rn_tag;
|
||||
const void *rn_tag;
|
||||
} rrw_node_t;
|
||||
|
||||
static rrw_node_t *
|
||||
@ -99,7 +99,7 @@ rrn_find(rrwlock_t *rrl)
|
||||
* Add a node to the head of the singly linked list.
|
||||
*/
|
||||
static void
|
||||
rrn_add(rrwlock_t *rrl, void *tag)
|
||||
rrn_add(rrwlock_t *rrl, const void *tag)
|
||||
{
|
||||
rrw_node_t *rn;
|
||||
|
||||
@ -115,7 +115,7 @@ rrn_add(rrwlock_t *rrl, void *tag)
|
||||
* thread's list and return TRUE; otherwise return FALSE.
|
||||
*/
|
||||
static boolean_t
|
||||
rrn_find_and_remove(rrwlock_t *rrl, void *tag)
|
||||
rrn_find_and_remove(rrwlock_t *rrl, const void *tag)
|
||||
{
|
||||
rrw_node_t *rn;
|
||||
rrw_node_t *prev = NULL;
|
||||
@ -160,7 +160,7 @@ rrw_destroy(rrwlock_t *rrl)
|
||||
}
|
||||
|
||||
static void
|
||||
rrw_enter_read_impl(rrwlock_t *rrl, boolean_t prio, void *tag)
|
||||
rrw_enter_read_impl(rrwlock_t *rrl, boolean_t prio, const void *tag)
|
||||
{
|
||||
mutex_enter(&rrl->rr_lock);
|
||||
#if !defined(ZFS_DEBUG) && defined(_KERNEL)
|
||||
@ -192,7 +192,7 @@ rrw_enter_read_impl(rrwlock_t *rrl, boolean_t prio, void *tag)
|
||||
}
|
||||
|
||||
void
|
||||
rrw_enter_read(rrwlock_t *rrl, void *tag)
|
||||
rrw_enter_read(rrwlock_t *rrl, const void *tag)
|
||||
{
|
||||
rrw_enter_read_impl(rrl, B_FALSE, tag);
|
||||
}
|
||||
@ -204,7 +204,7 @@ rrw_enter_read(rrwlock_t *rrl, void *tag)
|
||||
* the pending writer does not work, so we have to give an explicit hint here.
|
||||
*/
|
||||
void
|
||||
rrw_enter_read_prio(rrwlock_t *rrl, void *tag)
|
||||
rrw_enter_read_prio(rrwlock_t *rrl, const void *tag)
|
||||
{
|
||||
rrw_enter_read_impl(rrl, B_TRUE, tag);
|
||||
}
|
||||
@ -228,7 +228,7 @@ rrw_enter_write(rrwlock_t *rrl)
|
||||
}
|
||||
|
||||
void
|
||||
rrw_enter(rrwlock_t *rrl, krw_t rw, void *tag)
|
||||
rrw_enter(rrwlock_t *rrl, krw_t rw, const void *tag)
|
||||
{
|
||||
if (rw == RW_READER)
|
||||
rrw_enter_read(rrl, tag);
|
||||
@ -237,7 +237,7 @@ rrw_enter(rrwlock_t *rrl, krw_t rw, void *tag)
|
||||
}
|
||||
|
||||
void
|
||||
rrw_exit(rrwlock_t *rrl, void *tag)
|
||||
rrw_exit(rrwlock_t *rrl, const void *tag)
|
||||
{
|
||||
mutex_enter(&rrl->rr_lock);
|
||||
#if !defined(ZFS_DEBUG) && defined(_KERNEL)
|
||||
@ -339,7 +339,7 @@ rrm_destroy(rrmlock_t *rrl)
|
||||
}
|
||||
|
||||
void
|
||||
rrm_enter(rrmlock_t *rrl, krw_t rw, void *tag)
|
||||
rrm_enter(rrmlock_t *rrl, krw_t rw, const void *tag)
|
||||
{
|
||||
if (rw == RW_READER)
|
||||
rrm_enter_read(rrl, tag);
|
||||
@ -358,7 +358,7 @@ rrm_enter(rrmlock_t *rrl, krw_t rw, void *tag)
|
||||
#define RRM_TD_LOCK() (((uint32_t)(uintptr_t)(curthread)) % RRM_NUM_LOCKS)
|
||||
|
||||
void
|
||||
rrm_enter_read(rrmlock_t *rrl, void *tag)
|
||||
rrm_enter_read(rrmlock_t *rrl, const void *tag)
|
||||
{
|
||||
rrw_enter_read(&rrl->locks[RRM_TD_LOCK()], tag);
|
||||
}
|
||||
@ -373,7 +373,7 @@ rrm_enter_write(rrmlock_t *rrl)
|
||||
}
|
||||
|
||||
void
|
||||
rrm_exit(rrmlock_t *rrl, void *tag)
|
||||
rrm_exit(rrmlock_t *rrl, const void *tag)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -164,7 +164,8 @@ static const zio_taskq_info_t zio_taskqs[ZIO_TYPES][ZIO_TASKQ_TYPES] = {
|
||||
static void spa_sync_version(void *arg, dmu_tx_t *tx);
|
||||
static void spa_sync_props(void *arg, dmu_tx_t *tx);
|
||||
static boolean_t spa_has_active_shared_spare(spa_t *spa);
|
||||
static int spa_load_impl(spa_t *spa, spa_import_type_t type, char **ereport);
|
||||
static int spa_load_impl(spa_t *spa, spa_import_type_t type,
|
||||
const char **ereport);
|
||||
static void spa_vdev_resilver_done(spa_t *spa);
|
||||
|
||||
static uint_t zio_taskq_batch_pct = 80; /* 1 thread per cpu in pset */
|
||||
@ -277,7 +278,7 @@ static int zfs_livelist_condense_new_alloc = 0;
|
||||
* Add a (source=src, propname=propval) list to an nvlist.
|
||||
*/
|
||||
static void
|
||||
spa_prop_add_list(nvlist_t *nvl, zpool_prop_t prop, char *strval,
|
||||
spa_prop_add_list(nvlist_t *nvl, zpool_prop_t prop, const char *strval,
|
||||
uint64_t intval, zprop_source_t src)
|
||||
{
|
||||
const char *propname = zpool_prop_to_name(prop);
|
||||
@ -2974,7 +2975,7 @@ spa_try_repair(spa_t *spa, nvlist_t *config)
|
||||
static int
|
||||
spa_load(spa_t *spa, spa_load_state_t state, spa_import_type_t type)
|
||||
{
|
||||
char *ereport = FM_EREPORT_ZFS_POOL;
|
||||
const char *ereport = FM_EREPORT_ZFS_POOL;
|
||||
int error;
|
||||
|
||||
spa->spa_load_state = state;
|
||||
@ -3291,7 +3292,7 @@ out:
|
||||
* ZPOOL_CONFIG_MMP_HOSTID - hostid from the active pool
|
||||
*/
|
||||
if (error == EREMOTEIO) {
|
||||
char *hostname = "<unknown>";
|
||||
const char *hostname = "<unknown>";
|
||||
uint64_t hostid = 0;
|
||||
|
||||
if (mmp_label) {
|
||||
@ -4399,7 +4400,7 @@ spa_ld_load_dedup_tables(spa_t *spa)
|
||||
}
|
||||
|
||||
static int
|
||||
spa_ld_verify_logs(spa_t *spa, spa_import_type_t type, char **ereport)
|
||||
spa_ld_verify_logs(spa_t *spa, spa_import_type_t type, const char **ereport)
|
||||
{
|
||||
vdev_t *rvd = spa->spa_root_vdev;
|
||||
|
||||
@ -4766,7 +4767,7 @@ spa_ld_mos_with_trusted_config(spa_t *spa, spa_import_type_t type,
|
||||
* config stored in the MOS.
|
||||
*/
|
||||
static int
|
||||
spa_load_impl(spa_t *spa, spa_import_type_t type, char **ereport)
|
||||
spa_load_impl(spa_t *spa, spa_import_type_t type, const char **ereport)
|
||||
{
|
||||
int error = 0;
|
||||
boolean_t missing_feat_write = B_FALSE;
|
||||
@ -5157,8 +5158,8 @@ spa_load_best(spa_t *spa, spa_load_state_t state, uint64_t max_request,
|
||||
* ambiguous state.
|
||||
*/
|
||||
static int
|
||||
spa_open_common(const char *pool, spa_t **spapp, void *tag, nvlist_t *nvpolicy,
|
||||
nvlist_t **config)
|
||||
spa_open_common(const char *pool, spa_t **spapp, const void *tag,
|
||||
nvlist_t *nvpolicy, nvlist_t **config)
|
||||
{
|
||||
spa_t *spa;
|
||||
spa_load_state_t state = SPA_LOAD_OPEN;
|
||||
@ -5274,14 +5275,14 @@ spa_open_common(const char *pool, spa_t **spapp, void *tag, nvlist_t *nvpolicy,
|
||||
}
|
||||
|
||||
int
|
||||
spa_open_rewind(const char *name, spa_t **spapp, void *tag, nvlist_t *policy,
|
||||
nvlist_t **config)
|
||||
spa_open_rewind(const char *name, spa_t **spapp, const void *tag,
|
||||
nvlist_t *policy, nvlist_t **config)
|
||||
{
|
||||
return (spa_open_common(name, spapp, tag, policy, config));
|
||||
}
|
||||
|
||||
int
|
||||
spa_open(const char *name, spa_t **spapp, void *tag)
|
||||
spa_open(const char *name, spa_t **spapp, const void *tag)
|
||||
{
|
||||
return (spa_open_common(name, spapp, tag, NULL, NULL));
|
||||
}
|
||||
@ -7507,7 +7508,7 @@ spa_vdev_trim(spa_t *spa, nvlist_t *nv, uint64_t cmd_type, uint64_t rate,
|
||||
* Split a set of devices from their mirrors, and create a new pool from them.
|
||||
*/
|
||||
int
|
||||
spa_vdev_split_mirror(spa_t *spa, char *newname, nvlist_t *config,
|
||||
spa_vdev_split_mirror(spa_t *spa, const char *newname, nvlist_t *config,
|
||||
nvlist_t *props, boolean_t exp)
|
||||
{
|
||||
int error = 0;
|
||||
|
@ -67,7 +67,7 @@ static uint64_t spa_config_generation = 1;
|
||||
* This can be overridden in userland to preserve an alternate namespace for
|
||||
* userland pools when doing testing.
|
||||
*/
|
||||
char *spa_config_path = ZPOOL_CACHE;
|
||||
char *spa_config_path = (char *)ZPOOL_CACHE;
|
||||
#ifdef _KERNEL
|
||||
static int zfs_autoimport_disable = B_TRUE;
|
||||
#endif
|
||||
|
@ -659,9 +659,9 @@ sync_upgrade_errlog(spa_t *spa, uint64_t spa_err_obj, uint64_t *newobj,
|
||||
}
|
||||
|
||||
char buf[64];
|
||||
char *name = "";
|
||||
errphys_to_name(&zep, buf, sizeof (buf));
|
||||
|
||||
const char *name = "";
|
||||
(void) zap_update(spa->spa_meta_objset, err_obj,
|
||||
buf, 1, strlen(name) + 1, name, tx);
|
||||
}
|
||||
@ -901,17 +901,14 @@ sync_error_list(spa_t *spa, avl_tree_t *t, uint64_t *obj, dmu_tx_t *tx)
|
||||
/* add errors to the current log */
|
||||
if (!spa_feature_is_enabled(spa, SPA_FEATURE_HEAD_ERRLOG)) {
|
||||
for (se = avl_first(t); se != NULL; se = AVL_NEXT(t, se)) {
|
||||
char *name = se->se_name ? se->se_name : "";
|
||||
|
||||
bookmark_to_name(&se->se_bookmark, buf, sizeof (buf));
|
||||
|
||||
const char *name = se->se_name ? se->se_name : "";
|
||||
(void) zap_update(spa->spa_meta_objset, *obj, buf, 1,
|
||||
strlen(name) + 1, name, tx);
|
||||
}
|
||||
} else {
|
||||
for (se = avl_first(t); se != NULL; se = AVL_NEXT(t, se)) {
|
||||
char *name = se->se_name ? se->se_name : "";
|
||||
|
||||
zbookmark_err_phys_t zep;
|
||||
zep.zb_object = se->se_bookmark.zb_object;
|
||||
zep.zb_level = se->se_bookmark.zb_level;
|
||||
@ -943,6 +940,7 @@ sync_error_list(spa_t *spa, avl_tree_t *t, uint64_t *obj, dmu_tx_t *tx)
|
||||
}
|
||||
errphys_to_name(&zep, buf, sizeof (buf));
|
||||
|
||||
const char *name = se->se_name ? se->se_name : "";
|
||||
(void) zap_update(spa->spa_meta_objset,
|
||||
err_obj, buf, 1, strlen(name) + 1, name, tx);
|
||||
}
|
||||
@ -1153,7 +1151,7 @@ swap_errlog(spa_t *spa, uint64_t spa_err_obj, uint64_t new_head, uint64_t
|
||||
for (zap_cursor_init(&zc, spa->spa_meta_objset, old_head_errlog);
|
||||
zap_cursor_retrieve(&zc, &za) == 0; zap_cursor_advance(&zc)) {
|
||||
|
||||
char *name = "";
|
||||
const char *name = "";
|
||||
name_to_errphys(za.za_name, &err_block);
|
||||
if (err_block.zb_birth < txg) {
|
||||
(void) zap_update(spa->spa_meta_objset, new_head_errlog,
|
||||
|
@ -462,7 +462,7 @@ spa_config_lock_destroy(spa_t *spa)
|
||||
}
|
||||
|
||||
int
|
||||
spa_config_tryenter(spa_t *spa, int locks, void *tag, krw_t rw)
|
||||
spa_config_tryenter(spa_t *spa, int locks, const void *tag, krw_t rw)
|
||||
{
|
||||
for (int i = 0; i < SCL_LOCKS; i++) {
|
||||
spa_config_lock_t *scl = &spa->spa_config_lock[i];
|
||||
@ -877,7 +877,7 @@ spa_next(spa_t *prev)
|
||||
* have the namespace lock held.
|
||||
*/
|
||||
void
|
||||
spa_open_ref(spa_t *spa, void *tag)
|
||||
spa_open_ref(spa_t *spa, const void *tag)
|
||||
{
|
||||
ASSERT(zfs_refcount_count(&spa->spa_refcount) >= spa->spa_minref ||
|
||||
MUTEX_HELD(&spa_namespace_lock));
|
||||
@ -889,7 +889,7 @@ spa_open_ref(spa_t *spa, void *tag)
|
||||
* have the namespace lock held.
|
||||
*/
|
||||
void
|
||||
spa_close(spa_t *spa, void *tag)
|
||||
spa_close(spa_t *spa, const void *tag)
|
||||
{
|
||||
ASSERT(zfs_refcount_count(&spa->spa_refcount) > spa->spa_minref ||
|
||||
MUTEX_HELD(&spa_namespace_lock));
|
||||
@ -905,7 +905,7 @@ spa_close(spa_t *spa, void *tag)
|
||||
* so the asserts in spa_close() do not apply.
|
||||
*/
|
||||
void
|
||||
spa_async_close(spa_t *spa, void *tag)
|
||||
spa_async_close(spa_t *spa, const void *tag)
|
||||
{
|
||||
(void) zfs_refcount_remove(&spa->spa_refcount, tag);
|
||||
}
|
||||
@ -1513,8 +1513,8 @@ void
|
||||
snprintf_blkptr(char *buf, size_t buflen, const blkptr_t *bp)
|
||||
{
|
||||
char type[256];
|
||||
char *checksum = NULL;
|
||||
char *compress = NULL;
|
||||
const char *checksum = NULL;
|
||||
const char *compress = NULL;
|
||||
|
||||
if (bp != NULL) {
|
||||
if (BP_GET_TYPE(bp) & DMU_OT_NEWTYPE) {
|
||||
|
@ -5790,7 +5790,7 @@ vdev_prop_get(vdev_t *vd, nvlist_t *innvl, nvlist_t *outnvl)
|
||||
KM_SLEEP);
|
||||
for (uint64_t i = 0; i < vd->vdev_children;
|
||||
i++) {
|
||||
char *vname;
|
||||
const char *vname;
|
||||
|
||||
vname = vdev_name(vd->vdev_child[i],
|
||||
namebuf, sizeof (namebuf));
|
||||
|
@ -563,7 +563,7 @@ vdev_raidz_math_fini(void)
|
||||
}
|
||||
|
||||
static const struct {
|
||||
char *name;
|
||||
const char *name;
|
||||
uint32_t sel;
|
||||
} math_impl_opts[] = {
|
||||
{ "cycle", IMPL_CYCLE },
|
||||
|
@ -260,7 +260,7 @@ vdev_rebuild_initiate_sync(void *arg, dmu_tx_t *tx)
|
||||
}
|
||||
|
||||
static void
|
||||
vdev_rebuild_log_notify(spa_t *spa, vdev_t *vd, char *name)
|
||||
vdev_rebuild_log_notify(spa_t *spa, vdev_t *vd, const char *name)
|
||||
{
|
||||
nvlist_t *aux = fnvlist_alloc();
|
||||
|
||||
|
@ -338,8 +338,8 @@ spa_vdev_alloc(spa_t *spa, uint64_t guid)
|
||||
}
|
||||
|
||||
static void
|
||||
spa_vdev_remove_aux(nvlist_t *config, char *name, nvlist_t **dev, int count,
|
||||
nvlist_t *dev_to_remove)
|
||||
spa_vdev_remove_aux(nvlist_t *config, const char *name, nvlist_t **dev,
|
||||
int count, nvlist_t *dev_to_remove)
|
||||
{
|
||||
nvlist_t **newdev = NULL;
|
||||
|
||||
@ -2384,7 +2384,8 @@ spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t unspare)
|
||||
int error = 0, error_log;
|
||||
boolean_t locked = MUTEX_HELD(&spa_namespace_lock);
|
||||
sysevent_t *ev = NULL;
|
||||
char *vd_type = NULL, *vd_path = NULL;
|
||||
const char *vd_type = NULL;
|
||||
char *vd_path = NULL;
|
||||
|
||||
ASSERT(spa_writeable(spa));
|
||||
|
||||
|
@ -61,7 +61,7 @@ typedef struct fuid_domain {
|
||||
uint64_t f_idx;
|
||||
} fuid_domain_t;
|
||||
|
||||
static char *nulldomain = "";
|
||||
static const char *const nulldomain = "";
|
||||
|
||||
/*
|
||||
* Compare two indexes.
|
||||
@ -171,7 +171,7 @@ zfs_fuid_table_destroy(avl_tree_t *idx_tree, avl_tree_t *domain_tree)
|
||||
avl_destroy(idx_tree);
|
||||
}
|
||||
|
||||
char *
|
||||
const char *
|
||||
zfs_fuid_idx_domain(avl_tree_t *idx_tree, uint32_t idx)
|
||||
{
|
||||
fuid_domain_t searchnode, *findnode;
|
||||
@ -290,9 +290,9 @@ zfs_fuid_sync(zfsvfs_t *zfsvfs, dmu_tx_t *tx)
|
||||
* necessary for the caller or another thread to detect the dirty table
|
||||
* and sync out the changes.
|
||||
*/
|
||||
int
|
||||
static int
|
||||
zfs_fuid_find_by_domain(zfsvfs_t *zfsvfs, const char *domain,
|
||||
char **retdomain, boolean_t addok)
|
||||
const char **retdomain, boolean_t addok)
|
||||
{
|
||||
fuid_domain_t searchnode, *findnode;
|
||||
avl_index_t loc;
|
||||
@ -358,7 +358,7 @@ retry:
|
||||
const char *
|
||||
zfs_fuid_find_by_idx(zfsvfs_t *zfsvfs, uint32_t idx)
|
||||
{
|
||||
char *domain;
|
||||
const char *domain;
|
||||
|
||||
if (idx == 0 || !zfsvfs->z_use_fuids)
|
||||
return (NULL);
|
||||
@ -518,8 +518,7 @@ zfs_fuid_create_cred(zfsvfs_t *zfsvfs, zfs_fuid_type_t type,
|
||||
uint64_t idx;
|
||||
ksid_t *ksid;
|
||||
uint32_t rid;
|
||||
char *kdomain;
|
||||
const char *domain;
|
||||
const char *kdomain, *domain;
|
||||
uid_t id;
|
||||
|
||||
VERIFY(type == ZFS_OWNER || type == ZFS_GROUP);
|
||||
@ -574,8 +573,7 @@ zfs_fuid_create(zfsvfs_t *zfsvfs, uint64_t id, cred_t *cr,
|
||||
zfs_fuid_type_t type, zfs_fuid_info_t **fuidpp)
|
||||
{
|
||||
#ifdef HAVE_KSID
|
||||
const char *domain;
|
||||
char *kdomain;
|
||||
const char *domain, *kdomain;
|
||||
uint32_t fuid_idx = FUID_INDEX(id);
|
||||
uint32_t rid = 0;
|
||||
idmap_stat status;
|
||||
|
@ -3470,7 +3470,7 @@ zil_close(zilog_t *zilog)
|
||||
mutex_exit(&zilog->zl_lock);
|
||||
}
|
||||
|
||||
static char *suspend_tag = "zil suspending";
|
||||
static const char *suspend_tag = "zil suspending";
|
||||
|
||||
/*
|
||||
* Suspend an intent log. While in suspended mode, we still honor
|
||||
|
@ -160,7 +160,7 @@ abd_fletcher_4_byteswap(abd_t *abd, uint64_t size,
|
||||
abd_fletcher_4_impl(abd, size, &acd);
|
||||
}
|
||||
|
||||
zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = {
|
||||
const zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = {
|
||||
{{NULL, NULL}, NULL, NULL, 0, "inherit"},
|
||||
{{NULL, NULL}, NULL, NULL, 0, "on"},
|
||||
{{abd_checksum_off, abd_checksum_off},
|
||||
|
@ -49,7 +49,7 @@ unsigned long zio_decompress_fail_fraction = 0;
|
||||
/*
|
||||
* Compression vectors.
|
||||
*/
|
||||
zio_compress_info_t zio_compress_table[ZIO_COMPRESS_FUNCTIONS] = {
|
||||
const zio_compress_info_t zio_compress_table[ZIO_COMPRESS_FUNCTIONS] = {
|
||||
{"inherit", 0, NULL, NULL, NULL},
|
||||
{"on", 0, NULL, NULL, NULL},
|
||||
{"uncompressed", 0, NULL, NULL, NULL},
|
||||
|
@ -51,7 +51,7 @@
|
||||
|
||||
typedef struct timetest {
|
||||
int type;
|
||||
char *name;
|
||||
const char *name;
|
||||
int (*func)(const char *pfile);
|
||||
} timetest_t;
|
||||
|
||||
@ -260,7 +260,7 @@ static int
|
||||
do_xattr(const char *pfile)
|
||||
{
|
||||
int ret = 0;
|
||||
char *value = "user.value";
|
||||
const char *value = "user.value";
|
||||
|
||||
if (pfile == NULL) {
|
||||
return (-1);
|
||||
@ -306,7 +306,7 @@ int
|
||||
main(void)
|
||||
{
|
||||
int i, ret, fd;
|
||||
char *penv[] = {"TESTDIR", "TESTFILE0"};
|
||||
const char *penv[] = {"TESTDIR", "TESTFILE0"};
|
||||
|
||||
(void) atexit(cleanup);
|
||||
|
||||
|
@ -47,7 +47,7 @@ static char dirpath[256];
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
char *cp1 = "";
|
||||
const char *cp1 = "";
|
||||
int i = 0;
|
||||
int ret = 0;
|
||||
int testdd = 0;
|
||||
|
@ -130,7 +130,7 @@ read_map(const char *filename, nvlist_t **allcfgs)
|
||||
* for freeing the configuration returned.
|
||||
*/
|
||||
static int
|
||||
read_map_key(const char *filename, char *key, nvlist_t **cfg)
|
||||
read_map_key(const char *filename, const char *key, nvlist_t **cfg)
|
||||
{
|
||||
nvlist_t *allcfgs, *foundcfg = NULL;
|
||||
int error;
|
||||
@ -320,8 +320,8 @@ write_map_key(const char *filename, char *key, draid_map_t *map,
|
||||
}
|
||||
|
||||
static void
|
||||
dump_map(draid_map_t *map, char *key, double worst_ratio, double avg_ratio,
|
||||
int verbose)
|
||||
dump_map(draid_map_t *map, const char *key, double worst_ratio,
|
||||
double avg_ratio, int verbose)
|
||||
{
|
||||
if (verbose == 0) {
|
||||
return;
|
||||
@ -363,7 +363,7 @@ dump_map(draid_map_t *map, char *key, double worst_ratio, double avg_ratio,
|
||||
}
|
||||
|
||||
static void
|
||||
dump_map_nv(char *key, nvlist_t *cfg, int verbose)
|
||||
dump_map_nv(const char *key, nvlist_t *cfg, int verbose)
|
||||
{
|
||||
draid_map_t map;
|
||||
uint_t c;
|
||||
@ -385,7 +385,7 @@ dump_map_nv(char *key, nvlist_t *cfg, int verbose)
|
||||
* Print a summary of the mapping.
|
||||
*/
|
||||
static int
|
||||
dump_map_key(const char *filename, char *key, int verbose)
|
||||
dump_map_key(const char *filename, const char *key, int verbose)
|
||||
{
|
||||
nvlist_t *cfg;
|
||||
int error;
|
||||
|
@ -25,10 +25,9 @@
|
||||
#include <errno.h>
|
||||
|
||||
static void
|
||||
usage(char *msg, int exit_value)
|
||||
usage(const char *msg, int exit_value)
|
||||
{
|
||||
(void) fprintf(stderr, "get_diff file redacted_file\n");
|
||||
(void) fprintf(stderr, "%s\n", msg);
|
||||
(void) fprintf(stderr, "usage: get_diff file redacted_file\n%s\n", msg);
|
||||
exit(exit_value);
|
||||
}
|
||||
|
||||
|
@ -596,13 +596,13 @@ test_channel_program(const char *pool)
|
||||
"arg = ...\n"
|
||||
"argv = arg[\"argv\"]\n"
|
||||
"return argv[1]";
|
||||
char *const argv[1] = { "Hello World!" };
|
||||
const char *const argv[1] = { "Hello World!" };
|
||||
nvlist_t *required = fnvlist_alloc();
|
||||
nvlist_t *optional = fnvlist_alloc();
|
||||
nvlist_t *args = fnvlist_alloc();
|
||||
|
||||
fnvlist_add_string(required, "program", program);
|
||||
fnvlist_add_string_array(args, "argv", (const char * const *)argv, 1);
|
||||
fnvlist_add_string_array(args, "argv", argv, 1);
|
||||
fnvlist_add_nvlist(required, "arg", args);
|
||||
|
||||
fnvlist_add_boolean_value(optional, "sync", B_TRUE);
|
||||
|
@ -32,14 +32,14 @@
|
||||
|
||||
|
||||
static __attribute__((noreturn)) void
|
||||
usage(char *progname)
|
||||
usage(const char *progname)
|
||||
{
|
||||
(void) fprintf(stderr, "Usage: %s <dirname|filename>\n", progname);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static __attribute__((noreturn)) void
|
||||
fail(char *err)
|
||||
fail(const char *err)
|
||||
{
|
||||
perror(err);
|
||||
exit(1);
|
||||
|
@ -21,13 +21,11 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#define MAX_INT_LENGTH 10
|
||||
|
||||
static void
|
||||
usage(char *msg, int exit_value)
|
||||
usage(const char *msg, int exit_value)
|
||||
{
|
||||
(void) fprintf(stderr, "mkfiles basename max_file [min_file]\n");
|
||||
(void) fprintf(stderr, "%s\n", msg);
|
||||
(void) fprintf(stderr, "usage: mkfiles basename max_file [min_file]\n"
|
||||
"%s\n", msg);
|
||||
exit(exit_value);
|
||||
}
|
||||
|
||||
@ -40,13 +38,13 @@ main(int argc, char **argv)
|
||||
char buf[MAXPATHLEN];
|
||||
|
||||
if (argc < 3 || argc > 4)
|
||||
usage("Invalid number of arguments", -1);
|
||||
usage("Invalid number of arguments", 1);
|
||||
|
||||
if (sscanf(argv[2], "%u", &numfiles) != 1)
|
||||
usage("Invalid maximum file", -2);
|
||||
usage("Invalid maximum file", 2);
|
||||
|
||||
if (argc == 4 && sscanf(argv[3], "%u", &first_file) != 1)
|
||||
usage("Invalid first file", -3);
|
||||
usage("Invalid first file", 3);
|
||||
|
||||
for (i = first_file; i < first_file + numfiles; i++) {
|
||||
int fd;
|
||||
@ -54,11 +52,11 @@ main(int argc, char **argv)
|
||||
if ((fd = open(buf, O_CREAT | O_EXCL, O_RDWR)) == -1) {
|
||||
(void) fprintf(stderr, "Failed to create %s %s\n", buf,
|
||||
strerror(errno));
|
||||
return (-4);
|
||||
return (4);
|
||||
} else if (fchown(fd, getuid(), getgid()) < 0) {
|
||||
(void) fprintf(stderr, "Failed to chown %s %s\n", buf,
|
||||
strerror(errno));
|
||||
return (-5);
|
||||
return (5);
|
||||
}
|
||||
(void) close(fd);
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ crtfile(char *pname)
|
||||
{
|
||||
int fd = -1;
|
||||
int i, size;
|
||||
char *context = "0123456789ABCDF";
|
||||
const char *context = "0123456789ABCDF";
|
||||
char *pbuf;
|
||||
|
||||
if (pname == NULL) {
|
||||
|
@ -84,7 +84,7 @@ nvlist_equal(nvlist_t *nvla, nvlist_t *nvlb)
|
||||
static void
|
||||
test(const char *testname, boolean_t expect_success, boolean_t expect_match)
|
||||
{
|
||||
char *progstr = "input = ...; return {output=input}";
|
||||
const char *progstr = "input = ...; return {output=input}";
|
||||
|
||||
nvlist_t *outnvl;
|
||||
|
||||
@ -230,8 +230,8 @@ run_tests(void)
|
||||
test("uint64_array", B_FALSE, B_FALSE);
|
||||
}
|
||||
{
|
||||
char *const val[2] = { "0", "1" };
|
||||
fnvlist_add_string_array(nvl, key, (const char **)val, 2);
|
||||
const char *val[2] = { "0", "1" };
|
||||
fnvlist_add_string_array(nvl, key, val, 2);
|
||||
test("string_array", B_TRUE, B_FALSE);
|
||||
}
|
||||
{
|
||||
|
@ -49,7 +49,7 @@
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
char *filename = "badfile";
|
||||
const char *filename = "badfile";
|
||||
size_t size = 4395;
|
||||
size_t idx = 0;
|
||||
char *buf = NULL;
|
||||
|
@ -27,7 +27,7 @@ static char *ifile = NULL;
|
||||
static char *ofile = NULL;
|
||||
static int stride = 0;
|
||||
static int seek = 0;
|
||||
static char *execname = "stride_dd";
|
||||
static const char *execname = "stride_dd";
|
||||
|
||||
static void usage(void);
|
||||
static void parse_options(int argc, char *argv[]);
|
||||
|
@ -91,8 +91,8 @@ static int size_is_random = 0;
|
||||
static int value_is_random = 0;
|
||||
static int keep_files = 0;
|
||||
static int phase = PHASE_ALL;
|
||||
static char path[PATH_MAX] = "/tmp/xattrtest";
|
||||
static char script[PATH_MAX] = "/bin/true";
|
||||
static const char *path = "/tmp/xattrtest";
|
||||
static const char *script = "/bin/true";
|
||||
static char xattrbytes[XATTR_SIZE_MAX];
|
||||
|
||||
static int
|
||||
@ -161,8 +161,7 @@ parse_args(int argc, char **argv)
|
||||
}
|
||||
break;
|
||||
case 'p':
|
||||
strncpy(path, optarg, PATH_MAX);
|
||||
path[PATH_MAX - 1] = '\0';
|
||||
path = optarg;
|
||||
break;
|
||||
case 'c':
|
||||
synccaches = 1;
|
||||
@ -171,8 +170,7 @@ parse_args(int argc, char **argv)
|
||||
dropcaches = 1;
|
||||
break;
|
||||
case 't':
|
||||
strncpy(script, optarg, PATH_MAX);
|
||||
script[PATH_MAX - 1] = '\0';
|
||||
script = optarg;
|
||||
break;
|
||||
case 'e':
|
||||
seed = strtol(optarg, NULL, 0);
|
||||
@ -291,9 +289,9 @@ run_process(const char *path, char *argv[])
|
||||
}
|
||||
|
||||
static int
|
||||
post_hook(char *phase)
|
||||
post_hook(const char *phase)
|
||||
{
|
||||
char *argv[3] = { script, phase, (char *)0 };
|
||||
char *argv[3] = { (char *)script, (char *)phase, NULL };
|
||||
int rc;
|
||||
|
||||
if (synccaches)
|
||||
@ -517,9 +515,9 @@ getxattrs(void)
|
||||
int i, j, rnd_size, shift, rc = 0;
|
||||
char name[XATTR_NAME_MAX];
|
||||
char *verify_value = NULL;
|
||||
char *verify_string;
|
||||
const char *verify_string;
|
||||
char *value = NULL;
|
||||
char *value_string;
|
||||
const char *value_string;
|
||||
char *file = NULL;
|
||||
struct timeval start, stop;
|
||||
double seconds;
|
||||
|
@ -29,16 +29,16 @@
|
||||
*/
|
||||
typedef struct hkdf_tv {
|
||||
/* test vector input values */
|
||||
char *ikm;
|
||||
const char *ikm;
|
||||
uint_t ikm_len;
|
||||
char *salt;
|
||||
const char *salt;
|
||||
uint_t salt_len;
|
||||
char *info;
|
||||
const char *info;
|
||||
uint_t info_len;
|
||||
uint_t okm_len;
|
||||
|
||||
/* expected output */
|
||||
char *okm;
|
||||
const char *okm;
|
||||
} hkdf_tv_t;
|
||||
|
||||
/*
|
||||
@ -48,7 +48,7 @@ typedef struct hkdf_tv {
|
||||
* The current vectors were taken from:
|
||||
* https://www.kullo.net/blog/hkdf-sha-512-test-vectors/
|
||||
*/
|
||||
static hkdf_tv_t test_vectors[] = {
|
||||
static const hkdf_tv_t test_vectors[] = {
|
||||
{
|
||||
.ikm = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
|
||||
"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
|
||||
@ -170,7 +170,7 @@ static hkdf_tv_t test_vectors[] = {
|
||||
};
|
||||
|
||||
static void
|
||||
hexdump(char *str, uint8_t *src, uint_t len)
|
||||
hexdump(const char *str, uint8_t *src, uint_t len)
|
||||
{
|
||||
printf("\t%s\t", str);
|
||||
for (int i = 0; i < len; i++)
|
||||
@ -179,7 +179,7 @@ hexdump(char *str, uint8_t *src, uint_t len)
|
||||
}
|
||||
|
||||
static int
|
||||
run_test(int i, hkdf_tv_t *tv)
|
||||
run_test(int i, const hkdf_tv_t *tv)
|
||||
{
|
||||
int ret;
|
||||
uint8_t good[SHA512_DIGEST_LENGTH];
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <err.h>
|
||||
|
||||
/* backward compat in case it's not defined */
|
||||
#ifndef O_TMPFILE
|
||||
@ -33,75 +34,45 @@ fill_random(char *buf, int len)
|
||||
{
|
||||
srand(time(NULL));
|
||||
for (int i = 0; i < len; i++)
|
||||
buf[i] = (char)rand();
|
||||
buf[i] = (char)(rand() % 0xFF);
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
int i, fd;
|
||||
char buf1[BSZ], buf2[BSZ] = {};
|
||||
char *penv[] = {"TESTDIR"};
|
||||
char buf1[BSZ], buf2[BSZ] = {0};
|
||||
|
||||
(void) fprintf(stdout, "Verify O_TMPFILE is working properly.\n");
|
||||
|
||||
/*
|
||||
* Get the environment variable values.
|
||||
*/
|
||||
for (i = 0; i < sizeof (penv) / sizeof (char *); i++) {
|
||||
if ((penv[i] = getenv(penv[i])) == NULL) {
|
||||
(void) fprintf(stderr, "getenv(penv[%d])\n", i);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
const char *testdir = getenv("TESTDIR");
|
||||
if (testdir == NULL)
|
||||
errx(1, "getenv(\"TESTDIR\")");
|
||||
|
||||
fill_random(buf1, BSZ);
|
||||
|
||||
fd = open(penv[0], O_RDWR|O_TMPFILE, 0666);
|
||||
if (fd < 0) {
|
||||
perror("open");
|
||||
exit(2);
|
||||
}
|
||||
int fd = open(testdir, O_RDWR|O_TMPFILE, 0666);
|
||||
if (fd < 0)
|
||||
err(2, "open(%s)", testdir);
|
||||
|
||||
if (write(fd, buf1, BSZ) < 0) {
|
||||
perror("write");
|
||||
close(fd);
|
||||
exit(3);
|
||||
}
|
||||
if (write(fd, buf1, BSZ) < 0)
|
||||
err(3, "write");
|
||||
|
||||
if (pread(fd, buf2, BSZ, 0) < 0) {
|
||||
perror("pread");
|
||||
close(fd);
|
||||
exit(4);
|
||||
}
|
||||
if (pread(fd, buf2, BSZ, 0) < 0)
|
||||
err(4, "pread");
|
||||
|
||||
if (memcmp(buf1, buf2, BSZ) != 0) {
|
||||
fprintf(stderr, "data corrupted\n");
|
||||
close(fd);
|
||||
exit(5);
|
||||
}
|
||||
if (memcmp(buf1, buf2, BSZ) != 0)
|
||||
errx(5, "data corrupted");
|
||||
|
||||
memset(buf2, 0, BSZ);
|
||||
|
||||
if (fsetxattr(fd, "user.test", buf1, BSZ, 0) < 0) {
|
||||
perror("fsetxattr");
|
||||
close(fd);
|
||||
exit(6);
|
||||
}
|
||||
if (fsetxattr(fd, "user.test", buf1, BSZ, 0) < 0)
|
||||
err(6, "pread");
|
||||
|
||||
if (fgetxattr(fd, "user.test", buf2, BSZ) < 0) {
|
||||
perror("fgetxattr");
|
||||
close(fd);
|
||||
exit(7);
|
||||
}
|
||||
if (fgetxattr(fd, "user.test", buf2, BSZ) < 0)
|
||||
err(7, "fgetxattr");
|
||||
|
||||
if (memcmp(buf1, buf2, BSZ) != 0) {
|
||||
fprintf(stderr, "xattr corrupted\n");
|
||||
close(fd);
|
||||
exit(8);
|
||||
}
|
||||
|
||||
close(fd);
|
||||
if (memcmp(buf1, buf2, BSZ) != 0)
|
||||
errx(8, "xattr corrupted\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <err.h>
|
||||
|
||||
/* backward compat in case it's not defined */
|
||||
#ifndef O_TMPFILE
|
||||
@ -24,12 +25,27 @@
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
run(const char *op)
|
||||
{
|
||||
int ret;
|
||||
char buf[50];
|
||||
sprintf(buf, "sudo -E zpool %s $TESTPOOL", op);
|
||||
if ((ret = system(buf)) != 0) {
|
||||
if (ret == -1)
|
||||
err(4, "system \"zpool %s\"", op);
|
||||
else
|
||||
errx(4, "zpool %s exited %d\n",
|
||||
op, WEXITSTATUS(ret));
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
int i, fd, ret;
|
||||
int i, fd;
|
||||
char spath[1024], dpath[1024];
|
||||
char *penv[] = {"TESTDIR", "TESTFILE0"};
|
||||
const char *penv[] = {"TESTDIR", "TESTFILE0"};
|
||||
struct stat sbuf;
|
||||
|
||||
(void) fprintf(stdout, "Verify O_TMPFILE file can be linked.\n");
|
||||
@ -37,55 +53,25 @@ main(void)
|
||||
/*
|
||||
* Get the environment variable values.
|
||||
*/
|
||||
for (i = 0; i < sizeof (penv) / sizeof (char *); i++) {
|
||||
if ((penv[i] = getenv(penv[i])) == NULL) {
|
||||
(void) fprintf(stderr, "getenv(penv[%d])\n", i);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < ARRAY_SIZE(penv); i++)
|
||||
if ((penv[i] = getenv(penv[i])) == NULL)
|
||||
errx(1, "getenv(penv[%d])", i);
|
||||
|
||||
fd = open(penv[0], O_RDWR|O_TMPFILE, 0666);
|
||||
if (fd < 0) {
|
||||
perror("open");
|
||||
exit(2);
|
||||
}
|
||||
if (fd < 0)
|
||||
err(2, "open(%s)", penv[0]);
|
||||
|
||||
snprintf(spath, 1024, "/proc/self/fd/%d", fd);
|
||||
snprintf(dpath, 1024, "%s/%s", penv[0], penv[1]);
|
||||
if (linkat(AT_FDCWD, spath, AT_FDCWD, dpath, AT_SYMLINK_FOLLOW) < 0) {
|
||||
perror("linkat");
|
||||
close(fd);
|
||||
exit(3);
|
||||
}
|
||||
if (linkat(AT_FDCWD, spath, AT_FDCWD, dpath, AT_SYMLINK_FOLLOW) < 0)
|
||||
err(3, "linkat");
|
||||
|
||||
if ((ret = system("sudo -E zpool freeze $TESTPOOL"))) {
|
||||
if (ret == -1)
|
||||
perror("system \"zpool freeze\"");
|
||||
else
|
||||
fprintf(stderr, "zpool freeze exits with %d\n",
|
||||
WEXITSTATUS(ret));
|
||||
exit(4);
|
||||
}
|
||||
run("freeze");
|
||||
|
||||
close(fd);
|
||||
|
||||
if ((ret = system("sudo -E zpool export $TESTPOOL"))) {
|
||||
if (ret == -1)
|
||||
perror("system \"zpool export\"");
|
||||
else
|
||||
fprintf(stderr, "zpool export exits with %d\n",
|
||||
WEXITSTATUS(ret));
|
||||
exit(4);
|
||||
}
|
||||
|
||||
if ((ret = system("sudo -E zpool import $TESTPOOL"))) {
|
||||
if (ret == -1)
|
||||
perror("system \"zpool import\"");
|
||||
else
|
||||
fprintf(stderr, "zpool import exits with %d\n",
|
||||
WEXITSTATUS(ret));
|
||||
exit(4);
|
||||
}
|
||||
run("export");
|
||||
run("import");
|
||||
|
||||
if (stat(dpath, &sbuf) < 0) {
|
||||
perror("stat");
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <err.h>
|
||||
|
||||
/* backward compat in case it's not defined */
|
||||
#ifndef O_TMPFILE
|
||||
@ -28,7 +29,7 @@ main(void)
|
||||
{
|
||||
int i, fd;
|
||||
char spath[1024], dpath[1024];
|
||||
char *penv[] = {"TESTDIR", "TESTFILE0"};
|
||||
const char *penv[] = {"TESTDIR", "TESTFILE0"};
|
||||
struct stat sbuf;
|
||||
|
||||
(void) fprintf(stdout, "Verify O_EXCL tmpfile cannot be linked.\n");
|
||||
@ -36,33 +37,21 @@ main(void)
|
||||
/*
|
||||
* Get the environment variable values.
|
||||
*/
|
||||
for (i = 0; i < sizeof (penv) / sizeof (char *); i++) {
|
||||
if ((penv[i] = getenv(penv[i])) == NULL) {
|
||||
(void) fprintf(stderr, "getenv(penv[%d])\n", i);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < ARRAY_SIZE(penv); i++)
|
||||
if ((penv[i] = getenv(penv[i])) == NULL)
|
||||
errx(1, "getenv(penv[%d])", i);
|
||||
|
||||
fd = open(penv[0], O_RDWR|O_TMPFILE|O_EXCL, 0666);
|
||||
if (fd < 0) {
|
||||
perror("open");
|
||||
exit(2);
|
||||
}
|
||||
if (fd < 0)
|
||||
err(2, "open(%s)", penv[0]);
|
||||
|
||||
snprintf(spath, 1024, "/proc/self/fd/%d", fd);
|
||||
snprintf(dpath, 1024, "%s/%s", penv[0], penv[1]);
|
||||
if (linkat(AT_FDCWD, spath, AT_FDCWD, dpath, AT_SYMLINK_FOLLOW) == 0) {
|
||||
fprintf(stderr, "linkat returns successfully\n");
|
||||
close(fd);
|
||||
exit(3);
|
||||
}
|
||||
if (linkat(AT_FDCWD, spath, AT_FDCWD, dpath, AT_SYMLINK_FOLLOW) == 0)
|
||||
errx(3, "linkat returned successfully\n");
|
||||
|
||||
if (stat(dpath, &sbuf) == 0) {
|
||||
fprintf(stderr, "stat returns successfully\n");
|
||||
close(fd);
|
||||
exit(4);
|
||||
}
|
||||
close(fd);
|
||||
if (stat(dpath, &sbuf) == 0)
|
||||
errx(4, "stat returned successfully\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <err.h>
|
||||
|
||||
/* backward compat in case it's not defined */
|
||||
#ifndef O_TMPFILE
|
||||
@ -50,63 +51,46 @@ test_stat_mode(mode_t mask)
|
||||
struct stat st, fst;
|
||||
int i, fd;
|
||||
char spath[1024], dpath[1024];
|
||||
char *penv[] = {"TESTDIR", "TESTFILE0"};
|
||||
const char *penv[] = {"TESTDIR", "TESTFILE0"};
|
||||
mode_t masked = 0777 & ~mask;
|
||||
mode_t mode;
|
||||
|
||||
/*
|
||||
* Get the environment variable values.
|
||||
*/
|
||||
for (i = 0; i < sizeof (penv) / sizeof (char *); i++) {
|
||||
if ((penv[i] = getenv(penv[i])) == NULL) {
|
||||
fprintf(stderr, "getenv(penv[%d])\n", i);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < ARRAY_SIZE(penv); i++)
|
||||
if ((penv[i] = getenv(penv[i])) == NULL)
|
||||
errx(1, "getenv(penv[%d])", i);
|
||||
|
||||
umask(mask);
|
||||
fd = open(penv[0], O_RDWR|O_TMPFILE, 0777);
|
||||
if (fd == -1) {
|
||||
perror("open");
|
||||
exit(2);
|
||||
}
|
||||
if (fd == -1)
|
||||
err(2, "open(%s)", penv[0]);
|
||||
|
||||
if (fstat(fd, &fst) == -1) {
|
||||
perror("fstat");
|
||||
close(fd);
|
||||
exit(3);
|
||||
}
|
||||
if (fstat(fd, &fst) == -1)
|
||||
err(3, "open");
|
||||
|
||||
snprintf(spath, sizeof (spath), "/proc/self/fd/%d", fd);
|
||||
snprintf(dpath, sizeof (dpath), "%s/%s", penv[0], penv[1]);
|
||||
|
||||
unlink(dpath);
|
||||
if (linkat(AT_FDCWD, spath, AT_FDCWD, dpath, AT_SYMLINK_FOLLOW) == -1) {
|
||||
perror("linkat");
|
||||
close(fd);
|
||||
exit(4);
|
||||
}
|
||||
if (linkat(AT_FDCWD, spath, AT_FDCWD, dpath, AT_SYMLINK_FOLLOW) == -1)
|
||||
err(4, "linkat");
|
||||
close(fd);
|
||||
|
||||
if (stat(dpath, &st) == -1) {
|
||||
perror("stat");
|
||||
exit(5);
|
||||
}
|
||||
if (stat(dpath, &st) == -1)
|
||||
err(5, "stat");
|
||||
unlink(dpath);
|
||||
|
||||
/* Verify fstat(2) result */
|
||||
mode = fst.st_mode & 0777;
|
||||
if (mode != masked) {
|
||||
fprintf(stderr, "fstat(2) %o != %o\n", mode, masked);
|
||||
exit(6);
|
||||
}
|
||||
if (mode != masked)
|
||||
errx(6, "fstat(2) %o != %o\n", mode, masked);
|
||||
|
||||
/* Verify stat(2) result */
|
||||
mode = st.st_mode & 0777;
|
||||
if (mode != masked) {
|
||||
fprintf(stderr, "stat(2) %o != %o\n", mode, masked);
|
||||
exit(7);
|
||||
}
|
||||
if (mode != masked)
|
||||
errx(7, "stat(2) %o != %o\n", mode, masked);
|
||||
}
|
||||
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user