From: Tomas Bzatek <tbzatek@redhat.com>
Date: Mon, 19 Feb 2024 13:50:09 +0000 (-0500)
Subject: nbft: Add SSNS 'discovered' flag
X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=ab7cd434aad06f1654406db751a4d520a23e16a3;p=users%2Fsagi%2Flibnvme.git

nbft: Add SSNS 'discovered' flag

Indicates that the SSNS record was obtained through discovery.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
---

diff --git a/src/nvme/nbft.c b/src/nvme/nbft.c
index 3bdbeb1b..b7d0dc84 100644
--- a/src/nvme/nbft.c
+++ b/src/nvme/nbft.c
@@ -249,6 +249,8 @@ static int read_ssns(struct nbft_info *nbft,
 	/* flags */
 	ssns->unavailable = !!(le16_to_cpu(raw_ssns->flags) &
 			       NBFT_SSNS_UNAVAIL_NAMESPACE_UNAVAIL);
+	ssns->discovered = !!(le16_to_cpu(raw_ssns->flags) &
+			      NBFT_SSNS_DISCOVERED_NAMESPACE);
 
 	/* security profile */
 	if (raw_ssns->security_desc_index) {
diff --git a/src/nvme/nbft.h b/src/nvme/nbft.h
index 8bd415b6..8abc134a 100644
--- a/src/nvme/nbft.h
+++ b/src/nvme/nbft.h
@@ -1180,6 +1180,8 @@ enum nbft_info_nid_type {
  * 				Descriptor) or 0 if not supported.
  * @dhcp_root_path_string:	DHCP Root Path Override string (SSNS Extended
  * 				Information Descriptor).
+ * @discovered:			Indicates that this namespace was acquired
+ *				through discovery.
  * @unavailable:		Namespace is unavailable as indicated by
  *				the pre-OS driver.
  */
@@ -1202,6 +1204,7 @@ struct nbft_info_subsystem_ns {
 	int controller_id;
 	int asqsz;
 	char *dhcp_root_path_string;
+	bool discovered;
 	bool unavailable;
 };