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 39The 40.Fn bread , 41.Fn bwrite 42and 43.Fn berase 44functions provide a block read, write and erase API for 45.Xr libufs 3 46consumers. 47They operate on a userland UFS disk structure, and perform the read 48and write at a given block address, which uses the current 49.Va d_bsize 50value of the structure. 51.Sh RETURN VALUES 52The 53.Fn bread 54and 55.Fn bwrite 56functions return the amount read or written, or \-1 in case of any error, 57including short read. 58.Pp 59The 60.Fn berase 61function returns non-zero on error. 62.Sh ERRORS 63The function 64.Fn bread 65may fail and set 66.Va errno 67for any of the errors specified for the library functions 68.Xr ufs_disk_write 3 69or 70.Xr pread 2 . 71.Pp 72The function 73.Fn bwrite 74may fail and set 75.Va errno 76for any of the errors specified for the library function 77.Xr pwrite 2 . 78.Pp 79The function 80.Fn berase 81may fail and set 82.Va errno 83for any of the errors specified for the library function 84.Xr ioctl 2 . 85.Pp 86Additionally all three functions may follow the 87.Xr libufs 3 88error methodologies in situations where the amount of data written 89is 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 94These functions first appeared as part of 95.Xr libufs 3 96in 97.Fx 5.0 . 98.Sh AUTHORS 99.An Juli Mallett Aq Mt jmallett@FreeBSD.org 100