diff options
author | Boaz Harrosh <bharrosh@panasas.com> | 2009-04-19 12:11:42 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-04-27 12:05:40 -0400 |
commit | 71f32e31e5638df37904697e2d04182935add85d (patch) | |
tree | 2f1ab62477f8d5129cbae751c219a2c069fa31b8 /include/scsi | |
parent | bf5e84f69618f416e89a5a53434a8c865e70252e (diff) |
[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>
Diffstat (limited to 'include/scsi')
-rw-r--r-- | include/scsi/osd_protocol.h | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/include/scsi/osd_protocol.h b/include/scsi/osd_protocol.h index cd3cbf764650..fa8343ce3ca2 100644 --- a/include/scsi/osd_protocol.h +++ b/include/scsi/osd_protocol.h | |||
@@ -301,14 +301,24 @@ struct osd_attributes_list_attrid { | |||
301 | } __packed; | 301 | } __packed; |
302 | 302 | ||
303 | /* | 303 | /* |
304 | * NOTE: v1: is not aligned. | ||
305 | */ | ||
306 | struct osdv1_attributes_list_element { | ||
307 | __be32 attr_page; | ||
308 | __be32 attr_id; | ||
309 | __be16 attr_bytes; /* valid bytes at attr_val without padding */ | ||
310 | u8 attr_val[0]; | ||
311 | } __packed; | ||
312 | |||
313 | /* | ||
304 | * osd2r03: 7.1.3.3 List entry format for retrieved attributes and | 314 | * osd2r03: 7.1.3.3 List entry format for retrieved attributes and |
305 | * for setting attributes | 315 | * for setting attributes |
306 | * NOTE: v2 is 8-bytes aligned, v1 is not aligned. | 316 | * NOTE: v2 is 8-bytes aligned |
307 | */ | 317 | */ |
308 | struct osd_attributes_list_element { | 318 | struct osdv2_attributes_list_element { |
309 | __be32 attr_page; | 319 | __be32 attr_page; |
310 | __be32 attr_id; | 320 | __be32 attr_id; |
311 | __be16 attr_bytes; | 321 | __be16 attr_bytes; /* valid bytes at attr_val without padding */ |
312 | u8 attr_val[0]; | 322 | u8 attr_val[0]; |
313 | } __packed; | 323 | } __packed; |
314 | 324 | ||
@@ -324,13 +334,13 @@ enum { | |||
324 | 334 | ||
325 | static inline unsigned osdv1_attr_list_elem_size(unsigned len) | 335 | static inline unsigned osdv1_attr_list_elem_size(unsigned len) |
326 | { | 336 | { |
327 | return ALIGN(len + sizeof(struct osd_attributes_list_element), | 337 | return ALIGN(len + sizeof(struct osdv1_attributes_list_element), |
328 | OSDv1_ATTRIBUTES_ELEM_ALIGN); | 338 | OSDv1_ATTRIBUTES_ELEM_ALIGN); |
329 | } | 339 | } |
330 | 340 | ||
331 | static inline unsigned osdv2_attr_list_elem_size(unsigned len) | 341 | static inline unsigned osdv2_attr_list_elem_size(unsigned len) |
332 | { | 342 | { |
333 | return ALIGN(len + sizeof(struct osd_attributes_list_element), | 343 | return ALIGN(len + sizeof(struct osdv2_attributes_list_element), |
334 | OSD_ATTRIBUTES_ELEM_ALIGN); | 344 | OSD_ATTRIBUTES_ELEM_ALIGN); |
335 | } | 345 | } |
336 | 346 | ||