g_bio.9 (131594) | g_bio.9 (131689) |
---|---|
1.\" 2.\" Copyright (c) 2004 Pawel Jakub Dawidek <pjd@FreeBSD.org> 3.\" All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright --- 8 unchanged lines hidden (view full) --- 17.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, 18.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24.\" | 1.\" 2.\" Copyright (c) 2004 Pawel Jakub Dawidek <pjd@FreeBSD.org> 3.\" All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright --- 8 unchanged lines hidden (view full) --- 17.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, 18.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24.\" |
25.\" $FreeBSD: head/share/man/man9/g_bio.9 131594 2004-07-04 20:55:50Z ru $ | 25.\" $FreeBSD: head/share/man/man9/g_bio.9 131689 2004-07-06 08:21:12Z ru $ |
26.\" 27.Dd January 16, 2004 | 26.\" 27.Dd January 16, 2004 |
28.Dt g_bio 9 | 28.Dt G_BIO 9 |
29.Os 30.Sh NAME 31.Nm g_new_bio , 32.Nm g_clone_bio , 33.Nm g_destroy_bio , 34.Nm g_print_bio 35.Nd "GEOM bio controlling functions" 36.Sh SYNOPSIS --- 4 unchanged lines hidden (view full) --- 41.Ft "struct bio *" 42.Fn g_clone_bio "struct bio *bp" 43.Ft void 44.Fn g_destroy_bio "struct bio *bp" 45.Ft void 46.Fn g_print_bio "struct bio *bp" 47.Sh DESCRIPTION 48A | 29.Os 30.Sh NAME 31.Nm g_new_bio , 32.Nm g_clone_bio , 33.Nm g_destroy_bio , 34.Nm g_print_bio 35.Nd "GEOM bio controlling functions" 36.Sh SYNOPSIS --- 4 unchanged lines hidden (view full) --- 41.Ft "struct bio *" 42.Fn g_clone_bio "struct bio *bp" 43.Ft void 44.Fn g_destroy_bio "struct bio *bp" 45.Ft void 46.Fn g_print_bio "struct bio *bp" 47.Sh DESCRIPTION 48A |
49.Fa struct bio | 49.Vt "struct bio" |
50is used by GEOM to describe I/O requests, its 51most important fields are described below: 52.Bl -tag -width ".Va bio_attribute" 53.It Va bio_cmd 54I/O request command. 55There are four I/O requests available in GEOM: | 50is used by GEOM to describe I/O requests, its 51most important fields are described below: 52.Bl -tag -width ".Va bio_attribute" 53.It Va bio_cmd 54I/O request command. 55There are four I/O requests available in GEOM: |
56.Bl -tag -width BIO_GETATTR | 56.Bl -tag -width ".Dv BIO_GETATTR" |
57.It Dv BIO_READ 58A read request. 59.It Dv BIO_WRITE 60A write request. 61.It Dv BIO_DELETE 62Indicates that a certain range of data is no longer used and that 63it can be erased or freed as the underlying technology supports. 64Technologies like flash adaptation layers can arrange to erase the relevant --- 8 unchanged lines hidden (view full) --- 73field. 74.El 75.It Va bio_offset 76Offset into provider. 77.It Va bio_data 78Pointer to data buffer. 79.It Va bio_flags 80Available flags: | 57.It Dv BIO_READ 58A read request. 59.It Dv BIO_WRITE 60A write request. 61.It Dv BIO_DELETE 62Indicates that a certain range of data is no longer used and that 63it can be erased or freed as the underlying technology supports. 64Technologies like flash adaptation layers can arrange to erase the relevant --- 8 unchanged lines hidden (view full) --- 73field. 74.El 75.It Va bio_offset 76Offset into provider. 77.It Va bio_data 78Pointer to data buffer. 79.It Va bio_flags 80Available flags: |
81.Bl -tag -width BIO_GETATTR | 81.Bl -tag -width ".Dv BIO_GETATTR" |
82.It Dv BIO_ERROR 83Request failed (error value is stored in 84.Va bio_error 85field). 86.It Dv BIO_DONE 87Request finished. 88.It Dv BIO_FLAG1 89Available for private use. 90.It Dv BIO_FLAG2 91Available for private use. 92.El 93.It Va bio_error | 82.It Dv BIO_ERROR 83Request failed (error value is stored in 84.Va bio_error 85field). 86.It Dv BIO_DONE 87Request finished. 88.It Dv BIO_FLAG1 89Available for private use. 90.It Dv BIO_FLAG2 91Available for private use. 92.El 93.It Va bio_error |
94Error value when BIO_ERROR is set. | 94Error value when 95.Dv BIO_ERROR 96is set. |
95.It Va bio_done 96Pointer to function which will be called when the request is finished. 97.It Va bio_driver1 | 97.It Va bio_done 98Pointer to function which will be called when the request is finished. 99.It Va bio_driver1 |
98Private use by the callee (ie: the provider). | 100Private use by the callee (i.e., the provider). |
99.It Va bio_driver2 | 101.It Va bio_driver2 |
100Private use by the callee (ie: the provider). | 102Private use by the callee (i.e., the provider). |
101.It Va bio_caller1 | 103.It Va bio_caller1 |
102Private use by the caller (ie: the consumer). | 104Private use by the caller (i.e., the consumer). |
103.It Va bio_caller2 | 105.It Va bio_caller2 |
104Private use by the caller (ie: the consumer). | 106Private use by the caller (i.e., the consumer). |
105.It Va bio_attribute | 107.It Va bio_attribute |
106Attribute string for BIO_GETATTR request. | 108Attribute string for 109.Dv BIO_GETATTR 110request. |
107.It Va bio_from 108Consumer to use for request (attached to provider stored in 109.Va bio_to | 111.It Va bio_from 112Consumer to use for request (attached to provider stored in 113.Va bio_to |
110field) (typically read\-only for a class). | 114field) (typically read-only for a class). |
111.It Va bio_to | 115.It Va bio_to |
112Destination provider (typically read\-only for a class). | 116Destination provider (typically read-only for a class). |
113.It Va bio_length 114Request length in bytes. 115.It Va bio_completed 116Number of bytes completed, but they may not be completed from 117the front of the request. 118.It Va bio_children | 117.It Va bio_length 118Request length in bytes. 119.It Va bio_completed 120Number of bytes completed, but they may not be completed from 121the front of the request. 122.It Va bio_children |
119Number of bio clones (typically read\-only for a class). | 123Number of 124.Vt bio 125clones (typically read-only for a class). |
120.It Va bio_inbed | 126.It Va bio_inbed |
121Number of finished bio clones. | 127Number of finished 128.Vt bio 129clones. |
122.It Va bio_parent | 130.It Va bio_parent |
123Pointer to parent bio. | 131Pointer to parent 132.Vt bio . |
124.El 125.Pp 126The 127.Fn g_new_bio 128function allocates a new, empty 129.Vt bio 130structure. 131.Pp --- 46 unchanged lines hidden (view full) --- 178structure (for debugging purposes). 179.Sh RETURN VALUES 180The 181.Fn g_new_bio 182and 183.Fn g_clone_bio 184functions return a pointer to the allocated 185.Vt bio , | 133.El 134.Pp 135The 136.Fn g_new_bio 137function allocates a new, empty 138.Vt bio 139structure. 140.Pp --- 46 unchanged lines hidden (view full) --- 187structure (for debugging purposes). 188.Sh RETURN VALUES 189The 190.Fn g_new_bio 191and 192.Fn g_clone_bio 193functions return a pointer to the allocated 194.Vt bio , |
186or NULL if an error occurred. | 195or 196.Dv NULL 197if an error occurred. |
187.Sh EXAMPLES 188Implementation of | 198.Sh EXAMPLES 199Implementation of |
189.Dq Dv NULL Ns \-transformation , | 200.Dq Dv NULL Ns -transformation , |
190meaning that an I/O request is cloned and scheduled down without any 191modifications. | 201meaning that an I/O request is cloned and scheduled down without any 202modifications. |
192Let's assume that field | 203Let us assume that field |
193.Va ex_consumer 194in structure 195.Vt example_softc 196contains a consumer attached to the provider we want to operate on. 197.Bd -literal -offset indent 198void 199example_start(struct bio *bp) 200{ --- 46 unchanged lines hidden --- | 204.Va ex_consumer 205in structure 206.Vt example_softc 207contains a consumer attached to the provider we want to operate on. 208.Bd -literal -offset indent 209void 210example_start(struct bio *bp) 211{ --- 46 unchanged lines hidden --- |