xref: /freebsd/lib/libufs/cgread.3 (revision 1e413cf93298b5b97441a21d9a50fdcd0ee9945e)
1.\" Author:	Juli Mallett <jmallett@FreeBSD.org>
2.\" Date:	June 04, 2003
3.\" Description:
4.\" 	Manual page for libufs functions:
5.\"		cgread(3)
6.\"		cgread1(3)
7.\"		cgwrite1(3)
8.\"
9.\" This file is in the public domain.
10.\"
11.\" $FreeBSD$
12.\"
13.Dd June 4, 2003
14.Dt CGREAD 3
15.Os
16.Sh NAME
17.Nm cgread , cgread1, cgwrite1
18.Nd read/write cylinder groups of UFS disks
19.Sh LIBRARY
20.Lb libufs
21.Sh SYNOPSIS
22.In sys/param.h
23.In sys/mount.h
24.In ufs/ufs/ufsmount.h
25.In ufs/ufs/dinode.h
26.In ufs/ffs/fs.h
27.In libufs.h
28.Ft int
29.Fn cgread "struct uufsd *disk"
30.Ft int
31.Fn cgread1 "struct uufsd *disk" "int c"
32.Ft int
33.Fn cgwrite1 "struct uufsd *disk" "int c"
34.Sh DESCRIPTION
35The
36.Fn cgread
37and
38.Fn cgread1
39functions provide cylinder group reads for
40.Xr libufs 3
41consumers.
42The
43.Fn cgread1
44function reads from one cylinder group, specified by
45.Fa c
46into the
47.Va d_cg
48field of a userland UFS disk structure.
49It sets the
50.Va d_lcg
51field to the cylinder group number
52.Fa c .
53.Pp
54The
55.Fn cgread
56function operates on sequential cylinder groups.
57Calling the
58.Fn cgread
59function is equivalent to calling
60.Fn cgread1
61with a cylinder group specifier equivalent to the value of the current
62.Va d_ccg
63field, and then incrementing the
64.Va d_ccg
65field.
66.Pp
67The
68.Fn cgwrite1
69function stores cylinder group specified by
70.Fa c
71from
72.Va d_cg
73field of a userland UFS disk structure on disk.
74.Sh RETURN VALUES
75Both functions return 0 if there are no more cylinder groups to read,
761 if there are more cylinder groups, and \-1 on error.
77.Sh ERRORS
78The function
79.Fn cgread
80may fail and set
81.Va errno
82for any of the errors specified for the library function
83.Xr bread 3 .
84.Pp
85The function
86.Fn cgread1
87has semantically identical failure conditions to those of
88.Fn cgread .
89.Pp
90The function
91.Fn cgwrite1
92may fail and set
93.Va errno
94for any of the errors specified for the library function
95.Xr bwrite 3 .
96.Sh SEE ALSO
97.Xr bread 3 ,
98.Xr bwrite 3 ,
99.Xr libufs 3
100.Sh HISTORY
101These functions first appeared as part of
102.Xr libufs 3
103in
104.Fx 5.1 .
105.Sh AUTHORS
106.An Juli Mallett Aq jmallett@FreeBSD.org
107