--- Net2/sys/buf.h 2018/04/24 18:03:58 1.1.1.1 +++ Net2/sys/buf.h 2018/04/24 18:10:42 1.1.1.2 @@ -31,6 +31,14 @@ * SUCH DAMAGE. * * @(#)buf.h 7.11 (Berkeley) 5/9/90 + * + * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE + * -------------------- ----- ---------------------- + * CURRENT PATCH LEVEL: 1 00007 + * -------------------- ----- ---------------------- + * + * 20 Aug 92 David Greenman Fixed buffer cache hash index + * calculation */ /* @@ -110,12 +118,13 @@ struct buf #ifdef KERNEL #define BUFHSZ 512 #define RND (MAXBSIZE/DEV_BSIZE) +/* 20 Aug 92 BUFHASH*/ #if ((BUFHSZ&(BUFHSZ-1)) == 0) #define BUFHASH(dvp, dblkno) \ - ((struct buf *)&bufhash[((int)(dvp)+(((int)(dblkno))/RND))&(BUFHSZ-1)]) + ((struct buf *)&bufhash[((int)(dvp)/sizeof(struct vnode)+(int)(dblkno))&(BUFHSZ-1)]) #else #define BUFHASH(dvp, dblkno) \ - ((struct buf *)&bufhash[((int)(dvp)+(((int)(dblkno))/RND)) % BUFHSZ]) + ((struct buf *)&bufhash[((int)(dvp)/sizeof(struct vnode)+(int)(dblkno)) % BUFHSZ]) #endif struct buf *buf; /* the buffer pool itself */ @@ -129,11 +138,21 @@ struct buf bfreelist[BQUEUES]; /* heads struct buf bswlist; /* head of free swap header list */ struct buf *bclnlist; /* head of cleaned page list */ -struct buf *getblk(); -struct buf *geteblk(); -struct buf *getnewbuf(); +void bufinit(); +int bread(struct vnode *, daddr_t, int, struct ucred *, struct buf **); +int breada(struct vnode *, daddr_t, int, daddr_t, int, struct ucred *, + struct buf **); +int bwrite(struct buf *); +void bawrite(struct buf *); +void bdwrite(struct buf *); +void brelse(struct buf *); +struct buf *incore(struct vnode *, daddr_t); +struct buf *getblk(struct vnode *, daddr_t, int); +struct buf *geteblk(int); +int biowait(struct buf *); +int biodone(struct buf *); +void allocbuf(struct buf *, int); -unsigned minphys(); #endif /* @@ -151,8 +170,8 @@ unsigned minphys(); #define B_ASYNC 0x000100 /* don't wait for I/O completion */ #define B_DELWRI 0x000200 /* write at exit of avail list */ #define B_TAPE 0x000400 /* this is a magtape (no bdwrite) */ -#define B_UAREA 0x000800 /* add u-area to a swap operation */ -#define B_PAGET 0x001000 /* page in/out of page table space */ +#define B_VMPAGE 0x000800 /* buffer from virtual memory */ +#define B_MALLOC 0x001000 /* buffer from malloc space */ #define B_DIRTY 0x002000 /* dirty page to be pushed out async */ #define B_PGIN 0x004000 /* pagein op, so swap() can count it */ #define B_CACHE 0x008000 /* did bread find us in the cache ? */ @@ -205,7 +224,7 @@ unsigned minphys(); * Zero out a buffer's data portion. */ #define clrbuf(bp) { \ - blkclr((bp)->b_un.b_addr, (unsigned)(bp)->b_bcount); \ + bzero((bp)->b_un.b_addr, (unsigned)(bp)->b_bcount); \ (bp)->b_resid = 0; \ } #define B_CLRBUF 0x1 /* request allocated buffer be cleared */