Skip to content

Commit 27bd067

Browse files
nbft: Moves public nbft methods from libnvme to libnvmf
Fixes check-public-headers test with fabrics disabed. Since nbft is not included when fabrics is disabled, moves public nbft methods from libnvme.ld to libnvmf.ld and renames them with the libnvmf prefix. Also fixes build warnings in private.h when building with fabrics disables but netdb available. Includes ifaddrs in private.h if needed. Signed-off-by: Broc Going <bgoing@micron.com>
1 parent 9a9f4d3 commit 27bd067

11 files changed

Lines changed: 29 additions & 25 deletions

File tree

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
.TH "libnvme_free_nbft" 9 "libnvme_free_nbft" "April 2026" "libnvme API manual" LINUX
1+
.TH "libnvmf_free_nbft" 9 "libnvmf_free_nbft" "April 2026" "libnvme API manual" LINUX
22
.SH NAME
3-
libnvme_free_nbft \- Free the struct libnbft_info and its contents
3+
libnvmf_free_nbft \- Free the struct libnbft_info and its contents
44
.SH SYNOPSIS
5-
.B "void" libnvme_free_nbft
5+
.B "void" libnvmf_free_nbft
66
.BI "(struct libnvme_global_ctx *ctx " ","
77
.BI "struct libnbft_info *nbft " ");"
88
.SH ARGUMENTS
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
.TH "libnvme_read_nbft" 9 "libnvme_read_nbft" "April 2026" "libnvme API manual" LINUX
1+
.TH "libnvmf_read_nbft" 9 "libnvmf_read_nbft" "April 2026" "libnvme API manual" LINUX
22
.SH NAME
3-
libnvme_read_nbft \- Read and parse contents of an ACPI NBFT table
3+
libnvmf_read_nbft \- Read and parse contents of an ACPI NBFT table
44
.SH SYNOPSIS
5-
.B "int" libnvme_read_nbft
5+
.B "int" libnvmf_read_nbft
66
.BI "(struct libnvme_global_ctx *ctx " ","
77
.BI "struct libnbft_info **nbft " ","
88
.BI "const char *filename " ");"

libnvme/doc/rst/nbft.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@
431431

432432

433433

434-
.. c:function:: int libnvme_read_nbft (struct libnvme_global_ctx *ctx, struct libnbft_info **nbft, const char *filename)
434+
.. c:function:: int libnvmf_read_nbft (struct libnvme_global_ctx *ctx, struct libnbft_info **nbft, const char *filename)
435435
436436
Read and parse contents of an ACPI NBFT table
437437
@@ -449,14 +449,14 @@
449449
**Description**
450450
451451
Read and parse the specified NBFT file into a struct libnbft_info.
452-
Free with libnvme_free_nbft().
452+
Free with libnvmf_free_nbft().
453453
454454
**Return**
455455
456456
0 on success, errno otherwise.
457457
458458
459-
.. c:function:: void libnvme_free_nbft (struct libnvme_global_ctx *ctx, struct libnbft_info *nbft)
459+
.. c:function:: void libnvmf_free_nbft (struct libnvme_global_ctx *ctx, struct libnbft_info *nbft)
460460
461461
Free the struct libnbft_info and its contents
462462

libnvme/libnvme/nvme.i

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,13 +1368,13 @@ struct libnvme_ns {
13681368
PyObject *output;
13691369
int ret;
13701370

1371-
ret = libnvme_read_nbft(ctx, &nbft, filename);
1371+
ret = libnvmf_read_nbft(ctx, &nbft, filename);
13721372
if (ret) {
13731373
Py_RETURN_NONE;
13741374
}
13751375

13761376
output = nbft_to_pydict(nbft);
1377-
libnvme_free_nbft(ctx, nbft);
1377+
libnvmf_free_nbft(ctx, nbft);
13781378
return output;
13791379
}
13801380
%};

