x86/amd-iommu: Add per IOMMU reference counting
[linux/fpc-iii.git] / include / scsi / osd_protocol.h
blob2cc8e8b1cc19da61757676325ab3ae9cd9050e2d
1 /*
2 * osd_protocol.h - OSD T10 standard C definitions.
4 * Copyright (C) 2008 Panasas Inc. All rights reserved.
6 * Authors:
7 * Boaz Harrosh <bharrosh@panasas.com>
8 * Benny Halevy <bhalevy@panasas.com>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
13 * This file contains types and constants that are defined by the protocol
14 * Note: All names and symbols are taken from the OSD standard's text.
16 #ifndef __OSD_PROTOCOL_H__
17 #define __OSD_PROTOCOL_H__
19 #include <linux/types.h>
20 #include <asm/unaligned.h>
21 #include <scsi/scsi.h>
23 enum {
24 OSDv1_ADDITIONAL_CDB_LENGTH = 192,
25 OSDv1_TOTAL_CDB_LEN = OSDv1_ADDITIONAL_CDB_LENGTH + 8,
26 OSDv1_CAP_LEN = 80,
28 /* Latest supported version */
29 OSDv2_ADDITIONAL_CDB_LENGTH = 228,
30 OSD_ADDITIONAL_CDB_LENGTH =
31 OSDv2_ADDITIONAL_CDB_LENGTH,
32 OSD_TOTAL_CDB_LEN = OSD_ADDITIONAL_CDB_LENGTH + 8,
33 OSD_CAP_LEN = 104,
35 OSD_SYSTEMID_LEN = 20,
36 OSDv1_CRYPTO_KEYID_SIZE = 20,
37 OSDv2_CRYPTO_KEYID_SIZE = 32,
38 OSD_CRYPTO_KEYID_SIZE = OSDv2_CRYPTO_KEYID_SIZE,
39 OSD_CRYPTO_SEED_SIZE = 4,
40 OSD_CRYPTO_NONCE_SIZE = 12,
41 OSD_MAX_SENSE_LEN = 252, /* from SPC-3 */
43 OSD_PARTITION_FIRST_ID = 0x10000,
44 OSD_OBJECT_FIRST_ID = 0x10000,
47 /* (osd-r10 5.2.4)
48 * osd2r03: 5.2.3 Caching control bits
50 enum osd_options_byte {
51 OSD_CDB_FUA = 0x08, /* Force Unit Access */
52 OSD_CDB_DPO = 0x10, /* Disable Page Out */
56 * osd2r03: 5.2.5 Isolation.
57 * First 3 bits, V2-only.
58 * Also for attr 110h "default isolation method" at Root Information page
60 enum osd_options_byte_isolation {
61 OSD_ISOLATION_DEFAULT = 0,
62 OSD_ISOLATION_NONE = 1,
63 OSD_ISOLATION_STRICT = 2,
64 OSD_ISOLATION_RANGE = 4,
65 OSD_ISOLATION_FUNCTIONAL = 5,
66 OSD_ISOLATION_VENDOR = 7,
69 /* (osd-r10: 6.7)
70 * osd2r03: 6.8 FLUSH, FLUSH COLLECTION, FLUSH OSD, FLUSH PARTITION
72 enum osd_options_flush_scope_values {
73 OSD_CDB_FLUSH_ALL = 0,
74 OSD_CDB_FLUSH_ATTR_ONLY = 1,
76 OSD_CDB_FLUSH_ALL_RECURSIVE = 2,
77 /* V2-only */
78 OSD_CDB_FLUSH_ALL_RANGE = 2,
81 /* osd2r03: 5.2.10 Timestamps control */
82 enum {
83 OSD_CDB_NORMAL_TIMESTAMPS = 0,
84 OSD_CDB_BYPASS_TIMESTAMPS = 0x7f,
87 /* (osd-r10: 5.2.2.1)
88 * osd2r03: 5.2.4.1 Get and set attributes CDB format selection
89 * 2 bits at second nibble of command_specific_options byte
91 enum osd_attributes_mode {
92 /* V2-only */
93 OSD_CDB_SET_ONE_ATTR = 0x10,
95 OSD_CDB_GET_ATTR_PAGE_SET_ONE = 0x20,
96 OSD_CDB_GET_SET_ATTR_LISTS = 0x30,
98 OSD_CDB_GET_SET_ATTR_MASK = 0x30,
101 /* (osd-r10: 4.12.5)
102 * osd2r03: 4.14.5 Data-In and Data-Out buffer offsets
103 * byte offset = mantissa * (2^(exponent+8))
104 * struct {
105 * unsigned mantissa: 28;
106 * int exponent: 04;
109 typedef __be32 __bitwise osd_cdb_offset;
111 enum {
112 OSD_OFFSET_UNUSED = 0xFFFFFFFF,
113 OSD_OFFSET_MAX_BITS = 28,
115 OSDv1_OFFSET_MIN_SHIFT = 8,
116 OSD_OFFSET_MIN_SHIFT = 3,
117 OSD_OFFSET_MAX_SHIFT = 16,
120 /* Return the smallest allowed encoded offset that contains @offset.
122 * The actual encoded offset returned is @offset + *padding.
123 * (up to max_shift, non-inclusive)
125 osd_cdb_offset __osd_encode_offset(u64 offset, unsigned *padding,
126 int min_shift, int max_shift);
128 /* Minimum alignment is 256 bytes
129 * Note: Seems from std v1 that exponent can be from 0+8 to 0xE+8 (inclusive)
130 * which is 8 to 23 but IBM code restricts it to 16, so be it.
132 static inline osd_cdb_offset osd_encode_offset_v1(u64 offset, unsigned *padding)
134 return __osd_encode_offset(offset, padding,
135 OSDv1_OFFSET_MIN_SHIFT, OSD_OFFSET_MAX_SHIFT);
138 /* Minimum 8 bytes alignment
139 * Same as v1 but since exponent can be signed than a less than
140 * 256 alignment can be reached with small offsets (<2GB)
142 static inline osd_cdb_offset osd_encode_offset_v2(u64 offset, unsigned *padding)
144 return __osd_encode_offset(offset, padding,
145 OSD_OFFSET_MIN_SHIFT, OSD_OFFSET_MAX_SHIFT);
148 /* osd2r03: 5.2.1 Overview */
149 struct osd_cdb_head {
150 struct scsi_varlen_cdb_hdr varlen_cdb;
151 /*10*/ u8 options;
152 u8 command_specific_options;
153 u8 timestamp_control;
154 /*13*/ u8 reserved1[3];
155 /*16*/ __be64 partition;
156 /*24*/ __be64 object;
157 /*32*/ union { /* V1 vs V2 alignment differences */
158 struct __osdv1_cdb_addr_len {
159 /*32*/ __be32 list_identifier;/* Rarely used */
160 /*36*/ __be64 length;
161 /*44*/ __be64 start_address;
162 } __packed v1;
164 struct __osdv2_cdb_addr_len {
165 /* called allocation_length in some commands */
166 /*32*/ __be64 length;
167 /*40*/ __be64 start_address;
168 union {
169 /*48*/ __be32 list_identifier;/* Rarely used */
170 /* OSD2r05 5.2.5 CDB continuation length */
171 /*48*/ __be32 cdb_continuation_length;
173 } __packed v2;
175 /*52*/ union { /* selected attributes mode Page/List/Single */
176 struct osd_attributes_page_mode {
177 /*52*/ __be32 get_attr_page;
178 /*56*/ __be32 get_attr_alloc_length;
179 /*60*/ osd_cdb_offset get_attr_offset;
181 /*64*/ __be32 set_attr_page;
182 /*68*/ __be32 set_attr_id;
183 /*72*/ __be32 set_attr_length;
184 /*76*/ osd_cdb_offset set_attr_offset;
185 /*80*/ } __packed attrs_page;
187 struct osd_attributes_list_mode {
188 /*52*/ __be32 get_attr_desc_bytes;
189 /*56*/ osd_cdb_offset get_attr_desc_offset;
191 /*60*/ __be32 get_attr_alloc_length;
192 /*64*/ osd_cdb_offset get_attr_offset;
194 /*68*/ __be32 set_attr_bytes;
195 /*72*/ osd_cdb_offset set_attr_offset;
196 __be32 not_used;
197 /*80*/ } __packed attrs_list;
199 /* osd2r03:5.2.4.2 Set one attribute value using CDB fields */
200 struct osd_attributes_cdb_mode {
201 /*52*/ __be32 set_attr_page;
202 /*56*/ __be32 set_attr_id;
203 /*60*/ __be16 set_attr_len;
204 /*62*/ u8 set_attr_val[18];
205 /*80*/ } __packed attrs_cdb;
206 /*52*/ u8 get_set_attributes_parameters[28];
208 } __packed;
209 /*80*/
211 /*160 v1*/
212 struct osdv1_security_parameters {
213 /*160*/u8 integrity_check_value[OSDv1_CRYPTO_KEYID_SIZE];
214 /*180*/u8 request_nonce[OSD_CRYPTO_NONCE_SIZE];
215 /*192*/osd_cdb_offset data_in_integrity_check_offset;
216 /*196*/osd_cdb_offset data_out_integrity_check_offset;
217 } __packed;
218 /*200 v1*/
220 /*184 v2*/
221 struct osdv2_security_parameters {
222 /*184*/u8 integrity_check_value[OSDv2_CRYPTO_KEYID_SIZE];
223 /*216*/u8 request_nonce[OSD_CRYPTO_NONCE_SIZE];
224 /*228*/osd_cdb_offset data_in_integrity_check_offset;
225 /*232*/osd_cdb_offset data_out_integrity_check_offset;
226 } __packed;
227 /*236 v2*/
229 struct osd_security_parameters {
230 union {
231 struct osdv1_security_parameters v1;
232 struct osdv2_security_parameters v2;
236 struct osdv1_cdb {
237 struct osd_cdb_head h;
238 u8 caps[OSDv1_CAP_LEN];
239 struct osdv1_security_parameters sec_params;
240 } __packed;
242 struct osdv2_cdb {
243 struct osd_cdb_head h;
244 u8 caps[OSD_CAP_LEN];
245 struct osdv2_security_parameters sec_params;
246 } __packed;
248 struct osd_cdb {
249 union {
250 struct osdv1_cdb v1;
251 struct osdv2_cdb v2;
252 u8 buff[OSD_TOTAL_CDB_LEN];
254 } __packed;
256 static inline struct osd_cdb_head *osd_cdb_head(struct osd_cdb *ocdb)
258 return (struct osd_cdb_head *)ocdb->buff;
261 /* define both version actions
262 * Ex name = FORMAT_OSD we have OSD_ACT_FORMAT_OSD && OSDv1_ACT_FORMAT_OSD
264 #define OSD_ACT___(Name, Num) \
265 OSD_ACT_##Name = __constant_cpu_to_be16(0x8880 + Num), \
266 OSDv1_ACT_##Name = __constant_cpu_to_be16(0x8800 + Num),
268 /* V2 only actions */
269 #define OSD_ACT_V2(Name, Num) \
270 OSD_ACT_##Name = __constant_cpu_to_be16(0x8880 + Num),
272 #define OSD_ACT_V1_V2(Name, Num1, Num2) \
273 OSD_ACT_##Name = __constant_cpu_to_be16(Num2), \
274 OSDv1_ACT_##Name = __constant_cpu_to_be16(Num1),
276 enum osd_service_actions {
277 OSD_ACT_V2(OBJECT_STRUCTURE_CHECK, 0x00)
278 OSD_ACT___(FORMAT_OSD, 0x01)
279 OSD_ACT___(CREATE, 0x02)
280 OSD_ACT___(LIST, 0x03)
281 OSD_ACT_V2(PUNCH, 0x04)
282 OSD_ACT___(READ, 0x05)
283 OSD_ACT___(WRITE, 0x06)
284 OSD_ACT___(APPEND, 0x07)
285 OSD_ACT___(FLUSH, 0x08)
286 OSD_ACT_V2(CLEAR, 0x09)
287 OSD_ACT___(REMOVE, 0x0A)
288 OSD_ACT___(CREATE_PARTITION, 0x0B)
289 OSD_ACT___(REMOVE_PARTITION, 0x0C)
290 OSD_ACT___(GET_ATTRIBUTES, 0x0E)
291 OSD_ACT___(SET_ATTRIBUTES, 0x0F)
292 OSD_ACT___(CREATE_AND_WRITE, 0x12)
293 OSD_ACT___(CREATE_COLLECTION, 0x15)
294 OSD_ACT___(REMOVE_COLLECTION, 0x16)
295 OSD_ACT___(LIST_COLLECTION, 0x17)
296 OSD_ACT___(SET_KEY, 0x18)
297 OSD_ACT___(SET_MASTER_KEY, 0x19)
298 OSD_ACT___(FLUSH_COLLECTION, 0x1A)
299 OSD_ACT___(FLUSH_PARTITION, 0x1B)
300 OSD_ACT___(FLUSH_OSD, 0x1C)
302 OSD_ACT_V2(QUERY, 0x20)
303 OSD_ACT_V2(REMOVE_MEMBER_OBJECTS, 0x21)
304 OSD_ACT_V2(GET_MEMBER_ATTRIBUTES, 0x22)
305 OSD_ACT_V2(SET_MEMBER_ATTRIBUTES, 0x23)
307 OSD_ACT_V2(CREATE_CLONE, 0x28)
308 OSD_ACT_V2(CREATE_SNAPSHOT, 0x29)
309 OSD_ACT_V2(DETACH_CLONE, 0x2A)
310 OSD_ACT_V2(REFRESH_SNAPSHOT_CLONE, 0x2B)
311 OSD_ACT_V2(RESTORE_PARTITION_FROM_SNAPSHOT, 0x2C)
313 OSD_ACT_V2(READ_MAP, 0x31)
314 OSD_ACT_V2(READ_MAPS_COMPARE, 0x32)
316 OSD_ACT_V1_V2(PERFORM_SCSI_COMMAND, 0x8F7E, 0x8F7C)
317 OSD_ACT_V1_V2(SCSI_TASK_MANAGEMENT, 0x8F7F, 0x8F7D)
318 /* 0x8F80 to 0x8FFF are Vendor specific */
321 /* osd2r03: 7.1.3.2 List entry format for retrieving attributes */
322 struct osd_attributes_list_attrid {
323 __be32 attr_page;
324 __be32 attr_id;
325 } __packed;
328 * NOTE: v1: is not aligned.
330 struct osdv1_attributes_list_element {
331 __be32 attr_page;
332 __be32 attr_id;
333 __be16 attr_bytes; /* valid bytes at attr_val without padding */
334 u8 attr_val[0];
335 } __packed;
338 * osd2r03: 7.1.3.3 List entry format for retrieved attributes and
339 * for setting attributes
340 * NOTE: v2 is 8-bytes aligned
342 struct osdv2_attributes_list_element {
343 __be32 attr_page;
344 __be32 attr_id;
345 u8 reserved[6];
346 __be16 attr_bytes; /* valid bytes at attr_val without padding */
347 u8 attr_val[0];
348 } __packed;
350 enum {
351 OSDv1_ATTRIBUTES_ELEM_ALIGN = 1,
352 OSD_ATTRIBUTES_ELEM_ALIGN = 8,
355 enum {
356 OSD_ATTR_LIST_ALL_PAGES = 0xFFFFFFFF,
357 OSD_ATTR_LIST_ALL_IN_PAGE = 0xFFFFFFFF,
360 static inline unsigned osdv1_attr_list_elem_size(unsigned len)
362 return ALIGN(len + sizeof(struct osdv1_attributes_list_element),
363 OSDv1_ATTRIBUTES_ELEM_ALIGN);
366 static inline unsigned osdv2_attr_list_elem_size(unsigned len)
368 return ALIGN(len + sizeof(struct osdv2_attributes_list_element),
369 OSD_ATTRIBUTES_ELEM_ALIGN);
373 * osd2r03: 7.1.3 OSD attributes lists (Table 184) — List type values
375 enum osd_attr_list_types {
376 OSD_ATTR_LIST_GET = 0x1, /* descriptors only */
377 OSD_ATTR_LIST_SET_RETRIEVE = 0x9, /*descriptors/values variable-length*/
378 OSD_V2_ATTR_LIST_MULTIPLE = 0xE, /* ver2, Multiple Objects lists*/
379 OSD_V1_ATTR_LIST_CREATE_MULTIPLE = 0xF,/*ver1, used by create_multple*/
382 /* osd2r03: 7.1.3.4 Multi-object retrieved attributes format */
383 struct osd_attributes_list_multi_header {
384 __be64 object_id;
385 u8 object_type; /* object_type enum below */
386 u8 reserved[5];
387 __be16 list_bytes;
388 /* followed by struct osd_attributes_list_element's */
391 struct osdv1_attributes_list_header {
392 u8 type; /* low 4-bit only */
393 u8 pad;
394 __be16 list_bytes; /* Initiator shall set to Zero. Only set by target */
396 * type=9 followed by struct osd_attributes_list_element's
397 * type=E followed by struct osd_attributes_list_multi_header's
399 } __packed;
401 static inline unsigned osdv1_list_size(struct osdv1_attributes_list_header *h)
403 return be16_to_cpu(h->list_bytes);
406 struct osdv2_attributes_list_header {
407 u8 type; /* lower 4-bits only */
408 u8 pad[3];
409 /*4*/ __be32 list_bytes; /* Initiator shall set to zero. Only set by target */
411 * type=9 followed by struct osd_attributes_list_element's
412 * type=E followed by struct osd_attributes_list_multi_header's
414 } __packed;
416 static inline unsigned osdv2_list_size(struct osdv2_attributes_list_header *h)
418 return be32_to_cpu(h->list_bytes);
421 /* (osd-r10 6.13)
422 * osd2r03: 6.15 LIST (Table 79) LIST command parameter data.
423 * for root_lstchg below
425 enum {
426 OSD_OBJ_ID_LIST_PAR = 0x1, /* V1-only. Not used in V2 */
427 OSD_OBJ_ID_LIST_LSTCHG = 0x2,
431 * osd2r03: 6.15.2 LIST command parameter data
432 * (Also for LIST COLLECTION)
434 struct osd_obj_id_list {
435 __be64 list_bytes; /* bytes in list excluding list_bytes (-8) */
436 __be64 continuation_id;
437 __be32 list_identifier;
438 u8 pad[3];
439 u8 root_lstchg;
440 __be64 object_ids[0];
441 } __packed;
443 static inline bool osd_is_obj_list_done(struct osd_obj_id_list *list,
444 bool *is_changed)
446 *is_changed = (0 != (list->root_lstchg & OSD_OBJ_ID_LIST_LSTCHG));
447 return 0 != list->continuation_id;
451 * osd2r03: 4.12.4.5 The ALLDATA security method
453 struct osd_data_out_integrity_info {
454 __be64 data_bytes;
455 __be64 set_attributes_bytes;
456 __be64 get_attributes_bytes;
457 __u8 integrity_check_value[OSD_CRYPTO_KEYID_SIZE];
458 } __packed;
460 /* Same osd_data_out_integrity_info is used for OSD2/OSD1. The only difference
461 * Is the sizeof the structure since in OSD1 the last array is smaller. Use
462 * below for version independent handling of this structure
464 static inline int osd_data_out_integrity_info_sizeof(bool is_ver1)
466 return sizeof(struct osd_data_out_integrity_info) -
467 (is_ver1 * (OSDv2_CRYPTO_KEYID_SIZE - OSDv1_CRYPTO_KEYID_SIZE));
470 struct osd_data_in_integrity_info {
471 __be64 data_bytes;
472 __be64 retrieved_attributes_bytes;
473 __u8 integrity_check_value[OSD_CRYPTO_KEYID_SIZE];
474 } __packed;
476 /* Same osd_data_in_integrity_info is used for OSD2/OSD1. The only difference
477 * Is the sizeof the structure since in OSD1 the last array is smaller. Use
478 * below for version independent handling of this structure
480 static inline int osd_data_in_integrity_info_sizeof(bool is_ver1)
482 return sizeof(struct osd_data_in_integrity_info) -
483 (is_ver1 * (OSDv2_CRYPTO_KEYID_SIZE - OSDv1_CRYPTO_KEYID_SIZE));
486 struct osd_timestamp {
487 u8 time[6]; /* number of milliseconds since 1/1/1970 UT (big endian) */
488 } __packed;
489 /* FIXME: define helper functions to convert to/from osd time format */
492 * Capability & Security definitions
493 * osd2r03: 4.11.2.2 Capability format
494 * osd2r03: 5.2.8 Security parameters
497 struct osd_key_identifier {
498 u8 id[7]; /* if you know why 7 please email bharrosh@panasas.com */
499 } __packed;
501 /* for osd_capability.format */
502 enum {
503 OSD_SEC_CAP_FORMAT_NO_CAPS = 0,
504 OSD_SEC_CAP_FORMAT_VER1 = 1,
505 OSD_SEC_CAP_FORMAT_VER2 = 2,
508 /* security_method */
509 enum {
510 OSD_SEC_NOSEC = 0,
511 OSD_SEC_CAPKEY = 1,
512 OSD_SEC_CMDRSP = 2,
513 OSD_SEC_ALLDATA = 3,
516 enum object_type {
517 OSD_SEC_OBJ_ROOT = 0x1,
518 OSD_SEC_OBJ_PARTITION = 0x2,
519 OSD_SEC_OBJ_COLLECTION = 0x40,
520 OSD_SEC_OBJ_USER = 0x80,
523 enum osd_capability_bit_masks {
524 OSD_SEC_CAP_APPEND = BIT(0),
525 OSD_SEC_CAP_OBJ_MGMT = BIT(1),
526 OSD_SEC_CAP_REMOVE = BIT(2),
527 OSD_SEC_CAP_CREATE = BIT(3),
528 OSD_SEC_CAP_SET_ATTR = BIT(4),
529 OSD_SEC_CAP_GET_ATTR = BIT(5),
530 OSD_SEC_CAP_WRITE = BIT(6),
531 OSD_SEC_CAP_READ = BIT(7),
533 OSD_SEC_CAP_NONE1 = BIT(8),
534 OSD_SEC_CAP_NONE2 = BIT(9),
535 OSD_SEC_GBL_REM = BIT(10), /*v2 only*/
536 OSD_SEC_CAP_QUERY = BIT(11), /*v2 only*/
537 OSD_SEC_CAP_M_OBJECT = BIT(12), /*v2 only*/
538 OSD_SEC_CAP_POL_SEC = BIT(13),
539 OSD_SEC_CAP_GLOBAL = BIT(14),
540 OSD_SEC_CAP_DEV_MGMT = BIT(15),
543 /* for object_descriptor_type (hi nibble used) */
544 enum {
545 OSD_SEC_OBJ_DESC_NONE = 0, /* Not allowed */
546 OSD_SEC_OBJ_DESC_OBJ = 1 << 4, /* v1: also collection */
547 OSD_SEC_OBJ_DESC_PAR = 2 << 4, /* also root */
548 OSD_SEC_OBJ_DESC_COL = 3 << 4, /* v2 only */
551 /* (osd-r10:4.9.2.2)
552 * osd2r03:4.11.2.2 Capability format
554 struct osd_capability_head {
555 u8 format; /* low nibble */
556 u8 integrity_algorithm__key_version; /* MAKE_BYTE(integ_alg, key_ver) */
557 u8 security_method;
558 u8 reserved1;
559 /*04*/ struct osd_timestamp expiration_time;
560 /*10*/ u8 audit[20];
561 /*30*/ u8 discriminator[12];
562 /*42*/ struct osd_timestamp object_created_time;
563 /*48*/ u8 object_type;
564 /*49*/ u8 permissions_bit_mask[5];
565 /*54*/ u8 reserved2;
566 /*55*/ u8 object_descriptor_type; /* high nibble */
567 } __packed;
569 /*56 v1*/
570 struct osdv1_cap_object_descriptor {
571 union {
572 struct {
573 /*56*/ __be32 policy_access_tag;
574 /*60*/ __be64 allowed_partition_id;
575 /*68*/ __be64 allowed_object_id;
576 /*76*/ __be32 reserved;
577 } __packed obj_desc;
579 /*56*/ u8 object_descriptor[24];
581 } __packed;
582 /*80 v1*/
584 /*56 v2*/
585 struct osd_cap_object_descriptor {
586 union {
587 struct {
588 /*56*/ __be32 allowed_attributes_access;
589 /*60*/ __be32 policy_access_tag;
590 /*64*/ __be16 boot_epoch;
591 /*66*/ u8 reserved[6];
592 /*72*/ __be64 allowed_partition_id;
593 /*80*/ __be64 allowed_object_id;
594 /*88*/ __be64 allowed_range_length;
595 /*96*/ __be64 allowed_range_start;
596 } __packed obj_desc;
598 /*56*/ u8 object_descriptor[48];
600 } __packed;
601 /*104 v2*/
603 struct osdv1_capability {
604 struct osd_capability_head h;
605 struct osdv1_cap_object_descriptor od;
606 } __packed;
608 struct osd_capability {
609 struct osd_capability_head h;
610 struct osd_cap_object_descriptor od;
611 } __packed;
614 * osd_sec_set_caps - set cap-bits into the capabilities header
616 * @cap: The osd_capability_head to set cap bits to.
617 * @bit_mask: Use an ORed list of enum osd_capability_bit_masks values
619 * permissions_bit_mask is unaligned use below to set into caps
620 * in a version independent way
622 static inline void osd_sec_set_caps(struct osd_capability_head *cap,
623 u16 bit_mask)
626 *Note: The bits above are defined LE order this is because this way
627 * they can grow in the future to more then 16, and still retain
628 * there constant values.
630 put_unaligned_le16(bit_mask, &cap->permissions_bit_mask);
633 #endif /* ndef __OSD_PROTOCOL_H__ */