[SCSI] libosd: OSD2r05: Prepare for rev5 attribute list changes
In OSD2r05 draft each attribute list element header was changed so attribute-value would be 8 bytes aligned. In OSD2r01-r04 it was aligned on 2 bytes. (This is because in OSD2r01 the complete element was 8 bytes padded at end but the header was not adjusted and caused permanent miss-alignment.) OSD1 elements are not padded and might be or might not be aligned. OSD1 is still supported. In this code we do all the code re-factoring to separate OSD1/OSD2 differences but do not change actual wire format. All wire format changes will happen in one patch later, for bisect-ability. Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
This commit is contained in:

committed by
James Bottomley

parent
bf5e84f696
commit
71f32e31e5
@@ -301,14 +301,24 @@ struct osd_attributes_list_attrid {
|
||||
} __packed;
|
||||
|
||||
/*
|
||||
* osd2r03: 7.1.3.3 List entry format for retrieved attributes and
|
||||
* for setting attributes
|
||||
* NOTE: v2 is 8-bytes aligned, v1 is not aligned.
|
||||
* NOTE: v1: is not aligned.
|
||||
*/
|
||||
struct osd_attributes_list_element {
|
||||
struct osdv1_attributes_list_element {
|
||||
__be32 attr_page;
|
||||
__be32 attr_id;
|
||||
__be16 attr_bytes;
|
||||
__be16 attr_bytes; /* valid bytes at attr_val without padding */
|
||||
u8 attr_val[0];
|
||||
} __packed;
|
||||
|
||||
/*
|
||||
* osd2r03: 7.1.3.3 List entry format for retrieved attributes and
|
||||
* for setting attributes
|
||||
* NOTE: v2 is 8-bytes aligned
|
||||
*/
|
||||
struct osdv2_attributes_list_element {
|
||||
__be32 attr_page;
|
||||
__be32 attr_id;
|
||||
__be16 attr_bytes; /* valid bytes at attr_val without padding */
|
||||
u8 attr_val[0];
|
||||
} __packed;
|
||||
|
||||
@@ -324,13 +334,13 @@ enum {
|
||||
|
||||
static inline unsigned osdv1_attr_list_elem_size(unsigned len)
|
||||
{
|
||||
return ALIGN(len + sizeof(struct osd_attributes_list_element),
|
||||
return ALIGN(len + sizeof(struct osdv1_attributes_list_element),
|
||||
OSDv1_ATTRIBUTES_ELEM_ALIGN);
|
||||
}
|
||||
|
||||
static inline unsigned osdv2_attr_list_elem_size(unsigned len)
|
||||
{
|
||||
return ALIGN(len + sizeof(struct osd_attributes_list_element),
|
||||
return ALIGN(len + sizeof(struct osdv2_attributes_list_element),
|
||||
OSD_ATTRIBUTES_ELEM_ALIGN);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user