Skip to content

Commit 762188a

Browse files
hreineckeigaw
authored andcommitted
libnvme: Drop __nvme_lookup_ctrl()
All functions have been converted to the new interface, so rename __nvme_lookup_ctrl() to nvme_lookup_ctrl() and drop the wrapper. Signed-off-by: Hannes Reinecke <[email protected]>
1 parent 1d65471 commit 762188a

5 files changed

Lines changed: 18 additions & 42 deletions

File tree

libnvme/src/nvme/fabrics.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2425,7 +2425,7 @@ __public int nvmf_config_modify(struct nvme_global_ctx *ctx,
24252425
return -ENODEV;
24262426
}
24272427

2428-
c = __nvme_lookup_ctrl(s, fctx, NULL);
2428+
c = nvme_lookup_ctrl(s, fctx, NULL);
24292429
if (!c) {
24302430
nvme_msg(ctx, LOG_ERR, "Failed to lookup controller\n");
24312431
return -ENODEV;

libnvme/src/nvme/json.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static void json_parse_port(nvme_subsystem_t s, struct json_object *port_obj)
101101
attr_obj = json_object_object_get(port_obj, "trsvcid");
102102
if (attr_obj)
103103
fctx.trsvcid = json_object_get_string(attr_obj);
104-
c = __nvme_lookup_ctrl(s, &fctx, NULL);
104+
c = nvme_lookup_ctrl(s, &fctx, NULL);
105105
if (!c)
106106
return;
107107
json_update_attributes(c, port_obj);

libnvme/src/nvme/private.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -395,13 +395,9 @@ nvme_host_t nvme_lookup_host(struct nvme_global_ctx *ctx, const char *hostnqn,
395395
nvme_subsystem_t nvme_lookup_subsystem(struct nvme_host *h,
396396
const char *name,
397397
const char *subsysnqn);
398-
nvme_ctrl_t nvme_lookup_ctrl(nvme_subsystem_t s, const char *transport,
399-
const char *traddr, const char *host_traddr,
400-
const char *host_iface, const char *trsvcid,
398+
nvme_ctrl_t nvme_lookup_ctrl(nvme_subsystem_t s,
399+
struct nvmf_context *fctx,
401400
nvme_ctrl_t p);
402-
nvme_ctrl_t __nvme_lookup_ctrl(nvme_subsystem_t s,
403-
struct nvmf_context *fctx,
404-
nvme_ctrl_t p);
405401
nvme_ctrl_t nvme_ctrl_find(nvme_subsystem_t s, struct nvmf_context *fctx);
406402

407403
void __nvme_free_host(nvme_host_t h);

libnvme/src/nvme/tree.c

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,9 +1506,9 @@ nvme_ctrl_t nvme_ctrl_find(nvme_subsystem_t s, struct nvmf_context *fctx)
15061506
return __nvme_ctrl_find(s, fctx, NULL/*p*/);
15071507
}
15081508

1509-
nvme_ctrl_t __nvme_lookup_ctrl(nvme_subsystem_t s,
1510-
struct nvmf_context *fctx,
1511-
nvme_ctrl_t p)
1509+
nvme_ctrl_t nvme_lookup_ctrl(nvme_subsystem_t s,
1510+
struct nvmf_context *fctx,
1511+
nvme_ctrl_t p)
15121512
{
15131513
struct nvme_global_ctx *ctx;
15141514
struct nvme_ctrl *c;
@@ -1541,26 +1541,6 @@ nvme_ctrl_t __nvme_lookup_ctrl(nvme_subsystem_t s,
15411541
return c;
15421542
}
15431543

1544-
nvme_ctrl_t nvme_lookup_ctrl(nvme_subsystem_t s, const char *transport,
1545-
const char *traddr, const char *host_traddr,
1546-
const char *host_iface, const char *trsvcid,
1547-
nvme_ctrl_t p)
1548-
{
1549-
if (!s || !transport)
1550-
return NULL;
1551-
1552-
struct nvmf_context fctx = {
1553-
.transport = transport,
1554-
.traddr = traddr,
1555-
.host_traddr = host_traddr,
1556-
.host_iface = host_iface,
1557-
.trsvcid = trsvcid,
1558-
.subsysnqn = NULL,
1559-
};
1560-
1561-
return __nvme_lookup_ctrl(s, &fctx, p);
1562-
}
1563-
15641544
static int nvme_ctrl_scan_paths(struct nvme_global_ctx *ctx, struct nvme_ctrl *c)
15651545
{
15661546
_cleanup_dirents_ struct dirents paths = {};
@@ -1918,7 +1898,7 @@ int nvme_ctrl_alloc(struct nvme_global_ctx *ctx, nvme_subsystem_t s,
19181898
.host_iface = host_iface,
19191899
.trsvcid = trsvcid,
19201900
};
1921-
c = __nvme_lookup_ctrl(s, &fctx, p);
1901+
c = nvme_lookup_ctrl(s, &fctx, p);
19221902
if (c) {
19231903
if (!c->name)
19241904
break;

libnvme/test/tree.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ static struct nvme_global_ctx *create_tree()
140140
assert(!nvme_get_subsystem(ctx, h, d->subsysname,
141141
d->f.subsysnqn, &d->s));
142142
assert(d->s);
143-
d->c = __nvme_lookup_ctrl(d->s, &d->f, NULL);
143+
d->c = nvme_lookup_ctrl(d->s, &d->f, NULL);
144144
assert(d->c);
145145
d->ctrl_id = i;
146146

@@ -177,7 +177,7 @@ static bool tcp_ctrl_lookup(nvme_subsystem_t s, struct test_data *d)
177177

178178
f.host_traddr = NULL;
179179
f.host_iface = NULL;
180-
c = __nvme_lookup_ctrl(s, &f, NULL);
180+
c = nvme_lookup_ctrl(s, &f, NULL);
181181
printf("%10s %12s %10s -> ", f.trsvcid, "", "");
182182
show_ctrl(c);
183183
pass &= match_ctrl(d, c);
@@ -186,7 +186,7 @@ static bool tcp_ctrl_lookup(nvme_subsystem_t s, struct test_data *d)
186186
if (d->f.host_traddr) {
187187
f = d->f;
188188
f.host_iface = NULL;
189-
c = __nvme_lookup_ctrl(s, &f, NULL);
189+
c = nvme_lookup_ctrl(s, &f, NULL);
190190
printf("%10s %12s %10s -> ", f.trsvcid, f.host_traddr, "");
191191
show_ctrl(c);
192192
pass &= match_ctrl(d, c);
@@ -196,7 +196,7 @@ static bool tcp_ctrl_lookup(nvme_subsystem_t s, struct test_data *d)
196196
if (d->f.host_iface) {
197197
f = d->f;
198198
f.host_traddr = NULL;
199-
c = __nvme_lookup_ctrl(s, &f, NULL);
199+
c = nvme_lookup_ctrl(s, &f, NULL);
200200
printf("%10s %12s %10s -> ", f.trsvcid, "", f.host_iface);
201201
show_ctrl(c);
202202
pass &= match_ctrl(d, c);
@@ -205,7 +205,7 @@ static bool tcp_ctrl_lookup(nvme_subsystem_t s, struct test_data *d)
205205

206206
if (d->f.host_iface && d->f.traddr) {
207207
f = d->f;
208-
c = __nvme_lookup_ctrl(s, &f, NULL);
208+
c = nvme_lookup_ctrl(s, &f, NULL);
209209
printf("%10s %12s %10s -> ", f.trsvcid,
210210
f.host_traddr, f.host_iface);
211211
show_ctrl(c);
@@ -224,7 +224,7 @@ static bool default_ctrl_lookup(nvme_subsystem_t s, struct test_data *d)
224224

225225
f.host_iface = NULL;
226226
f.trsvcid = NULL;
227-
c = __nvme_lookup_ctrl(s, &f, NULL);
227+
c = nvme_lookup_ctrl(s, &f, NULL);
228228
printf("%10s %12s %10s -> ", "", "", "");
229229
show_ctrl(c);
230230
pass &= match_ctrl(d, c);
@@ -305,7 +305,7 @@ static bool test_src_addr()
305305
nvme_get_subsystem(ctx, h, DEFAULT_SUBSYSNAME, DEFAULT_SUBSYSNQN, &s);
306306
assert(s);
307307

308-
c = __nvme_lookup_ctrl(s, &fctx, NULL);
308+
c = nvme_lookup_ctrl(s, &fctx, NULL);
309309
assert(c);
310310

311311
c->address = NULL;
@@ -479,7 +479,7 @@ static bool ctrl_match(const char *tag,
479479
&s));
480480
assert(s);
481481

482-
reference_ctrl = __nvme_lookup_ctrl(s, &reference->f, NULL);
482+
reference_ctrl = nvme_lookup_ctrl(s, &reference->f, NULL);
483483
assert(reference_ctrl);
484484
reference_ctrl->name = "nvme1"; /* fake the device name */
485485
if (reference->address) {
@@ -489,7 +489,7 @@ static bool ctrl_match(const char *tag,
489489
/* nvme_ctrl_find() MUST BE RUN BEFORE nvme_lookup_ctrl() */
490490
found_ctrl = nvme_ctrl_find(s, &candidate->f);
491491

492-
candidate_ctrl = __nvme_lookup_ctrl(s, &candidate->f, NULL);
492+
candidate_ctrl = nvme_lookup_ctrl(s, &candidate->f, NULL);
493493

494494
if (should_match) {
495495
if (candidate_ctrl != reference_ctrl) {
@@ -1101,7 +1101,7 @@ static bool ctrl_config_match(const char *tag,
11011101
&s));
11021102
assert(s);
11031103

1104-
reference_ctrl = __nvme_lookup_ctrl(s, &reference->f, NULL);
1104+
reference_ctrl = nvme_lookup_ctrl(s, &reference->f, NULL);
11051105
assert(reference_ctrl);
11061106
reference_ctrl->name = "nvme1"; /* fake the device name */
11071107
if (reference->address) {

0 commit comments

Comments
 (0)