Blackfin arch: fix building for BF542 processors which only have 1 TWI
[pv_ops_mirror.git] / include / linux / uio.h
blobb7fe13883bdb1ba2682b503cff268c7e3618df9b
1 #ifndef __LINUX_UIO_H
2 #define __LINUX_UIO_H
4 #include <linux/compiler.h>
5 #include <linux/types.h>
7 /*
8 * Berkeley style UIO structures - Alan Cox 1994.
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
16 struct iovec
18 void __user *iov_base; /* BSD uses caddr_t (1003.1g requires void *) */
19 __kernel_size_t iov_len; /* Must be size_t (1003.1g) */
22 #ifdef __KERNEL__
24 struct kvec {
25 void *iov_base; /* and that should *never* hold a userland pointer */
26 size_t iov_len;
29 #endif
32 * UIO_MAXIOV shall be at least 16 1003.1g (5.4.1.1)
35 #define UIO_FASTIOV 8
36 #define UIO_MAXIOV 1024
39 * Total number of bytes covered by an iovec.
41 * NOTE that it is not safe to use this function until all the iovec's
42 * segment lengths have been validated. Because the individual lengths can
43 * overflow a size_t when added together.
45 static inline size_t iov_length(const struct iovec *iov, unsigned long nr_segs)
47 unsigned long seg;
48 size_t ret = 0;
50 for (seg = 0; seg < nr_segs; seg++)
51 ret += iov[seg].iov_len;
52 return ret;
55 unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to);
57 #endif