Make the code that parses UTP transfer request headers easier to read by using u8 instead of __be32 where appropriate.
Showing the changes to include/uapi (1 of 3 files). Show all
Unified · Split
| @@ -8,6 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | #ifndef SCSI_BSG_UFS_H |
| 9 | 9 | #define SCSI_BSG_UFS_H |
| 10 | 10 | |
| 11 | +#include <asm/byteorder.h> | |
| 11 | 12 | #include <linux/types.h> |
| 12 | 13 | /* |
| 13 | 14 | * This file intended to be included by both kernel and user space |
| @@ -40,11 +41,56 @@ enum ufs_rpmb_op_type { · 26 unmodified lines | ||
| 40 | 41 | * @dword_0: UPIU header DW-0 |
| 41 | 42 | * @dword_1: UPIU header DW-1 |
| 42 | 43 | * @dword_2: UPIU header DW-2 |
| 44 | + * | |
| 45 | + * @transaction_code: Type of request or response. See also enum | |
| 46 | + * upiu_request_transaction and enum upiu_response_transaction. | |
| 47 | + * @flags: UPIU flags. The meaning of individual flags depends on the | |
| 48 | + * transaction code. | |
| 49 | + * @lun: Logical unit number. | |
| 50 | + * @task_tag: Task tag. | |
| 51 | + * @iid: Initiator ID. | |
| 52 | + * @command_set_type: 0 for SCSI command set; 1 for UFS specific. | |
| 53 | + * @tm_function: Task management function in case of a task management request | |
| 54 | + * UPIU. | |
| 55 | + * @query_function: Query function in case of a query request UPIU. | |
| 56 | + * @response: 0 for success; 1 for failure. | |
| 57 | + * @status: SCSI status if this is the header of a response to a SCSI command. | |
| 58 | + * @ehs_length: EHS length in units of 32 bytes. | |
| 59 | + * @device_information: | |
| 60 | + * @data_segment_length: data segment length. | |
| 43 | 61 | */ |
| 44 | 62 | struct utp_upiu_header { |
| 45 | − __be32 dword_0; | |
| 46 | − __be32 dword_1; | |
| 47 | − __be32 dword_2; | |
| 63 | + union { | |
| 64 | + struct { | |
| 65 | + __be32 dword_0; | |
| 66 | + __be32 dword_1; | |
| 67 | + __be32 dword_2; | |
| 68 | + }; | |
| 69 | + struct { | |
| 70 | + __u8 transaction_code; | |
| 71 | + __u8 flags; | |
| 72 | + __u8 lun; | |
| 73 | + __u8 task_tag; | |
| 74 | +#if defined(__BIG_ENDIAN) | |
| 75 | + __u8 iid: 4; | |
| 76 | + __u8 command_set_type: 4; | |
| 77 | +#elif defined(__LITTLE_ENDIAN) | |
| 78 | + __u8 command_set_type: 4; | |
| 79 | + __u8 iid: 4; | |
| 80 | +#else | |
| 81 | +#error | |
| 82 | +#endif | |
| 83 | + union { | |
| 84 | + __u8 tm_function; | |
| 85 | + __u8 query_function; | |
| 86 | + }; | |
| 87 | + __u8 response; | |
| 88 | + __u8 status; | |
| 89 | + __u8 ehs_length; | |
| 90 | + __u8 device_information; | |
| 91 | + __be16 data_segment_length; | |
| 92 | + }; | |
| 93 | + }; | |
| 48 | 94 | }; |
| 49 | 95 | |
| 50 | 96 | /** |