]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - include/target/target_core_backend.h
target: break up free_device callback
[linux.git] / include / target / target_core_backend.h
index 1b0f447ce850f015e64dd27e47751fe945cbb2ec..3dbcacd7e8d7a98d4499ed6ed873ec4e18770920 100644 (file)
@@ -2,6 +2,7 @@
 #define TARGET_CORE_BACKEND_H
 
 #include <linux/types.h>
+#include <asm/unaligned.h>
 #include <target/target_core_base.h>
 
 #define TRANSPORT_FLAG_PASSTHROUGH             0x1
@@ -10,6 +11,7 @@
  * backend module.
  */
 #define TRANSPORT_FLAG_PASSTHROUGH_ALUA                0x2
+#define TRANSPORT_FLAG_PASSTHROUGH_PGR          0x4
 
 struct request_queue;
 struct scatterlist;
@@ -28,6 +30,7 @@ struct target_backend_ops {
 
        struct se_device *(*alloc_device)(struct se_hba *, const char *);
        int (*configure_device)(struct se_device *);
+       void (*destroy_device)(struct se_device *);
        void (*free_device)(struct se_device *device);
 
        ssize_t (*set_configfs_dev_params)(struct se_device *,
@@ -108,4 +111,11 @@ sector_t target_to_linux_sector(struct se_device *dev, sector_t lb);
 bool target_configure_unmap_from_queue(struct se_dev_attrib *attrib,
                                       struct request_queue *q);
 
+
+/* Only use get_unaligned_be24() if reading p - 1 is allowed. */
+static inline uint32_t get_unaligned_be24(const uint8_t *const p)
+{
+       return get_unaligned_be32(p - 1) & 0xffffffU;
+}
+
 #endif /* TARGET_CORE_BACKEND_H */