summaryrefslogtreecommitdiff
path: root/include/uapi/scsi/fc/fc_els.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/uapi/scsi/fc/fc_els.h')
-rw-r--r--include/uapi/scsi/fc/fc_els.h76
1 files changed, 48 insertions, 28 deletions
diff --git a/include/uapi/scsi/fc/fc_els.h b/include/uapi/scsi/fc/fc_els.h
index c9812c5c2fc4..019096beb179 100644
--- a/include/uapi/scsi/fc/fc_els.h
+++ b/include/uapi/scsi/fc/fc_els.h
@@ -11,6 +11,12 @@
#include <linux/types.h>
#include <asm/byteorder.h>
+#ifdef __KERNEL__
+#include <linux/stddef.h> /* for offsetof */
+#else
+#include <stddef.h> /* for offsetof */
+#endif
+
/*
* Fibre Channel Switch - Enhanced Link Services definitions.
* From T11 FC-LS Rev 1.2 June 7, 2005.
@@ -264,7 +270,7 @@ struct fc_tlv_desc {
* Size of descriptor excluding
* desc_tag and desc_len fields.
*/
- __u8 desc_value[0]; /* Descriptor Value */
+ __u8 desc_value[]; /* Descriptor Value */
};
/* Descriptor tag and len fields are considered the mandatory header
@@ -1027,7 +1033,7 @@ struct fc_fn_li_desc {
* threshold to caause the LI event
*/
__be32 pname_count; /* number of portname_list elements */
- __be64 pname_list[0]; /* list of N_Port_Names accessible
+ __be64 pname_list[]; /* list of N_Port_Names accessible
* through the attached port
*/
};
@@ -1069,7 +1075,7 @@ struct fc_fn_peer_congn_desc {
* congestion event
*/
__be32 pname_count; /* number of portname_list elements */
- __be64 pname_list[0]; /* list of N_Port_Names accessible
+ __be64 pname_list[]; /* list of N_Port_Names accessible
* through the attached port
*/
};
@@ -1104,18 +1110,21 @@ struct fc_els_fpin {
* Size of ELS excluding fpin_cmd,
* fpin_zero and desc_len fields.
*/
- struct fc_tlv_desc fpin_desc[0]; /* Descriptor list */
+ struct fc_tlv_desc fpin_desc[]; /* Descriptor list */
};
/* Diagnostic Function Descriptor - FPIN Registration */
struct fc_df_desc_fpin_reg {
- __be32 desc_tag; /* FPIN Registration (0x00030001) */
- __be32 desc_len; /* Length of Descriptor (in bytes).
- * Size of descriptor excluding
- * desc_tag and desc_len fields.
- */
- __be32 count; /* Number of desc_tags elements */
- __be32 desc_tags[0]; /* Array of Descriptor Tags.
+ /* New members MUST be added within the __struct_group() macro below. */
+ __struct_group(fc_df_desc_fpin_reg_hdr, __hdr, /* no attrs */,
+ __be32 desc_tag; /* FPIN Registration (0x00030001) */
+ __be32 desc_len; /* Length of Descriptor (in bytes).
+ * Size of descriptor excluding
+ * desc_tag and desc_len fields.
+ */
+ __be32 count; /* Number of desc_tags elements */
+ );
+ __be32 desc_tags[]; /* Array of Descriptor Tags.
* Each tag indicates a function
* supported by the N_Port (request)
* or by the N_Port and Fabric
@@ -1124,33 +1133,44 @@ struct fc_df_desc_fpin_reg {
* See ELS_FN_DTAG_xxx for tag values.
*/
};
+_Static_assert(offsetof(struct fc_df_desc_fpin_reg, desc_tags) == sizeof(struct fc_df_desc_fpin_reg_hdr),
+ "struct member likely outside of __struct_group()");
/*
* ELS_RDF - Register Diagnostic Functions
*/
struct fc_els_rdf {
- __u8 fpin_cmd; /* command (0x19) */
- __u8 fpin_zero[3]; /* specified as zero - part of cmd */
- __be32 desc_len; /* Length of Descriptor List (in bytes).
- * Size of ELS excluding fpin_cmd,
- * fpin_zero and desc_len fields.
- */
- struct fc_tlv_desc desc[0]; /* Descriptor list */
+ /* New members MUST be added within the __struct_group() macro below. */
+ __struct_group(fc_els_rdf_hdr, __hdr, /* no attrs */,
+ __u8 fpin_cmd; /* command (0x19) */
+ __u8 fpin_zero[3]; /* specified as zero - part of cmd */
+ __be32 desc_len; /* Length of Descriptor List (in bytes).
+ * Size of ELS excluding fpin_cmd,
+ * fpin_zero and desc_len fields.
+ */
+ );
+ struct fc_tlv_desc desc[]; /* Descriptor list */
};
+_Static_assert(offsetof(struct fc_els_rdf, desc) == sizeof(struct fc_els_rdf_hdr),
+ "struct member likely outside of __struct_group()");
/*
* ELS RDF LS_ACC Response.
*/
struct fc_els_rdf_resp {
- struct fc_els_ls_acc acc_hdr;
- __be32 desc_list_len; /* Length of response (in
- * bytes). Excludes acc_hdr
- * and desc_list_len fields.
- */
- struct fc_els_lsri_desc lsri;
- struct fc_tlv_desc desc[0]; /* Supported Descriptor list */
+ /* New members MUST be added within the __struct_group() macro below. */
+ __struct_group(fc_els_rdf_resp_hdr, __hdr, /* no attrs */,
+ struct fc_els_ls_acc acc_hdr;
+ __be32 desc_list_len; /* Length of response (in
+ * bytes). Excludes acc_hdr
+ * and desc_list_len fields.
+ */
+ struct fc_els_lsri_desc lsri;
+ );
+ struct fc_tlv_desc desc[]; /* Supported Descriptor list */
};
-
+_Static_assert(offsetof(struct fc_els_rdf_resp, desc) == sizeof(struct fc_els_rdf_resp_hdr),
+ "struct member likely outside of __struct_group()");
/*
* Diagnostic Capability Descriptors for EDC ELS
@@ -1231,7 +1251,7 @@ struct fc_els_edc {
* Size of ELS excluding edc_cmd,
* edc_zero and desc_len fields.
*/
- struct fc_tlv_desc desc[0];
+ struct fc_tlv_desc desc[];
/* Diagnostic Descriptor list */
};
@@ -1245,7 +1265,7 @@ struct fc_els_edc_resp {
* and desc_list_len fields.
*/
struct fc_els_lsri_desc lsri;
- struct fc_tlv_desc desc[0];
+ struct fc_tlv_desc desc[];
/* Supported Diagnostic Descriptor list */
};