0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef _LINUX_DM_IO_H
0011 #define _LINUX_DM_IO_H
0012
0013 #ifdef __KERNEL__
0014
0015 #include <linux/types.h>
0016 #include <linux/blk_types.h>
0017
0018 struct dm_io_region {
0019 struct block_device *bdev;
0020 sector_t sector;
0021 sector_t count;
0022 };
0023
0024 struct page_list {
0025 struct page_list *next;
0026 struct page *page;
0027 };
0028
0029 typedef void (*io_notify_fn)(unsigned long error, void *context);
0030
0031 enum dm_io_mem_type {
0032 DM_IO_PAGE_LIST,
0033 DM_IO_BIO,
0034 DM_IO_VMA,
0035 DM_IO_KMEM,
0036 };
0037
0038 struct dm_io_memory {
0039 enum dm_io_mem_type type;
0040
0041 unsigned offset;
0042
0043 union {
0044 struct page_list *pl;
0045 struct bio *bio;
0046 void *vma;
0047 void *addr;
0048 } ptr;
0049 };
0050
0051 struct dm_io_notify {
0052 io_notify_fn fn;
0053 void *context;
0054 };
0055
0056
0057
0058
0059 struct dm_io_client;
0060 struct dm_io_request {
0061 blk_opf_t bi_opf;
0062 struct dm_io_memory mem;
0063 struct dm_io_notify notify;
0064 struct dm_io_client *client;
0065 };
0066
0067
0068
0069
0070
0071
0072
0073 struct dm_io_client *dm_io_client_create(void);
0074 void dm_io_client_destroy(struct dm_io_client *client);
0075
0076
0077
0078
0079
0080
0081 int dm_io(struct dm_io_request *io_req, unsigned num_regions,
0082 struct dm_io_region *region, unsigned long *sync_error_bits);
0083
0084 #endif
0085 #endif