home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / linux / uio.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-11-13  |  1.1 KB  |  50 lines

  1. #ifndef __LINUX_UIO_H
  2. #define __LINUX_UIO_H
  3.  
  4.  
  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. struct iovec
  17. {
  18.     void *iov_base;    /* BSD uses caddr_t (1003.1g requires void *) */
  19.     __kernel_size_t iov_len; /* Must be size_t (1003.1g) */
  20. };
  21.  
  22.  
  23. /*
  24.  *    UIO_MAXIOV shall be at least 16 1003.1g (5.4.1.1)
  25.  */
  26.  
  27. #define UIO_FASTIOV    8
  28. #define UIO_MAXIOV    1024
  29.  
  30. /*
  31.  * Total number of bytes covered by an iovec.
  32.  *
  33.  * NOTE that it is not safe to use this function until all the iovec's
  34.  * segment lengths have been validated.  Because the individual lengths can
  35.  * overflow a size_t when added together.
  36.  */
  37. static inline size_t iov_length(const struct iovec *iov, unsigned long nr_segs)
  38. {
  39.     unsigned long seg;
  40.     size_t ret = 0;
  41.  
  42.     for (seg = 0; seg < nr_segs; seg++)
  43.         ret += iov[seg].iov_len;
  44.     return ret;
  45. }
  46.  
  47. unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to);
  48.  
  49. #endif
  50.