]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme: split off nvme-private.h header file
authorHannes Reinecke <hare@suse.de>
Wed, 16 Jun 2021 09:06:18 +0000 (11:06 +0200)
committerHannes Reinecke <hare@suse.de>
Wed, 16 Jun 2021 17:51:42 +0000 (19:51 +0200)
Split off a private header file from nvme.h to contain all definitions
being replaced by libnvme.

Signed-off-by: Hannes Reinecke <hare@suse.de>
25 files changed:
nvme-ioctl.h
nvme-print.c
nvme-print.h
nvme-private.h [new file with mode: 0644]
nvme-rpmb.c
nvme-status.c
nvme.c
nvme.h
plugins/amzn/amzn-nvme.c
plugins/dera/dera-nvme.c
plugins/huawei/huawei-nvme.c
plugins/intel/intel-nvme.c
plugins/memblaze/memblaze-nvme.c
plugins/micron/micron-nvme.c
plugins/netapp/netapp-nvme.c
plugins/nvidia/nvidia-nvme.c
plugins/scaleflux/sfx-nvme.c
plugins/seagate/seagate-nvme.c
plugins/shannon/shannon-nvme.c
plugins/toshiba/toshiba-nvme.c
plugins/transcend/transcend-nvme.c
plugins/virtium/virtium-nvme.c
plugins/wdc/wdc-nvme.c
plugins/ymtc/ymtc-nvme.c
plugins/zns/zns.c

index 09aa0bbda97f136fca4be646883380cbb625d485..18e49f0d75dd8dccc3136dd05e0b8a4759f2be3d 100644 (file)
@@ -5,6 +5,8 @@
 #include <stdbool.h>
 #include "linux/nvme_ioctl.h"
 #include "nvme.h"
+#include "linux/nvme.h"
+#include "nvme-private.h"
 
 #define NVME_IOCTL_TIMEOUT 120000 /* in milliseconds */
 
index 533e588ade7972c00cfd7a53cddf1c6afb2e9d77..57ae7fc7a89c0b615bdaaa7579b86774107c8aca 100755 (executable)
@@ -6,6 +6,8 @@
 #include <sys/stat.h>
 
 #include "nvme.h"
+#include "linux/nvme.h"
+#include "nvme-private.h"
 #include "nvme-print.h"
 #include "nvme-models.h"
 #include "util/suffix.h"
index 46abc0ba6ae7331204723a0b4c71bf1ad556038b..97076636f6918a7fe9cff863cf28e02c6d272336 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef NVME_PRINT_H
 #define NVME_PRINT_H
 
-#include "nvme.h"
 #include <inttypes.h>
 
 void d(unsigned char *buf, int len, int width, int group);
diff --git a/nvme-private.h b/nvme-private.h
new file mode 100644 (file)
index 0000000..1fd4eb2
--- /dev/null
@@ -0,0 +1,71 @@
+#ifndef _NVME_PRIVATE_H
+#define _NVME_PRIVATE_H
+
+struct nvme_subsystem;
+struct nvme_ctrl;
+
+struct nvme_namespace {
+       char *name;
+       struct nvme_ctrl *ctrl;
+
+       unsigned nsid;
+       struct nvme_id_ns ns;
+};
+
+struct nvme_ctrl {
+       char *name;
+       char *path;
+       struct nvme_subsystem *subsys;
+
+       char *address;
+       char *transport;
+       char *state;
+       char *ana_state;
+       char *traddr;
+       char *trsvcid;
+       char *host_traddr;
+       char *host_iface;
+       char *hostnqn;
+       char *hostid;
+
+       struct nvme_id_ctrl id;
+
+       int    nr_namespaces;
+       struct nvme_namespace *namespaces;
+};
+
+struct nvme_subsystem {
+       char *name;
+       char *subsysnqn;
+
+       int    nr_ctrls;
+       struct nvme_ctrl *ctrls;
+
+       int    nr_namespaces;
+       struct nvme_namespace *namespaces;
+};
+
+struct nvme_topology {
+       int    nr_subsystems;
+       struct nvme_subsystem *subsystems;
+};
+
+void *mmap_registers(const char *dev);
+
+int scan_ctrl_namespace_filter(const struct dirent *d);
+int scan_namespace_filter(const struct dirent *d);
+int scan_ctrl_paths_filter(const struct dirent *d);
+int scan_ctrls_filter(const struct dirent *d);
+int scan_subsys_filter(const struct dirent *d);
+int scan_dev_filter(const struct dirent *d);
+
+int scan_subsystems(struct nvme_topology *t, const char *subsysnqn,
+                   __u32 ns_instance, int nsid, char *dev_dir);
+void free_topology(struct nvme_topology *t);
+char *get_nvme_subsnqn(char *path);
+char *nvme_get_ctrl_attr(const char *path, const char *attr);
+
+int uuid_from_dmi(char *uuid);
+int uuid_from_systemd(char *uuid);
+
+#endif /* _NVME_PRIVATE_H */
index 0e11ef3320cd88c4a526a58b9711fecfdb88f3db..0b55391fc8d7b6ed9fed3511b67c8926dbae9bf6 100644 (file)
@@ -27,6 +27,8 @@
 #include <linux/socket.h>
 
 #include "nvme.h"
