Skip to content

Commit 96ad742

Browse files
committed
fabrics: move libnvmf_context to private-fabrics header
Prepare the stage for generating getter/setters for libnvmf_context. For this, the struct needs to be in the private-fabrics header so the getter/setters are placed in the correct header file. Signed-off-by: Daniel Wagner <[email protected]>
1 parent d2b92f0 commit 96ad742

4 files changed

Lines changed: 59 additions & 57 deletions

File tree

libnvme/src/nvme/json.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include "cleanup.h"
1818
#include "private.h"
19+
#include "private-fabrics.h"
1920

2021
#define JSON_UPDATE_INT_OPTION(c, k, a, o) \
2122
if (!strcmp(# a, k ) && !c->a) c->a = json_object_get_int(o);

libnvme/src/nvme/private-fabrics.h

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,63 @@
99

1010
#include <nvme/tree.h>
1111

12+
struct libnvmf_context {
13+
struct libnvme_global_ctx *ctx;
14+
15+
/* common callbacks */
16+
bool (*decide_retry)(struct libnvmf_context *fctx, int err,
17+
void *user_data);
18+
void (*connected)(struct libnvmf_context *fctx, struct libnvme_ctrl *c,
19+
void *user_data);
20+
void (*already_connected)(struct libnvmf_context *fctx,
21+
struct libnvme_host *host, const char *subsysnqn,
22+
const char *transport, const char *traddr,
23+
const char *trsvcid, void *user_data);
24+
25+
/* discovery callbacks */
26+
void (*discovery_log)(struct libnvmf_context *fctx,
27+
bool connect,
28+
struct nvmf_discovery_log *log,
29+
uint64_t numrec, void *user_data);
30+
int (*parser_init)(struct libnvmf_context *fctx,
31+
void *user_data);
32+
void (*parser_cleanup)(struct libnvmf_context *fctx,
33+
void *user_data);
34+
int (*parser_next_line)(struct libnvmf_context *fctx,
35+
void *user_data);
36+
37+
/* discovery defaults */
38+
int default_max_discovery_retries;
39+
int default_keep_alive_timeout;
40+
41+
/* common fabrics configuraiton */
42+
const char *device;
43+
bool persistent;
44+
struct libnvme_fabrics_config *cfg;
45+
46+
/* connection configuration */
47+
const char *subsysnqn;
48+
const char *transport;
49+
const char *traddr;
50+
const char *trsvcid;
51+
const char *host_traddr;
52+
const char *host_iface;
53+
54+
/* host configuration */
55+
const char *hostnqn;
56+
const char *hostid;
57+
58+
/* authentication and transport encryption configuration */
59+
const char *hostkey;
60+
const char *ctrlkey;
61+
const char *keyring;
62+
char *tls_key;
63+
const char *tls_key_identity;
64+
65+
void *user_data;
66+
};
67+
68+
1269
/**
1370
* NVMe-oF private struct definitions.
1471
*

libnvme/src/nvme/private.h

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -302,63 +302,6 @@ struct libnvme_global_ctx {
302302
struct io_uring *ring;
303303
#endif
304304
};
305-
306-
struct libnvmf_context {
307-
struct libnvme_global_ctx *ctx;
308-
309-
/* common callbacks */
310-
bool (*decide_retry)(struct libnvmf_context *fctx, int err,
311-
void *user_data);
312-
void (*connected)(struct libnvmf_context *fctx, struct libnvme_ctrl *c,
313-
void *user_data);
314-
void (*already_connected)(struct libnvmf_context *fctx,
315-
struct libnvme_host *host, const char *subsysnqn,
316-
const char *transport, const char *traddr,
317-
const char *trsvcid, void *user_data);
318-
319-
/* discovery callbacks */
320-
void (*discovery_log)(struct libnvmf_context *fctx,
321-
bool connect,
322-
struct nvmf_discovery_log *log,
323-
uint64_t numrec, void *user_data);
324-
int (*parser_init)(struct libnvmf_context *fctx,
325-
void *user_data);
326-
void (*parser_cleanup)(struct libnvmf_context *fctx,
327-
void *user_data);
328-
int (*parser_next_line)(struct libnvmf_context *fctx,
329-
void *user_data);
330-
331-
/* discovery defaults */
332-
int default_max_discovery_retries;
333-
int default_keep_alive_timeout;
334-
335-
/* common fabrics configuraiton */
336-
const char *device;
337-
bool persistent;
338-
struct libnvme_fabrics_config *cfg;
339-
340-
/* connection configuration */
341-
const char *subsysnqn;
342-
const char *transport;
343-
const char *traddr;
344-
const char *trsvcid;
345-
const char *host_traddr;
346-
const char *host_iface;
347-
348-
/* host configuration */
349-
const char *hostnqn;
350-
const char *hostid;
351-
352-
/* authentication and transport encryption configuration */
353-
const char *hostkey;
354-
const char *ctrlkey;
355-
const char *keyring;
356-
char *tls_key;
357-
const char *tls_key_identity;
358-
359-
void *user_data;
360-
};
361-
362305
int libnvme_set_attr(const char *dir, const char *attr, const char *value);
363306

364307
int json_read_config(struct libnvme_global_ctx *ctx, const char *config_file);

libnvme/test/tree.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include <libnvme.h>
1616
#include <nvme/private.h>
17+
#include <nvme/private-fabrics.h>
1718

1819
struct test_data {
1920
/* input data */

0 commit comments

Comments
 (0)