Skip to content

Commit f9446c2

Browse files
hreineckeigaw
authored andcommitted
libnvme: read-only host accessors
Some host attributes are fixed for the lifetime of the host, so once established they cannot be changed. Consequently it's pointless to have a 'setter' function as this would not do what's expected. Signed-off-by: Hannes Reinecke <[email protected]>
1 parent 0f9dca2 commit f9446c2

4 files changed

Lines changed: 2 additions & 30 deletions

File tree

libnvme/src/accessors.ld

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,7 @@ LIBNVME_ACCESSORS_3 {
8383
nvme_subsystem_get_iopolicy;
8484
nvme_subsystem_set_iopolicy;
8585
nvme_host_get_hostnqn;
86-
nvme_host_set_hostnqn;
8786
nvme_host_get_hostid;
88-
nvme_host_set_hostid;
8987
nvme_host_get_dhchap_host_key;
9088
nvme_host_set_dhchap_host_key;
9189
nvme_host_get_hostsymname;

libnvme/src/nvme/accessors.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -427,23 +427,11 @@ const char *nvme_subsystem_get_iopolicy(const struct nvme_subsystem *p)
427427
* Accessors for: struct nvme_host
428428
****************************************************************************/
429429

430-
void nvme_host_set_hostnqn(struct nvme_host *p, const char *hostnqn)
431-
{
432-
free(p->hostnqn);
433-
p->hostnqn = hostnqn ? strdup(hostnqn) : NULL;
434-
}
435-
436430
const char *nvme_host_get_hostnqn(const struct nvme_host *p)
437431
{
438432
return p->hostnqn;
439433
}
440434

441-
void nvme_host_set_hostid(struct nvme_host *p, const char *hostid)
442-
{
443-
free(p->hostid);
444-
p->hostid = hostid ? strdup(hostid) : NULL;
445-
}
446-
447435
const char *nvme_host_get_hostid(const struct nvme_host *p)
448436
{
449437
return p->hostid;

libnvme/src/nvme/accessors.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -618,13 +618,6 @@ const char *nvme_subsystem_get_iopolicy(const struct nvme_subsystem *p);
618618
* Accessors for: struct nvme_host
619619
****************************************************************************/
620620

621-
/**
622-
* nvme_host_set_hostnqn() - Set hostnqn.
623-
* @p: The &struct nvme_host instance to update.
624-
* @hostnqn: New string; a copy is stored. Pass NULL to clear.
625-
*/
626-
void nvme_host_set_hostnqn(struct nvme_host *p, const char *hostnqn);
627-
628621
/**
629622
* nvme_host_get_hostnqn() - Get hostnqn.
630623
* @p: The &struct nvme_host instance to query.
@@ -633,13 +626,6 @@ void nvme_host_set_hostnqn(struct nvme_host *p, const char *hostnqn);
633626
*/
634627
const char *nvme_host_get_hostnqn(const struct nvme_host *p);
635628

636-
/**
637-
* nvme_host_set_hostid() - Set hostid.
638-
* @p: The &struct nvme_host instance to update.
639-
* @hostid: New string; a copy is stored. Pass NULL to clear.
640-
*/
641-
void nvme_host_set_hostid(struct nvme_host *p, const char *hostid);
642-
643629
/**
644630
* nvme_host_get_hostid() - Get hostid.
645631
* @p: The &struct nvme_host instance to query.

libnvme/src/nvme/private.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ struct nvme_host { /*!generate-accessors*/
238238
struct list_head subsystems;
239239
struct nvme_global_ctx *ctx;
240240

241-
char *hostnqn;
242-
char *hostid;
241+
char *hostnqn; /*!accessors:readonly*/
242+
char *hostid; /*!accessors:readonly*/
243243
char *dhchap_host_key;
244244
char *hostsymname;
245245
bool pdc_enabled; //!accessors:none

0 commit comments

Comments
 (0)