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. --- 40 unchanged lines hidden (view full) --- 49 */ 50struct buf { 51 LIST_ENTRY(buf) b_hash; /* Hash chain. */ 52 LIST_ENTRY(buf) b_vnbufs; /* Buffer's associated vnode. */ 53 TAILQ_ENTRY(buf) b_freelist; /* Free list position if not active. */ 54 struct buf *b_actf, **b_actb; /* Device driver queue when active. */ 55 struct proc *b_proc; /* Associated proc; NULL if kernel. */ 56 volatile long b_flags; /* B_* flags. */ |
57 int b_qindex; /* buffer queue index */ |
58 int b_error; /* Errno value. */ 59 long b_bufsize; /* Allocated buffer size. */ 60 long b_bcount; /* Valid bytes in buffer. */ 61 long b_resid; /* Remaining I/O. */ 62 dev_t b_dev; /* Device associated with buffer. */ 63 struct { 64 caddr_t b_addr; /* Memory, superblocks, indirect etc. */ 65 } b_un; --- 5 unchanged lines hidden (view full) --- 71 struct vnode *b_vp; /* Device vnode. */ 72 int b_pfcent; /* Center page when swapping cluster. */ 73 int b_dirtyoff; /* Offset in buffer of dirty region. */ 74 int b_dirtyend; /* Offset of end of dirty region. */ 75 struct ucred *b_rcred; /* Read credentials reference. */ 76 struct ucred *b_wcred; /* Write credentials reference. */ 77 int b_validoff; /* Offset in buffer of valid region. */ 78 int b_validend; /* Offset of end of valid region. */ |
79 daddr_t b_pblkno; /* physical block number */ 80 caddr_t b_savekva; /* saved kva for transfer while bouncing */ 81 TAILQ_HEAD(b_clusterhd,buf) b_cluster; /* low level clustering */ 82 void *b_driver1; /* for private use by the driver */ 83 void *b_driver2; /* for private use by the driver */ 84 void *b_spc; 85 |
86}; 87 88/* Device driver compatibility definitions. */ 89#define b_active b_bcount /* Driver queue head: drive active. */ 90#define b_data b_un.b_addr /* b_un.b_addr is not changeable. */ 91#define b_errcnt b_resid /* Retry count while I/O in progress. */ 92#define iodone biodone /* Old name for biodone. */ 93#define iowait biowait /* Old name for biowait. */ --- 23 unchanged lines hidden (view full) --- 117#define B_RAW 0x00080000 /* Set by physio for raw transfers. */ 118#define B_READ 0x00100000 /* Read buffer. */ 119#define B_TAPE 0x00200000 /* Magnetic tape I/O. */ 120#define B_UAREA 0x00400000 /* Buffer describes Uarea I/O. */ 121#define B_WANTED 0x00800000 /* Process wants this buffer. */ 122#define B_WRITE 0x00000000 /* Write buffer (pseudo flag). */ 123#define B_WRITEINPROG 0x01000000 /* Write in progress. */ 124#define B_XXX 0x02000000 /* Debugging flag. */ |
125#define B_CLUSTER 0x40000000 /* pagein op, so swap() can count it */ 126#define B_BOUNCE 0x80000000 /* bounce buffer flag */ |
127 128/* 129 * This structure describes a clustered I/O. It is stored in the b_saveaddr 130 * field of the buffer on which I/O is done. At I/O completion, cluster 131 * callback uses the structure to parcel I/O's to individual buffers, and 132 * then free's this structure. 133 */ 134struct cluster_save { --- 18 unchanged lines hidden (view full) --- 153 154#ifdef KERNEL 155int nbuf; /* The number of buffer headers */ 156struct buf *buf; /* The buffer headers. */ 157char *buffers; /* The buffer contents. */ 158int bufpages; /* Number of memory pages in the buffer pool. */ 159struct buf *swbuf; /* Swap I/O buffer headers. */ 160int nswbuf; /* Number of swap I/O buffer headers. */ |
161TAILQ_HEAD(swqueue, buf) bswlist; |
162struct buf *bclnlist; /* Head of cleaned page list. */ 163 164__BEGIN_DECLS |
165void allocbuf __P((struct buf *, int)); 166void bawrite __P((struct buf *)); 167void bdwrite __P((struct buf *)); |
168void biodone __P((struct buf *)); 169int biowait __P((struct buf *)); 170int bread __P((struct vnode *, daddr_t, int, 171 struct ucred *, struct buf **)); 172int breadn __P((struct vnode *, daddr_t, int, daddr_t *, int *, int, 173 struct ucred *, struct buf **)); |
174void brelse __P((struct buf *)); |
175void bufinit __P((void)); 176int bwrite __P((struct buf *)); 177void cluster_callback __P((struct buf *)); 178int cluster_read __P((struct vnode *, u_quad_t, daddr_t, long, 179 struct ucred *, struct buf **)); 180void cluster_write __P((struct buf *, u_quad_t)); 181struct buf *getblk __P((struct vnode *, daddr_t, int, int, int)); 182struct buf *geteblk __P((int)); 183struct buf *getnewbuf __P((int slpflag, int slptimeo)); 184struct buf *incore __P((struct vnode *, daddr_t)); 185u_int minphys __P((struct buf *bp)); 186__END_DECLS 187#endif 188#endif /* !_SYS_BUF_H_ */ |