aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/openzfs/cmd/zed
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/openzfs/cmd/zed')
-rw-r--r--sys/contrib/openzfs/cmd/zed/agents/fmd_api.c6
-rw-r--r--sys/contrib/openzfs/cmd/zed/agents/zfs_agents.c6
-rw-r--r--sys/contrib/openzfs/cmd/zed/agents/zfs_diagnosis.c4
-rw-r--r--sys/contrib/openzfs/cmd/zed/agents/zfs_mod.c26
-rw-r--r--sys/contrib/openzfs/cmd/zed/agents/zfs_retire.c8
-rw-r--r--sys/contrib/openzfs/cmd/zed/zed_disk_event.c10
-rw-r--r--sys/contrib/openzfs/cmd/zed/zed_event.c6
7 files changed, 35 insertions, 31 deletions
diff --git a/sys/contrib/openzfs/cmd/zed/agents/fmd_api.c b/sys/contrib/openzfs/cmd/zed/agents/fmd_api.c
index 6858da5e7cf1..4a6cfbf8c05c 100644
--- a/sys/contrib/openzfs/cmd/zed/agents/fmd_api.c
+++ b/sys/contrib/openzfs/cmd/zed/agents/fmd_api.c
@@ -359,7 +359,7 @@ static void
zed_log_fault(nvlist_t *nvl, const char *uuid, const char *code)
{
nvlist_t *rsrc;
- char *strval;
+ const char *strval;
uint64_t guid;
uint8_t byte;
@@ -389,7 +389,7 @@ zed_log_fault(nvlist_t *nvl, const char *uuid, const char *code)
static const char *
fmd_fault_mkcode(nvlist_t *fault)
{
- char *class;
+ const char *class;
const char *code = "-";
/*
@@ -708,7 +708,7 @@ int
fmd_nvl_class_match(fmd_hdl_t *hdl, nvlist_t *nvl, const char *pattern)
{
(void) hdl;
- char *class;
+ const char *class;
return (nvl != NULL &&
nvlist_lookup_string(nvl, FM_CLASS, &class) == 0 &&
diff --git a/sys/contrib/openzfs/cmd/zed/agents/zfs_agents.c b/sys/contrib/openzfs/cmd/zed/agents/zfs_agents.c
index 587051c25bfd..a2daa77a61fe 100644
--- a/sys/contrib/openzfs/cmd/zed/agents/zfs_agents.c
+++ b/sys/contrib/openzfs/cmd/zed/agents/zfs_agents.c
@@ -64,7 +64,7 @@ typedef enum device_type {
typedef struct guid_search {
uint64_t gs_pool_guid;
uint64_t gs_vdev_guid;
- char *gs_devid;
+ const char *gs_devid;
device_type_t gs_vdev_type;
uint64_t gs_vdev_expandtime; /* vdev expansion time */
} guid_search_t;
@@ -77,7 +77,7 @@ static boolean_t
zfs_agent_iter_vdev(zpool_handle_t *zhp, nvlist_t *nvl, void *arg)
{
guid_search_t *gsp = arg;
- char *path = NULL;
+ const char *path = NULL;
uint_t c, children;
nvlist_t **child;
uint64_t vdev_guid;
@@ -211,7 +211,7 @@ zfs_agent_post_event(const char *class, const char *subclass, nvlist_t *nvl)
uint64_t pool_guid = 0, vdev_guid = 0;
guid_search_t search = { 0 };
device_type_t devtype = DEVICE_TYPE_PRIMARY;
- char *devid = NULL;
+ const char *devid = NULL;
class = "resource.fs.zfs.removed";
subclass = "";
diff --git a/sys/contrib/openzfs/cmd/zed/agents/zfs_diagnosis.c b/sys/contrib/openzfs/cmd/zed/agents/zfs_diagnosis.c
index 685f71bb923b..f6ba334a3ba3 100644
--- a/sys/contrib/openzfs/cmd/zed/agents/zfs_diagnosis.c
+++ b/sys/contrib/openzfs/cmd/zed/agents/zfs_diagnosis.c
@@ -464,7 +464,7 @@ zfs_fm_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl, const char *class)
nvlist_t *detector;
boolean_t pool_found = B_FALSE;
boolean_t isresource;
- char *type;
+ const char *type;
/*
* We subscribe to notifications for vdev or pool removal. In these
@@ -780,7 +780,7 @@ zfs_fm_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl, const char *class)
ZFS_MAKE_EREPORT(FM_EREPORT_ZFS_IO_FAILURE)) ||
fmd_nvl_class_match(hdl, nvl,
ZFS_MAKE_EREPORT(FM_EREPORT_ZFS_PROBE_FAILURE))) {
- char *failmode = NULL;
+ const char *failmode = NULL;
boolean_t checkremove = B_FALSE;
uint32_t pri = 0;
int32_t flags = 0;
diff --git a/sys/contrib/openzfs/cmd/zed/agents/zfs_mod.c b/sys/contrib/openzfs/cmd/zed/agents/zfs_mod.c
index e73fe25e56dd..1c82bd4f0010 100644
--- a/sys/contrib/openzfs/cmd/zed/agents/zfs_mod.c
+++ b/sys/contrib/openzfs/cmd/zed/agents/zfs_mod.c
@@ -183,7 +183,7 @@ zfs_unavail_pool(zpool_handle_t *zhp, void *data)
static void
zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)
{
- char *path;
+ const char *path;
vdev_state_t newstate;
nvlist_t *nvroot, *newvd;
pendingdev_t *device;
@@ -191,7 +191,7 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)
uint64_t offline = 0ULL, faulted = 0ULL;
uint64_t guid = 0ULL;
uint64_t is_spare = 0;
- char *physpath = NULL, *new_devid = NULL, *enc_sysfs_path = NULL;
+ const char *physpath = NULL, *new_devid = NULL, *enc_sysfs_path = NULL;
char rawpath[PATH_MAX], fullpath[PATH_MAX];
char devpath[PATH_MAX];
int ret;
@@ -549,7 +549,7 @@ static void
zfs_iter_vdev(zpool_handle_t *zhp, nvlist_t *nvl, void *data)
{
dev_data_t *dp = data;
- char *path = NULL;
+ const char *path = NULL;
uint_t c, children;
nvlist_t **child;
uint64_t guid = 0;
@@ -851,7 +851,7 @@ guid_iter(uint64_t pool_guid, uint64_t vdev_guid, const char *devid,
static int
zfs_deliver_add(nvlist_t *nvl)
{
- char *devpath = NULL, *devid = NULL;
+ const char *devpath = NULL, *devid = NULL;
uint64_t pool_guid = 0, vdev_guid = 0;
boolean_t is_slice;
@@ -999,7 +999,8 @@ zfsdle_vdev_online(zpool_handle_t *zhp, void *data)
nvlist_t *tgt;
int error;
- char *tmp_devname, devname[MAXPATHLEN] = "";
+ const char *tmp_devname;
+ char devname[MAXPATHLEN] = "";
uint64_t guid;
if (nvlist_lookup_uint64(udev_nvl, ZFS_EV_VDEV_GUID, &guid) == 0) {
@@ -1017,7 +1018,8 @@ zfsdle_vdev_online(zpool_handle_t *zhp, void *data)
if ((tgt = zpool_find_vdev_by_physpath(zhp, devname,
&avail_spare, &l2cache, NULL)) != NULL) {
- char *path, fullpath[MAXPATHLEN];
+ const char *path;
+ char fullpath[MAXPATHLEN];
uint64_t wholedisk = 0;
error = nvlist_lookup_string(tgt, ZPOOL_CONFIG_PATH, &path);
@@ -1030,10 +1032,11 @@ zfsdle_vdev_online(zpool_handle_t *zhp, void *data)
&wholedisk);
if (wholedisk) {
+ char *tmp;
path = strrchr(path, '/');
if (path != NULL) {
- path = zfs_strip_partition(path + 1);
- if (path == NULL) {
+ tmp = zfs_strip_partition(path + 1);
+ if (tmp == NULL) {
zpool_close(zhp);
return (0);
}
@@ -1042,8 +1045,8 @@ zfsdle_vdev_online(zpool_handle_t *zhp, void *data)
return (0);
}
- (void) strlcpy(fullpath, path, sizeof (fullpath));
- free(path);
+ (void) strlcpy(fullpath, tmp, sizeof (fullpath));
+ free(tmp);
/*
* We need to reopen the pool associated with this
@@ -1148,7 +1151,8 @@ zfsdle_vdev_online(zpool_handle_t *zhp, void *data)
static int
zfs_deliver_dle(nvlist_t *nvl)
{
- char *devname, name[MAXPATHLEN];
+ const char *devname;
+ char name[MAXPATHLEN];
uint64_t guid;
if (nvlist_lookup_uint64(nvl, ZFS_EV_VDEV_GUID, &guid) == 0) {
diff --git a/sys/contrib/openzfs/cmd/zed/agents/zfs_retire.c b/sys/contrib/openzfs/cmd/zed/agents/zfs_retire.c
index 45a45c497a0a..28714ec295bb 100644
--- a/sys/contrib/openzfs/cmd/zed/agents/zfs_retire.c
+++ b/sys/contrib/openzfs/cmd/zed/agents/zfs_retire.c
@@ -282,7 +282,7 @@ replace_with_spare(fmd_hdl_t *hdl, zpool_handle_t *zhp, nvlist_t *vdev)
*/
for (s = 0; s < nspares; s++) {
boolean_t rebuild = B_FALSE;
- char *spare_name, *type;
+ const char *spare_name, *type;
if (nvlist_lookup_string(spares[s], ZPOOL_CONFIG_PATH,
&spare_name) != 0)
@@ -377,9 +377,9 @@ zfs_retire_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl,
boolean_t is_repair;
boolean_t l2arc = B_FALSE;
boolean_t spare = B_FALSE;
- char *scheme;
+ const char *scheme;
nvlist_t *vdev = NULL;
- char *uuid;
+ const char *uuid;
int repair_done = 0;
boolean_t retire;
boolean_t is_disk;
@@ -401,7 +401,7 @@ zfs_retire_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl,
if (strcmp(class, "resource.fs.zfs.removed") == 0 ||
(strcmp(class, "resource.fs.zfs.statechange") == 0 &&
(state == VDEV_STATE_REMOVED || state == VDEV_STATE_FAULTED))) {
- char *devtype;
+ const char *devtype;
char *devname;
if (nvlist_lookup_string(nvl, FM_EREPORT_PAYLOAD_ZFS_VDEV_TYPE,
diff --git a/sys/contrib/openzfs/cmd/zed/zed_disk_event.c b/sys/contrib/openzfs/cmd/zed/zed_disk_event.c
index db89ecc907bb..32a8789d3001 100644
--- a/sys/contrib/openzfs/cmd/zed/zed_disk_event.c
+++ b/sys/contrib/openzfs/cmd/zed/zed_disk_event.c
@@ -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) {
diff --git a/sys/contrib/openzfs/cmd/zed/zed_event.c b/sys/contrib/openzfs/cmd/zed/zed_event.c
index ebd6851a2a86..c60d5a4bc22e 100644
--- a/sys/contrib/openzfs/cmd/zed/zed_event.c
+++ b/sys/contrib/openzfs/cmd/zed/zed_event.c
@@ -612,7 +612,7 @@ _zed_event_add_string_array(uint64_t eid, zed_strings_t *zsp,
char buf[MAXBUF];
int buflen = sizeof (buf);
const char *name;
- char **strp;
+ const char **strp;
uint_t nelem;
uint_t i;
char *p;
@@ -652,7 +652,7 @@ _zed_event_add_nvpair(uint64_t eid, zed_strings_t *zsp, nvpair_t *nvp)
uint16_t i16;
uint32_t i32;
uint64_t i64;
- char *str;
+ const char *str;
assert(zsp != NULL);
assert(nvp != NULL);
@@ -935,7 +935,7 @@ zed_event_service(struct zed_conf *zcp)
uint64_t eid;
int64_t *etime;
uint_t nelem;
- char *class;
+ const char *class;
const char *subclass;
int rv;