Deleted Added
full compact
g_data.9 (126861) g_data.9 (129381)
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_data.9 126861 2004-03-11 19:53:22Z pjd $
25.\" $FreeBSD: head/share/man/man9/g_data.9 129381 2004-05-18 11:33:37Z le $
26.\"
27.Dd January 16, 2004
28.Dt g_data 9
29.Os
30.Sh NAME
31.Nm g_read_data ,
32.Nm g_write_data
26.\"
27.Dd January 16, 2004
28.Dt g_data 9
29.Os
30.Sh NAME
31.Nm g_read_data ,
32.Nm g_write_data
33.Nd "read/write data through consumer"
33.Nd "read/write data from/to GEOM consumer"
34.Sh SYNOPSIS
35.In geom/geom.h
36.Ft "void *"
37.Fn g_read_data "struct g_consumer *cp" "off_t offset" "off_t length" "int *error"
38.Ft int
39.Fn g_write_data "struct g_consumer *cp" "off_t offset" "void *ptr" "off_t length"
40.Sh DESCRIPTION
41The
42.Fn g_read_data
34.Sh SYNOPSIS
35.In geom/geom.h
36.Ft "void *"
37.Fn g_read_data "struct g_consumer *cp" "off_t offset" "off_t length" "int *error"
38.Ft int
39.Fn g_write_data "struct g_consumer *cp" "off_t offset" "void *ptr" "off_t length"
40.Sh DESCRIPTION
41The
42.Fn g_read_data
43reads
43function reads
44.Fa length
44.Fa length
45bytes of data from a provider through attached consumer
46.Fa cp
45bytes of data from the provider attached to consumer
46.Fa cp ,
47starting at offset
48.Fa offset .
47starting at offset
48.Fa offset .
49Memory for data is allocated inside
49The buffer returned from
50.Fn g_read_data
50.Fn g_read_data
51with
51is allocated with
52.Fn g_malloc ,
52.Fn g_malloc ,
53and should therefor be freed by the caller with the
53so it should be freed by the caller with
54.Fn g_free
54.Fn g_free
55function after use.
55after use.
56If the operation fails, an error value will be stored in the
57.Fa error
58argument if it is not
59.Dv NULL .
60.Pp
61The
62.Fn g_write_data
56If the operation fails, an error value will be stored in the
57.Fa error
58argument if it is not
59.Dv NULL .
60.Pp
61The
62.Fn g_write_data
63writes
63function writes
64.Fa length
64.Fa length
65bytes of data from address
65bytes of data from the buffer pointed to by
66.Fa ptr
66.Fa ptr
67to the provider attached to consumer
68.Fa cp ,
67starting at offset
69starting at offset
68.Fa offset
69to a provider through the attached consumer
70.Fa cp .
70.Fa offset .
71.Sh RESTRICTIONS/CONDITIONS
71.Sh RESTRICTIONS/CONDITIONS
72Length of data should be a multiple of the sectorsize for the provider
72.Fa length
73should be a multiple of the provider's sectorsize
73and less than or equal to
74.Dv DFLTPHYS
75.Dv ( DFLTPHYS is defined in
76.In sys/param.h ) .
77.Pp
78The topology lock must not be held.
79.Sh RETURN VALUES
74and less than or equal to
75.Dv DFLTPHYS
76.Dv ( DFLTPHYS is defined in
77.In sys/param.h ) .
78.Pp
79The topology lock must not be held.
80.Sh RETURN VALUES
81The
80.Fn g_read_data
82.Fn g_read_data
81returns a pointer to the read data or
83function returns a pointer to a data buffer or
82.Dv NULL
83if an error occured.
84In that case an error value is stored in the
85.Fa error
84.Dv NULL
85if an error occured.
86In that case an error value is stored in the
87.Fa error
86argument unsless it is
88argument unless it is
87.Dv NULL .
88.Pp
89.Dv NULL .
90.Pp
91The
89.Fn g_write_data
92.Fn g_write_data
90returns the value 0 if successful; otherwise an error code is returned.
93function returns 0 if successful; otherwise an error code is returned.
91.Sh ERRORS
92Possible errors:
93.Bl -tag -width Er
94.It Bq Er EIO
95Can not read data.
96.El
97.Sh SEE ALSO
98.Xr DECLARE_GEOM_CLASS 9 ,

--- 14 unchanged lines hidden ---
94.Sh ERRORS
95Possible errors:
96.Bl -tag -width Er
97.It Bq Er EIO
98Can not read data.
99.El
100.Sh SEE ALSO
101.Xr DECLARE_GEOM_CLASS 9 ,

--- 14 unchanged lines hidden ---