1
2
3
4
5
6
7
8#ifndef __LINUX_IOBUF_H
9#define __LINUX_IOBUF_H
10
11#include <linux/mm.h>
12#include <linux/init.h>
13#include <linux/wait.h>
14#include <asm/atomic.h>
15
16
17
18
19
20
21
22
23
24
25
26
27#define KIO_MAX_ATOMIC_IO 512
28#define KIO_STATIC_PAGES (KIO_MAX_ATOMIC_IO / (PAGE_SIZE >> 10) + 1)
29#define KIO_MAX_SECTORS (KIO_MAX_ATOMIC_IO * 2)
30
31
32
33struct kiobuf
34{
35 int nr_pages;
36 int array_len;
37 int offset;
38 int length;
39
40 unsigned int locked : 1;
41
42 struct page ** maplist;
43 struct buffer_head ** bh;
44 unsigned long * blocks;
45
46
47 atomic_t io_count;
48 int errno;
49 void (*end_io) (struct kiobuf *);
50 wait_queue_head_t wait_queue;
51};
52
53
54
55
56int map_user_kiobuf(int rw, struct kiobuf *, unsigned long va, size_t len);
57void unmap_kiobuf(struct kiobuf *iobuf);
58int lock_kiovec(int nr, struct kiobuf *iovec[], int wait);
59int unlock_kiovec(int nr, struct kiobuf *iovec[]);
60void mark_dirty_kiobuf(struct kiobuf *iobuf, int bytes);
61
62
63
64void end_kio_request(struct kiobuf *, int);
65void simple_wakeup_kiobuf(struct kiobuf *);
66int alloc_kiovec(int nr, struct kiobuf **);
67void free_kiovec(int nr, struct kiobuf **);
68int expand_kiobuf(struct kiobuf *, int);
69void kiobuf_wait_for_io(struct kiobuf *);
70extern int alloc_kiobuf_bhs(struct kiobuf *);
71extern void free_kiobuf_bhs(struct kiobuf *);
72
73
74
75int brw_kiovec(int rw, int nr, struct kiobuf *iovec[],
76 kdev_t dev, unsigned long b[], int size);
77
78#endif
79