linux-old/include/linux/iobuf.h
<<
>>
Prefs
   1/*
   2 * iobuf.h
   3 *
   4 * Defines the structures used to track abstract kernel-space io buffers.
   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 * The kiobuf structure describes a physical set of pages reserved
  18 * locked for IO.  The reference counts on each page will have been
  19 * incremented, and the flags field will indicate whether or not we have
  20 * pre-locked all of the pages for IO.
  21 *
  22 * kiobufs may be passed in arrays to form a kiovec, but we must
  23 * preserve the property that no page is present more than once over the
  24 * entire iovec.
  25 */
  26
  27#define KIO_MAX_ATOMIC_IO       512 /* in kb */
  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/* The main kiobuf struct used for all our IO! */
  32
  33struct kiobuf 
  34{
  35        int             nr_pages;       /* Pages actually referenced */
  36        int             array_len;      /* Space in the allocated lists */
  37        int             offset;         /* Offset to start of valid data */
  38        int             length;         /* Number of valid bytes of data */
  39
  40        unsigned int    locked : 1;     /* If set, pages has been locked */
  41
  42        struct page **  maplist;
  43        struct buffer_head ** bh;
  44        unsigned long * blocks;
  45
  46        /* Dynamic state for IO completion: */
  47        atomic_t        io_count;       /* IOs still in progress */
  48        int             errno;          /* Status of completed IO */
  49        void            (*end_io) (struct kiobuf *); /* Completion callback */
  50        wait_queue_head_t wait_queue;
  51};
  52
  53
  54/* mm/memory.c */
  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/* fs/iobuf.c */
  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/* fs/buffer.c */
  74
  75int     brw_kiovec(int rw, int nr, struct kiobuf *iovec[], 
  76                   kdev_t dev, unsigned long b[], int size);
  77
  78#endif /* __LINUX_IOBUF_H */
  79
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.