|
Last change
on this file was
2,
checked in by jglee, 11 years ago
|
|
first commit
|
-
Property svn:executable set to
*
|
|
File size:
1.5 KB
|
| Line | |
|---|
| 1 | #ifndef __LINUX_UIO_H |
|---|
| 2 | #define __LINUX_UIO_H |
|---|
| 3 | |
|---|
| 4 | #include <linux/types.h> |
|---|
| 5 | |
|---|
| 6 | /* |
|---|
| 7 | * Berkeley style UIO structures - Alan Cox 1994. |
|---|
| 8 | * |
|---|
| 9 | * This program is free software; you can redistribute it and/or |
|---|
| 10 | * modify it under the terms of the GNU General Public License |
|---|
| 11 | * as published by the Free Software Foundation; either version |
|---|
| 12 | * 2 of the License, or (at your option) any later version. |
|---|
| 13 | */ |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | /* A word of warning: Our uio structure will clash with the C library one (which is now obsolete). Remove the C |
|---|
| 17 | library one from sys/uio.h if you have a very old library set */ |
|---|
| 18 | |
|---|
| 19 | struct iovec |
|---|
| 20 | { |
|---|
| 21 | void *iov_base; /* BSD uses caddr_t (1003.1g requires void *) */ |
|---|
| 22 | __kernel_size_t iov_len; /* Must be size_t (1003.1g) */ |
|---|
| 23 | }; |
|---|
| 24 | |
|---|
| 25 | /* |
|---|
| 26 | * UIO_MAXIOV shall be at least 16 1003.1g (5.4.1.1) |
|---|
| 27 | */ |
|---|
| 28 | |
|---|
| 29 | #define UIO_FASTIOV 8 |
|---|
| 30 | #define UIO_MAXIOV 1024 |
|---|
| 31 | #if 0 |
|---|
| 32 | #define UIO_MAXIOV 16 /* Maximum iovec's in one operation |
|---|
| 33 | 16 matches BSD */ |
|---|
| 34 | /* Beg pardon: BSD has 1024 --ANK */ |
|---|
| 35 | #endif |
|---|
| 36 | |
|---|
| 37 | /* |
|---|
| 38 | * Total number of bytes covered by an iovec. |
|---|
| 39 | * |
|---|
| 40 | * NOTE that it is not safe to use this function until all the iovec's |
|---|
| 41 | * segment lengths have been validated. Because the individual lengths can |
|---|
| 42 | * overflow a size_t when added together. |
|---|
| 43 | */ |
|---|
| 44 | static inline size_t iov_length(const struct iovec *iov, unsigned long nr_segs) |
|---|
| 45 | { |
|---|
| 46 | unsigned long seg; |
|---|
| 47 | size_t ret = 0; |
|---|
| 48 | |
|---|
| 49 | for (seg = 0; seg < nr_segs; seg++) |
|---|
| 50 | ret += iov[seg].iov_len; |
|---|
| 51 | return ret; |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to); |
|---|
| 55 | |
|---|
| 56 | #endif |
|---|
Note: See
TracBrowser
for help on using the repository browser.