+#include "linux/nvme.h"
+#include "nvme-private.h"
 #include "nvme-print.h"
 #include "nvme-ioctl.h"
 
index 270eb06326f4b6d09a2b356f7543f373d3203a95..d82a6d5bd7171f5889ec2a22d130798e4d2db810 100644 (file)
@@ -3,6 +3,8 @@
 #include <errno.h>
 
 #include "nvme.h"
+#include "linux/nvme.h"
+#include "nvme-private.h"
 #include "nvme-status.h"
 
 static inline __u8 nvme_generic_status_to_errno(__u16 status)
diff --git a/nvme.c b/nvme.c
index d327a9c905118af5791bf9db95f31961849524fc..4f985046dcede8fb5db329770d0828889ee9623c 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -49,6 +49,9 @@
 #include <sys/stat.h>
 
 #include "common.h"
+#include "nvme.h"
+#include "linux/nvme.h"
+#include "nvme-private.h"
 #include "nvme-print.h"
 #include "nvme-ioctl.h"
 #include "nvme-status.h"
diff --git a/nvme.h b/nvme.h
index 3b733675bb9ee48919e29b66a9cda1e75748d037..592ba52fa0e9b868819f4f8059d19a56d7fb51cd 100644 (file)
--- a/nvme.h
+++ b/nvme.h
@@ -49,7 +49,6 @@
 #include "util/json.h"
 #endif
 #include "util/argconfig.h"
-#include "linux/nvme.h"
 
 enum nvme_print_flags {
        NORMAL  = 0,
@@ -59,55 +58,6 @@ enum nvme_print_flags {
        BINARY  = 1 << 3,       /* binary dump raw bytes */
 };
 
-struct nvme_subsystem;
-struct nvme_ctrl;
-
-struct nvme_namespace {
-       char *name;
-       struct nvme_ctrl *ctrl;
-
-       unsigned nsid;
-       struct nvme_id_ns ns;
-};
-
-struct nvme_ctrl {
-       char *name;
-       char *path;
-       struct nvme_subsystem *subsys;
-
-       char *address;
-       char *transport;
-       char *state;
-       char *ana_state;
-       char *traddr;
-       char *trsvcid;
-       char *host_traddr;
-       char *host_iface;
-       char *hostnqn;
-       char *hostid;
-
-       struct nvme_id_ctrl id;
-
-       int    nr_namespaces;
-       struct nvme_namespace *namespaces;
-};
-
-struct nvme_subsystem {
-       char *name;
-       char *subsysnqn;
-
-       int    nr_ctrls;
-       struct nvme_ctrl *ctrls;
-
-       int    nr_namespaces;
-       struct nvme_namespace *namespaces;
-};
-
-struct nvme_topology {
-       int    nr_subsystems;
-       struct nvme_subsystem *subsystems;
-};
-
 #define SYS_NVME "/sys/class/nvme"
 
 void register_extension(struct plugin *plugin);
@@ -119,30 +69,13 @@ extern const char *output_format;
 
 enum nvme_print_flags validate_output_format(const char *format);
 int __id_ctrl(int argc, char **argv, struct command *cmd,
-       struct plugin *plugin, void (*vs)(__u8 *vs, struct json_object *root));
+       struct plugin *plugin, void (*vs)(uint8_t *vs, struct json_object *root));
 char *nvme_char_from_block(char *block);
