Sys/Sys/Bio.H 1 1 /* 65 Void *Bio Caller2; /* Private Use by the Caller
Total Page:16
File Type:pdf, Size:1020Kb
04/21/04 16:54:59 sys/sys/bio.h 1 1 /* 65 void *bio_caller2; /* Private use by the caller. */ 2 * Copyright (c) 1982, 1986, 1989, 1993 66 TAILQ_ENTRY(bio) bio_queue; /* Disksort queue. */ 3 * The Regents of the University of California. All rights reserved. 67 const char *bio_attribute; /* Attribute for BIO_[GS]ETATTR */ 4 * (c) UNIX System Laboratories, Inc. 68 struct g_consumer *bio_from; /* GEOM linkage */ 5 * All or some portions of this file are derived from material licensed 69 struct g_provider *bio_to; /* GEOM linkage */ 6 * to the University of California by American Telephone and Telegraph 70 off_t bio_length; /* Like bio_bcount */ 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 71 off_t bio_completed; /* Inverse of bio_resid */ 8 * the permission of UNIX System Laboratories, Inc. 72 u_int bio_children; /* Number of spawned bios */ 9 * 73 u_int bio_inbed; /* Children safely home by now */ 10 * Redistribution and use in source and binary forms, with or without 74 struct bio *bio_parent; /* Pointer to parent */ 11 * modification, are permitted provided that the following conditions 75 struct bintime bio_t0; /* Time request started */ 12 * are met: 76 13 * 1. Redistributions of source code must retain the above copyright 77 bio_task_t *bio_task; /* Task_queue handler */ 14 * notice, this list of conditions and the following disclaimer. 78 void *bio_task_arg; /* Argument to above */ 15 * 2. Redistributions in binary form must reproduce the above copyright 79 16 * notice, this list of conditions and the following disclaimer in the 80 /* XXX: these go away when bio chaining is introduced */ 17 * documentation and/or other materials provided with the distribution. 81 daddr_t bio_pblkno; /* physical block number */ 18 * 3. Neither the name of the University nor the names of its contributors 82 }; 19 * may be used to endorse or promote products derived from this software 83 20 * without specific prior written permission. 84 /* bio_cmd */ 21 * 85 #define BIO_READ 0x00000001 22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ‘‘AS IS’’ AND 86 #define BIO_WRITE 0x00000002 23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 87 #define BIO_DELETE 0x00000004 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 88 #define BIO_GETATTR 0x00000008 25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 89 #define BIO_CMD1 0x40000000 /* Available for local hacks */ 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 90 #define BIO_CMD2 0x80000000 /* Available for local hacks */ 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 91 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 92 /* bio_flags */ 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 93 #define BIO_ERROR 0x00000001 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 94 #define BIO_DONE 0x00000004 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 95 #define BIO_FLAG2 0x40000000 /* Available for local hacks */ 32 * SUCH DAMAGE. 96 #define BIO_FLAG1 0x80000000 /* Available for local hacks */ 33 * 97 34 * @(#)buf.h 8.9 (Berkeley) 3/30/95 98 #ifdef _KERNEL 35 * $FreeBSD: src/sys/sys/bio.h,v 1.135.2.1 2004/02/11 08:31:23 scottl Exp $ 99 36 */ 100 struct uio; 37 101 struct devstat; 38 #ifndef _SYS_BIO_H_ 102 39 #define _SYS_BIO_H_ 103 struct bio_queue_head { 40 104 TAILQ_HEAD(bio_queue, bio) queue; 41 #include <sys/queue.h> 105 off_t last_offset; 42 106 struct bio *insert_point; 43 struct disk; 107 struct bio *switch_point; 44 struct bio; 108 }; 45 109 46 typedef void bio_task_t(void *); 110 void biodone(struct bio *bp); 47 111 void biofinish(struct bio *bp, struct devstat *stat, int error); 48 /* 112 int biowait(struct bio *bp, const char *wchan); 49 * The bio structure describes an I/O operation in the kernel. 113 50 */ 114 void bioq_disksort(struct bio_queue_head *ap, struct bio *bp); 51 struct bio { 115 struct bio *bioq_first(struct bio_queue_head *head); 52 u_int bio_cmd; /* I/O operation. */ 116 void bioq_flush(struct bio_queue_head *head, struct devstat *stp, int error); 53 dev_t bio_dev; /* Device to do I/O on. */ 117 void bioq_init(struct bio_queue_head *head); 54 struct disk *bio_disk; /* Valid below geom_disk.c only */ 118 void bioq_insert_tail(struct bio_queue_head *head, struct bio *bp); 55 off_t bio_offset; /* Offset into file. */ 119 void bioq_remove(struct bio_queue_head *head, struct bio *bp); 56 long bio_bcount; /* Valid bytes in buffer. */ 120 57 caddr_t bio_data; /* Memory, superblocks, indirect etc. 121 void bio_taskqueue(struct bio *bp, bio_task_t *fund, void *arg); */ 122 58 u_int bio_flags; /* BIO_ flags. */ 123 int physio(dev_t dev, struct uio *uio, int ioflag); 59 int bio_error; /* Errno for BIO_ERROR. */ 124 #define physread physio 60 long bio_resid; /* Remaining I/0 in bytes. */ 125 #define physwrite physio 61 void (*bio_done)(struct bio *); 126 62 void *bio_driver1; /* Private use by the callee. */ 127 #endif /* _KERNEL */ 63 void *bio_driver2; /* Private use by the callee. */ 128 64 void *bio_caller1; /* Private use by the caller. */ 129 #endif /* !_SYS_BIO_H_ */ 11/15/03 01:28:09 sys/sys/buf.h 1 1 /* 66 void (*io_complete)(struct buf *); 2 * Copyright (c) 1982, 1986, 1989, 1993 67 void (*io_deallocate)(struct buf *); 3 * The Regents of the University of California. All rights reserved. 68 void (*io_movedeps)(struct buf *, struct buf *); 4 * (c) UNIX System Laboratories, Inc. 69 int (*io_countdeps)(struct buf *, int); 5 * All or some portions of this file are derived from material licensed 70 } bioops; 6 * to the University of California by American Telephone and Telegraph 71 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 72 struct buf_ops { 8 * the permission of UNIX System Laboratories, Inc. 73 char *bop_name; 9 * 74 int (*bop_write)(struct buf *); 10 * Redistribution and use in source and binary forms, with or without 75 }; 11 * modification, are permitted provided that the following conditions 76 12 * are met: 77 extern struct buf_ops buf_ops_bio; 13 * 1. Redistributions of source code must retain the above copyright 78 14 * notice, this list of conditions and the following disclaimer. 79 struct vm_object; 15 * 2. Redistributions in binary form must reproduce the above copyright 80 16 * notice, this list of conditions and the following disclaimer in the 81 typedef unsigned char b_xflags_t; 17 * documentation and/or other materials provided with the distribution. 82 18 * 3. All advertising materials mentioning features or use of this software 83 /* 19 * must display the following acknowledgement: 84 * The buffer header describes an I/O operation in the kernel. 20 * This product includes software developed by the University of 85 * 21 * California, Berkeley and its contributors. 86 * NOTES: 22 * 4. Neither the name of the University nor the names of its contributors 87 * b_bufsize, b_bcount. b_bufsize is the allocation size of the 23 * may be used to endorse or promote products derived from this software 88 * buffer, either DEV_BSIZE or PAGE_SIZE aligned. b_bcount is the 24 * without specific prior written permission. 89 * originally requested buffer size and can serve as a bounds check 25 * 90 * against EOF. For most, but not all uses, b_bcount == b_bufsize. 26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ‘‘AS IS’’ AND 91 * 27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 92 * b_dirtyoff, b_dirtyend. Buffers support piecemeal, unaligned 28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 93 * ranges of dirty data that need to be written to backing store. 29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 94 * The range is typically clipped at b_bcount ( not b_bufsize ). 30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 95 * 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 96 * b_resid. Number of bytes remaining in I/O. After an I/O operation 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 97 * completes, b_resid is usually 0 indicating 100% success. 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 98 * 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 99 * All fields are protected by the buffer lock except those marked: 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 100 * V - Protected by owning vnode lock 36 * SUCH DAMAGE. 101 * Q - Protected by the buf queue lock 37 * 102 * D - Protected by an dependency implementation specific lock 38 * @(#)buf.h 8.9 (Berkeley) 3/30/95 103 */ 39 * $FreeBSD: src/sys/sys/buf.h,v 1.162 2003/11/15 09:28:09 phk Exp $ 104 struct buf { 40 */ 105 struct bio b_io; /* "Builtin" I/O request. */ 41 106 #define b_bcount b_io.bio_bcount 42 #ifndef _SYS_BUF_H_ 107 #define b_caller1 b_io.bio_caller1 43 #define _SYS_BUF_H_ 108 #define b_data b_io.bio_data 44 109 #define b_dev b_io.bio_dev 45 #include <sys/queue.h> 110 #define b_error b_io.bio_error 46 #include <sys/lock.h> 111 #define b_iocmd b_io.bio_cmd 47 #include <sys/lockmgr.h> 112 #define b_ioflags b_io.bio_flags 48 113 #define b_iooffset b_io.bio_offset 49 struct bio; 114 #define b_resid b_io.bio_resid 50 struct buf; 115 struct buf_ops *b_op; 51 struct mount; 116 unsigned b_magic; 52 struct vnode; 117 #define