mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 19:28:53 +03:00
nvpair: Constify string functions
After addressing coverity complaints involving `nvpair_name()`, the compiler started complaining about dropping const. This lead to a rabbit hole where not only `nvpair_name()` needed to be constified, but also `nvpair_value_string()`, `fnvpair_value_string()` and a few other static functions, plus variable pointers throughout the code. The result became a fairly big change, so it has been split out into its own patch. Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Closes #14612
This commit is contained in:
committed by
Brian Behlendorf
parent
50f6934b9c
commit
d1807f168e
@@ -60,7 +60,7 @@ struct udev_monitor *g_mon;
|
||||
static void
|
||||
zed_udev_event(const char *class, const char *subclass, nvlist_t *nvl)
|
||||
{
|
||||
char *strval;
|
||||
const char *strval;
|
||||
uint64_t numval;
|
||||
|
||||
zed_log_msg(LOG_INFO, "zed_disk_event:");
|
||||
@@ -178,7 +178,8 @@ static void *
|
||||
zed_udev_monitor(void *arg)
|
||||
{
|
||||
struct udev_monitor *mon = arg;
|
||||
char *tmp, *tmp2;
|
||||
const char *tmp;
|
||||
char *tmp2;
|
||||
|
||||
zed_log_msg(LOG_INFO, "Waiting for new udev disk events...");
|
||||
|
||||
@@ -336,7 +337,7 @@ zed_udev_monitor(void *arg)
|
||||
if (strcmp(class, EC_DEV_STATUS) == 0 &&
|
||||
udev_device_get_property_value(dev, "DM_UUID") &&
|
||||
udev_device_get_property_value(dev, "MPATH_SBIN_PATH")) {
|
||||
tmp = (char *)udev_device_get_devnode(dev);
|
||||
tmp = udev_device_get_devnode(dev);
|
||||
tmp2 = zfs_get_underlying_path(tmp);
|
||||
if (tmp && tmp2 && (strcmp(tmp, tmp2) != 0)) {
|
||||
/*
|
||||
@@ -353,8 +354,7 @@ zed_udev_monitor(void *arg)
|
||||
class = EC_DEV_ADD;
|
||||
subclass = ESC_DISK;
|
||||
} else {
|
||||
tmp = (char *)
|
||||
udev_device_get_property_value(dev,
|
||||
tmp = udev_device_get_property_value(dev,
|
||||
"DM_NR_VALID_PATHS");
|
||||
/* treat as a multipath remove */
|
||||
if (tmp != NULL && strcmp(tmp, "0") == 0) {
|
||||
|
||||
Reference in New Issue
Block a user