libnvme/src/libnvme.ld

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ LIBNVME_3 {
3838
libnvme_free_ctrl;
3939
libnvme_free_global_ctx;
4040
libnvme_free_host;
41-
libnvme_free_nbft;
4241
libnvme_free_ns;
4342
libnvme_free_subsystem;
4443
libnvme_gen_dhchap_key;
@@ -178,7 +177,6 @@ LIBNVME_3 {
178177
libnvme_read_hostid;
179178
libnvme_read_hostnqn;
180179
libnvme_read_key;
181-
libnvme_read_nbft;
182180
libnvme_refresh_topology;
183181
libnvme_rescan_ctrl;
184182
libnvme_rescan_ns;

libnvme/src/libnvmf.ld

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@ LIBNVMF_3 {
2929
libnvmf_discovery_nbft;
3030
libnvmf_eflags_str;
3131
libnvmf_exat_ptr_next;
32+
libnvmf_free_nbft;
3233
libnvmf_get_default_trsvcid;
3334
libnvmf_get_discovery_log;
3435
libnvmf_is_registration_supported;
3536
libnvmf_nbft_free;
3637
libnvmf_nbft_read_files;
3738
libnvmf_prtype_str;
3839
libnvmf_qptype_str;
40+
libnvmf_read_nbft;
3941
libnvmf_register_ctrl;
4042
libnvmf_sectype_str;
4143
libnvmf_subtype_str;

libnvme/src/nvme/fabrics.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2600,7 +2600,7 @@ __public int libnvmf_nbft_read_files(struct libnvme_global_ctx *ctx, char *path,
26002600
snprintf(filename, sizeof(filename), "%s/%s", path,
26012601
dent[i]->d_name);
26022602

2603-
ret = libnvme_read_nbft(ctx, &nbft, filename);
2603+
ret = libnvmf_read_nbft(ctx, &nbft, filename);
26042604
if (!ret) {
26052605
struct nbft_file_entry *new;
26062606

@@ -2630,7 +2630,7 @@ __public void libnvmf_nbft_free(struct libnvme_global_ctx *ctx, struct nbft_file
26302630
while (head) {
26312631
struct nbft_file_entry *next = head->next;
26322632

2633-
libnvme_free_nbft(ctx, head->nbft);
2633+
libnvmf_free_nbft(ctx, head->nbft);
26342634
free(head);
26352635

26362636
head = next;

libnvme/src/nvme/nbft.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ static int parse_raw_nbft(struct libnvme_global_ctx *ctx, struct libnbft_info *n
710710
return 0;
711711
}
712712

713-
__public void libnvme_free_nbft(struct libnvme_global_ctx *ctx, struct libnbft_info *nbft)
713+
__public void libnvmf_free_nbft(struct libnvme_global_ctx *ctx, struct libnbft_info *nbft)
714714
{
715715
struct libnbft_hfi **hfi;
716716
struct libnbft_security **sec;
@@ -736,7 +736,7 @@ __public void libnvme_free_nbft(struct libnvme_global_ctx *ctx, struct libnbft_i
736736
free(nbft);
737737
}
738738

739-
__public int libnvme_read_nbft(struct libnvme_global_ctx *ctx, struct libnbft_info **nbft,
739+
__public int libnvmf_read_nbft(struct libnvme_global_ctx *ctx, struct libnbft_info **nbft,
740740
const char *filename)
741741
{
742742
__u8 *raw_nbft = NULL;
@@ -800,7 +800,7 @@ __public int libnvme_read_nbft(struct libnvme_global_ctx *ctx, struct libnbft_in
800800

801801
if (parse_raw_nbft(ctx, *nbft)) {
802802
libnvme_msg(ctx, LIBNVME_LOG_ERR, "Failed to parse %s\n", filename);
803-
libnvme_free_nbft(ctx, *nbft);
803+
libnvmf_free_nbft(ctx, *nbft);
804804
return -EINVAL;
805805
}
806806
return 0;

libnvme/src/nvme/nbft.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,26 +246,26 @@ struct libnbft_info {
246246
};
247247

248248
/**
249-
* libnvme_read_nbft() - Read and parse contents of an ACPI NBFT table
249+
* libnvmf_read_nbft() - Read and parse contents of an ACPI NBFT table
250250
*
251251
* @ctx: struct libnvme_global_ctx object
252252
* @nbft: Parsed NBFT table data.
253253
* @filename: Filename of the raw NBFT table to read.
254254
*
255255
* Read and parse the specified NBFT file into a struct libnbft_info.
256-
* Free with libnvme_free_nbft().
256+
* Free with libnvmf_free_nbft().
257257
*
258258
* Return: 0 on success, errno otherwise.
259259
*/
260-
int libnvme_read_nbft(struct libnvme_global_ctx *ctx, struct libnbft_info **nbft,
260+
int libnvmf_read_nbft(struct libnvme_global_ctx *ctx, struct libnbft_info **nbft,
261261
const char *filename);
262262

263263
/**
264-
* libnvme_free_nbft() - Free the struct libnbft_info and its contents
264+
* libnvmf_free_nbft() - Free the struct libnbft_info and its contents
265265
* @ctx: struct libnvme_global_ctx object
266266
* @nbft: Parsed NBFT table data.
267267
*/
268-
void libnvme_free_nbft(struct libnvme_global_ctx *ctx, struct libnbft_info *nbft);
268+
void libnvmf_free_nbft(struct libnvme_global_ctx *ctx, struct libnbft_info *nbft);
269269

270270
/**
271271
* struct nbft_file_entry - Linked list entry for NBFT files

libnvme/src/nvme/private.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
#include <sys/stat.h>
1111
#include <sys/types.h>
1212

13+
#if defined(HAVE_NETDB) || defined(CONFIG_FABRICS)
14+
#include <ifaddrs.h>
15+
#endif
16+
1317
#include <ccan/list/list.h>
1418

1519
#include "nvme/nvme-types.h"

0 commit comments

Comments
 (0)