-void *mmap_registers(const char *dev);
 
 extern int current_index;
-int scan_ctrl_namespace_filter(const struct dirent *d);
-int scan_namespace_filter(const struct dirent *d);
-int scan_ctrl_paths_filter(const struct dirent *d);
-int scan_ctrls_filter(const struct dirent *d);
-int scan_subsys_filter(const struct dirent *d);
-int scan_dev_filter(const struct dirent *d);
-
-int scan_subsystems(struct nvme_topology *t, const char *subsysnqn,
-                   __u32 ns_instance, int nsid, char *dev_dir);
-void free_topology(struct nvme_topology *t);
-char *get_nvme_subsnqn(char *path);
-char *nvme_get_ctrl_attr(const char *path, const char *attr);
-
 void *nvme_alloc(size_t len, bool *huge);
 void nvme_free(void *p, bool huge);
 
-int uuid_from_dmi(char *uuid);
-int uuid_from_systemd(char *uuid);
-
 unsigned long long elapsed_utime(struct timeval start_time,
                                        struct timeval end_time);
 #endif /* _NVME_H */
index 47a2d82fce729ffb3c29de4b300e4b990a6763b2..9217586c95448b712d3d5bab56a65b3616f742d9 100644 (file)
@@ -9,6 +9,8 @@
 
 #include "common.h"
 #include "nvme.h"
+#include "linux/nvme.h"
+#include "nvme-private.h"
 #include "nvme-print.h"
 #include "nvme-ioctl.h"
 #include "plugin.h"
index be78930771ed82bb8cbb261b4739c1d557f75471..a91d658b896611cc25dd9acec67558b4d203044f 100644 (file)
@@ -10,6 +10,8 @@
 #include <sys/time.h>
 
 #include "nvme.h"
+#include "linux/nvme.h"
+#include "nvme-private.h"
 #include "nvme-print.h"
 #include "nvme-ioctl.h"
 #include "plugin.h"
index b39d86156d51c19ff984d7f645015e8ced9acc82..05c6336f6d52d51879531b46a9acb07f5e5262e4 100644 (file)
@@ -29,6 +29,8 @@
 #include "linux/nvme_ioctl.h"
 
 #include "nvme.h"
+#include "linux/nvme.h"
+#include "nvme-private.h"
 #include "nvme-print.h"
 #include "nvme-ioctl.h"
 #include "plugin.h"
index 8f8d54d8fa1bc4e9c37baff4cc1fba5d729f6a7d..59fbd94556dea4974237baf60207ea0201264e20 100644 (file)
@@ -9,6 +9,8 @@
 
 #include "common.h"
 #include "nvme.h"
+#include "linux/nvme.h"
+#include "nvme-private.h"
 #include "nvme-print.h"
 #include "nvme-ioctl.h"
 #include "plugin.h"
index e3807f13bf4264b36a6319a2c93d6bf78b6dd710..f6fbc802d1b422d93c8d3ec66a33275261c2b2d6 100644 (file)
@@ -8,6 +8,8 @@
 #include "linux/nvme_ioctl.h"
 
 #include "nvme.h"
+#include "linux/nvme.h"
+#include "nvme-private.h"
 #include "nvme-print.h"
 #include "nvme-ioctl.h"
 #include "plugin.h"
index d3f2dc47442da4dd43bd0972dc99603b29f5a4d7..32cecbb8e143c011c92cb7f4b6e8bfa3c8809488 100644 (file)
@@ -10,6 +10,8 @@
 #include <libgen.h>
 #include <sys/stat.h>
 #include "nvme.h"
+#include "linux/nvme.h"
+#include "nvme-private.h"
 #include "nvme-print.h"
 #include "nvme-status.h"
 #include "nvme-ioctl.h"
index 15c3923148b48e7d7f121295810ae243861a72fb..0fe2bedbdaa568f49b9a5eb045c5dc184bee174d 100644 (file)
@@ -24,6 +24,8 @@
 #include <sys/ioctl.h>
 
 #include "nvme.h"
+#include "linux/nvme.h"
+#include "nvme-private.h"
 #include "nvme-ioctl.h"
 
 #include "suffix.h"
