]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - include/linux/dm-io.h
UBUNTU: SAUCE: LSM stacking: LSM: Manage file security blobs
[mirror_ubuntu-artful-kernel.git] / include / linux / dm-io.h
CommitLineData
1da177e4
LT
1/*
2 * Copyright (C) 2003 Sistina Software
22a1ceb1
HM
3 * Copyright (C) 2004 - 2008 Red Hat, Inc. All rights reserved.
4 *
5 * Device-Mapper low-level I/O.
1da177e4
LT
6 *
7 * This file is released under the GPL.
8 */
9
22a1ceb1
HM
10#ifndef _LINUX_DM_IO_H
11#define _LINUX_DM_IO_H
12
13#ifdef __KERNEL__
1da177e4 14
22a1ceb1 15#include <linux/types.h>
1da177e4 16
22a1ceb1 17struct dm_io_region {
1da177e4
LT
18 struct block_device *bdev;
19 sector_t sector;
bf17ce3a 20 sector_t count; /* If this is zero the region is ignored. */
1da177e4
LT
21};
22
23struct page_list {
24 struct page_list *next;
25 struct page *page;
26};
27
1da177e4
LT
28typedef void (*io_notify_fn)(unsigned long error, void *context);
29
c8b03afe
HM
30enum dm_io_mem_type {
31 DM_IO_PAGE_LIST,/* Page list */
003b5c57 32 DM_IO_BIO, /* Bio vector */
c8b03afe
HM
33 DM_IO_VMA, /* Virtual memory area */
34 DM_IO_KMEM, /* Kernel memory */
35};
36
37struct dm_io_memory {
38 enum dm_io_mem_type type;
39
924e600d
MS
40 unsigned offset;
41
c8b03afe
HM
42 union {
43 struct page_list *pl;
003b5c57 44 struct bio *bio;
c8b03afe
HM
45 void *vma;
46 void *addr;
47 } ptr;
c8b03afe
HM
48};
49
50struct dm_io_notify {
51 io_notify_fn fn; /* Callback for asynchronous requests */
52 void *context; /* Passed to callback */
53};
54
55/*
56 * IO request structure
57 */
58struct dm_io_client;
59struct dm_io_request {
e6047149 60 int bi_op; /* REQ_OP */
ef295ecf 61 int bi_op_flags; /* req_flag_bits */
c8b03afe
HM
62 struct dm_io_memory mem; /* Memory to use for io */
63 struct dm_io_notify notify; /* Synchronous if notify.fn is NULL */
64 struct dm_io_client *client; /* Client memory handler */
65};
1da177e4 66
c8b03afe
HM
67/*
68 * For async io calls, users can alternatively use the dm_io() function below
69 * and dm_io_client_create() to create private mempools for the client.
70 *
71 * Create/destroy may block.
72 */
bda8efec 73struct dm_io_client *dm_io_client_create(void);
c8b03afe
HM
74void dm_io_client_destroy(struct dm_io_client *client);
75
c8b03afe
HM
76/*
77 * IO interface using private per-client pools.
bf17ce3a
MB
78 * Each bit in the optional 'sync_error_bits' bitset indicates whether an
79 * error occurred doing io to the corresponding region.
c8b03afe
HM
80 */
81int dm_io(struct dm_io_request *io_req, unsigned num_regions,
22a1ceb1 82 struct dm_io_region *region, unsigned long *sync_error_bits);
c8b03afe 83
22a1ceb1
HM
84#endif /* __KERNEL__ */
85#endif /* _LINUX_DM_IO_H */