1
0
Fork 0

Adding upstream version 2.12.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-03-20 08:10:40 +01:00
parent 65508f0a28
commit c0fbec1eb4
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
571 changed files with 10718 additions and 2738 deletions

38
plugins/lm/lm-print.c Normal file
View file

@ -0,0 +1,38 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "lm-print.h"
#define lm_print(name, flags, ...) \
do { \
struct lm_print_ops *ops = lm_print_ops(flags); \
if (ops && ops->name) \
ops->name(__VA_ARGS__); \
else \
fprintf(stderr, "unhandled output format\n"); \
} while (false)
static struct lm_print_ops *lm_print_ops(nvme_print_flags_t flags)
{
struct lm_print_ops *ops = NULL;
if (flags & JSON || nvme_is_output_format_json())
ops = lm_get_json_print_ops(flags);
else if (flags & BINARY)
ops = lm_get_binary_print_ops(flags);
else
ops = lm_get_stdout_print_ops(flags);
return ops;
}
void lm_show_controller_state_data(struct nvme_lm_controller_state_data *data, size_t len,
__u32 offset, nvme_print_flags_t flags)
{
lm_print(controller_state_data, flags, data, len, offset);
}
void lm_show_controller_data_queue(struct nvme_lm_ctrl_data_queue_fid_data *data,
nvme_print_flags_t flags)
{
lm_print(controller_data_queue, flags, data);
}