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