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