From a773b08b88a5dec6eebdd2c7c892072c6ff2432d Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sun, 2 Dec 2018 23:12:26 +0000 Subject: [PATCH] Move common logpage routines into nvmecontrol.h For the upcoming move of vendor specific code into vendor specific files, make the common logpage routines global and move them to nvmecontrol.h. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18403 --- sbin/nvmecontrol/logpage.c | 9 +-------- sbin/nvmecontrol/nvmecontrol.h | 8 ++++++++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/sbin/nvmecontrol/logpage.c b/sbin/nvmecontrol/logpage.c index 561e4a2ca0c8..4cb5c824a478 100644 --- a/sbin/nvmecontrol/logpage.c +++ b/sbin/nvmecontrol/logpage.c @@ -53,16 +53,9 @@ SET_DECLARE(logpage, struct logpage_function); #define LOGPAGE_USAGE \ " nvmecontrol logpage <-p page_id> [-b] [-v vendor] [-x] \n" \ -#define DEFAULT_SIZE (4096) #define MAX_FW_SLOTS (7) -struct kv_name -{ - uint32_t key; - const char *name; -}; - -static const char * +const char * kv_lookup(const struct kv_name *kv, size_t kv_count, uint32_t key) { static char bad[32]; diff --git a/sbin/nvmecontrol/nvmecontrol.h b/sbin/nvmecontrol/nvmecontrol.h index 59693a55fc9a..0213be4803e6 100644 --- a/sbin/nvmecontrol/nvmecontrol.h +++ b/sbin/nvmecontrol/nvmecontrol.h @@ -69,6 +69,14 @@ struct logpage_function { } ; \ NVME_LOGPAGESET(unique ## _lpf) +#define DEFAULT_SIZE (4096) +struct kv_name { + uint32_t key; + const char *name; +}; + +const char *kv_lookup(const struct kv_name *kv, size_t kv_count, uint32_t key); + #define NVME_CTRLR_PREFIX "nvme" #define NVME_NS_PREFIX "ns"