]> CyberLeo.Net >> Repos - FreeBSD/releng/7.2.git/blob - lib/libufs/bread.3
Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.
[FreeBSD/releng/7.2.git] / lib / libufs / bread.3
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 file system
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 .Fo bwrite
31 .Fa "struct uufsd *disk" "ufs2_daddr_t blockno"
32 .Fa "const void *data" "size_t size"
33 .Fc
34 .Sh DESCRIPTION
35 The
36 .Fn bread
37 and
38 .Fn bwrite
39 functions provide a block read and write API for
40 .Xr libufs 3
41 consumers.
42 They operate on a userland UFS disk structure, and perform the read
43 and write at a given block address, which uses the current
44 .Va d_bsize
45 value of the structure.
46 .Sh RETURN VALUES
47 The
48 .Fn bread
49 and
50 .Fn bwrite
51 functions return the amount read or written, or \-1 in case of any error,
52 including short read.
53 .Sh ERRORS
54 The function
55 .Fn bread
56 may fail and set
57 .Va errno
58 for any of the errors specified for the library functions
59 .Xr ufs_disk_write 3
60 or
61 .Xr pread 2 .
62 Additionally, it may follow the
63 .Xr libufs 3
64 error methodologies in situations where the amount of data read
65 is not equal to the amount requested, or in case of device error.
66 .Pp
67 The function
68 .Fn bwrite
69 may fail and set
70 .Va errno
71 for any of the errors specified for the library function
72 .Xr pwrite 2 .
73 Additionally, it may follow the
74 .Xr libufs 3
75 error methodologies in situations where the amount of data written
76 is not equal to the amount requested, or in case of a device error.
77 .Sh SEE ALSO
78 .Xr libufs 3 ,
79 .Xr ufs_disk_write 3
80 .Sh HISTORY
81 These functions first appeared as part of
82 .Xr libufs 3
83 in
84 .Fx 5.0 .
85 .Sh AUTHORS
86 .An Juli Mallett Aq jmallett@FreeBSD.org