The cgread and cgread1 functions provide cylinder group reads for libufs(3) consumers. The cgread1 function reads from one cylinder group, specified by c into the d_cg field of a userland UFS disk structure. It sets the d_lcg field to the cylinder group number c.
The cgread function operates on sequential cylinder groups. Calling the cgread function is equivalent to calling cgread1 with a cylinder group specifier equivalent to the value of the current d_ccg field, and then incrementing the d_ccg field.
Both functions return 0 if there are no more cylinder groups to read, 1 if there are more cylinder groups, and -1 on error.
The function cgread may fail and set errno for any of the errors specified for the library function bread(3).
The function cgread1 has semantically identical failure conditions to those of cgread.