Skip to content

Commit 2e7dcff

Browse files
Martin Belangerigaw
authored andcommitted
libnvme: rename libnvme_ns_get_uuid to libnvme_ns_copy_uuid
The function copies the UUID into a caller-supplied buffer rather than returning a pointer, so "copy" is a more accurate name than "get". Update the declaration in tree.h, definition in tree.c, the ABI version script, the test, and the uuid member annotation (read=none since the copy function signature is incompatible with the %extend getter pattern used by the Python bindings). Signed-off-by: Martin Belanger <Martin.Belanger@dell.com> Assisted-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 874d2b6 commit 2e7dcff

5 files changed

Lines changed: 6 additions & 6 deletions

File tree

libnvme/src/libnvme.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ LIBNVME_3 {
131131
libnvme_ns_get_nguid;
132132
libnvme_ns_get_serial;
133133
libnvme_ns_get_subsystem;
134-
libnvme_ns_get_uuid;
134+
libnvme_ns_copy_uuid;
135135
libnvme_ns_reset_stat;
136136
libnvme_ns_update_stat;
137137
libnvme_ns_get_stat_interval;

libnvme/src/nvme/private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ struct libnvme_ns { // !generate-accessors
262262

263263
uint8_t eui64[8]; // !access:write=none
264264
uint8_t nguid[16]; // !access:write=none
265-
unsigned char uuid[NVME_UUID_LEN]; // !access:read=custom,write=none
265+
unsigned char uuid[NVME_UUID_LEN]; // !access:read=none,write=none
266266
enum nvme_csi csi; // !access:write=none
267267

268268
long command_retry_count; // !access:read=custom,write=none

libnvme/src/nvme/tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2618,7 +2618,7 @@ __public const char *libnvme_ns_get_firmware(libnvme_ns_t n)
26182618
return n->c ? n->c->firmware : n->s->firmware;
26192619
}
26202620

2621-
__public void libnvme_ns_get_uuid(libnvme_ns_t n,
2621+
__public void libnvme_ns_copy_uuid(libnvme_ns_t n,
26222622
unsigned char out[NVME_UUID_LEN])
26232623
{
26242624
memcpy(out, n->uuid, NVME_UUID_LEN);

libnvme/src/nvme/tree.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,13 +478,13 @@ libnvme_ns_t libnvme_subsystem_next_ns(libnvme_subsystem_t s, libnvme_ns_t n);
478478
p = libnvme_namespace_next_path(n, p))
479479

480480
/**
481-
* libnvme_ns_get_uuid() - UUID of a namespace
481+
* libnvme_ns_copy_uuid() - Copy UUID of a namespace into a caller buffer
482482
* @n: Namespace instance
483483
* @out: buffer for the UUID
484484
*
485485
* Copies the namespace's uuid into @out
486486
*/
487-
void libnvme_ns_get_uuid(libnvme_ns_t n, unsigned char out[NVME_UUID_LEN]);
487+
void libnvme_ns_copy_uuid(libnvme_ns_t n, unsigned char out[NVME_UUID_LEN]);
488488

489489
/**
490490
* libnvme_ns_get_command_retry_count() - Get command retry count

libnvme/test/test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ int main(int argc, char **argv)
452452
print_hex(libnvme_ns_get_eui64(n), 8);
453453
printf(" nguid:");
454454
print_hex(libnvme_ns_get_nguid(n), 16);
455-
libnvme_ns_get_uuid(n, uuid);
455+
libnvme_ns_copy_uuid(n, uuid);
456456
libnvme_uuid_to_string(uuid, uuid_str);
457457
printf(" uuid:%s csi:%d\n", uuid_str,
458458
libnvme_ns_get_csi(n));

0 commit comments

Comments
 (0)