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
|
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;
|
struct mntent mnt;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
mnt.mnt_fsname = dataset;
|
mnt.mnt_fsname = (char *)dataset;
|
||||||
mnt.mnt_dir = mntpoint;
|
mnt.mnt_dir = (char *)mntpoint;
|
||||||
mnt.mnt_type = type;
|
mnt.mnt_type = (char *)type;
|
||||||
mnt.mnt_opts = mntopts ? mntopts : "";
|
mnt.mnt_opts = (char *)(mntopts ?: "");
|
||||||
mnt.mnt_freq = 0;
|
mnt.mnt_freq = 0;
|
||||||
mnt.mnt_passno = 0;
|
mnt.mnt_passno = 0;
|
||||||
|
|
||||||
fp = setmntent("/etc/mtab", "a+");
|
fp = setmntent("/etc/mtab", "a+e");
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
(void) fprintf(stderr, gettext(
|
(void) fprintf(stderr, gettext(
|
||||||
"filesystem '%s' was mounted, but /etc/mtab "
|
"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)
|
static void print_opts(raidz_test_opts_t *opts, boolean_t force)
|
||||||
{
|
{
|
||||||
char *verbose;
|
const char *verbose;
|
||||||
switch (opts->rto_v) {
|
switch (opts->rto_v) {
|
||||||
case D_ALL:
|
case D_ALL:
|
||||||
verbose = "no";
|
verbose = "no";
|
||||||
|
@ -102,7 +102,7 @@
|
|||||||
#define ZDB_MAP_OBJECT_ID(obj) (obj)
|
#define ZDB_MAP_OBJECT_ID(obj) (obj)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char *
|
static const char *
|
||||||
zdb_ot_name(dmu_object_type_t type)
|
zdb_ot_name(dmu_object_type_t type)
|
||||||
{
|
{
|
||||||
if (type < DMU_OT_NUMTYPES)
|
if (type < DMU_OT_NUMTYPES)
|
||||||
@ -2922,7 +2922,7 @@ dsl_deadlist_entry_dump(void *arg, dsl_deadlist_entry_t *dle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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 bytes[32];
|
||||||
char comp[32];
|
char comp[32];
|
||||||
@ -2963,7 +2963,7 @@ dump_blkptr_list(dsl_deadlist_t *dl, char *name)
|
|||||||
if (dump_opt['d'] < 4)
|
if (dump_opt['d'] < 4)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
(void) printf("\n");
|
(void) putchar('\n');
|
||||||
|
|
||||||
dsl_deadlist_iterate(dl, dsl_deadlist_entry_dump, NULL);
|
dsl_deadlist_iterate(dl, dsl_deadlist_entry_dump, NULL);
|
||||||
}
|
}
|
||||||
@ -3098,9 +3098,8 @@ static void
|
|||||||
print_idstr(uint64_t id, const char *id_type)
|
print_idstr(uint64_t id, const char *id_type)
|
||||||
{
|
{
|
||||||
if (FUID_INDEX(id)) {
|
if (FUID_INDEX(id)) {
|
||||||
char *domain;
|
const char *domain =
|
||||||
|
zfs_fuid_idx_domain(&idx_tree, FUID_INDEX(id));
|
||||||
domain = zfs_fuid_idx_domain(&idx_tree, FUID_INDEX(id));
|
|
||||||
(void) printf("\t%s %llx [%s-%d]\n", id_type,
|
(void) printf("\t%s %llx [%s-%d]\n", id_type,
|
||||||
(u_longlong_t)id, domain, (int)FUID_RID(id));
|
(u_longlong_t)id, domain, (int)FUID_RID(id));
|
||||||
} else {
|
} 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" };
|
"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.
|
* pointer to point to a descriptive error message.
|
||||||
*/
|
*/
|
||||||
static int
|
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;
|
uint64_t flags = 0;
|
||||||
char *p, *s, *dup, *flagstr, *tmp = NULL;
|
char *p, *s, *dup, *flagstr, *tmp = NULL;
|
||||||
@ -4236,13 +4235,13 @@ first_label(cksum_record_t *rec)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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++)
|
for (int i = 0; i < VDEV_LABELS; i++)
|
||||||
if (rec->labels[i] == B_TRUE)
|
if (rec->labels[i] == B_TRUE)
|
||||||
printf("%d ", i);
|
printf("%d ", i);
|
||||||
printf("\n");
|
putchar('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAX_UBERBLOCK_COUNT (VDEV_UBERBLOCK_RING >> UBERBLOCK_SHIFT)
|
#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.
|
* Used to simplify reporting of the histogram data.
|
||||||
*/
|
*/
|
||||||
typedef struct one_histo {
|
typedef struct one_histo {
|
||||||
char *name;
|
const char *name;
|
||||||
uint64_t *count;
|
uint64_t *count;
|
||||||
uint64_t *len;
|
uint64_t *len;
|
||||||
uint64_t cumulative;
|
uint64_t cumulative;
|
||||||
@ -8093,32 +8092,33 @@ zdb_read_block(char *thing, spa_t *spa)
|
|||||||
vdev_t *vd;
|
vdev_t *vd;
|
||||||
abd_t *pabd;
|
abd_t *pabd;
|
||||||
void *lbuf, *buf;
|
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;
|
int i, error;
|
||||||
boolean_t borrowed = B_FALSE, found = B_FALSE;
|
boolean_t borrowed = B_FALSE, found = B_FALSE;
|
||||||
|
|
||||||
dup = strdup(thing);
|
dup = strdup(thing);
|
||||||
s = strtok_r(dup, ":", &tmp);
|
s = strtok_r(dup, ":", &tmp);
|
||||||
vdev = s ? s : "";
|
vdev = s ?: "";
|
||||||
s = strtok_r(NULL, ":", &tmp);
|
s = strtok_r(NULL, ":", &tmp);
|
||||||
offset = strtoull(s ? s : "", NULL, 16);
|
offset = strtoull(s ? s : "", NULL, 16);
|
||||||
sizes = strtok_r(NULL, ":", &tmp);
|
sizes = strtok_r(NULL, ":", &tmp);
|
||||||
s = 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))
|
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))
|
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))
|
if (!IS_P2ALIGNED(offset, DEV_BSIZE))
|
||||||
s = "offset must be a multiple of sector size";
|
errmsg = "offset must be a multiple of sector size";
|
||||||
if (s) {
|
if (errmsg) {
|
||||||
(void) printf("Invalid block specifier: %s - %s\n", thing, s);
|
(void) printf("Invalid block specifier: %s - %s\n",
|
||||||
|
thing, errmsg);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tmp = NULL;
|
||||||
for (s = strtok_r(flagstr, ":", &tmp);
|
for (s = strtok_r(flagstr, ":", &tmp);
|
||||||
s != NULL;
|
s != NULL;
|
||||||
s = strtok_r(NULL, ":", &tmp)) {
|
s = strtok_r(NULL, ":", &tmp)) {
|
||||||
@ -8930,13 +8930,13 @@ retry_lookup:
|
|||||||
sizeof (zopt_object_range_t));
|
sizeof (zopt_object_range_t));
|
||||||
for (unsigned i = 0; i < zopt_object_args; i++) {
|
for (unsigned i = 0; i < zopt_object_args; i++) {
|
||||||
int err;
|
int err;
|
||||||
char *msg = NULL;
|
const char *msg = NULL;
|
||||||
|
|
||||||
err = parse_object_range(argv[i],
|
err = parse_object_range(argv[i],
|
||||||
&zopt_object_ranges[i], &msg);
|
&zopt_object_ranges[i], &msg);
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
fatal("Bad object or range: '%s': %s\n",
|
fatal("Bad object or range: '%s': %s\n",
|
||||||
argv[i], msg ? msg : "");
|
argv[i], msg ?: "");
|
||||||
}
|
}
|
||||||
} else if (argc > 0 && dump_opt['m']) {
|
} else if (argc > 0 && dump_opt['m']) {
|
||||||
zopt_metaslab_args = argc;
|
zopt_metaslab_args = argc;
|
||||||
|
@ -389,7 +389,8 @@ zed_log_fault(nvlist_t *nvl, const char *uuid, const char *code)
|
|||||||
static const char *
|
static const char *
|
||||||
fmd_fault_mkcode(nvlist_t *fault)
|
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
|
* 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 *
|
static char *
|
||||||
safe_strdup(char *str)
|
safe_strdup(const char *str)
|
||||||
{
|
{
|
||||||
char *dupstr = strdup(str);
|
char *dupstr = strdup(str);
|
||||||
|
|
||||||
@ -690,7 +690,8 @@ parse_depth(char *opt, int *flags)
|
|||||||
|
|
||||||
#define PROGRESS_DELAY 2 /* seconds */
|
#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 time_t pt_begin;
|
||||||
static char *pt_header = NULL;
|
static char *pt_header = NULL;
|
||||||
static boolean_t pt_shown;
|
static boolean_t pt_shown;
|
||||||
@ -703,7 +704,7 @@ start_progress_timer(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_progress_header(char *header)
|
set_progress_header(const char *header)
|
||||||
{
|
{
|
||||||
assert(pt_header == NULL);
|
assert(pt_header == NULL);
|
||||||
pt_header = safe_strdup(header);
|
pt_header = safe_strdup(header);
|
||||||
@ -714,7 +715,7 @@ set_progress_header(char *header)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_progress(char *update)
|
update_progress(const char *update)
|
||||||
{
|
{
|
||||||
if (!pt_shown && time(NULL) > pt_begin) {
|
if (!pt_shown && time(NULL) > pt_begin) {
|
||||||
int len = strlen(update);
|
int len = strlen(update);
|
||||||
@ -732,10 +733,10 @@ update_progress(char *update)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
finish_progress(char *done)
|
finish_progress(const char *done)
|
||||||
{
|
{
|
||||||
if (pt_shown) {
|
if (pt_shown) {
|
||||||
(void) printf("%s\n", done);
|
(void) puts(done);
|
||||||
(void) fflush(stdout);
|
(void) fflush(stdout);
|
||||||
}
|
}
|
||||||
free(pt_header);
|
free(pt_header);
|
||||||
@ -1903,8 +1904,8 @@ get_callback(zfs_handle_t *zhp, void *data)
|
|||||||
nvlist_t *user_props = zfs_get_user_props(zhp);
|
nvlist_t *user_props = zfs_get_user_props(zhp);
|
||||||
zprop_list_t *pl = cbp->cb_proplist;
|
zprop_list_t *pl = cbp->cb_proplist;
|
||||||
nvlist_t *propval;
|
nvlist_t *propval;
|
||||||
char *strval;
|
const char *strval;
|
||||||
char *sourceval;
|
const char *sourceval;
|
||||||
boolean_t received = is_recvd_column(cbp);
|
boolean_t received = is_recvd_column(cbp);
|
||||||
|
|
||||||
for (; pl != NULL; pl = pl->pl_next) {
|
for (; pl != NULL; pl = pl->pl_next) {
|
||||||
@ -1973,10 +1974,10 @@ get_callback(zfs_handle_t *zhp, void *data)
|
|||||||
sourcetype = ZPROP_SRC_NONE;
|
sourcetype = ZPROP_SRC_NONE;
|
||||||
strval = "-";
|
strval = "-";
|
||||||
} else {
|
} else {
|
||||||
verify(nvlist_lookup_string(propval,
|
strval = fnvlist_lookup_string(propval,
|
||||||
ZPROP_VALUE, &strval) == 0);
|
ZPROP_VALUE);
|
||||||
verify(nvlist_lookup_string(propval,
|
sourceval = fnvlist_lookup_string(propval,
|
||||||
ZPROP_SOURCE, &sourceval) == 0);
|
ZPROP_SOURCE);
|
||||||
|
|
||||||
if (strcmp(sourceval,
|
if (strcmp(sourceval,
|
||||||
zfs_get_name(zhp)) == 0) {
|
zfs_get_name(zhp)) == 0) {
|
||||||
@ -2618,9 +2619,9 @@ enum us_field_types {
|
|||||||
USFIELD_OBJUSED,
|
USFIELD_OBJUSED,
|
||||||
USFIELD_OBJQUOTA
|
USFIELD_OBJQUOTA
|
||||||
};
|
};
|
||||||
static char *us_field_hdr[] = { "TYPE", "NAME", "USED", "QUOTA",
|
static const char *const us_field_hdr[] = { "TYPE", "NAME", "USED", "QUOTA",
|
||||||
"OBJUSED", "OBJQUOTA" };
|
"OBJUSED", "OBJQUOTA" };
|
||||||
static char *us_field_names[] = { "type", "name", "used", "quota",
|
static const char *const us_field_names[] = { "type", "name", "used", "quota",
|
||||||
"objused", "objquota" };
|
"objused", "objquota" };
|
||||||
#define USFIELD_LAST (sizeof (us_field_names) / sizeof (char *))
|
#define USFIELD_LAST (sizeof (us_field_names) / sizeof (char *))
|
||||||
|
|
||||||
@ -2640,8 +2641,8 @@ static int us_type_bits[] = {
|
|||||||
USTYPE_SMB_USR,
|
USTYPE_SMB_USR,
|
||||||
USTYPE_ALL
|
USTYPE_ALL
|
||||||
};
|
};
|
||||||
static char *us_type_names[] = { "posixgroup", "posixuser", "smbgroup",
|
static const char *const us_type_names[] = { "posixgroup", "posixuser",
|
||||||
"smbuser", "all" };
|
"smbgroup", "smbuser", "all" };
|
||||||
|
|
||||||
typedef struct us_node {
|
typedef struct us_node {
|
||||||
nvlist_t *usn_nvl;
|
nvlist_t *usn_nvl;
|
||||||
@ -2669,11 +2670,9 @@ typedef struct {
|
|||||||
} us_sort_info_t;
|
} us_sort_info_t;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
us_field_index(char *field)
|
us_field_index(const char *field)
|
||||||
{
|
{
|
||||||
int i;
|
for (int i = 0; i < USFIELD_LAST; i++) {
|
||||||
|
|
||||||
for (i = 0; i < USFIELD_LAST; i++) {
|
|
||||||
if (strcmp(field, us_field_names[i]) == 0)
|
if (strcmp(field, us_field_names[i]) == 0)
|
||||||
return (i);
|
return (i);
|
||||||
}
|
}
|
||||||
@ -2695,8 +2694,8 @@ us_compare(const void *larg, const void *rarg, void *unused)
|
|||||||
boolean_t lvb, rvb;
|
boolean_t lvb, rvb;
|
||||||
|
|
||||||
for (; sortcol != NULL; sortcol = sortcol->sc_next) {
|
for (; sortcol != NULL; sortcol = sortcol->sc_next) {
|
||||||
char *lvstr = "";
|
char *lvstr = (char *)"";
|
||||||
char *rvstr = "";
|
char *rvstr = (char *)"";
|
||||||
uint32_t lv32 = 0;
|
uint32_t lv32 = 0;
|
||||||
uint32_t rv32 = 0;
|
uint32_t rv32 = 0;
|
||||||
uint64_t lv64 = 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;
|
us_cbdata_t *cb = (us_cbdata_t *)arg;
|
||||||
zfs_userquota_prop_t prop = cb->cb_prop;
|
zfs_userquota_prop_t prop = cb->cb_prop;
|
||||||
char *name = NULL;
|
char *name = NULL;
|
||||||
char *propname;
|
const char *propname;
|
||||||
char sizebuf[32];
|
char sizebuf[32];
|
||||||
us_node_t *node;
|
us_node_t *node;
|
||||||
uu_avl_pool_t *avl_pool = cb->cb_avl_pool;
|
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) {
|
while ((field = fields[cfield]) != USFIELD_LAST) {
|
||||||
nvpair_t *nvp = NULL;
|
nvpair_t *nvp = NULL;
|
||||||
data_type_t type;
|
data_type_t type;
|
||||||
uint32_t val32;
|
uint32_t val32 = -1;
|
||||||
uint64_t val64;
|
uint64_t val64 = -1;
|
||||||
char *strval = "-";
|
const char *strval = "-";
|
||||||
|
|
||||||
while ((nvp = nvlist_next_nvpair(nvl, nvp)) != NULL) {
|
while ((nvp = nvlist_next_nvpair(nvl, nvp)) != NULL)
|
||||||
if (strcmp(nvpair_name(nvp),
|
if (strcmp(nvpair_name(nvp),
|
||||||
us_field_names[field]) == 0)
|
us_field_names[field]) == 0)
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
type = nvp == NULL ? DATA_TYPE_UNKNOWN : nvpair_type(nvp);
|
type = nvp == NULL ? DATA_TYPE_UNKNOWN : nvpair_type(nvp);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case DATA_TYPE_UINT32:
|
case DATA_TYPE_UINT32:
|
||||||
(void) nvpair_value_uint32(nvp, &val32);
|
val32 = fnvpair_value_uint32(nvp);
|
||||||
break;
|
break;
|
||||||
case DATA_TYPE_UINT64:
|
case DATA_TYPE_UINT64:
|
||||||
(void) nvpair_value_uint64(nvp, &val64);
|
val64 = fnvpair_value_uint64(nvp);
|
||||||
break;
|
break;
|
||||||
case DATA_TYPE_STRING:
|
case DATA_TYPE_STRING:
|
||||||
(void) nvpair_value_string(nvp, &strval);
|
strval = fnvpair_value_string(nvp);
|
||||||
break;
|
break;
|
||||||
case DATA_TYPE_UNKNOWN:
|
case DATA_TYPE_UNKNOWN:
|
||||||
break;
|
break;
|
||||||
@ -3048,7 +3046,7 @@ print_us_node(boolean_t scripted, boolean_t parsable, int *fields, int types,
|
|||||||
switch (field) {
|
switch (field) {
|
||||||
case USFIELD_TYPE:
|
case USFIELD_TYPE:
|
||||||
if (type == DATA_TYPE_UINT32)
|
if (type == DATA_TYPE_UINT32)
|
||||||
strval = (char *)us_type2str(val32);
|
strval = us_type2str(val32);
|
||||||
break;
|
break;
|
||||||
case USFIELD_NAME:
|
case USFIELD_NAME:
|
||||||
if (type == DATA_TYPE_UINT64) {
|
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 (!first) {
|
||||||
if (scripted)
|
if (scripted)
|
||||||
(void) printf("\t");
|
(void) putchar('\t');
|
||||||
else
|
else
|
||||||
(void) printf(" ");
|
(void) fputs(" ", stdout);
|
||||||
}
|
}
|
||||||
if (scripted)
|
if (scripted)
|
||||||
(void) printf("%s", strval);
|
(void) fputs(strval, stdout);
|
||||||
else if (field == USFIELD_TYPE || field == USFIELD_NAME)
|
else if (field == USFIELD_TYPE || field == USFIELD_NAME)
|
||||||
(void) printf("%-*s", (int)width[field], strval);
|
(void) printf("%-*s", (int)width[field], strval);
|
||||||
else
|
else
|
||||||
@ -3110,7 +3108,7 @@ print_us_node(boolean_t scripted, boolean_t parsable, int *fields, int types,
|
|||||||
cfield++;
|
cfield++;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) printf("\n");
|
(void) putchar('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3476,15 +3474,15 @@ print_dataset(zfs_handle_t *zhp, list_cbdata_t *cb)
|
|||||||
char property[ZFS_MAXPROPLEN];
|
char property[ZFS_MAXPROPLEN];
|
||||||
nvlist_t *userprops = zfs_get_user_props(zhp);
|
nvlist_t *userprops = zfs_get_user_props(zhp);
|
||||||
nvlist_t *propval;
|
nvlist_t *propval;
|
||||||
char *propstr;
|
const char *propstr;
|
||||||
boolean_t right_justify;
|
boolean_t right_justify;
|
||||||
|
|
||||||
for (; pl != NULL; pl = pl->pl_next) {
|
for (; pl != NULL; pl = pl->pl_next) {
|
||||||
if (!first) {
|
if (!first) {
|
||||||
if (cb->cb_scripted)
|
if (cb->cb_scripted)
|
||||||
(void) printf("\t");
|
(void) putchar('\t');
|
||||||
else
|
else
|
||||||
(void) printf(" ");
|
(void) fputs(" ", stdout);
|
||||||
} else {
|
} else {
|
||||||
first = B_FALSE;
|
first = B_FALSE;
|
||||||
}
|
}
|
||||||
@ -3521,8 +3519,8 @@ print_dataset(zfs_handle_t *zhp, list_cbdata_t *cb)
|
|||||||
pl->pl_user_prop, &propval) != 0)
|
pl->pl_user_prop, &propval) != 0)
|
||||||
propstr = "-";
|
propstr = "-";
|
||||||
else
|
else
|
||||||
verify(nvlist_lookup_string(propval,
|
propstr = fnvlist_lookup_string(propval,
|
||||||
ZPROP_VALUE, &propstr) == 0);
|
ZPROP_VALUE);
|
||||||
right_justify = B_FALSE;
|
right_justify = B_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3532,14 +3530,14 @@ print_dataset(zfs_handle_t *zhp, list_cbdata_t *cb)
|
|||||||
* format specifier.
|
* format specifier.
|
||||||
*/
|
*/
|
||||||
if (cb->cb_scripted || (pl->pl_next == NULL && !right_justify))
|
if (cb->cb_scripted || (pl->pl_next == NULL && !right_justify))
|
||||||
(void) printf("%s", propstr);
|
(void) fputs(propstr, stdout);
|
||||||
else if (right_justify)
|
else if (right_justify)
|
||||||
(void) printf("%*s", (int)pl->pl_width, propstr);
|
(void) printf("%*s", (int)pl->pl_width, propstr);
|
||||||
else
|
else
|
||||||
(void) printf("%-*s", (int)pl->pl_width, propstr);
|
(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;
|
int i;
|
||||||
nvpair_t *nvp = NULL;
|
nvpair_t *nvp = NULL;
|
||||||
char *hdr_cols[] = { "NAME", "TAG", "TIMESTAMP" };
|
const char *const hdr_cols[] = { "NAME", "TAG", "TIMESTAMP" };
|
||||||
const char *col;
|
const char *col;
|
||||||
|
|
||||||
if (!scripted) {
|
if (!scripted) {
|
||||||
@ -6607,7 +6605,7 @@ typedef struct get_all_state {
|
|||||||
static int
|
static int
|
||||||
get_one_dataset(zfs_handle_t *zhp, void *data)
|
get_one_dataset(zfs_handle_t *zhp, void *data)
|
||||||
{
|
{
|
||||||
static char *spin[] = { "-", "\\", "|", "/" };
|
static const char *const spin[] = { "-", "\\", "|", "/" };
|
||||||
static int spinval = 0;
|
static int spinval = 0;
|
||||||
static int spincheck = 0;
|
static int spincheck = 0;
|
||||||
static time_t last_spin_time = (time_t)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;
|
break;
|
||||||
|
|
||||||
case OP_MOUNT:
|
case OP_MOUNT:
|
||||||
if (options == NULL)
|
mnt.mnt_mntopts = (char *)(options ?: "");
|
||||||
mnt.mnt_mntopts = "";
|
|
||||||
else
|
|
||||||
mnt.mnt_mntopts = (char *)options;
|
|
||||||
|
|
||||||
if (!hasmntopt(&mnt, MNTOPT_REMOUNT) &&
|
if (!hasmntopt(&mnt, MNTOPT_REMOUNT) &&
|
||||||
zfs_is_mounted(zhp, NULL)) {
|
zfs_is_mounted(zhp, NULL)) {
|
||||||
@ -7616,7 +7611,7 @@ zfs_do_unshare(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
find_command_idx(char *command, int *idx)
|
find_command_idx(const char *command, int *idx)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -7881,7 +7876,6 @@ static int
|
|||||||
zfs_do_channel_program(int argc, char **argv)
|
zfs_do_channel_program(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int ret, fd, c;
|
int ret, fd, c;
|
||||||
char *progbuf, *filename, *poolname;
|
|
||||||
size_t progsize, progread;
|
size_t progsize, progread;
|
||||||
nvlist_t *outnvl = NULL;
|
nvlist_t *outnvl = NULL;
|
||||||
uint64_t instrlimit = ZCP_DEFAULT_INSTRLIMIT;
|
uint64_t instrlimit = ZCP_DEFAULT_INSTRLIMIT;
|
||||||
@ -7938,8 +7932,8 @@ zfs_do_channel_program(int argc, char **argv)
|
|||||||
goto usage;
|
goto usage;
|
||||||
}
|
}
|
||||||
|
|
||||||
poolname = argv[0];
|
const char *poolname = argv[0];
|
||||||
filename = argv[1];
|
const char *filename = argv[1];
|
||||||
if (strcmp(filename, "-") == 0) {
|
if (strcmp(filename, "-") == 0) {
|
||||||
fd = 0;
|
fd = 0;
|
||||||
filename = "standard input";
|
filename = "standard input";
|
||||||
@ -7964,7 +7958,7 @@ zfs_do_channel_program(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
progread = 0;
|
progread = 0;
|
||||||
progsize = 1024;
|
progsize = 1024;
|
||||||
progbuf = safe_malloc(progsize);
|
char *progbuf = safe_malloc(progsize);
|
||||||
do {
|
do {
|
||||||
ret = read(fd, progbuf + progread, progsize - progread);
|
ret = read(fd, progbuf + progread, progsize - progread);
|
||||||
progread += ret;
|
progread += ret;
|
||||||
@ -8010,14 +8004,17 @@ zfs_do_channel_program(int argc, char **argv)
|
|||||||
* exists. Otherwise, generate an appropriate error message,
|
* exists. Otherwise, generate an appropriate error message,
|
||||||
* falling back on strerror() for an unexpected return code.
|
* falling back on strerror() for an unexpected return code.
|
||||||
*/
|
*/
|
||||||
char *errstring = NULL;
|
const char *errstring = NULL;
|
||||||
const char *msg = gettext("Channel program execution failed");
|
const char *msg = gettext("Channel program execution failed");
|
||||||
uint64_t instructions = 0;
|
uint64_t instructions = 0;
|
||||||
if (outnvl != NULL && nvlist_exists(outnvl, ZCP_RET_ERROR)) {
|
if (outnvl != NULL && nvlist_exists(outnvl, ZCP_RET_ERROR)) {
|
||||||
|
char *es = NULL;
|
||||||
(void) nvlist_lookup_string(outnvl,
|
(void) nvlist_lookup_string(outnvl,
|
||||||
ZCP_RET_ERROR, &errstring);
|
ZCP_RET_ERROR, &es);
|
||||||
if (errstring == NULL)
|
if (es == NULL)
|
||||||
errstring = strerror(ret);
|
errstring = strerror(ret);
|
||||||
|
else
|
||||||
|
errstring = es;
|
||||||
if (ret == ETIME) {
|
if (ret == ETIME) {
|
||||||
(void) nvlist_lookup_uint64(outnvl,
|
(void) nvlist_lookup_uint64(outnvl,
|
||||||
ZCP_ARG_INSTRLIMIT, &instructions);
|
ZCP_ARG_INSTRLIMIT, &instructions);
|
||||||
@ -8601,7 +8598,7 @@ main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
char *cmdname;
|
const char *cmdname;
|
||||||
char **newargv;
|
char **newargv;
|
||||||
|
|
||||||
(void) setlocale(LC_ALL, "");
|
(void) setlocale(LC_ALL, "");
|
||||||
|
@ -442,9 +442,8 @@ static void
|
|||||||
vdev_run_cmd(vdev_cmd_data_t *data, char *cmd)
|
vdev_run_cmd(vdev_cmd_data_t *data, char *cmd)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
char *argv[2] = {cmd, 0};
|
char *argv[2] = {cmd};
|
||||||
char *env[5] = {"PATH=/bin:/sbin:/usr/bin:/usr/sbin", NULL, NULL, NULL,
|
char *env[5] = {(char *)"PATH=/bin:/sbin:/usr/bin:/usr/sbin"};
|
||||||
NULL};
|
|
||||||
char **lines = NULL;
|
char **lines = NULL;
|
||||||
int lines_cnt = 0;
|
int lines_cnt = 0;
|
||||||
int i;
|
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++) {
|
for (c = 0; c < children; c++) {
|
||||||
uint64_t is_log = B_FALSE, is_hole = B_FALSE;
|
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,
|
(void) nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_HOLE,
|
||||||
&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,
|
(void) nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_LOG,
|
||||||
&is_log);
|
&is_log);
|
||||||
if (is_log)
|
if (is_log)
|
||||||
class = VDEV_ALLOC_BIAS_LOG;
|
class = (char *)VDEV_ALLOC_BIAS_LOG;
|
||||||
(void) nvlist_lookup_string(child[c],
|
(void) nvlist_lookup_string(child[c],
|
||||||
ZPOOL_CONFIG_ALLOCATION_BIAS, &class);
|
ZPOOL_CONFIG_ALLOCATION_BIAS, &class);
|
||||||
if (strcmp(match, class) != 0)
|
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.
|
* Add a property pair (name, string-value) into a property nvlist.
|
||||||
*/
|
*/
|
||||||
static int
|
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)
|
boolean_t poolprop)
|
||||||
{
|
{
|
||||||
zpool_prop_t prop = ZPOOL_PROP_INVAL;
|
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
|
* Set a default property pair (name, string-value) in a property nvlist
|
||||||
*/
|
*/
|
||||||
static int
|
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;
|
char *pval;
|
||||||
|
|
||||||
@ -2069,15 +2070,13 @@ typedef struct status_cbdata {
|
|||||||
} status_cbdata_t;
|
} status_cbdata_t;
|
||||||
|
|
||||||
/* Return 1 if string is NULL, empty, or whitespace; return 0 otherwise. */
|
/* Return 1 if string is NULL, empty, or whitespace; return 0 otherwise. */
|
||||||
static int
|
static boolean_t
|
||||||
is_blank_str(char *str)
|
is_blank_str(const char *str)
|
||||||
{
|
{
|
||||||
while (str != NULL && *str != '\0') {
|
for (; str != NULL && *str != '\0'; ++str)
|
||||||
if (!isblank(*str))
|
if (!isblank(*str))
|
||||||
return (0);
|
return (B_FALSE);
|
||||||
str++;
|
return (B_TRUE);
|
||||||
}
|
|
||||||
return (1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print command output lines for specific vdev in a specific pool */
|
/* 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;
|
vdev_cmd_data_t *data;
|
||||||
int i, j;
|
int i, j;
|
||||||
char *val;
|
const char *val;
|
||||||
|
|
||||||
for (i = 0; i < vcdl->count; i++) {
|
for (i = 0; i < vcdl->count; i++) {
|
||||||
if ((strcmp(vcdl->data[i].path, path) != 0) ||
|
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);
|
printf("%*s", vcdl->uniq_cols_width[j], val);
|
||||||
if (j < vcdl->uniq_cols_cnt - 1)
|
if (j < vcdl->uniq_cols_cnt - 1)
|
||||||
printf(" ");
|
fputs(" ", stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print out any values that aren't in a column at the end */
|
/* Print out any values that aren't in a column at the end */
|
||||||
for (j = data->cols_cnt; j < data->lines_cnt; j++) {
|
for (j = data->cols_cnt; j < data->lines_cnt; j++) {
|
||||||
/* Did we have any columns? If so print a spacer. */
|
/* Did we have any columns? If so print a spacer. */
|
||||||
if (vcdl->uniq_cols_cnt > 0)
|
if (vcdl->uniq_cols_cnt > 0)
|
||||||
printf(" ");
|
fputs(" ", stdout);
|
||||||
|
|
||||||
val = data->lines[j];
|
val = data->lines[j];
|
||||||
printf("%s", val ? val : "");
|
fputs(val ?: "", stdout);
|
||||||
}
|
}
|
||||||
break;
|
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
|
* Return the color associated with a health string. This includes returning
|
||||||
* NULL for no color change.
|
* NULL for no color change.
|
||||||
*/
|
*/
|
||||||
static char *
|
static const char *
|
||||||
health_str_to_color(const char *health)
|
health_str_to_color(const char *health)
|
||||||
{
|
{
|
||||||
if (strcmp(health, gettext("FAULTED")) == 0 ||
|
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;
|
const char *state;
|
||||||
char *type;
|
char *type;
|
||||||
char *path = NULL;
|
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,
|
if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN,
|
||||||
&child, &children) != 0)
|
&child, &children) != 0)
|
||||||
@ -2318,13 +2317,13 @@ print_status_config(zpool_handle_t *zhp, status_cbdata_t *cb, const char *name,
|
|||||||
ccolor = ANSI_RED;
|
ccolor = ANSI_RED;
|
||||||
|
|
||||||
if (cb->cb_literal) {
|
if (cb->cb_literal) {
|
||||||
printf(" ");
|
fputc(' ', stdout);
|
||||||
printf_color(rcolor, "%5llu",
|
printf_color(rcolor, "%5llu",
|
||||||
(u_longlong_t)vs->vs_read_errors);
|
(u_longlong_t)vs->vs_read_errors);
|
||||||
printf(" ");
|
fputc(' ', stdout);
|
||||||
printf_color(wcolor, "%5llu",
|
printf_color(wcolor, "%5llu",
|
||||||
(u_longlong_t)vs->vs_write_errors);
|
(u_longlong_t)vs->vs_write_errors);
|
||||||
printf(" ");
|
fputc(' ', stdout);
|
||||||
printf_color(ccolor, "%5llu",
|
printf_color(ccolor, "%5llu",
|
||||||
(u_longlong_t)vs->vs_checksum_errors);
|
(u_longlong_t)vs->vs_checksum_errors);
|
||||||
} else {
|
} 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_write_errors, wbuf, sizeof (wbuf));
|
||||||
zfs_nicenum(vs->vs_checksum_errors, cbuf,
|
zfs_nicenum(vs->vs_checksum_errors, cbuf,
|
||||||
sizeof (cbuf));
|
sizeof (cbuf));
|
||||||
printf(" ");
|
fputc(' ', stdout);
|
||||||
printf_color(rcolor, "%5s", rbuf);
|
printf_color(rcolor, "%5s", rbuf);
|
||||||
printf(" ");
|
fputc(' ', stdout);
|
||||||
printf_color(wcolor, "%5s", wbuf);
|
printf_color(wcolor, "%5s", wbuf);
|
||||||
printf(" ");
|
fputc(' ', stdout);
|
||||||
printf_color(ccolor, "%5s", cbuf);
|
printf_color(ccolor, "%5s", cbuf);
|
||||||
}
|
}
|
||||||
if (cb->cb_print_slow_ios) {
|
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);
|
&is_log);
|
||||||
|
|
||||||
if (is_log) {
|
if (is_log) {
|
||||||
bias = VDEV_ALLOC_CLASS_LOGS;
|
bias = (char *)VDEV_ALLOC_CLASS_LOGS;
|
||||||
} else {
|
} else {
|
||||||
(void) nvlist_lookup_string(child[c],
|
(void) nvlist_lookup_string(child[c],
|
||||||
ZPOOL_CONFIG_ALLOCATION_BIAS, &bias);
|
ZPOOL_CONFIG_ALLOCATION_BIAS, &bias);
|
||||||
@ -2711,8 +2710,8 @@ show_import(nvlist_t *config, boolean_t report_error)
|
|||||||
char *name;
|
char *name;
|
||||||
uint64_t guid;
|
uint64_t guid;
|
||||||
uint64_t hostid = 0;
|
uint64_t hostid = 0;
|
||||||
char *msgid;
|
const char *msgid;
|
||||||
char *hostname = "unknown";
|
const char *hostname = "unknown";
|
||||||
nvlist_t *nvroot, *nvinfo;
|
nvlist_t *nvroot, *nvinfo;
|
||||||
zpool_status_t reason;
|
zpool_status_t reason;
|
||||||
zpool_errata_t errata;
|
zpool_errata_t errata;
|
||||||
@ -3252,7 +3251,7 @@ import_pools(nvlist_t *pools, nvlist_t *props, char *mntopts, int flags,
|
|||||||
if (first)
|
if (first)
|
||||||
first = B_FALSE;
|
first = B_FALSE;
|
||||||
else if (!do_all)
|
else if (!do_all)
|
||||||
(void) putchar('\n');
|
(void) fputc('\n', stdout);
|
||||||
|
|
||||||
if (do_all) {
|
if (do_all) {
|
||||||
err |= do_import(config, NULL, mntopts,
|
err |= do_import(config, NULL, mntopts,
|
||||||
@ -4848,7 +4847,7 @@ children:
|
|||||||
(void) nvlist_lookup_uint64(newchild[c],
|
(void) nvlist_lookup_uint64(newchild[c],
|
||||||
ZPOOL_CONFIG_IS_LOG, &islog);
|
ZPOOL_CONFIG_IS_LOG, &islog);
|
||||||
if (islog) {
|
if (islog) {
|
||||||
bias = VDEV_ALLOC_CLASS_LOGS;
|
bias = (char *)VDEV_ALLOC_CLASS_LOGS;
|
||||||
} else {
|
} else {
|
||||||
(void) nvlist_lookup_string(newchild[c],
|
(void) nvlist_lookup_string(newchild[c],
|
||||||
ZPOOL_CONFIG_ALLOCATION_BIAS, &bias);
|
ZPOOL_CONFIG_ALLOCATION_BIAS, &bias);
|
||||||
@ -5382,7 +5381,7 @@ terminal_height(void)
|
|||||||
static void
|
static void
|
||||||
print_zpool_script_help(char *name, char *path)
|
print_zpool_script_help(char *name, char *path)
|
||||||
{
|
{
|
||||||
char *argv[] = {path, "-h", NULL};
|
char *argv[] = {path, (char *)"-h", NULL};
|
||||||
char **lines = NULL;
|
char **lines = NULL;
|
||||||
int lines_cnt = 0;
|
int lines_cnt = 0;
|
||||||
int rc;
|
int rc;
|
||||||
@ -5434,7 +5433,7 @@ print_zpool_dir_scripts(char *dirpath)
|
|||||||
* Print out help text for all zpool status/iostat -c scripts.
|
* Print out help text for all zpool status/iostat -c scripts.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
print_zpool_script_list(char *subcommand)
|
print_zpool_script_list(const char *subcommand)
|
||||||
{
|
{
|
||||||
char *dir, *sp, *tmp;
|
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;
|
zprop_list_t *pl = cb->cb_proplist;
|
||||||
boolean_t first = B_TRUE;
|
boolean_t first = B_TRUE;
|
||||||
char property[ZPOOL_MAXPROPLEN];
|
char property[ZPOOL_MAXPROPLEN];
|
||||||
char *propstr;
|
const char *propstr;
|
||||||
boolean_t right_justify;
|
boolean_t right_justify;
|
||||||
size_t width;
|
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,
|
if (nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_LOG,
|
||||||
&islog) == 0 && islog) {
|
&islog) == 0 && islog) {
|
||||||
bias = VDEV_ALLOC_CLASS_LOGS;
|
bias = (char *)VDEV_ALLOC_CLASS_LOGS;
|
||||||
} else {
|
} else {
|
||||||
(void) nvlist_lookup_string(child[c],
|
(void) nvlist_lookup_string(child[c],
|
||||||
ZPOOL_CONFIG_ALLOCATION_BIAS, &bias);
|
ZPOOL_CONFIG_ALLOCATION_BIAS, &bias);
|
||||||
@ -8118,7 +8117,7 @@ status_callback(zpool_handle_t *zhp, void *data)
|
|||||||
{
|
{
|
||||||
status_cbdata_t *cbp = data;
|
status_cbdata_t *cbp = data;
|
||||||
nvlist_t *config, *nvroot;
|
nvlist_t *config, *nvroot;
|
||||||
char *msgid;
|
const char *msgid;
|
||||||
zpool_status_t reason;
|
zpool_status_t reason;
|
||||||
zpool_errata_t errata;
|
zpool_errata_t errata;
|
||||||
const char *health;
|
const char *health;
|
||||||
@ -8163,12 +8162,12 @@ status_callback(zpool_handle_t *zhp, void *data)
|
|||||||
printf(" ");
|
printf(" ");
|
||||||
printf_color(ANSI_BOLD, gettext("pool:"));
|
printf_color(ANSI_BOLD, gettext("pool:"));
|
||||||
printf(" %s\n", zpool_get_name(zhp));
|
printf(" %s\n", zpool_get_name(zhp));
|
||||||
printf(" ");
|
fputc(' ', stdout);
|
||||||
printf_color(ANSI_BOLD, gettext("state: "));
|
printf_color(ANSI_BOLD, gettext("state: "));
|
||||||
|
|
||||||
printf_color(health_str_to_color(health), "%s", health);
|
printf_color(health_str_to_color(health), "%s", health);
|
||||||
|
|
||||||
printf("\n");
|
fputc('\n', stdout);
|
||||||
|
|
||||||
switch (reason) {
|
switch (reason) {
|
||||||
case ZPOOL_STATUS_MISSING_DEV_R:
|
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_checkpoint_stat_t *pcs = NULL;
|
||||||
pool_scan_stat_t *pss = NULL;
|
pool_scan_stat_t *pss = NULL;
|
||||||
pool_removal_stat_t *prs = NULL;
|
pool_removal_stat_t *prs = NULL;
|
||||||
char *headers[] = {"DISCARD", "FREE", "INITIALIZE", "REPLACE",
|
const char *const headers[] = {"DISCARD", "FREE", "INITIALIZE",
|
||||||
"REMOVE", "RESILVER", "SCRUB", "TRIM"};
|
"REPLACE", "REMOVE", "RESILVER", "SCRUB", "TRIM"};
|
||||||
int col_widths[ZPOOL_WAIT_NUM_ACTIVITIES];
|
int col_widths[ZPOOL_WAIT_NUM_ACTIVITIES];
|
||||||
|
|
||||||
/* Calculate the width of each column */
|
/* 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])
|
if (wd->wd_enabled[i])
|
||||||
(void) printf("%*s", col_widths[i], headers[i]);
|
(void) printf("%*s", col_widths[i], headers[i]);
|
||||||
}
|
}
|
||||||
(void) printf("\n");
|
(void) fputc('\n', stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Bytes of work remaining in each activity */
|
/* Bytes of work remaining in each activity */
|
||||||
@ -10795,11 +10794,9 @@ found:;
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
find_command_idx(char *command, int *idx)
|
find_command_idx(const char *command, int *idx)
|
||||||
{
|
{
|
||||||
int i;
|
for (int i = 0; i < NCOMMAND; ++i) {
|
||||||
|
|
||||||
for (i = 0; i < NCOMMAND; i++) {
|
|
||||||
if (command_table[i].name == NULL)
|
if (command_table[i].name == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ make_leaf_vdev(nvlist_t *props, const char *arg, boolean_t is_primary)
|
|||||||
char path[MAXPATHLEN];
|
char path[MAXPATHLEN];
|
||||||
struct stat64 statbuf;
|
struct stat64 statbuf;
|
||||||
nvlist_t *vdev = NULL;
|
nvlist_t *vdev = NULL;
|
||||||
char *type = NULL;
|
const char *type = NULL;
|
||||||
boolean_t wholedisk = B_FALSE;
|
boolean_t wholedisk = B_FALSE;
|
||||||
uint64_t ashift = 0;
|
uint64_t ashift = 0;
|
||||||
int err;
|
int err;
|
||||||
|
@ -90,7 +90,7 @@ char metric_data_type = 'u';
|
|||||||
uint64_t metric_value_mask = UINT64_MAX;
|
uint64_t metric_value_mask = UINT64_MAX;
|
||||||
uint64_t timestamp = 0;
|
uint64_t timestamp = 0;
|
||||||
int complained_about_sync = 0;
|
int complained_about_sync = 0;
|
||||||
char *tags = "";
|
const char *tags = "";
|
||||||
|
|
||||||
typedef int (*stat_printer_f)(nvlist_t *, const char *, const char *);
|
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
|
* print key=value where value is a uint64_t
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
print_kv(char *key, uint64_t value)
|
print_kv(const char *key, uint64_t value)
|
||||||
{
|
{
|
||||||
printf("%s=%llu%c", key,
|
printf("%s=%llu%c", key,
|
||||||
(u_longlong_t)value & metric_value_mask, metric_data_type);
|
(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;
|
uint64_t remaining_time;
|
||||||
pool_scan_stat_t *ps = NULL;
|
pool_scan_stat_t *ps = NULL;
|
||||||
double pct_done;
|
double pct_done;
|
||||||
char *state[DSS_NUM_STATES] = {
|
const char *const state[DSS_NUM_STATES] = {
|
||||||
"none", "scanning", "finished", "canceled"};
|
"none", "scanning", "finished", "canceled"};
|
||||||
char *func;
|
const char *func;
|
||||||
|
|
||||||
(void) nvlist_lookup_uint64_array(nvroot,
|
(void) nvlist_lookup_uint64_array(nvroot,
|
||||||
ZPOOL_CONFIG_SCAN_STATS,
|
ZPOOL_CONFIG_SCAN_STATS,
|
||||||
@ -262,17 +262,15 @@ static char *
|
|||||||
get_vdev_name(nvlist_t *nvroot, const char *parent_name)
|
get_vdev_name(nvlist_t *nvroot, const char *parent_name)
|
||||||
{
|
{
|
||||||
static char vdev_name[256];
|
static char vdev_name[256];
|
||||||
char *vdev_type = NULL;
|
|
||||||
uint64_t vdev_id = 0;
|
uint64_t vdev_id = 0;
|
||||||
|
|
||||||
if (nvlist_lookup_string(nvroot, ZPOOL_CONFIG_TYPE,
|
char *vdev_type = (char *)"unknown";
|
||||||
&vdev_type) != 0) {
|
nvlist_lookup_string(nvroot, ZPOOL_CONFIG_TYPE, &vdev_type);
|
||||||
vdev_type = "unknown";
|
|
||||||
}
|
|
||||||
if (nvlist_lookup_uint64(
|
if (nvlist_lookup_uint64(
|
||||||
nvroot, ZPOOL_CONFIG_ID, &vdev_id) != 0) {
|
nvroot, ZPOOL_CONFIG_ID, &vdev_id) != 0)
|
||||||
vdev_id = UINT64_MAX;
|
vdev_id = UINT64_MAX;
|
||||||
}
|
|
||||||
if (parent_name == NULL) {
|
if (parent_name == NULL) {
|
||||||
(void) snprintf(vdev_name, sizeof (vdev_name), "%s",
|
(void) snprintf(vdev_name, sizeof (vdev_name), "%s",
|
||||||
vdev_type);
|
vdev_type);
|
||||||
@ -298,22 +296,15 @@ static char *
|
|||||||
get_vdev_desc(nvlist_t *nvroot, const char *parent_name)
|
get_vdev_desc(nvlist_t *nvroot, const char *parent_name)
|
||||||
{
|
{
|
||||||
static char vdev_desc[2 * MAXPATHLEN];
|
static char vdev_desc[2 * MAXPATHLEN];
|
||||||
char *vdev_type = NULL;
|
|
||||||
uint64_t vdev_id = 0;
|
|
||||||
char vdev_value[MAXPATHLEN];
|
char vdev_value[MAXPATHLEN];
|
||||||
char *vdev_path = NULL;
|
|
||||||
char *s, *t;
|
char *s, *t;
|
||||||
|
|
||||||
if (nvlist_lookup_string(nvroot, ZPOOL_CONFIG_TYPE, &vdev_type) != 0) {
|
char *vdev_type = (char *)"unknown";
|
||||||
vdev_type = "unknown";
|
uint64_t vdev_id = UINT64_MAX;
|
||||||
}
|
char *vdev_path = NULL;
|
||||||
if (nvlist_lookup_uint64(nvroot, ZPOOL_CONFIG_ID, &vdev_id) != 0) {
|
nvlist_lookup_string(nvroot, ZPOOL_CONFIG_TYPE, &vdev_type);
|
||||||
vdev_id = UINT64_MAX;
|
nvlist_lookup_uint64(nvroot, ZPOOL_CONFIG_ID, &vdev_id);
|
||||||
}
|
nvlist_lookup_string(nvroot, ZPOOL_CONFIG_PATH, &vdev_path);
|
||||||
if (nvlist_lookup_string(
|
|
||||||
nvroot, ZPOOL_CONFIG_PATH, &vdev_path) != 0) {
|
|
||||||
vdev_path = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (parent_name == NULL) {
|
if (parent_name == NULL) {
|
||||||
s = escape_string(vdev_type);
|
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 */
|
/* short_names become part of the metric name and are influxdb-ready */
|
||||||
struct lat_lookup {
|
struct lat_lookup {
|
||||||
char *name;
|
const char *name;
|
||||||
char *short_name;
|
const char *short_name;
|
||||||
uint64_t sum;
|
uint64_t sum;
|
||||||
uint64_t *array;
|
uint64_t *array;
|
||||||
};
|
};
|
||||||
@ -487,8 +478,8 @@ print_vdev_size_stats(nvlist_t *nvroot, const char *pool_name,
|
|||||||
|
|
||||||
/* short_names become the field name */
|
/* short_names become the field name */
|
||||||
struct size_lookup {
|
struct size_lookup {
|
||||||
char *name;
|
const char *name;
|
||||||
char *short_name;
|
const char *short_name;
|
||||||
uint64_t sum;
|
uint64_t sum;
|
||||||
uint64_t *array;
|
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 */
|
/* short_names are used for the field name */
|
||||||
struct queue_lookup {
|
struct queue_lookup {
|
||||||
char *name;
|
const char *name;
|
||||||
char *short_name;
|
const char *short_name;
|
||||||
};
|
};
|
||||||
struct queue_lookup queue_type[] = {
|
struct queue_lookup queue_type[] = {
|
||||||
{ZPOOL_CONFIG_VDEV_SYNC_R_ACTIVE_QUEUE, "sync_r_active"},
|
{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 */
|
/* short_names become part of the metric name */
|
||||||
struct queue_lookup {
|
struct queue_lookup {
|
||||||
char *name;
|
const char *name;
|
||||||
char *short_name;
|
const char *short_name;
|
||||||
};
|
};
|
||||||
struct queue_lookup queue_type[] = {
|
struct queue_lookup queue_type[] = {
|
||||||
{ZPOOL_CONFIG_VDEV_SYNC_R_ACTIVE_QUEUE, "sync_r_active_queue"},
|
{ZPOOL_CONFIG_VDEV_SYNC_R_ACTIVE_QUEUE, "sync_r_active_queue"},
|
||||||
@ -789,7 +780,7 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int opt;
|
int opt;
|
||||||
int ret = 8;
|
int ret = 8;
|
||||||
char *line = NULL;
|
char *line = NULL, *ttags = NULL;
|
||||||
size_t len, tagslen = 0;
|
size_t len, tagslen = 0;
|
||||||
struct option long_options[] = {
|
struct option long_options[] = {
|
||||||
{"execd", no_argument, NULL, 'e'},
|
{"execd", no_argument, NULL, 'e'},
|
||||||
@ -817,15 +808,17 @@ main(int argc, char *argv[])
|
|||||||
sum_histogram_buckets = 1;
|
sum_histogram_buckets = 1;
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
|
free(ttags);
|
||||||
tagslen = strlen(optarg) + 2;
|
tagslen = strlen(optarg) + 2;
|
||||||
tags = calloc(1, tagslen);
|
ttags = calloc(1, tagslen);
|
||||||
if (tags == NULL) {
|
if (ttags == NULL) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"error: cannot allocate memory "
|
"error: cannot allocate memory "
|
||||||
"for tags\n");
|
"for tags\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
(void) snprintf(tags, tagslen, ",%s", optarg);
|
(void) snprintf(ttags, tagslen, ",%s", optarg);
|
||||||
|
tags = ttags;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
usage(argv[0]);
|
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_shared_opts;
|
||||||
static ztest_shared_opts_t ztest_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 {
|
typedef struct ztest_shared_ds {
|
||||||
uint64_t zd_seq;
|
uint64_t zd_seq;
|
||||||
@ -623,10 +623,10 @@ static void sig_handler(int signo)
|
|||||||
|
|
||||||
#define FATAL_MSG_SZ 1024
|
#define FATAL_MSG_SZ 1024
|
||||||
|
|
||||||
char *fatal_msg;
|
static const char *fatal_msg;
|
||||||
|
|
||||||
static __attribute__((format(printf, 2, 3))) __attribute__((noreturn)) void
|
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;
|
va_list args;
|
||||||
int save_errno = errno;
|
int save_errno = errno;
|
||||||
@ -724,7 +724,7 @@ typedef struct ztest_option {
|
|||||||
const char *long_opt_param;
|
const char *long_opt_param;
|
||||||
const char *comment;
|
const char *comment;
|
||||||
unsigned int default_int;
|
unsigned int default_int;
|
||||||
char *default_str;
|
const char *default_str;
|
||||||
} ztest_option_t;
|
} ztest_option_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1200,30 +1200,31 @@ ztest_is_draid_spare(const char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static nvlist_t *
|
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;
|
uint64_t vdev;
|
||||||
nvlist_t *file;
|
nvlist_t *file;
|
||||||
boolean_t draid_spare = B_FALSE;
|
boolean_t draid_spare = B_FALSE;
|
||||||
|
|
||||||
pathbuf = umem_alloc(MAXPATHLEN, UMEM_NOFAIL);
|
|
||||||
|
|
||||||
if (ashift == 0)
|
if (ashift == 0)
|
||||||
ashift = ztest_get_ashift();
|
ashift = ztest_get_ashift();
|
||||||
|
|
||||||
if (path == NULL) {
|
if (path == NULL) {
|
||||||
|
pathbuf = umem_alloc(MAXPATHLEN, UMEM_NOFAIL);
|
||||||
path = pathbuf;
|
path = pathbuf;
|
||||||
|
|
||||||
if (aux != NULL) {
|
if (aux != NULL) {
|
||||||
vdev = ztest_shared->zs_vdev_aux;
|
vdev = ztest_shared->zs_vdev_aux;
|
||||||
(void) snprintf(path, MAXPATHLEN,
|
(void) snprintf(pathbuf, MAXPATHLEN,
|
||||||
ztest_aux_template, ztest_opts.zo_dir,
|
ztest_aux_template, ztest_opts.zo_dir,
|
||||||
pool == NULL ? ztest_opts.zo_pool : pool,
|
pool == NULL ? ztest_opts.zo_pool : pool,
|
||||||
aux, vdev);
|
aux, vdev);
|
||||||
} else {
|
} else {
|
||||||
vdev = ztest_shared->zs_vdev_next_leaf++;
|
vdev = ztest_shared->zs_vdev_next_leaf++;
|
||||||
(void) snprintf(path, MAXPATHLEN,
|
(void) snprintf(pathbuf, MAXPATHLEN,
|
||||||
ztest_dev_template, ztest_opts.zo_dir,
|
ztest_dev_template, ztest_opts.zo_dir,
|
||||||
pool == NULL ? ztest_opts.zo_pool : pool, vdev);
|
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 *
|
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)
|
uint64_t ashift, int r)
|
||||||
{
|
{
|
||||||
nvlist_t *raid, **child;
|
nvlist_t *raid, **child;
|
||||||
@ -1302,8 +1303,8 @@ make_vdev_raid(char *path, char *aux, char *pool, size_t size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static nvlist_t *
|
static nvlist_t *
|
||||||
make_vdev_mirror(char *path, char *aux, char *pool, size_t size,
|
make_vdev_mirror(const char *path, const char *aux, const char *pool,
|
||||||
uint64_t ashift, int r, int m)
|
size_t size, uint64_t ashift, int r, int m)
|
||||||
{
|
{
|
||||||
nvlist_t *mirror, **child;
|
nvlist_t *mirror, **child;
|
||||||
int c;
|
int c;
|
||||||
@ -1330,8 +1331,8 @@ make_vdev_mirror(char *path, char *aux, char *pool, size_t size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static nvlist_t *
|
static nvlist_t *
|
||||||
make_vdev_root(char *path, char *aux, char *pool, size_t size, uint64_t ashift,
|
make_vdev_root(const char *path, const char *aux, const char *pool, size_t size,
|
||||||
const char *class, int r, int m, int t)
|
uint64_t ashift, const char *class, int r, int m, int t)
|
||||||
{
|
{
|
||||||
nvlist_t *root, **child;
|
nvlist_t *root, **child;
|
||||||
int c;
|
int c;
|
||||||
@ -3371,7 +3372,7 @@ ztest_vdev_aux_add_remove(ztest_ds_t *zd, uint64_t id)
|
|||||||
spa_t *spa = ztest_spa;
|
spa_t *spa = ztest_spa;
|
||||||
vdev_t *rvd = spa->spa_root_vdev;
|
vdev_t *rvd = spa->spa_root_vdev;
|
||||||
spa_aux_vdev_t *sav;
|
spa_aux_vdev_t *sav;
|
||||||
char *aux;
|
const char *aux;
|
||||||
char *path;
|
char *path;
|
||||||
uint64_t guid = 0;
|
uint64_t guid = 0;
|
||||||
int error, ignore_err = 0;
|
int error, ignore_err = 0;
|
||||||
@ -5271,7 +5272,7 @@ ztest_zap(ztest_ds_t *zd, uint64_t id)
|
|||||||
dmu_tx_t *tx;
|
dmu_tx_t *tx;
|
||||||
char propname[100], txgname[100];
|
char propname[100], txgname[100];
|
||||||
int error;
|
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);
|
od = umem_alloc(sizeof (ztest_od_t), UMEM_NOFAIL);
|
||||||
ztest_od_init(od, id, FTAG, 0, DMU_OT_ZAP_OTHER, 0, 0, 0);
|
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 **args = calloc(2*ztest_opts.zo_gvars_count + 1, sizeof (char *));
|
||||||
char **cur = args;
|
char **cur = args;
|
||||||
for (size_t i = 0; i < ztest_opts.zo_gvars_count; i++) {
|
for (size_t i = 0; i < ztest_opts.zo_gvars_count; i++) {
|
||||||
char *kv = ztest_opts.zo_gvars[i];
|
*cur++ = (char *)"-o";
|
||||||
*cur = "-o";
|
*cur++ = ztest_opts.zo_gvars[i];
|
||||||
cur++;
|
|
||||||
*cur = strdup(kv);
|
|
||||||
cur++;
|
|
||||||
}
|
}
|
||||||
ASSERT3P(cur, ==, &args[2*ztest_opts.zo_gvars_count]);
|
ASSERT3P(cur, ==, &args[2*ztest_opts.zo_gvars_count]);
|
||||||
*cur = NULL;
|
*cur = NULL;
|
||||||
@ -6891,7 +6889,7 @@ ztest_trim(ztest_ds_t *zd, uint64_t id)
|
|||||||
* Verify pool integrity by running zdb.
|
* Verify pool integrity by running zdb.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
ztest_run_zdb(char *pool)
|
ztest_run_zdb(const char *pool)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
char *bin;
|
char *bin;
|
||||||
@ -6949,12 +6947,12 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ztest_walk_pool_directory(char *header)
|
ztest_walk_pool_directory(const char *header)
|
||||||
{
|
{
|
||||||
spa_t *spa = NULL;
|
spa_t *spa = NULL;
|
||||||
|
|
||||||
if (ztest_opts.zo_verbose >= 6)
|
if (ztest_opts.zo_verbose >= 6)
|
||||||
(void) printf("%s\n", header);
|
(void) puts(header);
|
||||||
|
|
||||||
mutex_enter(&spa_namespace_lock);
|
mutex_enter(&spa_namespace_lock);
|
||||||
while ((spa = spa_next(spa)) != NULL)
|
while ((spa = spa_next(spa)) != NULL)
|
||||||
@ -7206,7 +7204,7 @@ ztest_thread(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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);
|
(void) snprintf(dsname, ZFS_MAX_DATASET_NAME_LEN, "%s/ds_%d", pool, d);
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ AM_CPPFLAGS = \
|
|||||||
|
|
||||||
AM_LIBTOOLFLAGS = --silent
|
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 += -fno-strict-aliasing
|
||||||
AM_CFLAGS += $(NO_OMIT_FRAME_POINTER)
|
AM_CFLAGS += $(NO_OMIT_FRAME_POINTER)
|
||||||
AM_CFLAGS += $(IMPLICIT_FALLTHROUGH)
|
AM_CFLAGS += $(IMPLICIT_FALLTHROUGH)
|
||||||
|
@ -681,25 +681,28 @@ line_worker(char *line, const char *cachefile)
|
|||||||
}
|
}
|
||||||
*(tofree++) = linktgt;
|
*(tofree++) = linktgt;
|
||||||
|
|
||||||
char *dependencies[][2] = {
|
struct dep {
|
||||||
|
const char *type;
|
||||||
|
char *list;
|
||||||
|
} deps[] = {
|
||||||
{"wants", wantedby},
|
{"wants", wantedby},
|
||||||
{"requires", requiredby},
|
{"requires", requiredby},
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
for (__typeof__(&*dependencies) dep = &*dependencies; **dep; ++dep) {
|
for (struct dep *dep = deps; dep->type; ++dep) {
|
||||||
if (!(*dep)[1])
|
if (!dep->list)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (char *reqby = strtok_r((*dep)[1], " ", &toktmp);
|
for (char *reqby = strtok_r(dep->list, " ", &toktmp);
|
||||||
reqby;
|
reqby;
|
||||||
reqby = strtok_r(NULL, " ", &toktmp)) {
|
reqby = strtok_r(NULL, " ", &toktmp)) {
|
||||||
char *depdir;
|
char *depdir;
|
||||||
if (asprintf(
|
if (asprintf(
|
||||||
&depdir, "%s.%s", reqby, (*dep)[0]) == -1) {
|
&depdir, "%s.%s", reqby, dep->type) == -1) {
|
||||||
fprintf(stderr, PROGNAME "[%d]: %s: "
|
fprintf(stderr, PROGNAME "[%d]: %s: "
|
||||||
"out of memory for dependent dir name "
|
"out of memory for dependent dir name "
|
||||||
"\"%s.%s\"!\n",
|
"\"%s.%s\"!\n",
|
||||||
getpid(), dataset, reqby, (*dep)[0]);
|
getpid(), dataset, reqby, dep->type);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,9 +423,9 @@ typedef enum {
|
|||||||
ZPOOL_STATUS_OK
|
ZPOOL_STATUS_OK
|
||||||
} zpool_status_t;
|
} 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 *);
|
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 *);
|
zpool_errata_t *);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -870,8 +870,9 @@ _LIBZFS_H int zfs_unmountall(zfs_handle_t *, int);
|
|||||||
_LIBZFS_H int zfs_mount_delegation_check(void);
|
_LIBZFS_H int zfs_mount_delegation_check(void);
|
||||||
|
|
||||||
#if defined(__linux__) || defined(__APPLE__)
|
#if defined(__linux__) || defined(__APPLE__)
|
||||||
_LIBZFS_H int zfs_parse_mount_options(char *mntopts, unsigned long *mntflags,
|
_LIBZFS_H int zfs_parse_mount_options(const char *mntopts,
|
||||||
unsigned long *zfsflags, int sloppy, char *badopt, char *mtabopt);
|
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,
|
_LIBZFS_H void zfs_adjust_mount_options(zfs_handle_t *zhp, const char *mntpoint,
|
||||||
char *mntopts, char *mtabopt);
|
char *mntopts, char *mtabopt);
|
||||||
#endif
|
#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 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
|
* Utility functions for zfs version
|
||||||
|
@ -155,9 +155,9 @@ struct zfs_cmd;
|
|||||||
#define ANSI_RESET "\033[0m"
|
#define ANSI_RESET "\033[0m"
|
||||||
#define ANSI_BOLD "\033[1m"
|
#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 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 const char *zfs_basename(const char *path);
|
||||||
_LIBZUTIL_H ssize_t zfs_dirnamelen(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_alloc(size_t size, int kmflags);
|
||||||
void zfs_kmem_free(void *buf, size_t size);
|
void zfs_kmem_free(void *buf, size_t size);
|
||||||
uint64_t kmem_size(void);
|
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 *),
|
int (*constructor)(void *, void *, int), void (*destructor)(void *, void *),
|
||||||
void (*reclaim)(void *) __unused, void *private, vmem_t *vmp, int cflags);
|
void (*reclaim)(void *) __unused, void *private, vmem_t *vmp, int cflags);
|
||||||
void kmem_cache_destroy(kmem_cache_t *cache);
|
void kmem_cache_destroy(kmem_cache_t *cache);
|
||||||
|
@ -183,7 +183,7 @@ typedef struct spl_kmem_cache {
|
|||||||
} spl_kmem_cache_t;
|
} spl_kmem_cache_t;
|
||||||
#define kmem_cache_t 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,
|
size_t align, spl_kmem_ctor_t ctor, spl_kmem_dtor_t dtor,
|
||||||
void *reclaim, void *priv, void *vmp, int flags);
|
void *reclaim, void *priv, void *vmp, int flags);
|
||||||
extern void spl_kmem_cache_set_move(spl_kmem_cache_t *,
|
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,
|
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,
|
dmu_object_type_t ot, const uint8_t *salt, const uint8_t *iv,
|
||||||
const uint8_t *mac);
|
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);
|
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,
|
uint64_t psize, uint64_t lsize, enum zio_compress compression_type,
|
||||||
uint8_t complevel);
|
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,
|
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,
|
const uint8_t *mac, dmu_object_type_t ot, uint64_t psize, uint64_t lsize,
|
||||||
enum zio_compress compression_type, uint8_t complevel);
|
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);
|
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,
|
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,
|
int dbuf_hold_impl(struct dnode *dn, uint8_t level, uint64_t blkid,
|
||||||
boolean_t fail_sparse, boolean_t fail_uncached,
|
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,
|
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,
|
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,
|
int dbuf_prefetch(struct dnode *dn, int64_t level, uint64_t blkid,
|
||||||
zio_priority_t prio, arc_flags_t aflags);
|
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,
|
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);
|
uint64_t dbuf_refcount(dmu_buf_impl_t *db);
|
||||||
|
|
||||||
void dbuf_rele(dmu_buf_impl_t *db, void *tag);
|
void dbuf_rele(dmu_buf_impl_t *db, const void *tag);
|
||||||
void dbuf_rele_and_unlock(dmu_buf_impl_t *db, void *tag, boolean_t evicting);
|
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,
|
dmu_buf_impl_t *dbuf_find(struct objset *os, uint64_t object, uint8_t level,
|
||||||
uint64_t blkid);
|
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_unoverride(dbuf_dirty_record_t *dr);
|
||||||
void dbuf_sync_list(list_t *list, int level, dmu_tx_t *tx);
|
void dbuf_sync_list(list_t *list, int level, dmu_tx_t *tx);
|
||||||
void dbuf_release_bp(dmu_buf_impl_t *db);
|
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);
|
db_lock_type_t dmu_buf_lock_parent(dmu_buf_impl_t *db, krw_t rw,
|
||||||
void dmu_buf_unlock_parent(dmu_buf_impl_t *db, db_lock_type_t type, void *tag);
|
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,
|
void dbuf_free_range(struct dnode *dn, uint64_t start, uint64_t end,
|
||||||
struct dmu_tx *);
|
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,
|
typedef void dmu_objset_create_sync_func_t(objset_t *os, void *arg,
|
||||||
cred_t *cr, dmu_tx_t *tx);
|
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,
|
int dmu_objset_own(const char *name, dmu_objset_type_t type,
|
||||||
boolean_t readonly, boolean_t key_required, void *tag, objset_t **osp);
|
boolean_t readonly, boolean_t key_required, const void *tag,
|
||||||
void dmu_objset_rele(objset_t *os, void *tag);
|
objset_t **osp);
|
||||||
void dmu_objset_disown(objset_t *os, boolean_t key_required, void *tag);
|
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);
|
int dmu_objset_open_ds(struct dsl_dataset *ds, objset_t **osp);
|
||||||
|
|
||||||
void dmu_objset_evict_dbufs(objset_t *os);
|
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);
|
int dnodesize, dmu_tx_t *tx);
|
||||||
uint64_t dmu_object_alloc_hold(objset_t *os, dmu_object_type_t ot,
|
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 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);
|
dmu_tx_t *tx);
|
||||||
int dmu_object_claim(objset_t *os, uint64_t object, dmu_object_type_t ot,
|
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);
|
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.
|
* 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(objset_t *os, uint64_t object, const void *tag,
|
||||||
int dmu_bonus_hold_by_dnode(dnode_t *dn, void *tag, dmu_buf_t **dbp,
|
dmu_buf_t **dbp);
|
||||||
|
int dmu_bonus_hold_by_dnode(dnode_t *dn, const void *tag, dmu_buf_t **dbp,
|
||||||
uint32_t flags);
|
uint32_t flags);
|
||||||
int dmu_bonus_max(void);
|
int dmu_bonus_max(void);
|
||||||
int dmu_set_bonus(dmu_buf_t *, int, dmu_tx_t *);
|
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
|
* 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);
|
dmu_buf_t **dbp);
|
||||||
int dmu_spill_hold_by_dnode(dnode_t *dn, uint32_t flags,
|
int dmu_spill_hold_by_dnode(dnode_t *dn, uint32_t flags,
|
||||||
void *tag, dmu_buf_t **dbp);
|
const void *tag, dmu_buf_t **dbp);
|
||||||
int dmu_spill_hold_existing(dmu_buf_t *bonus, 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
|
* 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.
|
* The object number must be a valid, allocated object number.
|
||||||
*/
|
*/
|
||||||
int dmu_buf_hold(objset_t *os, uint64_t object, uint64_t offset,
|
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,
|
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,
|
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,
|
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);
|
dmu_buf_t ***dbpp, uint32_t flags);
|
||||||
/*
|
/*
|
||||||
* Add a reference to a dmu buffer that has already been held via
|
* 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.
|
* 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,
|
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_refcount(dmu_buf_t *db);
|
||||||
uint64_t dmu_buf_user_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.
|
* individually with dmu_buf_rele.
|
||||||
*/
|
*/
|
||||||
int dmu_buf_hold_array_by_bonus(dmu_buf_t *db, uint64_t offset,
|
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);
|
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);
|
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_metadata;
|
||||||
boolean_t ot_dbuf_metadata_cache;
|
boolean_t ot_dbuf_metadata_cache;
|
||||||
boolean_t ot_encrypt;
|
boolean_t ot_encrypt;
|
||||||
char *ot_name;
|
const char *ot_name;
|
||||||
} dmu_object_type_info_t;
|
} dmu_object_type_info_t;
|
||||||
|
|
||||||
typedef const struct dmu_object_byteswap_info {
|
typedef const struct dmu_object_byteswap_info {
|
||||||
arc_byteswap_func_t ob_func;
|
arc_byteswap_func_t ob_func;
|
||||||
char *ob_name;
|
const char *ob_name;
|
||||||
} dmu_object_byteswap_info_t;
|
} dmu_object_byteswap_info_t;
|
||||||
|
|
||||||
extern const dmu_object_type_info_t dmu_ot[DMU_OT_NUMTYPES];
|
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_zapify(objset_t *, uint64_t, dmu_object_type_t, dmu_tx_t *);
|
||||||
void dmu_object_free_zapified(objset_t *, uint64_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,
|
int dmu_buf_hold_noread(objset_t *, uint64_t, uint64_t,
|
||||||
void *, dmu_buf_t **);
|
const void *, dmu_buf_t **);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -201,19 +201,19 @@ struct objset {
|
|||||||
#define DMU_PROJECTUSED_DNODE(os) ((os)->os_projectused_dnode.dnh_dnode)
|
#define DMU_PROJECTUSED_DNODE(os) ((os)->os_projectused_dnode.dnh_dnode)
|
||||||
|
|
||||||
/* called from zpl */
|
/* called from zpl */
|
||||||
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_hold_flags(const char *name, boolean_t decrypt, void *tag,
|
int dmu_objset_hold_flags(const char *name, boolean_t decrypt, const void *tag,
|
||||||
objset_t **osp);
|
objset_t **osp);
|
||||||
int dmu_objset_own(const char *name, 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);
|
||||||
int dmu_objset_own_obj(struct dsl_pool *dp, uint64_t obj,
|
int dmu_objset_own_obj(struct dsl_pool *dp, uint64_t obj,
|
||||||
dmu_objset_type_t type, boolean_t readonly, boolean_t decrypt,
|
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,
|
void dmu_objset_refresh_ownership(struct dsl_dataset *ds,
|
||||||
struct dsl_dataset **newds, boolean_t decrypt, void *tag);
|
struct dsl_dataset **newds, boolean_t decrypt, const void *tag);
|
||||||
void dmu_objset_rele(objset_t *os, void *tag);
|
void dmu_objset_rele(objset_t *os, const void *tag);
|
||||||
void dmu_objset_rele_flags(objset_t *os, boolean_t decrypt, 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, 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);
|
int dmu_objset_from_ds(struct dsl_dataset *ds, objset_t **osp);
|
||||||
|
|
||||||
void dmu_objset_stats(objset_t *os, nvlist_t *nv);
|
void dmu_objset_stats(objset_t *os, nvlist_t *nv);
|
||||||
|
@ -334,7 +334,7 @@ struct dnode {
|
|||||||
kcondvar_t dn_notxholds;
|
kcondvar_t dn_notxholds;
|
||||||
kcondvar_t dn_nodnholds;
|
kcondvar_t dn_nodnholds;
|
||||||
enum dnode_dirtycontext dn_dirtyctx;
|
enum dnode_dirtycontext dn_dirtyctx;
|
||||||
void *dn_dirtyctx_firstset; /* dbg: contents meaningless */
|
const void *dn_dirtyctx_firstset; /* dbg: contents meaningless */
|
||||||
|
|
||||||
/* protected by own devices */
|
/* protected by own devices */
|
||||||
zfs_refcount_t dn_tx_holds;
|
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);
|
void dnode_rm_spill(dnode_t *dn, dmu_tx_t *tx);
|
||||||
|
|
||||||
int dnode_hold(struct objset *dd, uint64_t object,
|
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,
|
int dnode_hold_impl(struct objset *dd, uint64_t object, int flag, int dn_slots,
|
||||||
void *ref, dnode_t **dnp);
|
const void *ref, dnode_t **dnp);
|
||||||
boolean_t dnode_add_ref(dnode_t *dn, void *ref);
|
boolean_t dnode_add_ref(dnode_t *dn, const void *ref);
|
||||||
void dnode_rele(dnode_t *dn, void *ref);
|
void dnode_rele(dnode_t *dn, const void *ref);
|
||||||
void dnode_rele_and_unlock(dnode_t *dn, void *tag, boolean_t evicting);
|
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);
|
int dnode_try_claim(objset_t *os, uint64_t object, int slots);
|
||||||
boolean_t dnode_is_dirty(dnode_t *dn);
|
boolean_t dnode_is_dirty(dnode_t *dn);
|
||||||
void dnode_setdirty(dnode_t *dn, dmu_tx_t *tx);
|
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_sync(dnode_t *dn, dmu_tx_t *tx);
|
||||||
void dnode_allocate(dnode_t *dn, dmu_object_type_t ot, int blocksize, int ibs,
|
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);
|
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;
|
kmutex_t ds_lock;
|
||||||
objset_t *ds_objset;
|
objset_t *ds_objset;
|
||||||
uint64_t ds_userrefs;
|
uint64_t ds_userrefs;
|
||||||
void *ds_owner;
|
const void *ds_owner;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Long holds prevent the ds from being destroyed; they allow the
|
* 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_FLAG_DECRYPT = 1 << 0 /* needs access to encrypted data */
|
||||||
} ds_hold_flags_t;
|
} 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);
|
dsl_dataset_t **dsp);
|
||||||
int dsl_dataset_hold_flags(struct dsl_pool *dp, const char *name,
|
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,
|
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_create_key_mapping(dsl_dataset_t *ds);
|
||||||
int dsl_dataset_hold_obj_flags(struct dsl_pool *dp, uint64_t dsobj,
|
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);
|
void dsl_dataset_remove_key_mapping(dsl_dataset_t *ds);
|
||||||
int dsl_dataset_hold_obj(struct dsl_pool *dp, uint64_t dsobj,
|
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 dsl_dataset_rele_flags(dsl_dataset_t *ds, ds_hold_flags_t flags,
|
||||||
void *tag);
|
const void *tag);
|
||||||
void dsl_dataset_rele(dsl_dataset_t *ds, void *tag);
|
void dsl_dataset_rele(dsl_dataset_t *ds, const void *tag);
|
||||||
int dsl_dataset_own(struct dsl_pool *dp, const char *name,
|
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,
|
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,
|
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,
|
int dsl_dataset_own_obj_force(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);
|
||||||
void dsl_dataset_disown(dsl_dataset_t *ds, ds_hold_flags_t flags, void *tag);
|
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);
|
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);
|
int dsl_dataset_namelen(dsl_dataset_t *ds);
|
||||||
boolean_t dsl_dataset_has_owner(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,
|
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,
|
void dsl_pool_ckpoint_diduse_space(dsl_pool_t *dp,
|
||||||
int64_t used, int64_t comp, int64_t uncomp);
|
int64_t used, int64_t comp, int64_t uncomp);
|
||||||
boolean_t dsl_pool_need_dirty_delay(dsl_pool_t *dp);
|
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(dsl_pool_t *dp, const void *tag);
|
||||||
void dsl_pool_config_enter_prio(dsl_pool_t *dp, void *tag);
|
void dsl_pool_config_enter_prio(dsl_pool_t *dp, const void *tag);
|
||||||
void dsl_pool_config_exit(dsl_pool_t *dp, 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(dsl_pool_t *dp);
|
||||||
boolean_t dsl_pool_config_held_writer(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);
|
const char *tag, dmu_tx_t *tx);
|
||||||
void dsl_pool_clean_tmp_userrefs(dsl_pool_t *dp);
|
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_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);
|
int dsl_pool_hold(const char *name, const void *tag, dsl_pool_t **dp);
|
||||||
void dsl_pool_rele(dsl_pool_t *dp, void *tag);
|
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_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);
|
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_init(rrwlock_t *rrl, boolean_t track_all);
|
||||||
void rrw_destroy(rrwlock_t *rrl);
|
void rrw_destroy(rrwlock_t *rrl);
|
||||||
void rrw_enter(rrwlock_t *rrl, krw_t rw, void *tag);
|
void rrw_enter(rrwlock_t *rrl, krw_t rw, const void *tag);
|
||||||
void rrw_enter_read(rrwlock_t *rrl, void *tag);
|
void rrw_enter_read(rrwlock_t *rrl, const void *tag);
|
||||||
void rrw_enter_read_prio(rrwlock_t *rrl, void *tag);
|
void rrw_enter_read_prio(rrwlock_t *rrl, const void *tag);
|
||||||
void rrw_enter_write(rrwlock_t *rrl);
|
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);
|
boolean_t rrw_held(rrwlock_t *rrl, krw_t rw);
|
||||||
void rrw_tsd_destroy(void *arg);
|
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_init(rrmlock_t *rrl, boolean_t track_all);
|
||||||
void rrm_destroy(rrmlock_t *rrl);
|
void rrm_destroy(rrmlock_t *rrl);
|
||||||
void rrm_enter(rrmlock_t *rrl, krw_t rw, void *tag);
|
void rrm_enter(rrmlock_t *rrl, krw_t rw, const void *tag);
|
||||||
void rrm_enter_read(rrmlock_t *rrl, void *tag);
|
void rrm_enter_read(rrmlock_t *rrl, const void *tag);
|
||||||
void rrm_enter_write(rrmlock_t *rrl);
|
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);
|
boolean_t rrm_held(rrmlock_t *rrl, krw_t rw);
|
||||||
|
|
||||||
#define RRM_READ_HELD(x) rrm_held(x, RW_READER)
|
#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.
|
* Attribute to register support for.
|
||||||
*/
|
*/
|
||||||
typedef struct sa_attr_reg {
|
typedef struct sa_attr_reg {
|
||||||
char *sa_name; /* attribute name */
|
const char *sa_name; /* attribute name */
|
||||||
uint16_t sa_length;
|
uint16_t sa_length;
|
||||||
sa_bswap_type_t sa_byteswap; /* bswap function enum */
|
sa_bswap_type_t sa_byteswap; /* bswap function enum */
|
||||||
sa_attr_type_t sa_attr; /* filled in during registration */
|
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) \
|
#define SNPRINTF_BLKPTR(func, ws, buf, size, bp, type, checksum, compress) \
|
||||||
{ \
|
{ \
|
||||||
static const char *copyname[] = \
|
static const char *const copyname[] = \
|
||||||
{ "zero", "single", "double", "triple" }; \
|
{ "zero", "single", "double", "triple" }; \
|
||||||
int len = 0; \
|
int len = 0; \
|
||||||
int copies = 0; \
|
int copies = 0; \
|
||||||
@ -743,8 +743,8 @@ typedef enum trim_type {
|
|||||||
} trim_type_t;
|
} trim_type_t;
|
||||||
|
|
||||||
/* state manipulation functions */
|
/* state manipulation functions */
|
||||||
extern int spa_open(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 **, void *tag,
|
extern int spa_open_rewind(const char *pool, spa_t **, const void *tag,
|
||||||
nvlist_t *policy, nvlist_t **config);
|
nvlist_t *policy, nvlist_t **config);
|
||||||
extern int spa_get_stats(const char *pool, nvlist_t **config, char *altroot,
|
extern int spa_get_stats(const char *pool, nvlist_t **config, char *altroot,
|
||||||
size_t buflen);
|
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);
|
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_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_setfru(spa_t *spa, uint64_t guid, const char *newfru);
|
||||||
extern int spa_vdev_split_mirror(spa_t *spa, char *newname, nvlist_t *config,
|
extern int spa_vdev_split_mirror(spa_t *spa, const char *newname,
|
||||||
nvlist_t *props, boolean_t exp);
|
nvlist_t *config, nvlist_t *props, boolean_t exp);
|
||||||
|
|
||||||
/* spare state (which is global across all pools) */
|
/* spare state (which is global across all pools) */
|
||||||
extern void spa_spare_add(vdev_t *vd);
|
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);
|
extern spa_t *spa_next(spa_t *prev);
|
||||||
|
|
||||||
/* Refcount functions */
|
/* Refcount functions */
|
||||||
extern void spa_open_ref(spa_t *spa, void *tag);
|
extern void spa_open_ref(spa_t *spa, const void *tag);
|
||||||
extern void spa_close(spa_t *spa, void *tag);
|
extern void spa_close(spa_t *spa, const void *tag);
|
||||||
extern void spa_async_close(spa_t *spa, void *tag);
|
extern void spa_async_close(spa_t *spa, const void *tag);
|
||||||
extern boolean_t spa_refcount_zero(spa_t *spa);
|
extern boolean_t spa_refcount_zero(spa_t *spa);
|
||||||
|
|
||||||
#define SCL_NONE 0x00
|
#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);
|
spa_load_state_t spa_load_state);
|
||||||
|
|
||||||
/* Pool configuration locks */
|
/* 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_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 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);
|
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 void zfs_fuid_info_free(zfs_fuid_info_t *);
|
||||||
extern boolean_t zfs_groupmember(zfsvfs_t *, uint64_t, cred_t *);
|
extern boolean_t zfs_groupmember(zfsvfs_t *, uint64_t, cred_t *);
|
||||||
void zfs_fuid_sync(zfsvfs_t *, dmu_tx_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 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 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,
|
extern int zfs_id_to_fuidstr(zfsvfs_t *zfsvfs, const char *domain, uid_t rid,
|
||||||
char *buf, size_t len, boolean_t addok);
|
char *buf, size_t len, boolean_t addok);
|
||||||
#endif
|
#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 *);
|
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 *);
|
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 *);
|
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_init_t *ci_tmpl_init;
|
||||||
zio_checksum_tmpl_free_t *ci_tmpl_free;
|
zio_checksum_tmpl_free_t *ci_tmpl_free;
|
||||||
zio_checksum_flags_t ci_flags;
|
zio_checksum_flags_t ci_flags;
|
||||||
char *ci_name; /* descriptive name */
|
const char *ci_name; /* descriptive name */
|
||||||
} zio_checksum_info_t;
|
} zio_checksum_info_t;
|
||||||
|
|
||||||
typedef struct zio_bad_cksum {
|
typedef struct zio_bad_cksum {
|
||||||
@ -102,7 +102,7 @@ typedef struct zio_bad_cksum {
|
|||||||
uint8_t zbc_has_cksum; /* expected/actual valid */
|
uint8_t zbc_has_cksum; /* expected/actual valid */
|
||||||
} zio_bad_cksum_t;
|
} 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];
|
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.
|
* Information about each compression function.
|
||||||
*/
|
*/
|
||||||
typedef const struct zio_compress_info {
|
typedef const struct zio_compress_info {
|
||||||
char *ci_name;
|
const char *ci_name;
|
||||||
int ci_level;
|
int ci_level;
|
||||||
zio_compress_func_t *ci_compress;
|
zio_compress_func_t *ci_compress;
|
||||||
zio_decompress_func_t *ci_decompress;
|
zio_decompress_func_t *ci_decompress;
|
||||||
zio_decompresslevel_func_t *ci_decompress_level;
|
zio_decompresslevel_func_t *ci_decompress_level;
|
||||||
} zio_compress_info_t;
|
} 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
|
* lz4 compression init & free
|
||||||
|
@ -67,7 +67,7 @@ typedef struct zio_crypt_info {
|
|||||||
size_t ci_keylen;
|
size_t ci_keylen;
|
||||||
|
|
||||||
/* human-readable name of the encryption algorithm */
|
/* human-readable name of the encryption algorithm */
|
||||||
char *ci_name;
|
const char *ci_name;
|
||||||
} zio_crypt_info_t;
|
} zio_crypt_info_t;
|
||||||
|
|
||||||
extern const zio_crypt_info_t zio_crypt_table[ZIO_CRYPT_FUNCTIONS];
|
extern const zio_crypt_info_t zio_crypt_table[ZIO_CRYPT_FUNCTIONS];
|
||||||
|
@ -34,7 +34,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
_ZFS_COMUTIL_H boolean_t zfs_allocatable_devs(nvlist_t *);
|
_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 void zpool_get_load_policy(nvlist_t *, zpool_load_policy_t *);
|
||||||
|
|
||||||
_ZFS_COMUTIL_H int zfs_zpl_version_map(int spa_version);
|
_ZFS_COMUTIL_H int zfs_zpl_version_map(int spa_version);
|
||||||
|
@ -81,7 +81,7 @@ typedef enum {
|
|||||||
} zfs_deleg_note_t;
|
} zfs_deleg_note_t;
|
||||||
|
|
||||||
typedef struct zfs_deleg_perm_tab {
|
typedef struct zfs_deleg_perm_tab {
|
||||||
char *z_perm;
|
const char *z_perm;
|
||||||
zfs_deleg_note_t z_note;
|
zfs_deleg_note_t z_note;
|
||||||
} zfs_deleg_perm_tab_t;
|
} 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 _sol_getmntent(FILE *fp, struct mnttab *mp);
|
||||||
extern int getextmntent(const char *path, struct extmnttab *mp,
|
extern int getextmntent(const char *path, struct extmnttab *mp,
|
||||||
struct stat64 *statbuf);
|
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;
|
struct mntent mnt_new;
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ umem_nofail_callback(umem_nofail_callback_t *cb __maybe_unused)
|
|||||||
|
|
||||||
static inline umem_cache_t *
|
static inline umem_cache_t *
|
||||||
umem_cache_create(
|
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_constructor_t *constructor,
|
||||||
umem_destructor_t *destructor,
|
umem_destructor_t *destructor,
|
||||||
umem_reclaim_t *reclaim,
|
umem_reclaim_t *reclaim,
|
||||||
|
@ -849,7 +849,8 @@ encryption_feature_is_enabled(zpool_handle_t *zph)
|
|||||||
static int
|
static int
|
||||||
populate_create_encryption_params_nvlists(libzfs_handle_t *hdl,
|
populate_create_encryption_params_nvlists(libzfs_handle_t *hdl,
|
||||||
zfs_handle_t *zhp, boolean_t newkey, zfs_keyformat_t keyformat,
|
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;
|
int ret;
|
||||||
uint64_t iters = 0, salt = 0;
|
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 */
|
/* default to prompt if no keylocation is specified */
|
||||||
if (keyformat != ZFS_KEYFORMAT_NONE && keylocation == NULL) {
|
if (keyformat != ZFS_KEYFORMAT_NONE && keylocation == NULL) {
|
||||||
keylocation = "prompt";
|
keylocation = (char *)"prompt";
|
||||||
ret = nvlist_add_string(props,
|
ret = nvlist_add_string(props,
|
||||||
zfs_prop_to_name(ZFS_PROP_KEYLOCATION), keylocation);
|
zfs_prop_to_name(ZFS_PROP_KEYLOCATION), keylocation);
|
||||||
if (ret != 0)
|
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 */
|
/* default to prompt if no keylocation is specified */
|
||||||
if (keylocation == NULL) {
|
if (keylocation == NULL) {
|
||||||
keylocation = "prompt";
|
keylocation = (char *)"prompt";
|
||||||
ret = nvlist_add_string(props,
|
ret = nvlist_add_string(props,
|
||||||
zfs_prop_to_name(ZFS_PROP_KEYLOCATION),
|
zfs_prop_to_name(ZFS_PROP_KEYLOCATION),
|
||||||
keylocation);
|
keylocation);
|
||||||
|
@ -882,7 +882,7 @@ libzfs_mnttab_find(libzfs_handle_t *hdl, const char *fsname,
|
|||||||
return (ENOENT);
|
return (ENOENT);
|
||||||
|
|
||||||
srch.mnt_special = (char *)fsname;
|
srch.mnt_special = (char *)fsname;
|
||||||
srch.mnt_fstype = MNTTYPE_ZFS;
|
srch.mnt_fstype = (char *)MNTTYPE_ZFS;
|
||||||
ret = getmntany(mnttab, entry, &srch) ? ENOENT : 0;
|
ret = getmntany(mnttab, entry, &srch) ? ENOENT : 0;
|
||||||
(void) fclose(mnttab);
|
(void) fclose(mnttab);
|
||||||
return (ret);
|
return (ret);
|
||||||
@ -2051,7 +2051,7 @@ getprop_uint64(zfs_handle_t *zhp, zfs_prop_t prop, char **source)
|
|||||||
verify(!zhp->zfs_props_table ||
|
verify(!zhp->zfs_props_table ||
|
||||||
zhp->zfs_props_table[prop] == B_TRUE);
|
zhp->zfs_props_table[prop] == B_TRUE);
|
||||||
value = zfs_prop_default_numeric(prop);
|
value = zfs_prop_default_numeric(prop);
|
||||||
*source = "";
|
*source = (char *)"";
|
||||||
}
|
}
|
||||||
|
|
||||||
return (value);
|
return (value);
|
||||||
@ -2072,7 +2072,7 @@ getprop_string(zfs_handle_t *zhp, zfs_prop_t prop, char **source)
|
|||||||
verify(!zhp->zfs_props_table ||
|
verify(!zhp->zfs_props_table ||
|
||||||
zhp->zfs_props_table[prop] == B_TRUE);
|
zhp->zfs_props_table[prop] == B_TRUE);
|
||||||
value = zfs_prop_default_string(prop);
|
value = zfs_prop_default_string(prop);
|
||||||
*source = "";
|
*source = (char *)"";
|
||||||
}
|
}
|
||||||
|
|
||||||
return (value);
|
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"};
|
zfs_cmd_t zc = {"\0"};
|
||||||
nvlist_t *zplprops = NULL;
|
nvlist_t *zplprops = NULL;
|
||||||
struct mnttab mnt;
|
struct mnttab mnt;
|
||||||
char *mntopt_on = NULL;
|
const char *mntopt_on = NULL;
|
||||||
char *mntopt_off = NULL;
|
const char *mntopt_off = NULL;
|
||||||
boolean_t received = zfs_is_recvd_props_mode(zhp);
|
boolean_t received = zfs_is_recvd_props_mode(zhp);
|
||||||
|
|
||||||
*source = NULL;
|
*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)
|
if (zhp->zfs_mntopts == NULL)
|
||||||
mnt.mnt_mntopts = "";
|
mnt.mnt_mntopts = (char *)"";
|
||||||
else
|
else
|
||||||
mnt.mnt_mntopts = zhp->zfs_mntopts;
|
mnt.mnt_mntopts = zhp->zfs_mntopts;
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ typedef struct differ_info {
|
|||||||
int datafd;
|
int datafd;
|
||||||
} differ_info_t;
|
} 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);
|
int flags);
|
||||||
extern int do_unmount(zfs_handle_t *zhp, const char *mntpt, int flags);
|
extern int do_unmount(zfs_handle_t *zhp, const char *mntpt, int flags);
|
||||||
extern int libzfs_load_module(void);
|
extern int libzfs_load_module(void);
|
||||||
|
@ -289,7 +289,7 @@ zfs_is_mountable(zfs_handle_t *zhp, char *buf, size_t buflen,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
zfs_add_option(zfs_handle_t *zhp, char *options, int len,
|
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;
|
char *source;
|
||||||
uint64_t value;
|
uint64_t value;
|
||||||
|
@ -119,7 +119,7 @@ zpool_get_prop_string(zpool_handle_t *zhp, zpool_prop_t prop,
|
|||||||
zprop_source_t *src)
|
zprop_source_t *src)
|
||||||
{
|
{
|
||||||
nvlist_t *nv, *nvl;
|
nvlist_t *nv, *nvl;
|
||||||
char *value;
|
const char *value;
|
||||||
zprop_source_t source;
|
zprop_source_t source;
|
||||||
|
|
||||||
nvl = zhp->zpool_props;
|
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);
|
value = fnvlist_lookup_string(nv, ZPROP_VALUE);
|
||||||
} else {
|
} else {
|
||||||
source = ZPROP_SRC_DEFAULT;
|
source = ZPROP_SRC_DEFAULT;
|
||||||
if ((value = (char *)zpool_prop_default_string(prop)) == NULL)
|
if ((value = zpool_prop_default_string(prop)) == NULL)
|
||||||
value = "-";
|
value = "-";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2111,7 +2111,7 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
|
|||||||
case EREMOTEIO:
|
case EREMOTEIO:
|
||||||
if (nv != NULL && nvlist_lookup_nvlist(nv,
|
if (nv != NULL && nvlist_lookup_nvlist(nv,
|
||||||
ZPOOL_CONFIG_LOAD_INFO, &nvinfo) == 0) {
|
ZPOOL_CONFIG_LOAD_INFO, &nvinfo) == 0) {
|
||||||
char *hostname = "<unknown>";
|
const char *hostname = "<unknown>";
|
||||||
uint64_t hostid = 0;
|
uint64_t hostid = 0;
|
||||||
mmp_state_t mmp_state;
|
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)
|
char *buf, size_t len, zprop_source_t *srctype, boolean_t literal)
|
||||||
{
|
{
|
||||||
nvlist_t *nv;
|
nvlist_t *nv;
|
||||||
char *strval;
|
const char *strval;
|
||||||
uint64_t intval;
|
uint64_t intval;
|
||||||
zprop_source_t src = ZPROP_SRC_NONE;
|
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);
|
strval = fnvlist_lookup_string(nv, ZPROP_VALUE);
|
||||||
} else {
|
} else {
|
||||||
src = ZPROP_SRC_DEFAULT;
|
src = ZPROP_SRC_DEFAULT;
|
||||||
if ((strval = (char *)vdev_prop_default_string(prop))
|
if ((strval = vdev_prop_default_string(prop)) == NULL)
|
||||||
== NULL)
|
|
||||||
strval = "-";
|
strval = "-";
|
||||||
}
|
}
|
||||||
(void) strlcpy(buf, strval, len);
|
(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 */
|
/* name of filesystem/volume that contains snapshot we are sending */
|
||||||
char tofs[ZFS_MAX_DATASET_NAME_LEN];
|
char tofs[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
/* short name of snap we are sending */
|
/* short name of snap we are sending */
|
||||||
char *tosnap = "";
|
const char *tosnap = "";
|
||||||
|
|
||||||
char errbuf[ERRBUFLEN];
|
char errbuf[ERRBUFLEN];
|
||||||
(void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
|
(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
|
* 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.
|
* 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-14", /* ZPOOL_STATUS_CORRUPT_CACHE */
|
||||||
"ZFS-8000-2Q", /* ZPOOL_STATUS_MISSING_DEV_R */
|
"ZFS-8000-2Q", /* ZPOOL_STATUS_MISSING_DEV_R */
|
||||||
"ZFS-8000-3C", /* ZPOOL_STATUS_MISSING_DEV_NR */
|
"ZFS-8000-3C", /* ZPOOL_STATUS_MISSING_DEV_NR */
|
||||||
@ -495,7 +495,8 @@ check_status(nvlist_t *config, boolean_t isimport,
|
|||||||
}
|
}
|
||||||
|
|
||||||
zpool_status_t
|
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
|
* 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_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);
|
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.
|
* Returns 0 otherwise.
|
||||||
*/
|
*/
|
||||||
int
|
boolean_t
|
||||||
libzfs_envvar_is_set(char *envvar)
|
libzfs_envvar_is_set(const char *envvar)
|
||||||
{
|
{
|
||||||
char *env = getenv(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, "YES", 3) && strnlen(env, 4) == 3) ||
|
||||||
(!strncasecmp(env, "ON", 2) && strnlen(env, 3) == 2)))
|
(!strncasecmp(env, "ON", 2) && strnlen(env, 3) == 2)));
|
||||||
return (1);
|
|
||||||
|
|
||||||
return (0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
libzfs_handle_t *
|
libzfs_handle_t *
|
||||||
@ -2002,22 +1999,22 @@ use_color(void)
|
|||||||
* color_end();
|
* color_end();
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
color_start(char *color)
|
color_start(const char *color)
|
||||||
{
|
{
|
||||||
if (use_color())
|
if (use_color())
|
||||||
printf("%s", color);
|
fputs(color, stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
color_end(void)
|
color_end(void)
|
||||||
{
|
{
|
||||||
if (use_color())
|
if (use_color())
|
||||||
printf(ANSI_RESET);
|
fputs(ANSI_RESET, stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* printf() with a color. If color is NULL, then do a normal printf. */
|
/* printf() with a color. If color is NULL, then do a normal printf. */
|
||||||
int
|
int
|
||||||
printf_color(char *color, char *format, ...)
|
printf_color(const char *color, const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list aptr;
|
va_list aptr;
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -74,7 +74,7 @@ build_iovec(struct iovec **iov, int *iovlen, const char *name, void *val,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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)
|
char *dataptr, int datalen, char *optptr, int optlen)
|
||||||
{
|
{
|
||||||
struct iovec *iov;
|
struct iovec *iov;
|
||||||
@ -83,8 +83,6 @@ do_mount_(const char *spec, const char *dir, int mflag, char *fstype,
|
|||||||
|
|
||||||
assert(spec != NULL);
|
assert(spec != NULL);
|
||||||
assert(dir != NULL);
|
assert(dir != NULL);
|
||||||
assert(fstype != NULL);
|
|
||||||
assert(strcmp(fstype, MNTTYPE_ZFS) == 0);
|
|
||||||
assert(dataptr == NULL), (void) dataptr;
|
assert(dataptr == NULL), (void) dataptr;
|
||||||
assert(datalen == 0), (void) datalen;
|
assert(datalen == 0), (void) datalen;
|
||||||
assert(optptr != NULL);
|
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);
|
build_iovec(&iov, &iovlen, "update", NULL, 0);
|
||||||
if (mflag & MS_RDONLY)
|
if (mflag & MS_RDONLY)
|
||||||
build_iovec(&iov, &iovlen, "ro", NULL, 0);
|
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),
|
build_iovec(&iov, &iovlen, "fspath", __DECONST(char *, dir),
|
||||||
(size_t)-1);
|
(size_t)-1);
|
||||||
build_iovec(&iov, &iovlen, "from", __DECONST(char *, spec), (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
|
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)));
|
opts, sizeof (mntpt)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ out:
|
|||||||
* otherwise they are considered fatal are copied in to badopt.
|
* otherwise they are considered fatal are copied in to badopt.
|
||||||
*/
|
*/
|
||||||
int
|
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)
|
unsigned long *zfsflags, int sloppy, char *badopt, char *mtabopt)
|
||||||
{
|
{
|
||||||
int error = 0, quote = 0, flag = 0, count = 0;
|
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.
|
* make due with return value from the mount process.
|
||||||
*/
|
*/
|
||||||
int
|
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);
|
const char *src = zfs_get_name(zhp);
|
||||||
int error = 0;
|
int error = 0;
|
||||||
@ -341,10 +341,10 @@ do_mount(zfs_handle_t *zhp, const char *mntpt, char *opts, int flags)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
char *argv[9] = {
|
char *argv[9] = {
|
||||||
"/bin/mount",
|
(char *)"/bin/mount",
|
||||||
"--no-canonicalize",
|
(char *)"--no-canonicalize",
|
||||||
"-t", MNTTYPE_ZFS,
|
(char *)"-t", (char *)MNTTYPE_ZFS,
|
||||||
"-o", opts,
|
(char *)"-o", (char *)opts,
|
||||||
(char *)src,
|
(char *)src,
|
||||||
(char *)mntpt,
|
(char *)mntpt,
|
||||||
(char *)NULL };
|
(char *)NULL };
|
||||||
@ -384,23 +384,17 @@ do_unmount(zfs_handle_t *zhp, const char *mntpt, int flags)
|
|||||||
return (rv < 0 ? errno : 0);
|
return (rv < 0 ? errno : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
char force_opt[] = "-f";
|
|
||||||
char lazy_opt[] = "-l";
|
|
||||||
char *argv[7] = {
|
char *argv[7] = {
|
||||||
"/bin/umount",
|
(char *)"/bin/umount",
|
||||||
"-t", MNTTYPE_ZFS,
|
(char *)"-t", (char *)MNTTYPE_ZFS,
|
||||||
NULL, NULL, NULL, NULL };
|
NULL, NULL, NULL, NULL };
|
||||||
int rc, count = 3;
|
int rc, count = 3;
|
||||||
|
|
||||||
if (flags & MS_FORCE) {
|
if (flags & MS_FORCE)
|
||||||
argv[count] = force_opt;
|
argv[count++] = (char *)"-f";
|
||||||
count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flags & MS_DETACH) {
|
if (flags & MS_DETACH)
|
||||||
argv[count] = lazy_opt;
|
argv[count++] = (char *)"-l";
|
||||||
count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
argv[count] = (char *)mntpt;
|
argv[count] = (char *)mntpt;
|
||||||
rc = libzfs_run_process(argv[0], argv, STDOUT_VERBOSE|STDERR_VERBOSE);
|
rc = libzfs_run_process(argv[0], argv, STDOUT_VERBOSE|STDERR_VERBOSE);
|
||||||
|
@ -99,7 +99,7 @@ libzfs_load_module(void)
|
|||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
if (access(ZFS_SYSFS_DIR, F_OK) != 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))
|
if (libzfs_run_process("modprobe", argv, 0))
|
||||||
return (ENOEXEC);
|
return (ENOEXEC);
|
||||||
|
|
||||||
|
@ -1002,8 +1002,6 @@ kmem_cache_reap_active(void)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *zvol_tag = "zvol_tag";
|
|
||||||
|
|
||||||
void
|
void
|
||||||
zvol_create_minor(const char *name)
|
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) {
|
if (desc != NULL) {
|
||||||
char *suffix = "", *bias = NULL;
|
const char *suffix = "";
|
||||||
|
char *bias = NULL;
|
||||||
char bias_suffix[32];
|
char bias_suffix[32];
|
||||||
|
|
||||||
(void) nvlist_lookup_uint64(nv, ZPOOL_CONFIG_IS_LOG, &is_log);
|
(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;
|
int len;
|
||||||
if (nvlist_lookup_string(cnv, ZPOOL_CONFIG_PATH, &cname) &&
|
if (nvlist_lookup_string(cnv, ZPOOL_CONFIG_PATH, &cname) &&
|
||||||
nvlist_lookup_string(cnv, ZPOOL_CONFIG_TYPE, &cname))
|
nvlist_lookup_string(cnv, ZPOOL_CONFIG_TYPE, &cname))
|
||||||
cname = "<unknown>";
|
cname = (char *)"<unknown>";
|
||||||
len = strlen(cname) + 2;
|
len = strlen(cname) + 2;
|
||||||
tname = umem_zalloc(len, UMEM_NOFAIL);
|
tname = umem_zalloc(len, UMEM_NOFAIL);
|
||||||
(void) strlcpy(tname, cname, len);
|
(void) strlcpy(tname, cname, len);
|
||||||
|
@ -328,7 +328,9 @@ zpool_find_import_blkid(libpc_handle_t *hdl, pthread_mutex_t *lock,
|
|||||||
return (EINVAL);
|
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) {
|
if (error != 0) {
|
||||||
blkid_dev_iterate_end(iter);
|
blkid_dev_iterate_end(iter);
|
||||||
blkid_put_cache(cache);
|
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 (nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0) {
|
||||||
if ((dl = zfs_dirnamelen(path)) == -1)
|
if ((dl = zfs_dirnamelen(path)) == -1)
|
||||||
path = ".";
|
path = (char *)".";
|
||||||
else
|
else
|
||||||
path[dl] = '\0';
|
path[dl] = '\0';
|
||||||
return (zpool_find_import_scan_dir(hdl, lock, cache,
|
return (zpool_find_import_scan_dir(hdl, lock, cache,
|
||||||
|
@ -337,7 +337,7 @@ aes_impl_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct {
|
static const struct {
|
||||||
char *name;
|
const char *name;
|
||||||
uint32_t sel;
|
uint32_t sel;
|
||||||
} aes_impl_opts[] = {
|
} aes_impl_opts[] = {
|
||||||
{ "cycle", IMPL_CYCLE },
|
{ "cycle", IMPL_CYCLE },
|
||||||
|
@ -907,7 +907,7 @@ gcm_impl_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct {
|
static const struct {
|
||||||
char *name;
|
const char *name;
|
||||||
uint32_t sel;
|
uint32_t sel;
|
||||||
} gcm_impl_opts[] = {
|
} gcm_impl_opts[] = {
|
||||||
{ "cycle", IMPL_CYCLE },
|
{ "cycle", IMPL_CYCLE },
|
||||||
|
@ -156,7 +156,7 @@ kmem_std_destructor(void *mem, int size __unused, void *private)
|
|||||||
}
|
}
|
||||||
|
|
||||||
kmem_cache_t *
|
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 *),
|
int (*constructor)(void *, void *, int), void (*destructor)(void *, void *),
|
||||||
void (*reclaim)(void *) __unused, void *private, vmem_t *vmp, int cflags)
|
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)
|
* KMC_NODEBUG Disable debugging (unsupported)
|
||||||
*/
|
*/
|
||||||
spl_kmem_cache_t *
|
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,
|
spl_kmem_ctor_t ctor, spl_kmem_dtor_t dtor, void *reclaim,
|
||||||
void *priv, void *vmp, int flags)
|
void *priv, void *vmp, int flags)
|
||||||
{
|
{
|
||||||
|
@ -68,7 +68,7 @@ zfs_allocatable_devs(nvlist_t *nv)
|
|||||||
* Are there special vdevs?
|
* Are there special vdevs?
|
||||||
*/
|
*/
|
||||||
boolean_t
|
boolean_t
|
||||||
zfs_special_devs(nvlist_t *nv, char *type)
|
zfs_special_devs(nvlist_t *nv, const char *type)
|
||||||
{
|
{
|
||||||
char *bias;
|
char *bias;
|
||||||
uint_t c;
|
uint_t c;
|
||||||
@ -84,11 +84,9 @@ zfs_special_devs(nvlist_t *nv, char *type)
|
|||||||
&bias) == 0) {
|
&bias) == 0) {
|
||||||
if (strcmp(bias, VDEV_ALLOC_BIAS_SPECIAL) == 0 ||
|
if (strcmp(bias, VDEV_ALLOC_BIAS_SPECIAL) == 0 ||
|
||||||
strcmp(bias, VDEV_ALLOC_BIAS_DEDUP) == 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);
|
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.
|
* it is not evictable.
|
||||||
*/
|
*/
|
||||||
static void
|
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;
|
arc_state_t *state;
|
||||||
|
|
||||||
@ -2740,8 +2740,8 @@ arc_can_share(arc_buf_hdr_t *hdr, arc_buf_t *buf)
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
arc_buf_alloc_impl(arc_buf_hdr_t *hdr, spa_t *spa, const zbookmark_phys_t *zb,
|
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,
|
const void *tag, boolean_t encrypted, boolean_t compressed,
|
||||||
boolean_t fill, arc_buf_t **ret)
|
boolean_t noauth, boolean_t fill, arc_buf_t **ret)
|
||||||
{
|
{
|
||||||
arc_buf_t *buf;
|
arc_buf_t *buf;
|
||||||
arc_fill_flags_t flags = ARC_FILL_LOCKED;
|
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);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *arc_onloan_tag = "onloan";
|
static const char *arc_onloan_tag = "onloan";
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
arc_loaned_bytes_update(int64_t delta)
|
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.
|
* The buf is returned thawed since we expect the consumer to modify it.
|
||||||
*/
|
*/
|
||||||
arc_buf_t *
|
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,
|
arc_buf_hdr_t *hdr = arc_hdr_alloc(spa_load_guid(spa), size, size,
|
||||||
B_FALSE, ZIO_COMPRESS_OFF, 0, type);
|
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.
|
* for bufs containing metadata.
|
||||||
*/
|
*/
|
||||||
arc_buf_t *
|
arc_buf_t *
|
||||||
arc_alloc_compressed_buf(spa_t *spa, void *tag, uint64_t psize, uint64_t lsize,
|
arc_alloc_compressed_buf(spa_t *spa, const void *tag, uint64_t psize,
|
||||||
enum zio_compress compression_type, uint8_t complevel)
|
uint64_t lsize, enum zio_compress compression_type, uint8_t complevel)
|
||||||
{
|
{
|
||||||
ASSERT3U(lsize, >, 0);
|
ASSERT3U(lsize, >, 0);
|
||||||
ASSERT3U(lsize, >=, psize);
|
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_buf_t *
|
||||||
arc_alloc_raw_buf(spa_t *spa, void *tag, uint64_t dsobj, boolean_t byteorder,
|
arc_alloc_raw_buf(spa_t *spa, const void *tag, uint64_t dsobj,
|
||||||
const uint8_t *salt, const uint8_t *iv, const uint8_t *mac,
|
boolean_t byteorder, const uint8_t *salt, const uint8_t *iv,
|
||||||
dmu_object_type_t ot, uint64_t psize, uint64_t lsize,
|
const uint8_t *mac, dmu_object_type_t ot, uint64_t psize, uint64_t lsize,
|
||||||
enum zio_compress compression_type, uint8_t complevel)
|
enum zio_compress compression_type, uint8_t complevel)
|
||||||
{
|
{
|
||||||
arc_buf_hdr_t *hdr;
|
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.
|
* used when modifying or reading db_blkptr.
|
||||||
*/
|
*/
|
||||||
db_lock_type_t
|
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;
|
enum db_lock_type ret = DLT_NONE;
|
||||||
if (db->db_parent != NULL) {
|
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.
|
* panic if we didn't pass the lock type in.
|
||||||
*/
|
*/
|
||||||
void
|
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)
|
if (type == DLT_PARENT)
|
||||||
rw_exit(&db->db_parent->db_rwlock);
|
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
|
static int
|
||||||
dbuf_read_impl(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags,
|
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;
|
dnode_t *dn;
|
||||||
zbookmark_phys_t zb;
|
zbookmark_phys_t zb;
|
||||||
@ -3532,7 +3532,7 @@ dbuf_hold_copy(dnode_t *dn, dmu_buf_impl_t *db)
|
|||||||
int
|
int
|
||||||
dbuf_hold_impl(dnode_t *dn, uint8_t level, uint64_t blkid,
|
dbuf_hold_impl(dnode_t *dn, uint8_t level, uint64_t blkid,
|
||||||
boolean_t fail_sparse, boolean_t fail_uncached,
|
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;
|
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 *
|
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));
|
return (dbuf_hold_level(dn, 0, blkid, tag));
|
||||||
}
|
}
|
||||||
|
|
||||||
dmu_buf_impl_t *
|
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;
|
dmu_buf_impl_t *db;
|
||||||
int err = dbuf_hold_impl(dn, level, blkid, FALSE, FALSE, tag, &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
|
#pragma weak dmu_buf_add_ref = dbuf_add_ref
|
||||||
void
|
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);
|
int64_t holds = zfs_refcount_add(&db->db_holds, tag);
|
||||||
VERIFY3S(holds, >, 1);
|
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
|
#pragma weak dmu_buf_try_add_ref = dbuf_try_add_ref
|
||||||
boolean_t
|
boolean_t
|
||||||
dbuf_try_add_ref(dmu_buf_t *db_fake, objset_t *os, uint64_t obj, uint64_t blkid,
|
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 *db = (dmu_buf_impl_t *)db_fake;
|
||||||
dmu_buf_impl_t *found_db;
|
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.
|
* dnode's parent dbuf evicting its dnode handles.
|
||||||
*/
|
*/
|
||||||
void
|
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);
|
mutex_enter(&db->db_mtx);
|
||||||
dbuf_rele_and_unlock(db, tag, B_FALSE);
|
dbuf_rele_and_unlock(db, tag, B_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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);
|
dbuf_rele((dmu_buf_impl_t *)db, tag);
|
||||||
}
|
}
|
||||||
@ -3748,7 +3748,7 @@ dmu_buf_rele(dmu_buf_t *db, void *tag)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void
|
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;
|
int64_t holds;
|
||||||
uint64_t size;
|
uint64_t size;
|
||||||
|
@ -160,7 +160,7 @@ const dmu_object_byteswap_info_t dmu_ot_byteswap[DMU_BSWAP_NUMFUNCS] = {
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
dmu_buf_hold_noread_by_dnode(dnode_t *dn, uint64_t offset,
|
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;
|
uint64_t blkid;
|
||||||
dmu_buf_impl_t *db;
|
dmu_buf_impl_t *db;
|
||||||
@ -180,7 +180,7 @@ dmu_buf_hold_noread_by_dnode(dnode_t *dn, uint64_t offset,
|
|||||||
}
|
}
|
||||||
int
|
int
|
||||||
dmu_buf_hold_noread(objset_t *os, uint64_t object, uint64_t offset,
|
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;
|
dnode_t *dn;
|
||||||
uint64_t blkid;
|
uint64_t blkid;
|
||||||
@ -207,7 +207,7 @@ dmu_buf_hold_noread(objset_t *os, uint64_t object, uint64_t offset,
|
|||||||
|
|
||||||
int
|
int
|
||||||
dmu_buf_hold_by_dnode(dnode_t *dn, uint64_t offset,
|
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 err;
|
||||||
int db_flags = DB_RF_CANFAIL;
|
int db_flags = DB_RF_CANFAIL;
|
||||||
@ -232,7 +232,7 @@ dmu_buf_hold_by_dnode(dnode_t *dn, uint64_t offset,
|
|||||||
|
|
||||||
int
|
int
|
||||||
dmu_buf_hold(objset_t *os, uint64_t object, uint64_t offset,
|
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 err;
|
||||||
int db_flags = DB_RF_CANFAIL;
|
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.
|
* has not yet been allocated a new bonus dbuf a will be allocated.
|
||||||
* Returns ENOENT, EIO, or 0.
|
* 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)
|
uint32_t flags)
|
||||||
{
|
{
|
||||||
dmu_buf_impl_t *db;
|
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
|
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;
|
dnode_t *dn;
|
||||||
int error;
|
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.
|
* dmu_spill_hold_existing() should be used.
|
||||||
*/
|
*/
|
||||||
int
|
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;
|
dmu_buf_impl_t *db = NULL;
|
||||||
int err;
|
int err;
|
||||||
@ -442,7 +443,7 @@ dmu_spill_hold_by_dnode(dnode_t *dn, uint32_t flags, void *tag, dmu_buf_t **dbp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
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;
|
dmu_buf_impl_t *db = (dmu_buf_impl_t *)bonus;
|
||||||
dnode_t *dn;
|
dnode_t *dn;
|
||||||
@ -471,7 +472,7 @@ dmu_spill_hold_existing(dmu_buf_t *bonus, void *tag, dmu_buf_t **dbp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
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_t **dbp)
|
||||||
{
|
{
|
||||||
dmu_buf_impl_t *db = (dmu_buf_impl_t *)bonus;
|
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
|
int
|
||||||
dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset, uint64_t length,
|
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;
|
dmu_buf_t **dbp;
|
||||||
zstream_t *zs = NULL;
|
zstream_t *zs = NULL;
|
||||||
@ -619,7 +621,8 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset, uint64_t length,
|
|||||||
|
|
||||||
int
|
int
|
||||||
dmu_buf_hold_array(objset_t *os, uint64_t object, uint64_t offset,
|
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;
|
dnode_t *dn;
|
||||||
int err;
|
int err;
|
||||||
@ -638,7 +641,7 @@ dmu_buf_hold_array(objset_t *os, uint64_t object, uint64_t offset,
|
|||||||
|
|
||||||
int
|
int
|
||||||
dmu_buf_hold_array_by_bonus(dmu_buf_t *db_fake, uint64_t offset,
|
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_t ***dbpp)
|
||||||
{
|
{
|
||||||
dmu_buf_impl_t *db = (dmu_buf_impl_t *)db_fake;
|
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
|
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;
|
int i;
|
||||||
dmu_buf_impl_t **dbp = (dmu_buf_impl_t **)dbp_fake;
|
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
|
static uint64_t
|
||||||
dmu_object_alloc_impl(objset_t *os, dmu_object_type_t ot, int blocksize,
|
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 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 object;
|
||||||
uint64_t L1_dnode_count = DNODES_PER_BLOCK <<
|
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
|
uint64_t
|
||||||
dmu_object_alloc_hold(objset_t *os, dmu_object_type_t ot, int blocksize,
|
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 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,
|
return (dmu_object_alloc_impl(os, ot, blocksize, indirect_blockshift,
|
||||||
bonustype, bonuslen, dnodesize, allocated_dnode, tag, tx));
|
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.
|
* can be held at a time.
|
||||||
*/
|
*/
|
||||||
int
|
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)
|
objset_t **osp)
|
||||||
{
|
{
|
||||||
dsl_pool_t *dp;
|
dsl_pool_t *dp;
|
||||||
@ -742,14 +742,14 @@ dmu_objset_hold_flags(const char *name, boolean_t decrypt, void *tag,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
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));
|
return (dmu_objset_hold_flags(name, B_FALSE, tag, osp));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
dmu_objset_own_impl(dsl_dataset_t *ds, dmu_objset_type_t type,
|
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;
|
(void) tag;
|
||||||
|
|
||||||
@ -789,7 +789,7 @@ dmu_objset_own_impl(dsl_dataset_t *ds, dmu_objset_type_t type,
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
dmu_objset_own(const char *name, dmu_objset_type_t type,
|
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_pool_t *dp;
|
||||||
dsl_dataset_t *ds;
|
dsl_dataset_t *ds;
|
||||||
@ -834,7 +834,7 @@ dmu_objset_own(const char *name, dmu_objset_type_t type,
|
|||||||
|
|
||||||
int
|
int
|
||||||
dmu_objset_own_obj(dsl_pool_t *dp, uint64_t obj, dmu_objset_type_t type,
|
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;
|
dsl_dataset_t *ds;
|
||||||
int err;
|
int err;
|
||||||
@ -855,7 +855,7 @@ dmu_objset_own_obj(dsl_pool_t *dp, uint64_t obj, dmu_objset_type_t type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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;
|
ds_hold_flags_t flags;
|
||||||
dsl_pool_t *dp = dmu_objset_pool(os);
|
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
|
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);
|
dmu_objset_rele_flags(os, B_FALSE, tag);
|
||||||
}
|
}
|
||||||
@ -884,7 +884,7 @@ dmu_objset_rele(objset_t *os, void *tag)
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
dmu_objset_refresh_ownership(dsl_dataset_t *ds, dsl_dataset_t **newds,
|
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;
|
dsl_pool_t *dp;
|
||||||
char name[ZFS_MAX_DATASET_NAME_LEN];
|
char name[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
@ -904,7 +904,7 @@ dmu_objset_refresh_ownership(dsl_dataset_t *ds, dsl_dataset_t **newds,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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;
|
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_queue_ff = 20;
|
||||||
static int zfs_recv_write_batch_size = 1024 * 1024;
|
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";
|
const char *const recv_clone_name = "%recv";
|
||||||
|
|
||||||
static int receive_read_payload_and_next_header(dmu_recv_cookie_t *ra, int len,
|
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
|
int
|
||||||
dnode_hold_impl(objset_t *os, uint64_t object, int flag, int slots,
|
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 epb, idx, err;
|
||||||
int drop_struct_lock = FALSE;
|
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.
|
* Return held dnode if the object is allocated, NULL if not.
|
||||||
*/
|
*/
|
||||||
int
|
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,
|
return (dnode_hold_impl(os, object, DNODE_MUST_BE_ALLOCATED, 0, tag,
|
||||||
dnp));
|
dnp));
|
||||||
@ -1574,7 +1574,7 @@ dnode_hold(objset_t *os, uint64_t object, void *tag, dnode_t **dnp)
|
|||||||
* new reference.
|
* new reference.
|
||||||
*/
|
*/
|
||||||
boolean_t
|
boolean_t
|
||||||
dnode_add_ref(dnode_t *dn, void *tag)
|
dnode_add_ref(dnode_t *dn, const void *tag)
|
||||||
{
|
{
|
||||||
mutex_enter(&dn->dn_mtx);
|
mutex_enter(&dn->dn_mtx);
|
||||||
if (zfs_refcount_is_zero(&dn->dn_holds)) {
|
if (zfs_refcount_is_zero(&dn->dn_holds)) {
|
||||||
@ -1587,14 +1587,14 @@ dnode_add_ref(dnode_t *dn, void *tag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dnode_rele(dnode_t *dn, void *tag)
|
dnode_rele(dnode_t *dn, const void *tag)
|
||||||
{
|
{
|
||||||
mutex_enter(&dn->dn_mtx);
|
mutex_enter(&dn->dn_mtx);
|
||||||
dnode_rele_and_unlock(dn, tag, B_FALSE);
|
dnode_rele_and_unlock(dn, tag, B_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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;
|
uint64_t refs;
|
||||||
/* Get while the hold prevents the dnode from moving. */
|
/* 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
|
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
|
* 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
|
* The empty-string name can't be in the AVL, and it compares
|
||||||
* before any entries with this TXG.
|
* before any entries with this TXG.
|
||||||
*/
|
*/
|
||||||
search.dbn_name = "";
|
search.dbn_name = (char *)"";
|
||||||
VERIFY3P(avl_find(&head->ds_bookmarks, &search, &idx), ==, NULL);
|
VERIFY3P(avl_find(&head->ds_bookmarks, &search, &idx), ==, NULL);
|
||||||
dsl_bookmark_node_t *dbn =
|
dsl_bookmark_node_t *dbn =
|
||||||
avl_nearest(&head->ds_bookmarks, idx, AVL_AFTER);
|
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
|
* The empty-string name can't be in the AVL, and it compares
|
||||||
* before any entries with this TXG.
|
* before any entries with this TXG.
|
||||||
*/
|
*/
|
||||||
search.dbn_name = "";
|
search.dbn_name = (char *)"";
|
||||||
VERIFY3P(avl_find(&head->ds_bookmarks, &search, &idx), ==, NULL);
|
VERIFY3P(avl_find(&head->ds_bookmarks, &search, &idx), ==, NULL);
|
||||||
dsl_bookmark_node_t *dbn =
|
dsl_bookmark_node_t *dbn =
|
||||||
avl_nearest(&head->ds_bookmarks, idx, AVL_AFTER);
|
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_crypto_params_t *dcp = skcka->skcka_cp;
|
||||||
dsl_wrapping_key_t *wkey = NULL, *found_wkey;
|
dsl_wrapping_key_t *wkey = NULL, *found_wkey;
|
||||||
dsl_wrapping_key_t wkey_search;
|
dsl_wrapping_key_t wkey_search;
|
||||||
char *keylocation = dcp->cp_keylocation;
|
const char *keylocation = dcp->cp_keylocation;
|
||||||
uint64_t rddobj, new_rddobj;
|
uint64_t rddobj, new_rddobj;
|
||||||
|
|
||||||
/* create and initialize the wrapping key */
|
/* 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;
|
uint8_t *keydata, *hmac_keydata, *iv, *mac;
|
||||||
uint64_t crypt, key_guid, keyformat, iters, salt;
|
uint64_t crypt, key_guid, keyformat, iters, salt;
|
||||||
uint64_t version = ZIO_CRYPT_KEY_CURRENT_VERSION;
|
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 */
|
/* lookup the values we need to create the DSL Crypto Key */
|
||||||
crypt = fnvlist_lookup_uint64(nvl, DSL_CRYPTO_KEY_CRYPTO_SUITE);
|
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
|
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;
|
dmu_buf_t *dbuf = ds->ds_dbuf;
|
||||||
boolean_t result = B_FALSE;
|
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
|
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)
|
dsl_dataset_t **dsp)
|
||||||
{
|
{
|
||||||
objset_t *mos = dp->dp_meta_objset;
|
objset_t *mos = dp->dp_meta_objset;
|
||||||
@ -758,7 +758,7 @@ dsl_dataset_create_key_mapping(dsl_dataset_t *ds)
|
|||||||
|
|
||||||
int
|
int
|
||||||
dsl_dataset_hold_obj_flags(dsl_pool_t *dp, uint64_t dsobj,
|
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;
|
int err;
|
||||||
|
|
||||||
@ -779,7 +779,7 @@ dsl_dataset_hold_obj_flags(dsl_pool_t *dp, uint64_t dsobj,
|
|||||||
|
|
||||||
int
|
int
|
||||||
dsl_dataset_hold_flags(dsl_pool_t *dp, const char *name, ds_hold_flags_t flags,
|
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;
|
dsl_dir_t *dd;
|
||||||
const char *snapname;
|
const char *snapname;
|
||||||
@ -832,7 +832,7 @@ dsl_dataset_hold_flags(dsl_pool_t *dp, const char *name, ds_hold_flags_t flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
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)
|
dsl_dataset_t **dsp)
|
||||||
{
|
{
|
||||||
return (dsl_dataset_hold_flags(dp, name, 0, tag, 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
|
static int
|
||||||
dsl_dataset_own_obj_impl(dsl_pool_t *dp, uint64_t dsobj, ds_hold_flags_t flags,
|
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);
|
int err = dsl_dataset_hold_obj_flags(dp, dsobj, flags, tag, dsp);
|
||||||
if (err != 0)
|
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
|
int
|
||||||
dsl_dataset_own_obj(dsl_pool_t *dp, uint64_t dsobj, ds_hold_flags_t flags,
|
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));
|
return (dsl_dataset_own_obj_impl(dp, dsobj, flags, tag, B_FALSE, dsp));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
dsl_dataset_own_obj_force(dsl_pool_t *dp, uint64_t dsobj,
|
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));
|
return (dsl_dataset_own_obj_impl(dp, dsobj, flags, tag, B_TRUE, dsp));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
dsl_dataset_own_impl(dsl_pool_t *dp, const char *name, ds_hold_flags_t flags,
|
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);
|
int err = dsl_dataset_hold_flags(dp, name, flags, tag, dsp);
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
@ -884,14 +884,14 @@ dsl_dataset_own_impl(dsl_pool_t *dp, const char *name, ds_hold_flags_t flags,
|
|||||||
|
|
||||||
int
|
int
|
||||||
dsl_dataset_own_force(dsl_pool_t *dp, const char *name, ds_hold_flags_t flags,
|
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));
|
return (dsl_dataset_own_impl(dp, name, flags, tag, B_TRUE, dsp));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
dsl_dataset_own(dsl_pool_t *dp, const char *name, ds_hold_flags_t flags,
|
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));
|
return (dsl_dataset_own_impl(dp, name, flags, tag, B_FALSE, dsp));
|
||||||
}
|
}
|
||||||
@ -970,7 +970,7 @@ dsl_dataset_namelen(dsl_dataset_t *ds)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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);
|
dmu_buf_rele(ds->ds_dbuf, tag);
|
||||||
}
|
}
|
||||||
@ -988,7 +988,8 @@ dsl_dataset_remove_key_mapping(dsl_dataset_t *ds)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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)
|
if (flags & DS_HOLD_FLAG_DECRYPT)
|
||||||
dsl_dataset_remove_key_mapping(ds);
|
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
|
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);
|
ASSERT3P(ds->ds_owner, ==, tag);
|
||||||
ASSERT(ds->ds_dbuf != NULL);
|
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
|
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;
|
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 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,
|
static int promote_hold(dsl_dataset_promote_arg_t *ddpa, dsl_pool_t *dp,
|
||||||
void *tag);
|
const void *tag);
|
||||||
static void promote_rele(dsl_dataset_promote_arg_t *ddpa, void *tag);
|
static void promote_rele(dsl_dataset_promote_arg_t *ddpa, const void *tag);
|
||||||
|
|
||||||
int
|
int
|
||||||
dsl_dataset_promote_check(void *arg, dmu_tx_t *tx)
|
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
|
static int
|
||||||
snaplist_make(dsl_pool_t *dp,
|
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;
|
uint64_t obj = last_obj;
|
||||||
|
|
||||||
@ -3784,7 +3785,7 @@ snaplist_space(list_t *l, uint64_t mintxg, uint64_t *spacep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
snaplist_destroy(list_t *l, void *tag)
|
snaplist_destroy(list_t *l, const void *tag)
|
||||||
{
|
{
|
||||||
struct promotenode *snap;
|
struct promotenode *snap;
|
||||||
|
|
||||||
@ -3800,7 +3801,7 @@ snaplist_destroy(list_t *l, void *tag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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;
|
int error;
|
||||||
dsl_dir_t *dd;
|
dsl_dir_t *dd;
|
||||||
@ -3850,7 +3851,7 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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->shared_snaps, tag);
|
||||||
snaplist_destroy(&ddpa->clone_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;
|
objset_t *os = dd->dd_pool->dp_meta_objset;
|
||||||
uint64_t limit, count;
|
uint64_t limit, count;
|
||||||
char *count_prop;
|
const char *count_prop;
|
||||||
enforce_res_t enforce;
|
enforce_res_t enforce;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
|
@ -1387,7 +1387,7 @@ dsl_pool_user_release(dsl_pool_t *dp, uint64_t dsobj, const char *tag,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
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;
|
spa_t *spa;
|
||||||
int error;
|
int error;
|
||||||
@ -1401,14 +1401,14 @@ dsl_pool_hold(const char *name, void *tag, dsl_pool_t **dp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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);
|
dsl_pool_config_exit(dp, tag);
|
||||||
spa_close(dp->dp_spa, tag);
|
spa_close(dp->dp_spa, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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.
|
* 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
|
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));
|
ASSERT(!rrw_held(&dp->dp_config_rwlock, RW_READER));
|
||||||
rrw_enter_read_prio(&dp->dp_config_rwlock, tag);
|
rrw_enter_read_prio(&dp->dp_config_rwlock, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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);
|
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);
|
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);
|
dsl_dataset_t **dsp);
|
||||||
|
|
||||||
typedef struct dsl_dataset_user_release_arg {
|
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 */
|
/* Place a dataset hold on the snapshot identified by passed dsobj string */
|
||||||
static int
|
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)
|
dsl_dataset_t **dsp)
|
||||||
{
|
{
|
||||||
return (dsl_dataset_hold_obj(dp, zfs_strtonum(dsobj, NULL), tag, 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;
|
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);
|
static __attribute__((noreturn)) void mmp_thread(void *arg);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -77,7 +77,7 @@ uint_t rrw_tsd_key;
|
|||||||
typedef struct rrw_node {
|
typedef struct rrw_node {
|
||||||
struct rrw_node *rn_next;
|
struct rrw_node *rn_next;
|
||||||
rrwlock_t *rn_rrl;
|
rrwlock_t *rn_rrl;
|
||||||
void *rn_tag;
|
const void *rn_tag;
|
||||||
} rrw_node_t;
|
} rrw_node_t;
|
||||||
|
|
||||||
static 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.
|
* Add a node to the head of the singly linked list.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
rrn_add(rrwlock_t *rrl, void *tag)
|
rrn_add(rrwlock_t *rrl, const void *tag)
|
||||||
{
|
{
|
||||||
rrw_node_t *rn;
|
rrw_node_t *rn;
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ rrn_add(rrwlock_t *rrl, void *tag)
|
|||||||
* thread's list and return TRUE; otherwise return FALSE.
|
* thread's list and return TRUE; otherwise return FALSE.
|
||||||
*/
|
*/
|
||||||
static boolean_t
|
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 *rn;
|
||||||
rrw_node_t *prev = NULL;
|
rrw_node_t *prev = NULL;
|
||||||
@ -160,7 +160,7 @@ rrw_destroy(rrwlock_t *rrl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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);
|
mutex_enter(&rrl->rr_lock);
|
||||||
#if !defined(ZFS_DEBUG) && defined(_KERNEL)
|
#if !defined(ZFS_DEBUG) && defined(_KERNEL)
|
||||||
@ -192,7 +192,7 @@ rrw_enter_read_impl(rrwlock_t *rrl, boolean_t prio, void *tag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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);
|
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.
|
* the pending writer does not work, so we have to give an explicit hint here.
|
||||||
*/
|
*/
|
||||||
void
|
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);
|
rrw_enter_read_impl(rrl, B_TRUE, tag);
|
||||||
}
|
}
|
||||||
@ -228,7 +228,7 @@ rrw_enter_write(rrwlock_t *rrl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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)
|
if (rw == RW_READER)
|
||||||
rrw_enter_read(rrl, tag);
|
rrw_enter_read(rrl, tag);
|
||||||
@ -237,7 +237,7 @@ rrw_enter(rrwlock_t *rrl, krw_t rw, void *tag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rrw_exit(rrwlock_t *rrl, void *tag)
|
rrw_exit(rrwlock_t *rrl, const void *tag)
|
||||||
{
|
{
|
||||||
mutex_enter(&rrl->rr_lock);
|
mutex_enter(&rrl->rr_lock);
|
||||||
#if !defined(ZFS_DEBUG) && defined(_KERNEL)
|
#if !defined(ZFS_DEBUG) && defined(_KERNEL)
|
||||||
@ -339,7 +339,7 @@ rrm_destroy(rrmlock_t *rrl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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)
|
if (rw == RW_READER)
|
||||||
rrm_enter_read(rrl, tag);
|
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)
|
#define RRM_TD_LOCK() (((uint32_t)(uintptr_t)(curthread)) % RRM_NUM_LOCKS)
|
||||||
|
|
||||||
void
|
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);
|
rrw_enter_read(&rrl->locks[RRM_TD_LOCK()], tag);
|
||||||
}
|
}
|
||||||
@ -373,7 +373,7 @@ rrm_enter_write(rrmlock_t *rrl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rrm_exit(rrmlock_t *rrl, void *tag)
|
rrm_exit(rrmlock_t *rrl, const void *tag)
|
||||||
{
|
{
|
||||||
int i;
|
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_version(void *arg, dmu_tx_t *tx);
|
||||||
static void spa_sync_props(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 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 void spa_vdev_resilver_done(spa_t *spa);
|
||||||
|
|
||||||
static uint_t zio_taskq_batch_pct = 80; /* 1 thread per cpu in pset */
|
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.
|
* Add a (source=src, propname=propval) list to an nvlist.
|
||||||
*/
|
*/
|
||||||
static void
|
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)
|
uint64_t intval, zprop_source_t src)
|
||||||
{
|
{
|
||||||
const char *propname = zpool_prop_to_name(prop);
|
const char *propname = zpool_prop_to_name(prop);
|
||||||
@ -2974,7 +2975,7 @@ spa_try_repair(spa_t *spa, nvlist_t *config)
|
|||||||
static int
|
static int
|
||||||
spa_load(spa_t *spa, spa_load_state_t state, spa_import_type_t type)
|
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;
|
int error;
|
||||||
|
|
||||||
spa->spa_load_state = state;
|
spa->spa_load_state = state;
|
||||||
@ -3291,7 +3292,7 @@ out:
|
|||||||
* ZPOOL_CONFIG_MMP_HOSTID - hostid from the active pool
|
* ZPOOL_CONFIG_MMP_HOSTID - hostid from the active pool
|
||||||
*/
|
*/
|
||||||
if (error == EREMOTEIO) {
|
if (error == EREMOTEIO) {
|
||||||
char *hostname = "<unknown>";
|
const char *hostname = "<unknown>";
|
||||||
uint64_t hostid = 0;
|
uint64_t hostid = 0;
|
||||||
|
|
||||||
if (mmp_label) {
|
if (mmp_label) {
|
||||||
@ -4399,7 +4400,7 @@ spa_ld_load_dedup_tables(spa_t *spa)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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;
|
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.
|
* config stored in the MOS.
|
||||||
*/
|
*/
|
||||||
static int
|
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;
|
int error = 0;
|
||||||
boolean_t missing_feat_write = B_FALSE;
|
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.
|
* ambiguous state.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
spa_open_common(const char *pool, spa_t **spapp, void *tag, nvlist_t *nvpolicy,
|
spa_open_common(const char *pool, spa_t **spapp, const void *tag,
|
||||||
nvlist_t **config)
|
nvlist_t *nvpolicy, nvlist_t **config)
|
||||||
{
|
{
|
||||||
spa_t *spa;
|
spa_t *spa;
|
||||||
spa_load_state_t state = SPA_LOAD_OPEN;
|
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
|
int
|
||||||
spa_open_rewind(const char *name, spa_t **spapp, void *tag, nvlist_t *policy,
|
spa_open_rewind(const char *name, spa_t **spapp, const void *tag,
|
||||||
nvlist_t **config)
|
nvlist_t *policy, nvlist_t **config)
|
||||||
{
|
{
|
||||||
return (spa_open_common(name, spapp, tag, policy, config));
|
return (spa_open_common(name, spapp, tag, policy, config));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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));
|
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.
|
* Split a set of devices from their mirrors, and create a new pool from them.
|
||||||
*/
|
*/
|
||||||
int
|
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)
|
nvlist_t *props, boolean_t exp)
|
||||||
{
|
{
|
||||||
int error = 0;
|
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
|
* This can be overridden in userland to preserve an alternate namespace for
|
||||||
* userland pools when doing testing.
|
* userland pools when doing testing.
|
||||||
*/
|
*/
|
||||||
char *spa_config_path = ZPOOL_CACHE;
|
char *spa_config_path = (char *)ZPOOL_CACHE;
|
||||||
#ifdef _KERNEL
|
#ifdef _KERNEL
|
||||||
static int zfs_autoimport_disable = B_TRUE;
|
static int zfs_autoimport_disable = B_TRUE;
|
||||||
#endif
|
#endif
|
||||||
|
@ -659,9 +659,9 @@ sync_upgrade_errlog(spa_t *spa, uint64_t spa_err_obj, uint64_t *newobj,
|
|||||||
}
|
}
|
||||||
|
|
||||||
char buf[64];
|
char buf[64];
|
||||||
char *name = "";
|
|
||||||
errphys_to_name(&zep, buf, sizeof (buf));
|
errphys_to_name(&zep, buf, sizeof (buf));
|
||||||
|
|
||||||
|
const char *name = "";
|
||||||
(void) zap_update(spa->spa_meta_objset, err_obj,
|
(void) zap_update(spa->spa_meta_objset, err_obj,
|
||||||
buf, 1, strlen(name) + 1, name, tx);
|
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 */
|
/* add errors to the current log */
|
||||||
if (!spa_feature_is_enabled(spa, SPA_FEATURE_HEAD_ERRLOG)) {
|
if (!spa_feature_is_enabled(spa, SPA_FEATURE_HEAD_ERRLOG)) {
|
||||||
for (se = avl_first(t); se != NULL; se = AVL_NEXT(t, se)) {
|
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));
|
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,
|
(void) zap_update(spa->spa_meta_objset, *obj, buf, 1,
|
||||||
strlen(name) + 1, name, tx);
|
strlen(name) + 1, name, tx);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (se = avl_first(t); se != NULL; se = AVL_NEXT(t, se)) {
|
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;
|
zbookmark_err_phys_t zep;
|
||||||
zep.zb_object = se->se_bookmark.zb_object;
|
zep.zb_object = se->se_bookmark.zb_object;
|
||||||
zep.zb_level = se->se_bookmark.zb_level;
|
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));
|
errphys_to_name(&zep, buf, sizeof (buf));
|
||||||
|
|
||||||
|
const char *name = se->se_name ? se->se_name : "";
|
||||||
(void) zap_update(spa->spa_meta_objset,
|
(void) zap_update(spa->spa_meta_objset,
|
||||||
err_obj, buf, 1, strlen(name) + 1, name, tx);
|
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);
|
for (zap_cursor_init(&zc, spa->spa_meta_objset, old_head_errlog);
|
||||||
zap_cursor_retrieve(&zc, &za) == 0; zap_cursor_advance(&zc)) {
|
zap_cursor_retrieve(&zc, &za) == 0; zap_cursor_advance(&zc)) {
|
||||||
|
|
||||||
char *name = "";
|
const char *name = "";
|
||||||
name_to_errphys(za.za_name, &err_block);
|
name_to_errphys(za.za_name, &err_block);
|
||||||
if (err_block.zb_birth < txg) {
|
if (err_block.zb_birth < txg) {
|
||||||
(void) zap_update(spa->spa_meta_objset, new_head_errlog,
|
(void) zap_update(spa->spa_meta_objset, new_head_errlog,
|
||||||
|
@ -462,7 +462,7 @@ spa_config_lock_destroy(spa_t *spa)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
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++) {
|
for (int i = 0; i < SCL_LOCKS; i++) {
|
||||||
spa_config_lock_t *scl = &spa->spa_config_lock[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.
|
* have the namespace lock held.
|
||||||
*/
|
*/
|
||||||
void
|
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 ||
|
ASSERT(zfs_refcount_count(&spa->spa_refcount) >= spa->spa_minref ||
|
||||||
MUTEX_HELD(&spa_namespace_lock));
|
MUTEX_HELD(&spa_namespace_lock));
|
||||||
@ -889,7 +889,7 @@ spa_open_ref(spa_t *spa, void *tag)
|
|||||||
* have the namespace lock held.
|
* have the namespace lock held.
|
||||||
*/
|
*/
|
||||||
void
|
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 ||
|
ASSERT(zfs_refcount_count(&spa->spa_refcount) > spa->spa_minref ||
|
||||||
MUTEX_HELD(&spa_namespace_lock));
|
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.
|
* so the asserts in spa_close() do not apply.
|
||||||
*/
|
*/
|
||||||
void
|
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);
|
(void) zfs_refcount_remove(&spa->spa_refcount, tag);
|
||||||
}
|
}
|
||||||
@ -1513,8 +1513,8 @@ void
|
|||||||
snprintf_blkptr(char *buf, size_t buflen, const blkptr_t *bp)
|
snprintf_blkptr(char *buf, size_t buflen, const blkptr_t *bp)
|
||||||
{
|
{
|
||||||
char type[256];
|
char type[256];
|
||||||
char *checksum = NULL;
|
const char *checksum = NULL;
|
||||||
char *compress = NULL;
|
const char *compress = NULL;
|
||||||
|
|
||||||
if (bp != NULL) {
|
if (bp != NULL) {
|
||||||
if (BP_GET_TYPE(bp) & DMU_OT_NEWTYPE) {
|
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);
|
KM_SLEEP);
|
||||||
for (uint64_t i = 0; i < vd->vdev_children;
|
for (uint64_t i = 0; i < vd->vdev_children;
|
||||||
i++) {
|
i++) {
|
||||||
char *vname;
|
const char *vname;
|
||||||
|
|
||||||
vname = vdev_name(vd->vdev_child[i],
|
vname = vdev_name(vd->vdev_child[i],
|
||||||
namebuf, sizeof (namebuf));
|
namebuf, sizeof (namebuf));
|
||||||
|
@ -563,7 +563,7 @@ vdev_raidz_math_fini(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct {
|
static const struct {
|
||||||
char *name;
|
const char *name;
|
||||||
uint32_t sel;
|
uint32_t sel;
|
||||||
} math_impl_opts[] = {
|
} math_impl_opts[] = {
|
||||||
{ "cycle", IMPL_CYCLE },
|
{ "cycle", IMPL_CYCLE },
|
||||||
|
@ -260,7 +260,7 @@ vdev_rebuild_initiate_sync(void *arg, dmu_tx_t *tx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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();
|
nvlist_t *aux = fnvlist_alloc();
|
||||||
|
|
||||||
|
@ -338,8 +338,8 @@ spa_vdev_alloc(spa_t *spa, uint64_t guid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
spa_vdev_remove_aux(nvlist_t *config, char *name, nvlist_t **dev, int count,
|
spa_vdev_remove_aux(nvlist_t *config, const char *name, nvlist_t **dev,
|
||||||
nvlist_t *dev_to_remove)
|
int count, nvlist_t *dev_to_remove)
|
||||||
{
|
{
|
||||||
nvlist_t **newdev = NULL;
|
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;
|
int error = 0, error_log;
|
||||||
boolean_t locked = MUTEX_HELD(&spa_namespace_lock);
|
boolean_t locked = MUTEX_HELD(&spa_namespace_lock);
|
||||||
sysevent_t *ev = NULL;
|
sysevent_t *ev = NULL;
|
||||||
char *vd_type = NULL, *vd_path = NULL;
|
const char *vd_type = NULL;
|
||||||
|
char *vd_path = NULL;
|
||||||
|
|
||||||
ASSERT(spa_writeable(spa));
|
ASSERT(spa_writeable(spa));
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ typedef struct fuid_domain {
|
|||||||
uint64_t f_idx;
|
uint64_t f_idx;
|
||||||
} fuid_domain_t;
|
} fuid_domain_t;
|
||||||
|
|
||||||
static char *nulldomain = "";
|
static const char *const nulldomain = "";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Compare two indexes.
|
* 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);
|
avl_destroy(idx_tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
const char *
|
||||||
zfs_fuid_idx_domain(avl_tree_t *idx_tree, uint32_t idx)
|
zfs_fuid_idx_domain(avl_tree_t *idx_tree, uint32_t idx)
|
||||||
{
|
{
|
||||||
fuid_domain_t searchnode, *findnode;
|
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
|
* necessary for the caller or another thread to detect the dirty table
|
||||||
* and sync out the changes.
|
* and sync out the changes.
|
||||||
*/
|
*/
|
||||||
int
|
static int
|
||||||
zfs_fuid_find_by_domain(zfsvfs_t *zfsvfs, const char *domain,
|
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;
|
fuid_domain_t searchnode, *findnode;
|
||||||
avl_index_t loc;
|
avl_index_t loc;
|
||||||
@ -358,7 +358,7 @@ retry:
|
|||||||
const char *
|
const char *
|
||||||
zfs_fuid_find_by_idx(zfsvfs_t *zfsvfs, uint32_t idx)
|
zfs_fuid_find_by_idx(zfsvfs_t *zfsvfs, uint32_t idx)
|
||||||
{
|
{
|
||||||
char *domain;
|
const char *domain;
|
||||||
|
|
||||||
if (idx == 0 || !zfsvfs->z_use_fuids)
|
if (idx == 0 || !zfsvfs->z_use_fuids)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
@ -518,8 +518,7 @@ zfs_fuid_create_cred(zfsvfs_t *zfsvfs, zfs_fuid_type_t type,
|
|||||||
uint64_t idx;
|
uint64_t idx;
|
||||||
ksid_t *ksid;
|
ksid_t *ksid;
|
||||||
uint32_t rid;
|
uint32_t rid;
|
||||||
char *kdomain;
|
const char *kdomain, *domain;
|
||||||
const char *domain;
|
|
||||||
uid_t id;
|
uid_t id;
|
||||||
|
|
||||||
VERIFY(type == ZFS_OWNER || type == ZFS_GROUP);
|
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)
|
zfs_fuid_type_t type, zfs_fuid_info_t **fuidpp)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_KSID
|
#ifdef HAVE_KSID
|
||||||
const char *domain;
|
const char *domain, *kdomain;
|
||||||
char *kdomain;
|
|
||||||
uint32_t fuid_idx = FUID_INDEX(id);
|
uint32_t fuid_idx = FUID_INDEX(id);
|
||||||
uint32_t rid = 0;
|
uint32_t rid = 0;
|
||||||
idmap_stat status;
|
idmap_stat status;
|
||||||
|
@ -3470,7 +3470,7 @@ zil_close(zilog_t *zilog)
|
|||||||
mutex_exit(&zilog->zl_lock);
|
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
|
* 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);
|
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, "inherit"},
|
||||||
{{NULL, NULL}, NULL, NULL, 0, "on"},
|
{{NULL, NULL}, NULL, NULL, 0, "on"},
|
||||||
{{abd_checksum_off, abd_checksum_off},
|
{{abd_checksum_off, abd_checksum_off},
|
||||||
|
@ -49,7 +49,7 @@ unsigned long zio_decompress_fail_fraction = 0;
|
|||||||
/*
|
/*
|
||||||
* Compression vectors.
|
* 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},
|
{"inherit", 0, NULL, NULL, NULL},
|
||||||
{"on", 0, NULL, NULL, NULL},
|
{"on", 0, NULL, NULL, NULL},
|
||||||
{"uncompressed", 0, NULL, NULL, NULL},
|
{"uncompressed", 0, NULL, NULL, NULL},
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
typedef struct timetest {
|
typedef struct timetest {
|
||||||
int type;
|
int type;
|
||||||
char *name;
|
const char *name;
|
||||||
int (*func)(const char *pfile);
|
int (*func)(const char *pfile);
|
||||||
} timetest_t;
|
} timetest_t;
|
||||||
|
|
||||||
@ -260,7 +260,7 @@ static int
|
|||||||
do_xattr(const char *pfile)
|
do_xattr(const char *pfile)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
char *value = "user.value";
|
const char *value = "user.value";
|
||||||
|
|
||||||
if (pfile == NULL) {
|
if (pfile == NULL) {
|
||||||
return (-1);
|
return (-1);
|
||||||
@ -306,7 +306,7 @@ int
|
|||||||
main(void)
|
main(void)
|
||||||
{
|
{
|
||||||
int i, ret, fd;
|
int i, ret, fd;
|
||||||
char *penv[] = {"TESTDIR", "TESTFILE0"};
|
const char *penv[] = {"TESTDIR", "TESTFILE0"};
|
||||||
|
|
||||||
(void) atexit(cleanup);
|
(void) atexit(cleanup);
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ static char dirpath[256];
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char *cp1 = "";
|
const char *cp1 = "";
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int testdd = 0;
|
int testdd = 0;
|
||||||
|
@ -130,7 +130,7 @@ read_map(const char *filename, nvlist_t **allcfgs)
|
|||||||
* for freeing the configuration returned.
|
* for freeing the configuration returned.
|
||||||
*/
|
*/
|
||||||
static int
|
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;
|
nvlist_t *allcfgs, *foundcfg = NULL;
|
||||||
int error;
|
int error;
|
||||||
@ -320,8 +320,8 @@ write_map_key(const char *filename, char *key, draid_map_t *map,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_map(draid_map_t *map, char *key, double worst_ratio, double avg_ratio,
|
dump_map(draid_map_t *map, const char *key, double worst_ratio,
|
||||||
int verbose)
|
double avg_ratio, int verbose)
|
||||||
{
|
{
|
||||||
if (verbose == 0) {
|
if (verbose == 0) {
|
||||||
return;
|
return;
|
||||||
@ -363,7 +363,7 @@ dump_map(draid_map_t *map, char *key, double worst_ratio, double avg_ratio,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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;
|
draid_map_t map;
|
||||||
uint_t c;
|
uint_t c;
|
||||||
@ -385,7 +385,7 @@ dump_map_nv(char *key, nvlist_t *cfg, int verbose)
|
|||||||
* Print a summary of the mapping.
|
* Print a summary of the mapping.
|
||||||
*/
|
*/
|
||||||
static int
|
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;
|
nvlist_t *cfg;
|
||||||
int error;
|
int error;
|
||||||
|
@ -25,10 +25,9 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
static void
|
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, "usage: get_diff file redacted_file\n%s\n", msg);
|
||||||
(void) fprintf(stderr, "%s\n", msg);
|
|
||||||
exit(exit_value);
|
exit(exit_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -596,13 +596,13 @@ test_channel_program(const char *pool)
|
|||||||
"arg = ...\n"
|
"arg = ...\n"
|
||||||
"argv = arg[\"argv\"]\n"
|
"argv = arg[\"argv\"]\n"
|
||||||
"return argv[1]";
|
"return argv[1]";
|
||||||
char *const argv[1] = { "Hello World!" };
|
const char *const argv[1] = { "Hello World!" };
|
||||||
nvlist_t *required = fnvlist_alloc();
|
nvlist_t *required = fnvlist_alloc();
|
||||||
nvlist_t *optional = fnvlist_alloc();
|
nvlist_t *optional = fnvlist_alloc();
|
||||||
nvlist_t *args = fnvlist_alloc();
|
nvlist_t *args = fnvlist_alloc();
|
||||||
|
|
||||||
fnvlist_add_string(required, "program", program);
|
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_nvlist(required, "arg", args);
|
||||||
|
|
||||||
fnvlist_add_boolean_value(optional, "sync", B_TRUE);
|
fnvlist_add_boolean_value(optional, "sync", B_TRUE);
|
||||||
|
@ -32,14 +32,14 @@
|
|||||||
|
|
||||||
|
|
||||||
static __attribute__((noreturn)) void
|
static __attribute__((noreturn)) void
|
||||||
usage(char *progname)
|
usage(const char *progname)
|
||||||
{
|
{
|
||||||
(void) fprintf(stderr, "Usage: %s <dirname|filename>\n", progname);
|
(void) fprintf(stderr, "Usage: %s <dirname|filename>\n", progname);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __attribute__((noreturn)) void
|
static __attribute__((noreturn)) void
|
||||||
fail(char *err)
|
fail(const char *err)
|
||||||
{
|
{
|
||||||
perror(err);
|
perror(err);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -21,13 +21,11 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
|
||||||
#define MAX_INT_LENGTH 10
|
|
||||||
|
|
||||||
static void
|
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, "usage: mkfiles basename max_file [min_file]\n"
|
||||||
(void) fprintf(stderr, "%s\n", msg);
|
"%s\n", msg);
|
||||||
exit(exit_value);
|
exit(exit_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,13 +38,13 @@ main(int argc, char **argv)
|
|||||||
char buf[MAXPATHLEN];
|
char buf[MAXPATHLEN];
|
||||||
|
|
||||||
if (argc < 3 || argc > 4)
|
if (argc < 3 || argc > 4)
|
||||||
usage("Invalid number of arguments", -1);
|
usage("Invalid number of arguments", 1);
|
||||||
|
|
||||||
if (sscanf(argv[2], "%u", &numfiles) != 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)
|
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++) {
|
for (i = first_file; i < first_file + numfiles; i++) {
|
||||||
int fd;
|
int fd;
|
||||||
@ -54,11 +52,11 @@ main(int argc, char **argv)
|
|||||||
if ((fd = open(buf, O_CREAT | O_EXCL, O_RDWR)) == -1) {
|
if ((fd = open(buf, O_CREAT | O_EXCL, O_RDWR)) == -1) {
|
||||||
(void) fprintf(stderr, "Failed to create %s %s\n", buf,
|
(void) fprintf(stderr, "Failed to create %s %s\n", buf,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
return (-4);
|
return (4);
|
||||||
} else if (fchown(fd, getuid(), getgid()) < 0) {
|
} else if (fchown(fd, getuid(), getgid()) < 0) {
|
||||||
(void) fprintf(stderr, "Failed to chown %s %s\n", buf,
|
(void) fprintf(stderr, "Failed to chown %s %s\n", buf,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
return (-5);
|
return (5);
|
||||||
}
|
}
|
||||||
(void) close(fd);
|
(void) close(fd);
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ crtfile(char *pname)
|
|||||||
{
|
{
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
int i, size;
|
int i, size;
|
||||||
char *context = "0123456789ABCDF";
|
const char *context = "0123456789ABCDF";
|
||||||
char *pbuf;
|
char *pbuf;
|
||||||
|
|
||||||
if (pname == NULL) {
|
if (pname == NULL) {
|
||||||
|
@ -84,7 +84,7 @@ nvlist_equal(nvlist_t *nvla, nvlist_t *nvlb)
|
|||||||
static void
|
static void
|
||||||
test(const char *testname, boolean_t expect_success, boolean_t expect_match)
|
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;
|
nvlist_t *outnvl;
|
||||||
|
|
||||||
@ -230,8 +230,8 @@ run_tests(void)
|
|||||||
test("uint64_array", B_FALSE, B_FALSE);
|
test("uint64_array", B_FALSE, B_FALSE);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
char *const val[2] = { "0", "1" };
|
const char *val[2] = { "0", "1" };
|
||||||
fnvlist_add_string_array(nvl, key, (const char **)val, 2);
|
fnvlist_add_string_array(nvl, key, val, 2);
|
||||||
test("string_array", B_TRUE, B_FALSE);
|
test("string_array", B_TRUE, B_FALSE);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char *filename = "badfile";
|
const char *filename = "badfile";
|
||||||
size_t size = 4395;
|
size_t size = 4395;
|
||||||
size_t idx = 0;
|
size_t idx = 0;
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
|
@ -27,7 +27,7 @@ static char *ifile = NULL;
|
|||||||
static char *ofile = NULL;
|
static char *ofile = NULL;
|
||||||
static int stride = 0;
|
static int stride = 0;
|
||||||
static int seek = 0;
|
static int seek = 0;
|
||||||
static char *execname = "stride_dd";
|
static const char *execname = "stride_dd";
|
||||||
|
|
||||||
static void usage(void);
|
static void usage(void);
|
||||||
static void parse_options(int argc, char *argv[]);
|
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 value_is_random = 0;
|
||||||
static int keep_files = 0;
|
static int keep_files = 0;
|
||||||
static int phase = PHASE_ALL;
|
static int phase = PHASE_ALL;
|
||||||
static char path[PATH_MAX] = "/tmp/xattrtest";
|
static const char *path = "/tmp/xattrtest";
|
||||||
static char script[PATH_MAX] = "/bin/true";
|
static const char *script = "/bin/true";
|
||||||
static char xattrbytes[XATTR_SIZE_MAX];
|
static char xattrbytes[XATTR_SIZE_MAX];
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -161,8 +161,7 @@ parse_args(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
strncpy(path, optarg, PATH_MAX);
|
path = optarg;
|
||||||
path[PATH_MAX - 1] = '\0';
|
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
synccaches = 1;
|
synccaches = 1;
|
||||||
@ -171,8 +170,7 @@ parse_args(int argc, char **argv)
|
|||||||
dropcaches = 1;
|
dropcaches = 1;
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
strncpy(script, optarg, PATH_MAX);
|
script = optarg;
|
||||||
script[PATH_MAX - 1] = '\0';
|
|
||||||
break;
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
seed = strtol(optarg, NULL, 0);
|
seed = strtol(optarg, NULL, 0);
|
||||||
@ -291,9 +289,9 @@ run_process(const char *path, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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;
|
int rc;
|
||||||
|
|
||||||
if (synccaches)
|
if (synccaches)
|
||||||
@ -517,9 +515,9 @@ getxattrs(void)
|
|||||||
int i, j, rnd_size, shift, rc = 0;
|
int i, j, rnd_size, shift, rc = 0;
|
||||||
char name[XATTR_NAME_MAX];
|
char name[XATTR_NAME_MAX];
|
||||||
char *verify_value = NULL;
|
char *verify_value = NULL;
|
||||||
char *verify_string;
|
const char *verify_string;
|
||||||
char *value = NULL;
|
char *value = NULL;
|
||||||
char *value_string;
|
const char *value_string;
|
||||||
char *file = NULL;
|
char *file = NULL;
|
||||||
struct timeval start, stop;
|
struct timeval start, stop;
|
||||||
double seconds;
|
double seconds;
|
||||||
|
@ -29,16 +29,16 @@
|
|||||||
*/
|
*/
|
||||||
typedef struct hkdf_tv {
|
typedef struct hkdf_tv {
|
||||||
/* test vector input values */
|
/* test vector input values */
|
||||||
char *ikm;
|
const char *ikm;
|
||||||
uint_t ikm_len;
|
uint_t ikm_len;
|
||||||
char *salt;
|
const char *salt;
|
||||||
uint_t salt_len;
|
uint_t salt_len;
|
||||||
char *info;
|
const char *info;
|
||||||
uint_t info_len;
|
uint_t info_len;
|
||||||
uint_t okm_len;
|
uint_t okm_len;
|
||||||
|
|
||||||
/* expected output */
|
/* expected output */
|
||||||
char *okm;
|
const char *okm;
|
||||||
} hkdf_tv_t;
|
} hkdf_tv_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -48,7 +48,7 @@ typedef struct hkdf_tv {
|
|||||||
* The current vectors were taken from:
|
* The current vectors were taken from:
|
||||||
* https://www.kullo.net/blog/hkdf-sha-512-test-vectors/
|
* 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"
|
.ikm = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
|
||||||
"\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
|
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);
|
printf("\t%s\t", str);
|
||||||
for (int i = 0; i < len; i++)
|
for (int i = 0; i < len; i++)
|
||||||
@ -179,7 +179,7 @@ hexdump(char *str, uint8_t *src, uint_t len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
run_test(int i, hkdf_tv_t *tv)
|
run_test(int i, const hkdf_tv_t *tv)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
uint8_t good[SHA512_DIGEST_LENGTH];
|
uint8_t good[SHA512_DIGEST_LENGTH];
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <err.h>
|
||||||
|
|
||||||
/* backward compat in case it's not defined */
|
/* backward compat in case it's not defined */
|
||||||
#ifndef O_TMPFILE
|
#ifndef O_TMPFILE
|
||||||
@ -33,75 +34,45 @@ fill_random(char *buf, int len)
|
|||||||
{
|
{
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
for (int i = 0; i < len; i++)
|
for (int i = 0; i < len; i++)
|
||||||
buf[i] = (char)rand();
|
buf[i] = (char)(rand() % 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(void)
|
main(void)
|
||||||
{
|
{
|
||||||
int i, fd;
|
char buf1[BSZ], buf2[BSZ] = {0};
|
||||||
char buf1[BSZ], buf2[BSZ] = {};
|
|
||||||
char *penv[] = {"TESTDIR"};
|
|
||||||
|
|
||||||
(void) fprintf(stdout, "Verify O_TMPFILE is working properly.\n");
|
(void) fprintf(stdout, "Verify O_TMPFILE is working properly.\n");
|
||||||
|
|
||||||
/*
|
const char *testdir = getenv("TESTDIR");
|
||||||
* Get the environment variable values.
|
if (testdir == NULL)
|
||||||
*/
|
errx(1, "getenv(\"TESTDIR\")");
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fill_random(buf1, BSZ);
|
fill_random(buf1, BSZ);
|
||||||
|
|
||||||
fd = open(penv[0], O_RDWR|O_TMPFILE, 0666);
|
int fd = open(testdir, O_RDWR|O_TMPFILE, 0666);
|
||||||
if (fd < 0) {
|
if (fd < 0)
|
||||||
perror("open");
|
err(2, "open(%s)", testdir);
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (write(fd, buf1, BSZ) < 0) {
|
if (write(fd, buf1, BSZ) < 0)
|
||||||
perror("write");
|
err(3, "write");
|
||||||
close(fd);
|
|
||||||
exit(3);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pread(fd, buf2, BSZ, 0) < 0) {
|
if (pread(fd, buf2, BSZ, 0) < 0)
|
||||||
perror("pread");
|
err(4, "pread");
|
||||||
close(fd);
|
|
||||||
exit(4);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (memcmp(buf1, buf2, BSZ) != 0) {
|
if (memcmp(buf1, buf2, BSZ) != 0)
|
||||||
fprintf(stderr, "data corrupted\n");
|
errx(5, "data corrupted");
|
||||||
close(fd);
|
|
||||||
exit(5);
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(buf2, 0, BSZ);
|
memset(buf2, 0, BSZ);
|
||||||
|
|
||||||
if (fsetxattr(fd, "user.test", buf1, BSZ, 0) < 0) {
|
if (fsetxattr(fd, "user.test", buf1, BSZ, 0) < 0)
|
||||||
perror("fsetxattr");
|
err(6, "pread");
|
||||||
close(fd);
|
|
||||||
exit(6);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fgetxattr(fd, "user.test", buf2, BSZ) < 0) {
|
if (fgetxattr(fd, "user.test", buf2, BSZ) < 0)
|
||||||
perror("fgetxattr");
|
err(7, "fgetxattr");
|
||||||
close(fd);
|
|
||||||
exit(7);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (memcmp(buf1, buf2, BSZ) != 0) {
|
if (memcmp(buf1, buf2, BSZ) != 0)
|
||||||
fprintf(stderr, "xattr corrupted\n");
|
errx(8, "xattr corrupted\n");
|
||||||
close(fd);
|
|
||||||
exit(8);
|
|
||||||
}
|
|
||||||
|
|
||||||
close(fd);
|
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <err.h>
|
||||||
|
|
||||||
/* backward compat in case it's not defined */
|
/* backward compat in case it's not defined */
|
||||||
#ifndef O_TMPFILE
|
#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
|
int
|
||||||
main(void)
|
main(void)
|
||||||
{
|
{
|
||||||
int i, fd, ret;
|
int i, fd;
|
||||||
char spath[1024], dpath[1024];
|
char spath[1024], dpath[1024];
|
||||||
char *penv[] = {"TESTDIR", "TESTFILE0"};
|
const char *penv[] = {"TESTDIR", "TESTFILE0"};
|
||||||
struct stat sbuf;
|
struct stat sbuf;
|
||||||
|
|
||||||
(void) fprintf(stdout, "Verify O_TMPFILE file can be linked.\n");
|
(void) fprintf(stdout, "Verify O_TMPFILE file can be linked.\n");
|
||||||
@ -37,55 +53,25 @@ main(void)
|
|||||||
/*
|
/*
|
||||||
* Get the environment variable values.
|
* Get the environment variable values.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < sizeof (penv) / sizeof (char *); i++) {
|
for (i = 0; i < ARRAY_SIZE(penv); i++)
|
||||||
if ((penv[i] = getenv(penv[i])) == NULL) {
|
if ((penv[i] = getenv(penv[i])) == NULL)
|
||||||
(void) fprintf(stderr, "getenv(penv[%d])\n", i);
|
errx(1, "getenv(penv[%d])", i);
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fd = open(penv[0], O_RDWR|O_TMPFILE, 0666);
|
fd = open(penv[0], O_RDWR|O_TMPFILE, 0666);
|
||||||
if (fd < 0) {
|
if (fd < 0)
|
||||||
perror("open");
|
err(2, "open(%s)", penv[0]);
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(spath, 1024, "/proc/self/fd/%d", fd);
|
snprintf(spath, 1024, "/proc/self/fd/%d", fd);
|
||||||
snprintf(dpath, 1024, "%s/%s", penv[0], penv[1]);
|
snprintf(dpath, 1024, "%s/%s", penv[0], penv[1]);
|
||||||
if (linkat(AT_FDCWD, spath, AT_FDCWD, dpath, AT_SYMLINK_FOLLOW) < 0) {
|
if (linkat(AT_FDCWD, spath, AT_FDCWD, dpath, AT_SYMLINK_FOLLOW) < 0)
|
||||||
perror("linkat");
|
err(3, "linkat");
|
||||||
close(fd);
|
|
||||||
exit(3);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((ret = system("sudo -E zpool freeze $TESTPOOL"))) {
|
run("freeze");
|
||||||
if (ret == -1)
|
|
||||||
perror("system \"zpool freeze\"");
|
|
||||||
else
|
|
||||||
fprintf(stderr, "zpool freeze exits with %d\n",
|
|
||||||
WEXITSTATUS(ret));
|
|
||||||
exit(4);
|
|
||||||
}
|
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
if ((ret = system("sudo -E zpool export $TESTPOOL"))) {
|
run("export");
|
||||||
if (ret == -1)
|
run("import");
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stat(dpath, &sbuf) < 0) {
|
if (stat(dpath, &sbuf) < 0) {
|
||||||
perror("stat");
|
perror("stat");
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <err.h>
|
||||||
|
|
||||||
/* backward compat in case it's not defined */
|
/* backward compat in case it's not defined */
|
||||||
#ifndef O_TMPFILE
|
#ifndef O_TMPFILE
|
||||||
@ -28,7 +29,7 @@ main(void)
|
|||||||
{
|
{
|
||||||
int i, fd;
|
int i, fd;
|
||||||
char spath[1024], dpath[1024];
|
char spath[1024], dpath[1024];
|
||||||
char *penv[] = {"TESTDIR", "TESTFILE0"};
|
const char *penv[] = {"TESTDIR", "TESTFILE0"};
|
||||||
struct stat sbuf;
|
struct stat sbuf;
|
||||||
|
|
||||||
(void) fprintf(stdout, "Verify O_EXCL tmpfile cannot be linked.\n");
|
(void) fprintf(stdout, "Verify O_EXCL tmpfile cannot be linked.\n");
|
||||||
@ -36,33 +37,21 @@ main(void)
|
|||||||
/*
|
/*
|
||||||
* Get the environment variable values.
|
* Get the environment variable values.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < sizeof (penv) / sizeof (char *); i++) {
|
for (i = 0; i < ARRAY_SIZE(penv); i++)
|
||||||
if ((penv[i] = getenv(penv[i])) == NULL) {
|
if ((penv[i] = getenv(penv[i])) == NULL)
|
||||||
(void) fprintf(stderr, "getenv(penv[%d])\n", i);
|
errx(1, "getenv(penv[%d])", i);
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fd = open(penv[0], O_RDWR|O_TMPFILE|O_EXCL, 0666);
|
fd = open(penv[0], O_RDWR|O_TMPFILE|O_EXCL, 0666);
|
||||||
if (fd < 0) {
|
if (fd < 0)
|
||||||
perror("open");
|
err(2, "open(%s)", penv[0]);
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(spath, 1024, "/proc/self/fd/%d", fd);
|
snprintf(spath, 1024, "/proc/self/fd/%d", fd);
|
||||||
snprintf(dpath, 1024, "%s/%s", penv[0], penv[1]);
|
snprintf(dpath, 1024, "%s/%s", penv[0], penv[1]);
|
||||||
if (linkat(AT_FDCWD, spath, AT_FDCWD, dpath, AT_SYMLINK_FOLLOW) == 0) {
|
if (linkat(AT_FDCWD, spath, AT_FDCWD, dpath, AT_SYMLINK_FOLLOW) == 0)
|
||||||
fprintf(stderr, "linkat returns successfully\n");
|
errx(3, "linkat returned successfully\n");
|
||||||
close(fd);
|
|
||||||
exit(3);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stat(dpath, &sbuf) == 0) {
|
if (stat(dpath, &sbuf) == 0)
|
||||||
fprintf(stderr, "stat returns successfully\n");
|
errx(4, "stat returned successfully\n");
|
||||||
close(fd);
|
|
||||||
exit(4);
|
|
||||||
}
|
|
||||||
close(fd);
|
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <err.h>
|
||||||
|
|
||||||
/* backward compat in case it's not defined */
|
/* backward compat in case it's not defined */
|
||||||
#ifndef O_TMPFILE
|
#ifndef O_TMPFILE
|
||||||
@ -50,63 +51,46 @@ test_stat_mode(mode_t mask)
|
|||||||
struct stat st, fst;
|
struct stat st, fst;
|
||||||
int i, fd;
|
int i, fd;
|
||||||
char spath[1024], dpath[1024];
|
char spath[1024], dpath[1024];
|
||||||
char *penv[] = {"TESTDIR", "TESTFILE0"};
|
const char *penv[] = {"TESTDIR", "TESTFILE0"};
|
||||||
mode_t masked = 0777 & ~mask;
|
mode_t masked = 0777 & ~mask;
|
||||||
mode_t mode;
|
mode_t mode;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the environment variable values.
|
* Get the environment variable values.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < sizeof (penv) / sizeof (char *); i++) {
|
for (i = 0; i < ARRAY_SIZE(penv); i++)
|
||||||
if ((penv[i] = getenv(penv[i])) == NULL) {
|
if ((penv[i] = getenv(penv[i])) == NULL)
|
||||||
fprintf(stderr, "getenv(penv[%d])\n", i);
|
errx(1, "getenv(penv[%d])", i);
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
umask(mask);
|
umask(mask);
|
||||||
fd = open(penv[0], O_RDWR|O_TMPFILE, 0777);
|
fd = open(penv[0], O_RDWR|O_TMPFILE, 0777);
|
||||||
if (fd == -1) {
|
if (fd == -1)
|
||||||
perror("open");
|
err(2, "open(%s)", penv[0]);
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fstat(fd, &fst) == -1) {
|
if (fstat(fd, &fst) == -1)
|
||||||
perror("fstat");
|
err(3, "open");
|
||||||
close(fd);
|
|
||||||
exit(3);
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(spath, sizeof (spath), "/proc/self/fd/%d", fd);
|
snprintf(spath, sizeof (spath), "/proc/self/fd/%d", fd);
|
||||||
snprintf(dpath, sizeof (dpath), "%s/%s", penv[0], penv[1]);
|
snprintf(dpath, sizeof (dpath), "%s/%s", penv[0], penv[1]);
|
||||||
|
|
||||||
unlink(dpath);
|
unlink(dpath);
|
||||||
if (linkat(AT_FDCWD, spath, AT_FDCWD, dpath, AT_SYMLINK_FOLLOW) == -1) {
|
if (linkat(AT_FDCWD, spath, AT_FDCWD, dpath, AT_SYMLINK_FOLLOW) == -1)
|
||||||
perror("linkat");
|
err(4, "linkat");
|
||||||
close(fd);
|
|
||||||
exit(4);
|
|
||||||
}
|
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
if (stat(dpath, &st) == -1) {
|
if (stat(dpath, &st) == -1)
|
||||||
perror("stat");
|
err(5, "stat");
|
||||||
exit(5);
|
|
||||||
}
|
|
||||||
unlink(dpath);
|
unlink(dpath);
|
||||||
|
|
||||||
/* Verify fstat(2) result */
|
/* Verify fstat(2) result */
|
||||||
mode = fst.st_mode & 0777;
|
mode = fst.st_mode & 0777;
|
||||||
if (mode != masked) {
|
if (mode != masked)
|
||||||
fprintf(stderr, "fstat(2) %o != %o\n", mode, masked);
|
errx(6, "fstat(2) %o != %o\n", mode, masked);
|
||||||
exit(6);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Verify stat(2) result */
|
/* Verify stat(2) result */
|
||||||
mode = st.st_mode & 0777;
|
mode = st.st_mode & 0777;
|
||||||
if (mode != masked) {
|
if (mode != masked)
|
||||||
fprintf(stderr, "stat(2) %o != %o\n", mode, masked);
|
errx(7, "stat(2) %o != %o\n", mode, masked);
|
||||||
exit(7);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
Reference in New Issue
Block a user