buf.h (44679) | buf.h (46349) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)buf.h 8.9 (Berkeley) 3/30/95 | 1/* 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)buf.h 8.9 (Berkeley) 3/30/95 |
39 * $Id: buf.h,v 1.64 1999/03/02 04:04:28 mckusick Exp $ | 39 * $Id: buf.h,v 1.65 1999/03/12 02:24:55 julian Exp $ |
40 */ 41 42#ifndef _SYS_BUF_H_ 43#define _SYS_BUF_H_ 44 45#include <sys/queue.h> 46 47struct buf; --- 25 unchanged lines hidden (view full) --- 73 struct { 74 long ia_long; 75 void *ia_ptr; 76 } ic_args[5]; 77}; 78 79/* 80 * The buffer header describes an I/O operation in the kernel. | 40 */ 41 42#ifndef _SYS_BUF_H_ 43#define _SYS_BUF_H_ 44 45#include <sys/queue.h> 46 47struct buf; --- 25 unchanged lines hidden (view full) --- 73 struct { 74 long ia_long; 75 void *ia_ptr; 76 } ic_args[5]; 77}; 78 79/* 80 * The buffer header describes an I/O operation in the kernel. |
81 * 82 * NOTES: 83 * b_bufsize, b_bcount. b_bufsize is the allocation size of the 84 * buffer, either DEV_BSIZE or PAGE_SIZE aligned. b_bcount is the 85 * originally requested buffer size and can serve as a bounds check 86 * against EOF. For most, but not all uses, b_bcount == b_bufsize. 87 * 88 * b_dirtyoff, b_dirtyend. Buffers support piecemeal, unaligned 89 * ranges of dirty data that need to be written to backing store. 90 * The range is typically clipped at b_bcount ( not b_bufsize ). 91 * 92 * b_resid. Number of bytes remaining in I/O. After an I/O operation 93 * completes, b_resid is usually 0 indicating 100% success. |
|
81 */ 82struct buf { 83 LIST_ENTRY(buf) b_hash; /* Hash chain. */ 84 TAILQ_ENTRY(buf) b_vnbufs; /* Buffer's associated vnode. */ 85 TAILQ_ENTRY(buf) b_freelist; /* Free list position if not active. */ 86 TAILQ_ENTRY(buf) b_act; /* Device driver queue when active. *new* */ 87 struct proc *b_proc; /* Associated proc; NULL if kernel. */ 88 long b_flags; /* B_* flags. */ --- 15 unchanged lines hidden (view full) --- 104 void (*b_iodone) __P((struct buf *)); 105 /* For nested b_iodone's. */ 106 struct iodone_chain *b_iodone_chain; 107 struct vnode *b_vp; /* Device vnode. */ 108 int b_dirtyoff; /* Offset in buffer of dirty region. */ 109 int b_dirtyend; /* Offset of end of dirty region. */ 110 struct ucred *b_rcred; /* Read credentials reference. */ 111 struct ucred *b_wcred; /* Write credentials reference. */ | 94 */ 95struct buf { 96 LIST_ENTRY(buf) b_hash; /* Hash chain. */ 97 TAILQ_ENTRY(buf) b_vnbufs; /* Buffer's associated vnode. */ 98 TAILQ_ENTRY(buf) b_freelist; /* Free list position if not active. */ 99 TAILQ_ENTRY(buf) b_act; /* Device driver queue when active. *new* */ 100 struct proc *b_proc; /* Associated proc; NULL if kernel. */ 101 long b_flags; /* B_* flags. */ --- 15 unchanged lines hidden (view full) --- 117 void (*b_iodone) __P((struct buf *)); 118 /* For nested b_iodone's. */ 119 struct iodone_chain *b_iodone_chain; 120 struct vnode *b_vp; /* Device vnode. */ 121 int b_dirtyoff; /* Offset in buffer of dirty region. */ 122 int b_dirtyend; /* Offset of end of dirty region. */ 123 struct ucred *b_rcred; /* Read credentials reference. */ 124 struct ucred *b_wcred; /* Write credentials reference. */ |
125#if 0 |
|
112 int b_validoff; /* Offset in buffer of valid region. */ 113 int b_validend; /* Offset of end of valid region. */ | 126 int b_validoff; /* Offset in buffer of valid region. */ 127 int b_validend; /* Offset of end of valid region. */ |
128#endif |
|
114 daddr_t b_pblkno; /* physical block number */ 115 void *b_saveaddr; /* Original b_addr for physio. */ 116 caddr_t b_savekva; /* saved kva for transfer while bouncing */ 117 void *b_driver1; /* for private use by the driver */ 118 void *b_driver2; /* for private use by the driver */ 119 union pager_info { 120 void *pg_spc; 121 int pg_reqpage; --- 24 unchanged lines hidden (view full) --- 146 * optimize the I/O. 147 * 148 * B_PAGING Indicates that bp is being used by the paging system or 149 * some paging system and that the bp is not linked into 150 * the b_vp's clean/dirty linked lists or ref counts. 151 * Buffer vp reassignments are illegal in this case. 152 * 153 * B_CACHE This may only be set if the buffer is entirely valid. | 129 daddr_t b_pblkno; /* physical block number */ 130 void *b_saveaddr; /* Original b_addr for physio. */ 131 caddr_t b_savekva; /* saved kva for transfer while bouncing */ 132 void *b_driver1; /* for private use by the driver */ 133 void *b_driver2; /* for private use by the driver */ 134 union pager_info { 135 void *pg_spc; 136 int pg_reqpage; --- 24 unchanged lines hidden (view full) --- 161 * optimize the I/O. 162 * 163 * B_PAGING Indicates that bp is being used by the paging system or 164 * some paging system and that the bp is not linked into 165 * the b_vp's clean/dirty linked lists or ref counts. 166 * Buffer vp reassignments are illegal in this case. 167 * 168 * B_CACHE This may only be set if the buffer is entirely valid. |
154 * The situation where B_DELWRI is set and B_CACHE gets 155 * cleared MUST be committed to disk so B_DELWRI can 156 * also be cleared. | 169 * The situation where B_DELWRI is set and B_CACHE is 170 * clear MUST be committed to disk by getblk() so 171 * B_DELWRI can also be cleared. See the comments for 172 * getblk() in kern/vfs_bio.c. If B_CACHE is clear, 173 * the caller is expected to clear B_ERROR|B_INVAL, 174 * set B_READ, and initiate an I/O. 175 * 176 * The 'entire buffer' is defined to be the range from 177 * 0 through b_bcount. 178 * 179 * B_MALLOC Request that the buffer be allocated from the malloc 180 * pool, DEV_BSIZE aligned instead of PAGE_SIZE aligned. 181 * 182 * B_VMIO Indicates that the buffer is tied into an VM object. 183 * The buffer's data is always PAGE_SIZE aligned even 184 * if b_bufsize and b_bcount are not. ( b_bufsize is 185 * always at least DEV_BSIZE aligned, though ). 186 * |
157 */ 158 159#define B_AGE 0x00000001 /* Move to age queue when I/O done. */ 160#define B_NEEDCOMMIT 0x00000002 /* Append-write in progress. */ 161#define B_ASYNC 0x00000004 /* Start I/O, do not wait. */ 162#define B_BAD 0x00000008 /* Bad block revectoring in progress. */ 163#define B_BUSY 0x00000010 /* I/O in progress. */ 164#define B_CACHE 0x00000020 /* Bread found us in the cache. */ --- 186 unchanged lines hidden (view full) --- 351void cluster_callback __P((struct buf *)); 352int cluster_read __P((struct vnode *, u_quad_t, daddr_t, long, 353 struct ucred *, long, int, struct buf **)); 354int cluster_wbuild __P((struct vnode *, long, daddr_t, int)); 355void cluster_write __P((struct buf *, u_quad_t)); 356int physio __P((void (*)(struct buf *), struct buf *, dev_t, 357 int, u_int (*)(struct buf *), struct uio *)); 358u_int minphys __P((struct buf *)); | 187 */ 188 189#define B_AGE 0x00000001 /* Move to age queue when I/O done. */ 190#define B_NEEDCOMMIT 0x00000002 /* Append-write in progress. */ 191#define B_ASYNC 0x00000004 /* Start I/O, do not wait. */ 192#define B_BAD 0x00000008 /* Bad block revectoring in progress. */ 193#define B_BUSY 0x00000010 /* I/O in progress. */ 194#define B_CACHE 0x00000020 /* Bread found us in the cache. */ --- 186 unchanged lines hidden (view full) --- 381void cluster_callback __P((struct buf *)); 382int cluster_read __P((struct vnode *, u_quad_t, daddr_t, long, 383 struct ucred *, long, int, struct buf **)); 384int cluster_wbuild __P((struct vnode *, long, daddr_t, int)); 385void cluster_write __P((struct buf *, u_quad_t)); 386int physio __P((void (*)(struct buf *), struct buf *, dev_t, 387 int, u_int (*)(struct buf *), struct uio *)); 388u_int minphys __P((struct buf *)); |
389void vfs_bio_set_validclean __P((struct buf *, int base, int size)); |
|
359void vfs_bio_clrbuf __P((struct buf *)); 360void vfs_busy_pages __P((struct buf *, int clear_modify)); 361void vfs_unbusy_pages __P((struct buf *)); 362void vwakeup __P((struct buf *)); 363void vmapbuf __P((struct buf *)); 364void vunmapbuf __P((struct buf *)); 365void relpbuf __P((struct buf *, int *)); 366void brelvp __P((struct buf *)); 367void bgetvp __P((struct vnode *, struct buf *)); 368void pbgetvp __P((struct vnode *, struct buf *)); 369void pbrelvp __P((struct buf *)); 370int allocbuf __P((struct buf *bp, int size)); 371void reassignbuf __P((struct buf *, struct vnode *)); 372void pbreassignbuf __P((struct buf *, struct vnode *)); 373struct buf *trypbuf __P((int *)); | 390void vfs_bio_clrbuf __P((struct buf *)); 391void vfs_busy_pages __P((struct buf *, int clear_modify)); 392void vfs_unbusy_pages __P((struct buf *)); 393void vwakeup __P((struct buf *)); 394void vmapbuf __P((struct buf *)); 395void vunmapbuf __P((struct buf *)); 396void relpbuf __P((struct buf *, int *)); 397void brelvp __P((struct buf *)); 398void bgetvp __P((struct vnode *, struct buf *)); 399void pbgetvp __P((struct vnode *, struct buf *)); 400void pbrelvp __P((struct buf *)); 401int allocbuf __P((struct buf *bp, int size)); 402void reassignbuf __P((struct buf *, struct vnode *)); 403void pbreassignbuf __P((struct buf *, struct vnode *)); 404struct buf *trypbuf __P((int *)); |
405 |
|
374#endif /* KERNEL */ 375 376#endif /* !_SYS_BUF_H_ */ | 406#endif /* KERNEL */ 407 408#endif /* !_SYS_BUF_H_ */ |