xref: /freebsd/lib/libufs/bread.3 (revision d37ea99837e6ad50837fd9fe1771ddf1c3ba6002)
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 4, 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/param.h
22.In sys/mount.h
23.In ufs/ufs/ufsmount.h
24.In ufs/ufs/dinode.h
25.In ufs/ffs/fs.h
26.In libufs.h
27.Ft ssize_t
28.Fn bread "struct uufsd *disk" "ufs2_daddr_t blockno" "void *data" "size_t size"
29.Ft ssize_t
30.Fn bwrite "struct uufsd *disk" "ufs2_daddr_t blockno" "const void *data" "size_t size"
31.Sh DESCRIPTION
32The
33.Fn bread
34and
35.Fn bwrite
36functions provide a block read and write API for
37.Xr libufs 3
38consumers.
39They operate on a userland UFS disk structure, and perform the read
40and write at a given block address, which uses the current
41.Fa d_bsize
42value of the structure.
43.Pp
44The
45.Fn bread
46and
47.Fn bwrite
48functions return the amount read or written, or -1 in case of any error,
49including short read.
50.Sh ERRORS
51The function
52.Fn bread
53may fail and set
54.Va errno
55for any of the errors specified for the library functions
56.Xr ufs_disk_write 3
57or
58.Xr pread 2 .
59Additionally, it may follow the
60.Xr libufs 3
61error methodologies in situations where the amount of data read
62is not equal to the amount requested, or in case of device error.
63.Pp
64The function
65.Fn bwrite
66may fail and set
67.Va errno
68for any of the errors specified for the library function
69.Xr pwrite 2 .
70Additionally, it may follow the
71.Xr libufs 3
72error methodologies in situations where the amount of data written
73is not equal to the amount requested, or in case of a device error.
74.Sh SEE ALSO
75.Xr libufs 3 ,
76.Xr ufs_disk_write 3
77.Sh HISTORY
78These functions first appeared as part of
79.Xr libufs 3
80in
81.Fx 5.0 .
82.Sh AUTHORS
83.An Juli Mallett Aq jmallett@FreeBSD.org
84