mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Add const to nvlist functions to properly expose their real behavior
Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Paul Dagnelie <pcd@delphix.com> Closes #12728
This commit is contained in:
@@ -428,7 +428,8 @@ fmd_case_add_suspect(fmd_hdl_t *hdl, fmd_case_t *cp, nvlist_t *fault)
|
||||
err |= nvlist_add_string(nvl, FM_SUSPECT_DIAG_CODE, code);
|
||||
err |= nvlist_add_int64_array(nvl, FM_SUSPECT_DIAG_TIME, tod, 2);
|
||||
err |= nvlist_add_uint32(nvl, FM_SUSPECT_FAULT_SZ, 1);
|
||||
err |= nvlist_add_nvlist_array(nvl, FM_SUSPECT_FAULT_LIST, &fault, 1);
|
||||
err |= nvlist_add_nvlist_array(nvl, FM_SUSPECT_FAULT_LIST,
|
||||
(const nvlist_t **)&fault, 1);
|
||||
|
||||
if (err)
|
||||
zed_log_die("failed to populate nvlist");
|
||||
|
||||
@@ -414,8 +414,8 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)
|
||||
ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH, enc_sysfs_path) != 0) ||
|
||||
nvlist_add_uint64(newvd, ZPOOL_CONFIG_WHOLE_DISK, wholedisk) != 0 ||
|
||||
nvlist_add_string(nvroot, ZPOOL_CONFIG_TYPE, VDEV_TYPE_ROOT) != 0 ||
|
||||
nvlist_add_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN, &newvd,
|
||||
1) != 0) {
|
||||
nvlist_add_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN,
|
||||
(const nvlist_t **)&newvd, 1) != 0) {
|
||||
zed_log_msg(LOG_WARNING, "zfs_mod: unable to add nvlist pairs");
|
||||
nvlist_free(newvd);
|
||||
nvlist_free(nvroot);
|
||||
|
||||
@@ -239,7 +239,7 @@ replace_with_spare(fmd_hdl_t *hdl, zpool_handle_t *zhp, nvlist_t *vdev)
|
||||
ZPOOL_CONFIG_ASHIFT, ashift);
|
||||
|
||||
(void) nvlist_add_nvlist_array(replacement,
|
||||
ZPOOL_CONFIG_CHILDREN, &spares[s], 1);
|
||||
ZPOOL_CONFIG_CHILDREN, (const nvlist_t **)&spares[s], 1);
|
||||
|
||||
fmd_hdl_debug(hdl, "zpool_vdev_replace '%s' with spare '%s'",
|
||||
dev_name, zfs_basename(spare_name));
|
||||
|
||||
+2
-1
@@ -8010,7 +8010,8 @@ zfs_do_channel_program(int argc, char **argv)
|
||||
* }
|
||||
*/
|
||||
nvlist_t *argnvl = fnvlist_alloc();
|
||||
fnvlist_add_string_array(argnvl, ZCP_ARG_CLIARGV, argv + 2, argc - 2);
|
||||
fnvlist_add_string_array(argnvl, ZCP_ARG_CLIARGV,
|
||||
(const char **)argv + 2, argc - 2);
|
||||
|
||||
if (sync_flag) {
|
||||
ret = lzc_channel_program(poolname, progbuf,
|
||||
|
||||
@@ -1647,8 +1647,8 @@ construct_spec(nvlist_t *props, int argc, char **argv)
|
||||
}
|
||||
}
|
||||
verify(nvlist_add_nvlist_array(nv,
|
||||
ZPOOL_CONFIG_CHILDREN, child,
|
||||
children) == 0);
|
||||
ZPOOL_CONFIG_CHILDREN,
|
||||
(const nvlist_t **)child, children) == 0);
|
||||
|
||||
for (c = 0; c < children; c++)
|
||||
nvlist_free(child[c]);
|
||||
@@ -1713,13 +1713,13 @@ construct_spec(nvlist_t *props, int argc, char **argv)
|
||||
verify(nvlist_add_string(nvroot, ZPOOL_CONFIG_TYPE,
|
||||
VDEV_TYPE_ROOT) == 0);
|
||||
verify(nvlist_add_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN,
|
||||
top, toplevels) == 0);
|
||||
(const nvlist_t **)top, toplevels) == 0);
|
||||
if (nspares != 0)
|
||||
verify(nvlist_add_nvlist_array(nvroot, ZPOOL_CONFIG_SPARES,
|
||||
spares, nspares) == 0);
|
||||
(const nvlist_t **)spares, nspares) == 0);
|
||||
if (nl2cache != 0)
|
||||
verify(nvlist_add_nvlist_array(nvroot, ZPOOL_CONFIG_L2CACHE,
|
||||
l2cache, nl2cache) == 0);
|
||||
(const nvlist_t **)l2cache, nl2cache) == 0);
|
||||
|
||||
spec_out:
|
||||
for (t = 0; t < toplevels; t++)
|
||||
|
||||
+7
-5
@@ -1287,7 +1287,8 @@ make_vdev_raid(char *path, char *aux, char *pool, size_t size,
|
||||
ztest_opts.zo_raid_type);
|
||||
fnvlist_add_uint64(raid, ZPOOL_CONFIG_NPARITY,
|
||||
ztest_opts.zo_raid_parity);
|
||||
fnvlist_add_nvlist_array(raid, ZPOOL_CONFIG_CHILDREN, child, r);
|
||||
fnvlist_add_nvlist_array(raid, ZPOOL_CONFIG_CHILDREN,
|
||||
(const nvlist_t **)child, r);
|
||||
|
||||
if (strcmp(ztest_opts.zo_raid_type, VDEV_TYPE_DRAID) == 0) {
|
||||
uint64_t ndata = ztest_opts.zo_draid_data;
|
||||
@@ -1335,7 +1336,8 @@ make_vdev_mirror(char *path, char *aux, char *pool, size_t size,
|
||||
|
||||
mirror = fnvlist_alloc();
|
||||
fnvlist_add_string(mirror, ZPOOL_CONFIG_TYPE, VDEV_TYPE_MIRROR);
|
||||
fnvlist_add_nvlist_array(mirror, ZPOOL_CONFIG_CHILDREN, child, m);
|
||||
fnvlist_add_nvlist_array(mirror, ZPOOL_CONFIG_CHILDREN,
|
||||
(const nvlist_t **)child, m);
|
||||
|
||||
for (c = 0; c < m; c++)
|
||||
fnvlist_free(child[c]);
|
||||
@@ -1374,7 +1376,7 @@ make_vdev_root(char *path, char *aux, char *pool, size_t size, uint64_t ashift,
|
||||
root = fnvlist_alloc();
|
||||
fnvlist_add_string(root, ZPOOL_CONFIG_TYPE, VDEV_TYPE_ROOT);
|
||||
fnvlist_add_nvlist_array(root, aux ? aux : ZPOOL_CONFIG_CHILDREN,
|
||||
child, t);
|
||||
(const nvlist_t **)child, t);
|
||||
|
||||
for (c = 0; c < t; c++)
|
||||
fnvlist_free(child[c]);
|
||||
@@ -3550,8 +3552,8 @@ ztest_split_pool(ztest_ds_t *zd, uint64_t id)
|
||||
/* OK, create a config that can be used to split */
|
||||
split = fnvlist_alloc();
|
||||
fnvlist_add_string(split, ZPOOL_CONFIG_TYPE, VDEV_TYPE_ROOT);
|
||||
fnvlist_add_nvlist_array(split, ZPOOL_CONFIG_CHILDREN, schild,
|
||||
lastlogid != 0 ? lastlogid : schildren);
|
||||
fnvlist_add_nvlist_array(split, ZPOOL_CONFIG_CHILDREN,
|
||||
(const nvlist_t **)schild, lastlogid != 0 ? lastlogid : schildren);
|
||||
|
||||
config = fnvlist_alloc();
|
||||
fnvlist_add_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, split);
|
||||
|
||||
Reference in New Issue
Block a user