[PATCH] dquot: add proper locking when using current->signal->tty
[usb.git] / drivers / md / dm-io.h
blobf9035bfd1a9f73aa8f8854a6c24c76a9790e7eef
1 /*
2 * Copyright (C) 2003 Sistina Software
4 * This file is released under the GPL.
5 */
7 #ifndef _DM_IO_H
8 #define _DM_IO_H
10 #include "dm.h"
12 struct io_region {
13 struct block_device *bdev;
14 sector_t sector;
15 sector_t count;
18 struct page_list {
19 struct page_list *next;
20 struct page *page;
25 * 'error' is a bitset, with each bit indicating whether an error
26 * occurred doing io to the corresponding region.
28 typedef void (*io_notify_fn)(unsigned long error, void *context);
32 * Before anyone uses the IO interface they should call
33 * dm_io_get(), specifying roughly how many pages they are
34 * expecting to perform io on concurrently.
36 * This function may block.
38 int dm_io_get(unsigned int num_pages);
39 void dm_io_put(unsigned int num_pages);
42 * Synchronous IO.
44 * Please ensure that the rw flag in the next two functions is
45 * either READ or WRITE, ie. we don't take READA. Any
46 * regions with a zero count field will be ignored.
48 int dm_io_sync(unsigned int num_regions, struct io_region *where, int rw,
49 struct page_list *pl, unsigned int offset,
50 unsigned long *error_bits);
52 int dm_io_sync_bvec(unsigned int num_regions, struct io_region *where, int rw,
53 struct bio_vec *bvec, unsigned long *error_bits);
55 int dm_io_sync_vm(unsigned int num_regions, struct io_region *where, int rw,
56 void *data, unsigned long *error_bits);
59 * Aynchronous IO.
61 * The 'where' array may be safely allocated on the stack since
62 * the function takes a copy.
64 int dm_io_async(unsigned int num_regions, struct io_region *where, int rw,
65 struct page_list *pl, unsigned int offset,
66 io_notify_fn fn, void *context);
68 int dm_io_async_bvec(unsigned int num_regions, struct io_region *where, int rw,
69 struct bio_vec *bvec, io_notify_fn fn, void *context);
71 int dm_io_async_vm(unsigned int num_regions, struct io_region *where, int rw,
72 void *data, io_notify_fn fn, void *context);
74 #endif