osd_protocol.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. /*
  2. * osd_protocol.h - OSD T10 standard C definitions.
  3. *
  4. * Copyright (C) 2008 Panasas Inc. All rights reserved.
  5. *
  6. * Authors:
  7. * Boaz Harrosh <bharrosh@panasas.com>
  8. * Benny Halevy <bhalevy@panasas.com>
  9. *
  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
  12. *
  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.
  15. */
  16. #ifndef __OSD_PROTOCOL_H__
  17. #define __OSD_PROTOCOL_H__
  18. #include <linux/types.h>
  19. #include <asm/unaligned.h>
  20. #include <scsi/scsi.h>
  21. enum {
  22. OSDv1_ADDITIONAL_CDB_LENGTH = 192,
  23. OSDv1_TOTAL_CDB_LEN = OSDv1_ADDITIONAL_CDB_LENGTH + 8,
  24. OSDv1_CAP_LEN = 80,
  25. /* Latest supported version */
  26. /* OSD_ADDITIONAL_CDB_LENGTH = 216,*/
  27. OSD_ADDITIONAL_CDB_LENGTH =
  28. OSDv1_ADDITIONAL_CDB_LENGTH, /* FIXME: Pete rev-001 sup */
  29. OSD_TOTAL_CDB_LEN = OSD_ADDITIONAL_CDB_LENGTH + 8,
  30. /* OSD_CAP_LEN = 104,*/
  31. OSD_CAP_LEN = OSDv1_CAP_LEN,/* FIXME: Pete rev-001 sup */
  32. OSD_SYSTEMID_LEN = 20,
  33. OSD_CRYPTO_KEYID_SIZE = 20,
  34. /*FIXME: OSDv2_CRYPTO_KEYID_SIZE = 32,*/
  35. OSD_CRYPTO_SEED_SIZE = 4,
  36. OSD_CRYPTO_NONCE_SIZE = 12,
  37. OSD_MAX_SENSE_LEN = 252, /* from SPC-3 */
  38. OSD_PARTITION_FIRST_ID = 0x10000,
  39. OSD_OBJECT_FIRST_ID = 0x10000,
  40. };
  41. /* (osd-r10 5.2.4)
  42. * osd2r03: 5.2.3 Caching control bits
  43. */
  44. enum osd_options_byte {
  45. OSD_CDB_FUA = 0x08, /* Force Unit Access */
  46. OSD_CDB_DPO = 0x10, /* Disable Page Out */
  47. };
  48. /*
  49. * osd2r03: 5.2.5 Isolation.
  50. * First 3 bits, V2-only.
  51. * Also for attr 110h "default isolation method" at Root Information page
  52. */
  53. enum osd_options_byte_isolation {
  54. OSD_ISOLATION_DEFAULT = 0,
  55. OSD_ISOLATION_NONE = 1,
  56. OSD_ISOLATION_STRICT = 2,
  57. OSD_ISOLATION_RANGE = 4,
  58. OSD_ISOLATION_FUNCTIONAL = 5,
  59. OSD_ISOLATION_VENDOR = 7,
  60. };
  61. /* (osd-r10: 6.7)
  62. * osd2r03: 6.8 FLUSH, FLUSH COLLECTION, FLUSH OSD, FLUSH PARTITION
  63. */
  64. enum osd_options_flush_scope_values {
  65. OSD_CDB_FLUSH_ALL = 0,
  66. OSD_CDB_FLUSH_ATTR_ONLY = 1,
  67. OSD_CDB_FLUSH_ALL_RECURSIVE = 2,
  68. /* V2-only */
  69. OSD_CDB_FLUSH_ALL_RANGE = 2,
  70. };
  71. /* osd2r03: 5.2.10 Timestamps control */
  72. enum {
  73. OSD_CDB_NORMAL_TIMESTAMPS = 0,
  74. OSD_CDB_BYPASS_TIMESTAMPS = 0x7f,
  75. };
  76. /* (osd-r10: 5.2.2.1)
  77. * osd2r03: 5.2.4.1 Get and set attributes CDB format selection
  78. * 2 bits at second nibble of command_specific_options byte
  79. */
  80. enum osd_attributes_mode {
  81. /* V2-only */
  82. OSD_CDB_SET_ONE_ATTR = 0x10,
  83. OSD_CDB_GET_ATTR_PAGE_SET_ONE = 0x20,
  84. OSD_CDB_GET_SET_ATTR_LISTS = 0x30,
  85. OSD_CDB_GET_SET_ATTR_MASK = 0x30,
  86. };
  87. /* (osd-r10: 4.12.5)
  88. * osd2r03: 4.14.5 Data-In and Data-Out buffer offsets
  89. * byte offset = mantissa * (2^(exponent+8))
  90. * struct {
  91. * unsigned mantissa: 28;
  92. * int exponent: 04;
  93. * }
  94. */
  95. typedef __be32 __bitwise osd_cdb_offset;
  96. enum {
  97. OSD_OFFSET_UNUSED = 0xFFFFFFFF,
  98. OSD_OFFSET_MAX_BITS = 28,
  99. OSDv1_OFFSET_MIN_SHIFT = 8,
  100. OSD_OFFSET_MIN_SHIFT = 3,
  101. OSD_OFFSET_MAX_SHIFT = 16,
  102. };
  103. /* Return the smallest allowed encoded offset that contains @offset.
  104. *
  105. * The actual encoded offset returned is @offset + *padding.
  106. * (up to max_shift, non-inclusive)
  107. */
  108. osd_cdb_offset __osd_encode_offset(u64 offset, unsigned *padding,
  109. int min_shift, int max_shift);
  110. /* Minimum alignment is 256 bytes
  111. * Note: Seems from std v1 that exponent can be from 0+8 to 0xE+8 (inclusive)
  112. * which is 8 to 23 but IBM code restricts it to 16, so be it.
  113. */
  114. static inline osd_cdb_offset osd_encode_offset_v1(u64 offset, unsigned *padding)
  115. {
  116. return __osd_encode_offset(offset, padding,
  117. OSDv1_OFFSET_MIN_SHIFT, OSD_OFFSET_MAX_SHIFT);
  118. }
  119. /* Minimum 8 bytes alignment
  120. * Same as v1 but since exponent can be signed than a less than
  121. * 256 alignment can be reached with small offsets (<2GB)
  122. */
  123. static inline osd_cdb_offset osd_encode_offset_v2(u64 offset, unsigned *padding)
  124. {
  125. return __osd_encode_offset(offset, padding,
  126. OSD_OFFSET_MIN_SHIFT, OSD_OFFSET_MAX_SHIFT);
  127. }
  128. /* osd2r03: 5.2.1 Overview */
  129. struct osd_cdb_head {
  130. struct scsi_varlen_cdb_hdr varlen_cdb;
  131. /*10*/ u8 options;
  132. u8 command_specific_options;
  133. u8 timestamp_control;
  134. /*13*/ u8 reserved1[3];
  135. /*16*/ __be64 partition;
  136. /*24*/ __be64 object;
  137. /*32*/ union { /* V1 vs V2 alignment differences */
  138. struct __osdv1_cdb_addr_len {
  139. /*32*/ __be32 list_identifier;/* Rarely used */
  140. /*36*/ __be64 length;
  141. /*44*/ __be64 start_address;
  142. } __packed v1;
  143. struct __osdv2_cdb_addr_len {
  144. /* called allocation_length in some commands */
  145. /*32*/ __be64 length;
  146. /*40*/ __be64 start_address;
  147. /*48*/ __be32 list_identifier;/* Rarely used */
  148. } __packed v2;
  149. };
  150. /*52*/ union { /* selected attributes mode Page/List/Single */
  151. struct osd_attributes_page_mode {
  152. /*52*/ __be32 get_attr_page;
  153. /*56*/ __be32 get_attr_alloc_length;
  154. /*60*/ osd_cdb_offset get_attr_offset;
  155. /*64*/ __be32 set_attr_page;
  156. /*68*/ __be32 set_attr_id;
  157. /*72*/ __be32 set_attr_length;
  158. /*76*/ osd_cdb_offset set_attr_offset;
  159. /*80*/ } __packed attrs_page;
  160. struct osd_attributes_list_mode {
  161. /*52*/ __be32 get_attr_desc_bytes;
  162. /*56*/ osd_cdb_offset get_attr_desc_offset;
  163. /*60*/ __be32 get_attr_alloc_length;
  164. /*64*/ osd_cdb_offset get_attr_offset;
  165. /*68*/ __be32 set_attr_bytes;
  166. /*72*/ osd_cdb_offset set_attr_offset;
  167. __be32 not_used;
  168. /*80*/ } __packed attrs_list;
  169. /* osd2r03:5.2.4.2 Set one attribute value using CDB fields */
  170. struct osd_attributes_cdb_mode {
  171. /*52*/ __be32 set_attr_page;
  172. /*56*/ __be32 set_attr_id;
  173. /*60*/ __be16 set_attr_len;
  174. /*62*/ u8 set_attr_val[18];
  175. /*80*/ } __packed attrs_cdb;
  176. /*52*/ u8 get_set_attributes_parameters[28];
  177. };
  178. } __packed;
  179. /*80*/
  180. /*160 v1*/
  181. /*184 v2*/
  182. struct osd_security_parameters {
  183. /*160*/u8 integrity_check_value[OSD_CRYPTO_KEYID_SIZE];
  184. /*180*/u8 request_nonce[OSD_CRYPTO_NONCE_SIZE];
  185. /*192*/osd_cdb_offset data_in_integrity_check_offset;
  186. /*196*/osd_cdb_offset data_out_integrity_check_offset;
  187. } __packed;
  188. /*200 v1*/
  189. /*224 v2*/
  190. /* FIXME: osdv2_security_parameters */
  191. struct osdv1_cdb {
  192. struct osd_cdb_head h;
  193. u8 caps[OSDv1_CAP_LEN];
  194. struct osd_security_parameters sec_params;
  195. } __packed;
  196. struct osdv2_cdb {
  197. struct osd_cdb_head h;
  198. u8 caps[OSD_CAP_LEN];
  199. struct osd_security_parameters sec_params;
  200. /* FIXME: osdv2_security_parameters */
  201. } __packed;
  202. struct osd_cdb {
  203. union {
  204. struct osdv1_cdb v1;
  205. struct osdv2_cdb v2;
  206. u8 buff[OSD_TOTAL_CDB_LEN];
  207. };
  208. } __packed;
  209. static inline struct osd_cdb_head *osd_cdb_head(struct osd_cdb *ocdb)
  210. {
  211. return (struct osd_cdb_head *)ocdb->buff;
  212. }
  213. /* define both version actions
  214. * Ex name = FORMAT_OSD we have OSD_ACT_FORMAT_OSD && OSDv1_ACT_FORMAT_OSD
  215. */
  216. #define OSD_ACT___(Name, Num) \
  217. OSD_ACT_##Name = __constant_cpu_to_be16(0x8880 + Num), \
  218. OSDv1_ACT_##Name = __constant_cpu_to_be16(0x8800 + Num),
  219. /* V2 only actions */
  220. #define OSD_ACT_V2(Name, Num) \
  221. OSD_ACT_##Name = __constant_cpu_to_be16(0x8880 + Num),
  222. #define OSD_ACT_V1_V2(Name, Num1, Num2) \
  223. OSD_ACT_##Name = __constant_cpu_to_be16(Num2), \
  224. OSDv1_ACT_##Name = __constant_cpu_to_be16(Num1),
  225. enum osd_service_actions {
  226. OSD_ACT_V2(OBJECT_STRUCTURE_CHECK, 0x00)
  227. OSD_ACT___(FORMAT_OSD, 0x01)
  228. OSD_ACT___(CREATE, 0x02)
  229. OSD_ACT___(LIST, 0x03)
  230. OSD_ACT_V2(PUNCH, 0x04)
  231. OSD_ACT___(READ, 0x05)
  232. OSD_ACT___(WRITE, 0x06)
  233. OSD_ACT___(APPEND, 0x07)
  234. OSD_ACT___(FLUSH, 0x08)
  235. OSD_ACT_V2(CLEAR, 0x09)
  236. OSD_ACT___(REMOVE, 0x0A)
  237. OSD_ACT___(CREATE_PARTITION, 0x0B)
  238. OSD_ACT___(REMOVE_PARTITION, 0x0C)
  239. OSD_ACT___(GET_ATTRIBUTES, 0x0E)
  240. OSD_ACT___(SET_ATTRIBUTES, 0x0F)
  241. OSD_ACT___(CREATE_AND_WRITE, 0x12)
  242. OSD_ACT___(CREATE_COLLECTION, 0x15)
  243. OSD_ACT___(REMOVE_COLLECTION, 0x16)
  244. OSD_ACT___(LIST_COLLECTION, 0x17)
  245. OSD_ACT___(SET_KEY, 0x18)
  246. OSD_ACT___(SET_MASTER_KEY, 0x19)
  247. OSD_ACT___(FLUSH_COLLECTION, 0x1A)
  248. OSD_ACT___(FLUSH_PARTITION, 0x1B)
  249. OSD_ACT___(FLUSH_OSD, 0x1C)
  250. OSD_ACT_V2(QUERY, 0x20)
  251. OSD_ACT_V2(REMOVE_MEMBER_OBJECTS, 0x21)
  252. OSD_ACT_V2(GET_MEMBER_ATTRIBUTES, 0x22)
  253. OSD_ACT_V2(SET_MEMBER_ATTRIBUTES, 0x23)
  254. OSD_ACT_V2(READ_MAP, 0x31)
  255. OSD_ACT_V1_V2(PERFORM_SCSI_COMMAND, 0x8F7E, 0x8F7C)
  256. OSD_ACT_V1_V2(SCSI_TASK_MANAGEMENT, 0x8F7F, 0x8F7D)
  257. /* 0x8F80 to 0x8FFF are Vendor specific */
  258. };
  259. /* osd2r03: 7.1.3.2 List entry format for retrieving attributes */
  260. struct osd_attributes_list_attrid {
  261. __be32 attr_page;
  262. __be32 attr_id;
  263. } __packed;
  264. /*
  265. * osd2r03: 7.1.3.3 List entry format for retrieved attributes and
  266. * for setting attributes
  267. * NOTE: v2 is 8-bytes aligned, v1 is not aligned.
  268. */
  269. struct osd_attributes_list_element {
  270. __be32 attr_page;
  271. __be32 attr_id;
  272. __be16 attr_bytes;
  273. u8 attr_val[0];
  274. } __packed;
  275. enum {
  276. OSDv1_ATTRIBUTES_ELEM_ALIGN = 1,
  277. OSD_ATTRIBUTES_ELEM_ALIGN = 8,
  278. };
  279. enum {
  280. OSD_ATTR_LIST_ALL_PAGES = 0xFFFFFFFF,
  281. OSD_ATTR_LIST_ALL_IN_PAGE = 0xFFFFFFFF,
  282. };
  283. static inline unsigned osdv1_attr_list_elem_size(unsigned len)
  284. {
  285. return ALIGN(len + sizeof(struct osd_attributes_list_element),
  286. OSDv1_ATTRIBUTES_ELEM_ALIGN);
  287. }
  288. static inline unsigned osdv2_attr_list_elem_size(unsigned len)
  289. {
  290. return ALIGN(len + sizeof(struct osd_attributes_list_element),
  291. OSD_ATTRIBUTES_ELEM_ALIGN);
  292. }
  293. /*
  294. * osd2r03: 7.1.3 OSD attributes lists (Table 184) — List type values
  295. */
  296. enum osd_attr_list_types {
  297. OSD_ATTR_LIST_GET = 0x1, /* descriptors only */
  298. OSD_ATTR_LIST_SET_RETRIEVE = 0x9, /*descriptors/values variable-length*/
  299. OSD_V2_ATTR_LIST_MULTIPLE = 0xE, /* ver2, Multiple Objects lists*/
  300. OSD_V1_ATTR_LIST_CREATE_MULTIPLE = 0xF,/*ver1, used by create_multple*/
  301. };
  302. /* osd2r03: 7.1.3.4 Multi-object retrieved attributes format */
  303. struct osd_attributes_list_multi_header {
  304. __be64 object_id;
  305. u8 object_type; /* object_type enum below */
  306. u8 reserved[5];
  307. __be16 list_bytes;
  308. /* followed by struct osd_attributes_list_element's */
  309. };
  310. struct osdv1_attributes_list_header {
  311. u8 type; /* low 4-bit only */
  312. u8 pad;
  313. __be16 list_bytes; /* Initiator shall set to Zero. Only set by target */
  314. /*
  315. * type=9 followed by struct osd_attributes_list_element's
  316. * type=E followed by struct osd_attributes_list_multi_header's
  317. */
  318. } __packed;
  319. static inline unsigned osdv1_list_size(struct osdv1_attributes_list_header *h)
  320. {
  321. return be16_to_cpu(h->list_bytes);
  322. }
  323. struct osdv2_attributes_list_header {
  324. u8 type; /* lower 4-bits only */
  325. u8 pad[3];
  326. /*4*/ __be32 list_bytes; /* Initiator shall set to zero. Only set by target */
  327. /*
  328. * type=9 followed by struct osd_attributes_list_element's
  329. * type=E followed by struct osd_attributes_list_multi_header's
  330. */
  331. } __packed;
  332. static inline unsigned osdv2_list_size(struct osdv2_attributes_list_header *h)
  333. {
  334. return be32_to_cpu(h->list_bytes);
  335. }
  336. /* (osd-r10 6.13)
  337. * osd2r03: 6.15 LIST (Table 79) LIST command parameter data.
  338. * for root_lstchg below
  339. */
  340. enum {
  341. OSD_OBJ_ID_LIST_PAR = 0x1, /* V1-only. Not used in V2 */
  342. OSD_OBJ_ID_LIST_LSTCHG = 0x2,
  343. };
  344. /*
  345. * osd2r03: 6.15.2 LIST command parameter data
  346. * (Also for LIST COLLECTION)
  347. */
  348. struct osd_obj_id_list {
  349. __be64 list_bytes; /* bytes in list excluding list_bytes (-8) */
  350. __be64 continuation_id;
  351. __be32 list_identifier;
  352. u8 pad[3];
  353. u8 root_lstchg;
  354. __be64 object_ids[0];
  355. } __packed;
  356. static inline bool osd_is_obj_list_done(struct osd_obj_id_list *list,
  357. bool *is_changed)
  358. {
  359. *is_changed = (0 != (list->root_lstchg & OSD_OBJ_ID_LIST_LSTCHG));
  360. return 0 != list->continuation_id;
  361. }
  362. /*
  363. * osd2r03: 4.12.4.5 The ALLDATA security method
  364. */
  365. struct osd_data_out_integrity_info {
  366. __be64 data_bytes;
  367. __be64 set_attributes_bytes;
  368. __be64 get_attributes_bytes;
  369. __be64 integrity_check_value;
  370. } __packed;
  371. struct osd_data_in_integrity_info {
  372. __be64 data_bytes;
  373. __be64 retrieved_attributes_bytes;
  374. __be64 integrity_check_value;
  375. } __packed;
  376. struct osd_timestamp {
  377. u8 time[6]; /* number of milliseconds since 1/1/1970 UT (big endian) */
  378. } __packed;
  379. /* FIXME: define helper functions to convert to/from osd time format */
  380. /*
  381. * Capability & Security definitions
  382. * osd2r03: 4.11.2.2 Capability format
  383. * osd2r03: 5.2.8 Security parameters
  384. */
  385. struct osd_key_identifier {
  386. u8 id[7]; /* if you know why 7 please email bharrosh@panasas.com */
  387. } __packed;
  388. /* for osd_capability.format */
  389. enum {
  390. OSD_SEC_CAP_FORMAT_NO_CAPS = 0,
  391. OSD_SEC_CAP_FORMAT_VER1 = 1,
  392. OSD_SEC_CAP_FORMAT_VER2 = 2,
  393. };
  394. /* security_method */
  395. enum {
  396. OSD_SEC_NOSEC = 0,
  397. OSD_SEC_CAPKEY = 1,
  398. OSD_SEC_CMDRSP = 2,
  399. OSD_SEC_ALLDATA = 3,
  400. };
  401. enum object_type {
  402. OSD_SEC_OBJ_ROOT = 0x1,
  403. OSD_SEC_OBJ_PARTITION = 0x2,
  404. OSD_SEC_OBJ_COLLECTION = 0x40,
  405. OSD_SEC_OBJ_USER = 0x80,
  406. };
  407. enum osd_capability_bit_masks {
  408. OSD_SEC_CAP_APPEND = BIT(0),
  409. OSD_SEC_CAP_OBJ_MGMT = BIT(1),
  410. OSD_SEC_CAP_REMOVE = BIT(2),
  411. OSD_SEC_CAP_CREATE = BIT(3),
  412. OSD_SEC_CAP_SET_ATTR = BIT(4),
  413. OSD_SEC_CAP_GET_ATTR = BIT(5),
  414. OSD_SEC_CAP_WRITE = BIT(6),
  415. OSD_SEC_CAP_READ = BIT(7),
  416. OSD_SEC_CAP_NONE1 = BIT(8),
  417. OSD_SEC_CAP_NONE2 = BIT(9),
  418. OSD_SEC_CAP_NONE3 = BIT(10),
  419. OSD_SEC_CAP_QUERY = BIT(11), /*v2 only*/
  420. OSD_SEC_CAP_M_OBJECT = BIT(12), /*v2 only*/
  421. OSD_SEC_CAP_POL_SEC = BIT(13),
  422. OSD_SEC_CAP_GLOBAL = BIT(14),
  423. OSD_SEC_CAP_DEV_MGMT = BIT(15),
  424. };
  425. /* for object_descriptor_type (hi nibble used) */
  426. enum {
  427. OSD_SEC_OBJ_DESC_NONE = 0, /* Not allowed */
  428. OSD_SEC_OBJ_DESC_OBJ = 1 << 4, /* v1: also collection */
  429. OSD_SEC_OBJ_DESC_PAR = 2 << 4, /* also root */
  430. OSD_SEC_OBJ_DESC_COL = 3 << 4, /* v2 only */
  431. };
  432. /* (osd-r10:4.9.2.2)
  433. * osd2r03:4.11.2.2 Capability format
  434. */
  435. struct osd_capability_head {
  436. u8 format; /* low nibble */
  437. u8 integrity_algorithm__key_version; /* MAKE_BYTE(integ_alg, key_ver) */
  438. u8 security_method;
  439. u8 reserved1;
  440. /*04*/ struct osd_timestamp expiration_time;
  441. /*10*/ u8 audit[20];
  442. /*30*/ u8 discriminator[12];
  443. /*42*/ struct osd_timestamp object_created_time;
  444. /*48*/ u8 object_type;
  445. /*49*/ u8 permissions_bit_mask[5];
  446. /*54*/ u8 reserved2;
  447. /*55*/ u8 object_descriptor_type; /* high nibble */
  448. } __packed;
  449. /*56 v1*/
  450. struct osdv1_cap_object_descriptor {
  451. union {
  452. struct {
  453. /*56*/ __be32 policy_access_tag;
  454. /*60*/ __be64 allowed_partition_id;
  455. /*68*/ __be64 allowed_object_id;
  456. /*76*/ __be32 reserved;
  457. } __packed obj_desc;
  458. /*56*/ u8 object_descriptor[24];
  459. };
  460. } __packed;
  461. /*80 v1*/
  462. /*56 v2*/
  463. struct osd_cap_object_descriptor {
  464. union {
  465. struct {
  466. /*56*/ __be32 allowed_attributes_access;
  467. /*60*/ __be32 policy_access_tag;
  468. /*64*/ __be16 boot_epoch;
  469. /*66*/ u8 reserved[6];
  470. /*72*/ __be64 allowed_partition_id;
  471. /*80*/ __be64 allowed_object_id;
  472. /*88*/ __be64 allowed_range_length;
  473. /*96*/ __be64 allowed_range_start;
  474. } __packed obj_desc;
  475. /*56*/ u8 object_descriptor[48];
  476. };
  477. } __packed;
  478. /*104 v2*/
  479. struct osdv1_capability {
  480. struct osd_capability_head h;
  481. struct osdv1_cap_object_descriptor od;
  482. } __packed;
  483. struct osd_capability {
  484. struct osd_capability_head h;
  485. /* struct osd_cap_object_descriptor od;*/
  486. struct osdv1_cap_object_descriptor od; /* FIXME: Pete rev-001 sup */
  487. } __packed;
  488. /**
  489. * osd_sec_set_caps - set cap-bits into the capabilities header
  490. *
  491. * @cap: The osd_capability_head to set cap bits to.
  492. * @bit_mask: Use an ORed list of enum osd_capability_bit_masks values
  493. *
  494. * permissions_bit_mask is unaligned use below to set into caps
  495. * in a version independent way
  496. */
  497. static inline void osd_sec_set_caps(struct osd_capability_head *cap,
  498. u16 bit_mask)
  499. {
  500. /*
  501. *Note: The bits above are defined LE order this is because this way
  502. * they can grow in the future to more then 16, and still retain
  503. * there constant values.
  504. */
  505. put_unaligned_le16(bit_mask, &cap->permissions_bit_mask);
  506. }
  507. #endif /* ndef __OSD_PROTOCOL_H__ */