index cdf51ab21c5ae396055c878ec53f14c9aaa0f2c4..cb080d7b81881503b6849c39486caa110b7ec6b4 100644 (file)
@@ -9,6 +9,8 @@
 
 #include "common.h"
 #include "nvme.h"
+#include "linux/nvme.h"
+#include "nvme-private.h"
 #include "nvme-print.h"
 #include "nvme-ioctl.h"
 #include "plugin.h"
index df7f9a3e2e6aa449951cad6b25449d4bb87671f3..31b885233b55bb10a152950e749890635ded049e 100644 (file)
@@ -14,6 +14,8 @@
 #include "linux/nvme_ioctl.h"
 
 #include "nvme.h"
+#include "linux/nvme.h"
+#include "nvme-private.h"
 #include "nvme-print.h"
 #include "nvme-ioctl.h"
 #include "nvme-status.h"
index 9512cda624eeffff1499d940048397ae1fe8d353..844594d8ed3632f68153c5acb18a8b516b00a08f 100644 (file)
@@ -31,6 +31,8 @@
 #include <ctype.h>
 #include "linux/nvme_ioctl.h"
 #include "nvme.h"
+#include "linux/nvme.h"
+#include "nvme-private.h"
 #include "nvme-print.h"
 #include "nvme-ioctl.h"
 #include "plugin.h"
index 1909e458d0d972c2c61ce65b9125fe01c376535e..fac29b4681b44fec52cfc60f6b1c27c166913e97 100644 (file)
@@ -9,6 +9,8 @@
 
 #include "common.h"
 #include "nvme.h"
+#include "linux/nvme.h"
+#include "nvme-private.h"
 #include "nvme-print.h"
 #include "nvme-ioctl.h"
 #include "plugin.h"
index cba1af8ce93c47e66108bf99913a0d4c5876aaed..5a167d59e034a16bd80146187f62ca6104d0ea61 100644 (file)
@@ -9,6 +9,8 @@
 
 #include "linux/nvme_ioctl.h"
 #include "nvme.h"
+#include "linux/nvme.h"
+#include "nvme-private.h"
 #include "nvme-print.h"
 #include "nvme-ioctl.h"
 #include "plugin.h"
index dbb56be3ba349083907d40def8db79d78dcabe91..e7d021c70bfae52852f9da474b086249519d0d37 100644 (file)
@@ -7,6 +7,8 @@
 
 #include "linux/nvme_ioctl.h"
 #include "nvme.h"
+#include "linux/nvme.h"
+#include "nvme-private.h"
 #include "nvme-print.h"
 #include "nvme-ioctl.h"
 #include "plugin.h"
index a194a5fac86f4b05f961aed079c4540976c9e059..249a7a8e4c67c9bf7e20183d28e162c3f71b89b5 100644 (file)
@@ -11,6 +11,8 @@
 
 #include "linux/nvme_ioctl.h"
 #include "nvme.h"
+#include "linux/nvme.h"
+#include "nvme-private.h"
 #include "nvme-print.h"
 #include "nvme-ioctl.h"
 #include "plugin.h"
index 585bc10e01fed053894abcef6983a072c44ce970..cdf77069c61b7d57e1518d2e44aa18d4ebe44c7f 100644 (file)
@@ -34,6 +34,8 @@
 
 #include "common.h"
 #include "nvme.h"
+#include "linux/nvme.h"
+#include "nvme-private.h"
 #include "nvme-print.h"
 #include "nvme-ioctl.h"
 #include "plugin.h"
index 91e52bef0ccd50f133746943ff320fe2e55a76be..d599f231375df9cdf0f267d64ab4e5c82ce32620 100644 (file)
@@ -7,6 +7,8 @@
 #include "linux/nvme_ioctl.h"
 
 #include "nvme.h"
+#include "linux/nvme.h"
+#include "nvme-private.h"
 #include "nvme-print.h"
 #include "nvme-ioctl.h"
 #include "plugin.h"
index 5c5ed92ae082d6a884ea591e66dae450d79200f5..70959a35adf71be57194c24bb06f92724430419f 100644 (file)
@@ -8,6 +8,8 @@
 #include <sys/stat.h>
 
 #include "nvme.h"
+#include "linux/nvme.h"
+#include "nvme-private.h"
 #include "nvme-ioctl.h"
 #include "nvme-print.h"
 #include "nvme-status.h"