zed: merge all _NOT_IMPLEMENTED_ events

These events should currently never be generated.

Also untag _zed_event_add_nvpair() from merge with
zpool_do_events_nvprint() ‒ they serve different purposes (machine,
usually script vs human consumption) and format the output differently
as it stands

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #11834
This commit is contained in:
наб 2021-04-02 20:47:00 +02:00 committed by Brian Behlendorf
parent 48b60cffda
commit 018560b153
2 changed files with 5 additions and 20 deletions

View File

@ -249,7 +249,7 @@ _zed_event_value_is_hex(const char *name)
* *
* All environment variables in [zsp] should be added through this function. * All environment variables in [zsp] should be added through this function.
*/ */
static int static __attribute__((format(printf, 5, 6))) int
_zed_event_add_var(uint64_t eid, zed_strings_t *zsp, _zed_event_add_var(uint64_t eid, zed_strings_t *zsp,
const char *prefix, const char *name, const char *fmt, ...) const char *prefix, const char *name, const char *fmt, ...)
{ {
@ -624,8 +624,6 @@ _zed_event_add_string_array(uint64_t eid, zed_strings_t *zsp,
* Convert the nvpair [nvp] to a string which is added to the environment * Convert the nvpair [nvp] to a string which is added to the environment
* of the child process. * of the child process.
* Return 0 on success, -1 on error. * Return 0 on success, -1 on error.
*
* FIXME: Refactor with cmd/zpool/zpool_main.c:zpool_do_events_nvprint()?
*/ */
static void static void
_zed_event_add_nvpair(uint64_t eid, zed_strings_t *zsp, nvpair_t *nvp) _zed_event_add_nvpair(uint64_t eid, zed_strings_t *zsp, nvpair_t *nvp)
@ -724,23 +722,11 @@ _zed_event_add_nvpair(uint64_t eid, zed_strings_t *zsp, nvpair_t *nvp)
_zed_event_add_var(eid, zsp, prefix, name, _zed_event_add_var(eid, zsp, prefix, name,
"%llu", (u_longlong_t)i64); "%llu", (u_longlong_t)i64);
break; break;
case DATA_TYPE_NVLIST:
_zed_event_add_var(eid, zsp, prefix, name,
"%s", "_NOT_IMPLEMENTED_"); /* FIXME */
break;
case DATA_TYPE_STRING: case DATA_TYPE_STRING:
(void) nvpair_value_string(nvp, &str); (void) nvpair_value_string(nvp, &str);
_zed_event_add_var(eid, zsp, prefix, name, _zed_event_add_var(eid, zsp, prefix, name,
"%s", (str ? str : "<NULL>")); "%s", (str ? str : "<NULL>"));
break; break;
case DATA_TYPE_BOOLEAN_ARRAY:
_zed_event_add_var(eid, zsp, prefix, name,
"%s", "_NOT_IMPLEMENTED_"); /* FIXME */
break;
case DATA_TYPE_BYTE_ARRAY:
_zed_event_add_var(eid, zsp, prefix, name,
"%s", "_NOT_IMPLEMENTED_"); /* FIXME */
break;
case DATA_TYPE_INT8_ARRAY: case DATA_TYPE_INT8_ARRAY:
_zed_event_add_int8_array(eid, zsp, prefix, nvp); _zed_event_add_int8_array(eid, zsp, prefix, nvp);
break; break;
@ -768,9 +754,11 @@ _zed_event_add_nvpair(uint64_t eid, zed_strings_t *zsp, nvpair_t *nvp)
case DATA_TYPE_STRING_ARRAY: case DATA_TYPE_STRING_ARRAY:
_zed_event_add_string_array(eid, zsp, prefix, nvp); _zed_event_add_string_array(eid, zsp, prefix, nvp);
break; break;
case DATA_TYPE_NVLIST:
case DATA_TYPE_BOOLEAN_ARRAY:
case DATA_TYPE_BYTE_ARRAY:
case DATA_TYPE_NVLIST_ARRAY: case DATA_TYPE_NVLIST_ARRAY:
_zed_event_add_var(eid, zsp, prefix, name, _zed_event_add_var(eid, zsp, prefix, name, "_NOT_IMPLEMENTED_");
"%s", "_NOT_IMPLEMENTED_"); /* FIXME */
break; break;
default: default:
errno = EINVAL; errno = EINVAL;

View File

@ -234,9 +234,6 @@ Terminate the daemon.
.PP .PP
ZEDLETs are unable to return state/status information to the kernel. ZEDLETs are unable to return state/status information to the kernel.
.PP .PP
Some zevent nvpair types are not handled. These are denoted by zevent
environment variables having a "_NOT_IMPLEMENTED_" value.
.PP
Internationalization support via gettext has not been added. Internationalization support via gettext has not been added.
.PP .PP
The diagnosis engine is not yet implemented. The diagnosis engine is not yet implemented.