diff options
| author | Bart Van Assche <bart.vanassche@sandisk.com> | 2017-05-23 19:48:27 -0400 |
|---|---|---|
| committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2017-07-07 01:57:59 -0400 |
| commit | a85d667e58bddf73be84d1981b41eaac985ed216 (patch) | |
| tree | b997450b0dce7048845834d1756a7e12cb19d069 /include/target | |
| parent | f2b72d6a8eed0eb02e6346886514a27df1efe827 (diff) | |
target: Use {get,put}_unaligned_be*() instead of open coding these functions
Introduce the function get_unaligned_be24(). Use {get,put}_unaligned_be*()
where appropriate. This patch does not change any functionality.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cc: Andy Grover <agrover@redhat.com>
Cc: David Disseldorp <ddiss@suse.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'include/target')
| -rw-r--r-- | include/target/target_core_backend.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h index e475531565fd..b76071161cdc 100644 --- a/include/target/target_core_backend.h +++ b/include/target/target_core_backend.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #define TARGET_CORE_BACKEND_H | 2 | #define TARGET_CORE_BACKEND_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | #include <asm/unaligned.h> | ||
| 5 | #include <target/target_core_base.h> | 6 | #include <target/target_core_base.h> |
| 6 | 7 | ||
| 7 | #define TRANSPORT_FLAG_PASSTHROUGH 0x1 | 8 | #define TRANSPORT_FLAG_PASSTHROUGH 0x1 |
| @@ -109,4 +110,11 @@ sector_t target_to_linux_sector(struct se_device *dev, sector_t lb); | |||
| 109 | bool target_configure_unmap_from_queue(struct se_dev_attrib *attrib, | 110 | bool target_configure_unmap_from_queue(struct se_dev_attrib *attrib, |
| 110 | struct request_queue *q); | 111 | struct request_queue *q); |
| 111 | 112 | ||
| 113 | |||
| 114 | /* Only use get_unaligned_be24() if reading p - 1 is allowed. */ | ||
| 115 | static inline uint32_t get_unaligned_be24(const uint8_t *const p) | ||
| 116 | { | ||
| 117 | return get_unaligned_be32(p - 1) & 0xffffffU; | ||
| 118 | } | ||
| 119 | |||
| 112 | #endif /* TARGET_CORE_BACKEND_H */ | 120 | #endif /* TARGET_CORE_BACKEND_H */ |
