xref: /freebsd/lib/libufs/bread.3 (revision 7660b554bc59a07be0431c17e0e33815818baa69)
1.\" Author:	Juli Mallett <jmallett@FreeBSD.org>
2.\" Date:	June 04, 2003
3.\" Description:
4.\" 	Manual page for libufs functions:
5.\"		bread(3)
6.\"		bwrite(3)
7.\"
8.\" This file is in the public domain.
9.\"
10.\" $FreeBSD$
11.\"
12.Dd June 04, 2003
13.Dt BREAD 3
14.Os
15.Sh NAME
16.Nm bread , bwrite
17.Nd read and write blocks of a UFS filesystem
18.Sh LIBRARY
19.Lb libufs
20.Sh SYNOPSIS
21.In sys/types.h
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 ssize_t
29.Fn bread "struct uufsd *disk" "ufs2_daddr_t blockno" "void *data" "size_t size"
30.Ft ssize_t
31.Fn bwrite "struct uufsd *disk" "ufs2_daddr_t blockno" "const void *data" "size_t size"
32.Sh DESCRIPTION
33The
34.Fn bread
35and
36.Fn bwrite
37functions provide a block read and write API for
38.Xr libufs 3
39consumers.
40They operate on a userland UFS disk structure, and perform the read
41and write at a given block address, which uses the current
42.Fa d_bsize
43value of the structure.
44.Pp
45The
46.Fn bread
47and
48.Fn bwrite
49functions return the amount read or written, or -1 in case of any error,
50including short read.
51.Sh ERRORS
52The function
53.Fn bread
54may fail and set
55.Va errno
56for any of the errors specified for the library functions
57.Xr ufs_disk_write 3
58or
59.Xr pread 2 .
60Additionally, it may follow the
61.Xr libufs 3
62error methodologies in situations where the amount of data read
63is not equal to the amount requested, or in case of device error.
64.Pp
65The function
66.Fn bwrite
67may fail and set
68.Va errno
69for any of the errors specified for the library function
70.Xr pwrite 2 .
71Additionally, it may follow the
72.Xr libufs 3
73error methodologies in situations where the amount of data written
74is not equal to the amount requested, or in case of a device error.
75.Sh SEE ALSO
76.Xr libufs 3 ,
77.Xr ufs_disk_write 3
78.Sh HISTORY
79These functions first appeared as part of
80.Xr libufs 3
81in
82.Fx 5.0 .
83.Sh AUTHORS
84.An Juli Mallett Aq jmallett@FreeBSD.org
85