]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
tree: Move structures to private.h
authorHannes Reinecke <hare@suse.de>
Fri, 7 May 2021 13:49:59 +0000 (15:49 +0200)
committerHannes Reinecke <hare@suse.de>
Sat, 19 Jun 2021 11:28:35 +0000 (13:28 +0200)
Move generic structures to private.h to avoid having to duplicate
definitions in the SWIG interface file.

Signed-off-by: Hannes Reinecke <hare@suse.de>
src/nvme/fabrics.c
src/nvme/json.c
src/nvme/private.h
src/nvme/tree.c

index fb614aacfeed39910ee8a37220def0ba0cad75ac..8b415cf40bcae141373f82973010aad80b85e71b 100644 (file)
@@ -27,6 +27,7 @@
 #define NVME_HOSTNQN_ID SD_ID128_MAKE(c7,f4,61,81,12,be,49,32,8c,83,10,6f,9d,dd,d8,6b)
 #endif
 
+#include <ccan/list/list.h>
 #include <ccan/array_size/array_size.h>
 
 #include "fabrics.h"
index d4f2644c63299ea3b59d89361ec86727a775396b..da4f18d3bf655f8520f910ffb4e46f3f1db6c1a9 100644 (file)
@@ -13,7 +13,6 @@
 #include <json-c/json.h>
 
 #include "fabrics.h"
-#include "private.h"
 
 #define json_object_add_value_string(o, k, v)                  \
        json_object_object_add(o, k, json_object_new_string(v))
index 70b38d451bff592df1eb091689e11ac62d349249..fbda6e226c8b9746e51e7318319cbd0c38912dbf 100644 (file)
@@ -13,6 +13,107 @@ extern const char *nvme_ctrl_sysfs_dir;
 extern const char *nvme_subsys_sysfs_dir;
 extern const char *nvme_ns_sysfs_dir;
 
+struct nvme_path {
+       struct list_node entry;
+       struct list_node nentry;
+
+       struct nvme_ctrl *c;
+       struct nvme_ns *n;
+
+       char *name;
+       char *sysfs_dir;
+       char *ana_state;
+       int grpid;
+};
+
+struct nvme_ns {
+       struct list_node entry;
+       struct list_head paths;
+
+       struct nvme_subsystem *s;
+       struct nvme_ctrl *c;
+
+       int fd;
+       __u32 nsid;
+       char *name;
+       char *sysfs_dir;
+
+       int lba_shift;
+       int lba_size;
+       int meta_size;
+       uint64_t lba_count;
+       uint64_t lba_util;
+
+       uint8_t eui64[8];
+       uint8_t nguid[16];
+#ifdef CONFIG_LIBUUID
+       uuid_t  uuid;
+#else
+       uint8_t uuid[16];
+#endif
+       enum nvme_csi csi;
+};
+
+struct nvme_ctrl {
+       struct list_node entry;
+       struct list_head paths;
+       struct list_head namespaces;
+
+       struct nvme_subsystem *s;
+
+       int fd;
+       char *name;
+       char *sysfs_dir;
+       char *address;
+       char *firmware;
+       char *model;
+       char *state;
+       char *numa_node;
+       char *queue_count;
+       char *serial;
+       char *sqsize;
+       char *hostnqn;
+       char *hostid;
+       char *transport;
+       char *subsysnqn;
+       char *traddr;
+       char *trsvcid;
+       char *host_traddr;
+       char *host_iface;
+       bool discovered;
+       bool persistent;
+       struct nvme_fabrics_config cfg;
+};
+
+struct nvme_subsystem {
+       struct list_node entry;
+       struct list_head ctrls;
+       struct list_head namespaces;
+       struct nvme_host *h;
+
+       char *name;
+       char *sysfs_dir;
+       char *subsysnqn;
+       char *model;
+       char *serial;
+       char *firmware;
+};
+
+struct nvme_host {
+       struct list_node entry;
+       struct list_head subsystems;
+       struct nvme_root *r;
+
+       char *hostnqn;
+       char *hostid;
+};
+
+struct nvme_root {
+       char *config_file;
+       struct list_head hosts;
+       bool modified;
+};
+
 int nvme_set_attr(const char *dir, const char *attr, const char *value);
 
 void json_read_config(nvme_root_t r, const char *config_file);
index 9bd3a14d4274841bd3dbd14190c622da4d192029..777ee9d177c91f343217eb707dc72343097c8ca4 100644 (file)
@@ -41,107 +41,6 @@ static int nvme_subsystem_scan_ctrl(struct nvme_subsystem *s, char *name);
 static int nvme_ctrl_scan_namespace(struct nvme_ctrl *c, char *name);
 static int nvme_ctrl_scan_path(struct nvme_ctrl *c, char *name);
 
-struct nvme_path {
-       struct list_node entry;
-       struct list_node nentry;
-
-       struct nvme_ctrl *c;
-       struct nvme_ns *n;
-
-       char *name;
-       char *sysfs_dir;
-       char *ana_state;
-       int grpid;
-};
-
-struct nvme_ns {
-       struct list_node entry;
-       struct list_head paths;
-
-       struct nvme_subsystem *s;
-       struct nvme_ctrl *c;
-
-       int fd;
-       __u32 nsid;
-       char *name;
-       char *sysfs_dir;
-
-       int lba_shift;
-       int lba_size;
-       int meta_size;
-       uint64_t lba_count;
-       uint64_t lba_util;
-
-       uint8_t eui64[8];
-       uint8_t nguid[16];
-#ifdef CONFIG_LIBUUID
-       uuid_t  uuid;
-#else
-       uint8_t uuid[16];
-#endif
-       enum nvme_csi csi;
-};
-
-struct nvme_ctrl {
-       struct list_node entry;
-       struct list_head paths;
-       struct list_head namespaces;
-
-       struct nvme_subsystem *s;
-
-       int fd;
-       char *name;
-       char *sysfs_dir;
-       char *address;
-       char *firmware;
-       char *model;
-       char *state;
-       char *numa_node;
-       char *queue_count;
-       char *serial;
-       char *sqsize;
-       char *hostnqn;
-       char *hostid;
-       char *transport;
-       char *subsysnqn;
-       char *traddr;
-       char *trsvcid;
-       char *host_traddr;
-       char *host_iface;
-       bool discovered;
-       bool persistent;
-       struct nvme_fabrics_config cfg;
-};
-
-struct nvme_subsystem {
-       struct list_node entry;
-       struct list_head ctrls;
-       struct list_head namespaces;
-       struct nvme_host *h;
-
-       char *name;
-       char *sysfs_dir;
-       char *subsysnqn;
-       char *model;
-       char *serial;
-       char *firmware;
-};
-
-struct nvme_host {
-       struct list_node entry;
-       struct list_head subsystems;
-       struct nvme_root *r;
-
-       char *hostnqn;
-       char *hostid;
-};
-
-struct nvme_root {
-       char *config_file;
-       struct list_head hosts;
-       bool modified;
-};
-
 static inline void nvme_free_dirents(struct dirent **d, int i)
 {
        while (i-- > 0)