Home | History | Annotate | Download | only in linux
      1 /****************************************************************************
      2  ****************************************************************************
      3  ***
      4  ***   This header was automatically generated from a Linux kernel header
      5  ***   of the same name, to make information necessary for userspace to
      6  ***   call into the kernel available to libc.  It contains only constants,
      7  ***   structures, and macros generated from the original header, and thus,
      8  ***   contains no copyrightable information.
      9  ***
     10  ***   To edit the content of this header, modify the corresponding
     11  ***   source file (e.g. under external/kernel-headers/original/) then
     12  ***   run bionic/libc/kernel/tools/update_all.py
     13  ***
     14  ***   Any manual change here will be lost the next time this script will
     15  ***   be run. You've been warned!
     16  ***
     17  ****************************************************************************
     18  ****************************************************************************/
     19 #ifndef __LINUX_BIO_H
     20 #define __LINUX_BIO_H
     21 #include <linux/highmem.h>
     22 #include <linux/mempool.h>
     23 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     24 #include <linux/ioprio.h>
     25 #include <asm/io.h>
     26 #if defined(BIO_VMERGE_MAX_SIZE) && defined(BIO_VMERGE_BOUNDARY)
     27 #define BIOVEC_VIRT_START_SIZE(x) (bvec_to_phys(x) & (BIO_VMERGE_BOUNDARY - 1))
     28 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     29 #define BIOVEC_VIRT_OVERSIZE(x) ((x) > BIO_VMERGE_MAX_SIZE)
     30 #else
     31 #define BIOVEC_VIRT_START_SIZE(x) 0
     32 #define BIOVEC_VIRT_OVERSIZE(x) 0
     33 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     34 #endif
     35 #ifndef BIO_VMERGE_BOUNDARY
     36 #define BIO_VMERGE_BOUNDARY 0
     37 #endif
     38 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     39 #define BIO_DEBUG
     40 #ifdef BIO_DEBUG
     41 #define BIO_BUG_ON BUG_ON
     42 #else
     43 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     44 #define BIO_BUG_ON
     45 #endif
     46 #define BIO_MAX_PAGES 256
     47 #define BIO_MAX_SIZE (BIO_MAX_PAGES << PAGE_CACHE_SHIFT)
     48 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     49 #define BIO_MAX_SECTORS (BIO_MAX_SIZE >> 9)
     50 struct bio_vec {
     51  struct page *bv_page;
     52  unsigned int bv_len;
     53 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     54  unsigned int bv_offset;
     55 };
     56 struct bio_set;
     57 struct bio;
     58 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     59 typedef int (bio_end_io_t) (struct bio *, unsigned int, int);
     60 typedef void (bio_destructor_t) (struct bio *);
     61 struct bio {
     62  sector_t bi_sector;
     63 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     64  struct bio *bi_next;
     65  struct block_device *bi_bdev;
     66  unsigned long bi_flags;
     67  unsigned long bi_rw;
     68 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     69  unsigned short bi_vcnt;
     70  unsigned short bi_idx;
     71  unsigned short bi_phys_segments;
     72  unsigned short bi_hw_segments;
     73 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     74  unsigned int bi_size;
     75  unsigned int bi_hw_front_size;
     76  unsigned int bi_hw_back_size;
     77  unsigned int bi_max_vecs;
     78 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     79  struct bio_vec *bi_io_vec;
     80  bio_end_io_t *bi_end_io;
     81  atomic_t bi_cnt;
     82  void *bi_private;
     83 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     84  bio_destructor_t *bi_destructor;
     85 };
     86 #define BIO_UPTODATE 0
     87 #define BIO_RW_BLOCK 1
     88 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     89 #define BIO_EOF 2
     90 #define BIO_SEG_VALID 3
     91 #define BIO_CLONED 4
     92 #define BIO_BOUNCED 5
     93 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     94 #define BIO_USER_MAPPED 6
     95 #define BIO_EOPNOTSUPP 7
     96 #define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
     97 #define BIO_POOL_BITS (4)
     98 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
     99 #define BIO_POOL_OFFSET (BITS_PER_LONG - BIO_POOL_BITS)
    100 #define BIO_POOL_MASK (1UL << BIO_POOL_OFFSET)
    101 #define BIO_POOL_IDX(bio) ((bio)->bi_flags >> BIO_POOL_OFFSET)
    102 #define BIO_RW 0
    103 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
    104 #define BIO_RW_AHEAD 1
    105 #define BIO_RW_BARRIER 2
    106 #define BIO_RW_FAILFAST 3
    107 #define BIO_RW_SYNC 4
    108 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
    109 #define BIO_PRIO_SHIFT (8 * sizeof(unsigned long) - IOPRIO_BITS)
    110 #define bio_prio(bio) ((bio)->bi_rw >> BIO_PRIO_SHIFT)
    111 #define bio_prio_valid(bio) ioprio_valid(bio_prio(bio))
    112 #define bio_set_prio(bio, prio) do {   WARN_ON(prio >= (1 << IOPRIO_BITS));   (bio)->bi_rw &= ((1UL << BIO_PRIO_SHIFT) - 1);   (bio)->bi_rw |= ((unsigned long) (prio) << BIO_PRIO_SHIFT);  } while (0)
    113 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
    114 #define bio_iovec_idx(bio, idx) (&((bio)->bi_io_vec[(idx)]))
    115 #define bio_iovec(bio) bio_iovec_idx((bio), (bio)->bi_idx)
    116 #define bio_page(bio) bio_iovec((bio))->bv_page
    117 #define bio_offset(bio) bio_iovec((bio))->bv_offset
    118 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
    119 #define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx)
    120 #define bio_sectors(bio) ((bio)->bi_size >> 9)
    121 #define bio_cur_sectors(bio) (bio_iovec(bio)->bv_len >> 9)
    122 #define bio_data(bio) (page_address(bio_page((bio))) + bio_offset((bio)))
    123 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
    124 #define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER))
    125 #define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC))
    126 #define bio_failfast(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST))
    127 #define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD))
    128 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
    129 #define bio_to_phys(bio) (page_to_phys(bio_page((bio))) + (unsigned long) bio_offset((bio)))
    130 #define bvec_to_phys(bv) (page_to_phys((bv)->bv_page) + (unsigned long) (bv)->bv_offset)
    131 #define __bio_kmap_atomic(bio, idx, kmtype)   (kmap_atomic(bio_iovec_idx((bio), (idx))->bv_page, kmtype) +   bio_iovec_idx((bio), (idx))->bv_offset)
    132 #define __bio_kunmap_atomic(addr, kmtype) kunmap_atomic(addr, kmtype)
    133 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
    134 #define __BVEC_END(bio) bio_iovec_idx((bio), (bio)->bi_vcnt - 1)
    135 #define __BVEC_START(bio) bio_iovec_idx((bio), (bio)->bi_idx)
    136 #ifndef BIOVEC_PHYS_MERGEABLE
    137 #define BIOVEC_PHYS_MERGEABLE(vec1, vec2)   ((bvec_to_phys((vec1)) + (vec1)->bv_len) == bvec_to_phys((vec2)))
    138 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
    139 #endif
    140 #define BIOVEC_VIRT_MERGEABLE(vec1, vec2)   ((((bvec_to_phys((vec1)) + (vec1)->bv_len) | bvec_to_phys((vec2))) & (BIO_VMERGE_BOUNDARY - 1)) == 0)
    141 #define __BIO_SEG_BOUNDARY(addr1, addr2, mask)   (((addr1) | (mask)) == (((addr2) - 1) | (mask)))
    142 #define BIOVEC_SEG_BOUNDARY(q, b1, b2)   __BIO_SEG_BOUNDARY(bvec_to_phys((b1)), bvec_to_phys((b2)) + (b2)->bv_len, (q)->seg_boundary_mask)
    143 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
    144 #define BIO_SEG_BOUNDARY(q, b1, b2)   BIOVEC_SEG_BOUNDARY((q), __BVEC_END((b1)), __BVEC_START((b2)))
    145 #define bio_io_error(bio, bytes) bio_endio((bio), (bytes), -EIO)
    146 #define __bio_for_each_segment(bvl, bio, i, start_idx)   for (bvl = bio_iovec_idx((bio), (start_idx)), i = (start_idx);   i < (bio)->bi_vcnt;   bvl++, i++)
    147 #define bio_for_each_segment(bvl, bio, i)   __bio_for_each_segment(bvl, bio, i, (bio)->bi_idx)
    148 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
    149 #define bio_get(bio) atomic_inc(&(bio)->bi_cnt)
    150 struct bio_pair {
    151  struct bio bio1, bio2;
    152  struct bio_vec bv1, bv2;
    153 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
    154  atomic_t cnt;
    155  int error;
    156 };
    157 struct request_queue;
    158 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
    159 struct sg_iovec;
    160 #define bvec_kmap_irq(bvec, flags) (page_address((bvec)->bv_page) + (bvec)->bv_offset)
    161 #define bvec_kunmap_irq(buf, flags) do { *(flags) = 0; } while (0)
    162 #define __bio_kunmap_irq(buf, flags) bvec_kunmap_irq(buf, flags)
    163 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
    164 #define bio_kmap_irq(bio, flags)   __bio_kmap_irq((bio), (bio)->bi_idx, (flags))
    165 #define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags)
    166 #endif
    167