Commit cd0e57e5 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

nvme_spec: add #defines for string lengths



This is useful for places that want to use the size of an NVMe
spec-defined field without having an instance of the corresponding
structure.

Specifically, we can use SPDK_NVME_CTRLR_SN_LEN to replace MAX_SN_LEN
in nvmf.h.

Change-Id: Ida3d59470cce58c0fe984601aa9e2e05cdfaa741
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/375467


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent c08ac18f
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -845,6 +845,10 @@ enum spdk_nvmf_ctrlr_model {
	SPDK_NVMF_CTRLR_MODEL_STATIC			= 1,
};

#define SPDK_NVME_CTRLR_SN_LEN	20
#define SPDK_NVME_CTRLR_MN_LEN	40
#define SPDK_NVME_CTRLR_FR_LEN	8

struct __attribute__((packed)) spdk_nvme_ctrlr_data {
	/* bytes 0-255: controller capabilities and features */

@@ -855,13 +859,13 @@ struct __attribute__((packed)) spdk_nvme_ctrlr_data {
	uint16_t		ssvid;

	/** serial number */
	int8_t			sn[20];
	int8_t			sn[SPDK_NVME_CTRLR_SN_LEN];

	/** model number */
	int8_t			mn[40];
	int8_t			mn[SPDK_NVME_CTRLR_MN_LEN];

	/** firmware revision */
	uint8_t			fr[8];
	uint8_t			fr[SPDK_NVME_CTRLR_FR_LEN];

	/** recommended arbitration burst */
	uint8_t			rab;
+0 −1
Original line number Diff line number Diff line
@@ -46,7 +46,6 @@
#include "spdk/queue.h"

#define MAX_VIRTUAL_NAMESPACE 16
#define MAX_SN_LEN 20

struct spdk_nvmf_tgt;

+1 −1
Original line number Diff line number Diff line
@@ -88,7 +88,7 @@ struct spdk_nvmf_subsystem {

	struct spdk_nvmf_tgt			*tgt;

	char sn[MAX_SN_LEN + 1];
	char sn[SPDK_NVME_CTRLR_SN_LEN + 1];

	struct spdk_nvmf_ns			ns[MAX_VIRTUAL_NAMESPACE];
	uint32_t 				max_nsid;