diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/linux/uio.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'include/linux/uio.h')
-rw-r--r-- | include/linux/uio.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/include/linux/uio.h b/include/linux/uio.h new file mode 100644 index 000000000000..9af8bbcd8963 --- /dev/null +++ b/include/linux/uio.h | |||
@@ -0,0 +1,66 @@ | |||
1 | #ifndef __LINUX_UIO_H | ||
2 | #define __LINUX_UIO_H | ||
3 | |||
4 | #include <linux/compiler.h> | ||
5 | #include <linux/types.h> | ||
6 | |||
7 | /* | ||
8 | * Berkeley style UIO structures - Alan Cox 1994. | ||
9 | * | ||
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. | ||
14 | */ | ||
15 | |||
16 | |||
17 | /* A word of warning: Our uio structure will clash with the C library one (which is now obsolete). Remove the C | ||
18 | library one from sys/uio.h if you have a very old library set */ | ||
19 | |||
20 | struct iovec | ||
21 | { | ||
22 | void __user *iov_base; /* BSD uses caddr_t (1003.1g requires void *) */ | ||
23 | __kernel_size_t iov_len; /* Must be size_t (1003.1g) */ | ||
24 | }; | ||
25 | |||
26 | #ifdef __KERNEL__ | ||
27 | |||
28 | struct kvec { | ||
29 | void *iov_base; /* and that should *never* hold a userland pointer */ | ||
30 | size_t iov_len; | ||
31 | }; | ||
32 | |||
33 | #endif | ||
34 | |||
35 | /* | ||
36 | * UIO_MAXIOV shall be at least 16 1003.1g (5.4.1.1) | ||
37 | */ | ||
38 | |||
39 | #define UIO_FASTIOV 8 | ||
40 | #define UIO_MAXIOV 1024 | ||
41 | #if 0 | ||
42 | #define UIO_MAXIOV 16 /* Maximum iovec's in one operation | ||
43 | 16 matches BSD */ | ||
44 | /* Beg pardon: BSD has 1024 --ANK */ | ||
45 | #endif | ||
46 | |||
47 | /* | ||
48 | * Total number of bytes covered by an iovec. | ||
49 | * | ||
50 | * NOTE that it is not safe to use this function until all the iovec's | ||
51 | * segment lengths have been validated. Because the individual lengths can | ||
52 | * overflow a size_t when added together. | ||
53 | */ | ||
54 | static inline size_t iov_length(const struct iovec *iov, unsigned long nr_segs) | ||
55 | { | ||
56 | unsigned long seg; | ||
57 | size_t ret = 0; | ||
58 | |||
59 | for (seg = 0; seg < nr_segs; seg++) | ||
60 | ret += iov[seg].iov_len; | ||
61 | return ret; | ||
62 | } | ||
63 | |||
64 | unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to); | ||
65 | |||
66 | #endif | ||