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: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/375467
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Daniel Verkamp 2017-08-23 11:16:37 -07:00
parent c08ac18f28
commit cd0e57e5ca
3 changed files with 8 additions and 5 deletions

View File

@ -845,6 +845,10 @@ enum spdk_nvmf_ctrlr_model {
SPDK_NVMF_CTRLR_MODEL_STATIC = 1, 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 { struct __attribute__((packed)) spdk_nvme_ctrlr_data {
/* bytes 0-255: controller capabilities and features */ /* bytes 0-255: controller capabilities and features */
@ -855,13 +859,13 @@ struct __attribute__((packed)) spdk_nvme_ctrlr_data {
uint16_t ssvid; uint16_t ssvid;
/** serial number */ /** serial number */
int8_t sn[20]; int8_t sn[SPDK_NVME_CTRLR_SN_LEN];
/** model number */ /** model number */
int8_t mn[40]; int8_t mn[SPDK_NVME_CTRLR_MN_LEN];
/** firmware revision */ /** firmware revision */
uint8_t fr[8]; uint8_t fr[SPDK_NVME_CTRLR_FR_LEN];
/** recommended arbitration burst */ /** recommended arbitration burst */
uint8_t rab; uint8_t rab;

View File

@ -46,7 +46,6 @@
#include "spdk/queue.h" #include "spdk/queue.h"
#define MAX_VIRTUAL_NAMESPACE 16 #define MAX_VIRTUAL_NAMESPACE 16
#define MAX_SN_LEN 20
struct spdk_nvmf_tgt; struct spdk_nvmf_tgt;

View File

@ -88,7 +88,7 @@ struct spdk_nvmf_subsystem {
struct spdk_nvmf_tgt *tgt; 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]; struct spdk_nvmf_ns ns[MAX_VIRTUAL_NAMESPACE];
uint32_t max_nsid; uint32_t max_nsid;