2003-06-09 09:59:11 +00:00
|
|
|
.\" Author: Juli Mallett <jmallett@FreeBSD.org>
|
|
|
|
.\" Date: June 04, 2003
|
|
|
|
.\" Description:
|
|
|
|
.\" Manual page for libufs functions:
|
|
|
|
.\" bread(3)
|
|
|
|
.\" bwrite(3)
|
|
|
|
.\"
|
2003-06-10 18:24:40 +00:00
|
|
|
.\" This file is in the public domain.
|
|
|
|
.\"
|
2003-06-09 09:59:11 +00:00
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
2004-07-02 18:00:03 +00:00
|
|
|
.Dd June 4, 2003
|
2003-06-09 09:59:11 +00:00
|
|
|
.Dt BREAD 3
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm bread , bwrite
|
2004-07-05 06:53:34 +00:00
|
|
|
.Nd read and write blocks of a UFS file system
|
2003-06-09 09:59:11 +00:00
|
|
|
.Sh LIBRARY
|
|
|
|
.Lb libufs
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.In sys/param.h
|
|
|
|
.In sys/mount.h
|
|
|
|
.In ufs/ufs/ufsmount.h
|
|
|
|
.In ufs/ufs/dinode.h
|
|
|
|
.In ufs/ffs/fs.h
|
|
|
|
.In libufs.h
|
|
|
|
.Ft ssize_t
|
|
|
|
.Fn bread "struct uufsd *disk" "ufs2_daddr_t blockno" "void *data" "size_t size"
|
|
|
|
.Ft ssize_t
|
2004-07-05 06:53:34 +00:00
|
|
|
.Fo bwrite
|
|
|
|
.Fa "struct uufsd *disk" "ufs2_daddr_t blockno"
|
|
|
|
.Fa "const void *data" "size_t size"
|
|
|
|
.Fc
|
2007-12-16 18:02:37 +00:00
|
|
|
.Ft int
|
|
|
|
.Fo berase
|
|
|
|
.Fa "struct uufsd *disk" "ufs2_daddr_t blockno" "ufs2_daddr_t size"
|
|
|
|
.Fc
|
2003-06-09 09:59:11 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
2007-12-16 18:02:37 +00:00
|
|
|
.Fn bread ,
|
2003-06-09 09:59:11 +00:00
|
|
|
.Fn bwrite
|
2007-12-16 18:02:37 +00:00
|
|
|
and
|
|
|
|
.Fn berase
|
|
|
|
functions provide a block read, write and erase API for
|
2003-06-09 09:59:11 +00:00
|
|
|
.Xr libufs 3
|
|
|
|
consumers.
|
|
|
|
They operate on a userland UFS disk structure, and perform the read
|
|
|
|
and write at a given block address, which uses the current
|
2004-07-05 06:53:34 +00:00
|
|
|
.Va d_bsize
|
2003-06-09 09:59:11 +00:00
|
|
|
value of the structure.
|
2004-07-05 06:53:34 +00:00
|
|
|
.Sh RETURN VALUES
|
2003-06-09 09:59:11 +00:00
|
|
|
The
|
|
|
|
.Fn bread
|
|
|
|
and
|
|
|
|
.Fn bwrite
|
2004-07-05 06:53:34 +00:00
|
|
|
functions return the amount read or written, or \-1 in case of any error,
|
2003-06-09 09:59:11 +00:00
|
|
|
including short read.
|
2007-12-16 18:02:37 +00:00
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn berase
|
|
|
|
function returns non-zero on error.
|
2003-06-09 09:59:11 +00:00
|
|
|
.Sh ERRORS
|
|
|
|
The function
|
|
|
|
.Fn bread
|
|
|
|
may fail and set
|
|
|
|
.Va errno
|
|
|
|
for any of the errors specified for the library functions
|
2003-06-10 18:36:16 +00:00
|
|
|
.Xr ufs_disk_write 3
|
2003-06-09 09:59:11 +00:00
|
|
|
or
|
|
|
|
.Xr pread 2 .
|
|
|
|
.Pp
|
|
|
|
The function
|
|
|
|
.Fn bwrite
|
|
|
|
may fail and set
|
|
|
|
.Va errno
|
|
|
|
for any of the errors specified for the library function
|
|
|
|
.Xr pwrite 2 .
|
2007-12-16 18:02:37 +00:00
|
|
|
.Pp
|
|
|
|
The function
|
|
|
|
.Fn berase
|
|
|
|
may fail and set
|
|
|
|
.Va errno
|
|
|
|
for any of the errors specified for the library function
|
|
|
|
.Xr ioctl 2 .
|
|
|
|
.Pp
|
|
|
|
Additionally all three functions may follow the
|
2003-06-09 09:59:11 +00:00
|
|
|
.Xr libufs 3
|
|
|
|
error methodologies in situations where the amount of data written
|
|
|
|
is not equal to the amount requested, or in case of a device error.
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr libufs 3 ,
|
|
|
|
.Xr ufs_disk_write 3
|
|
|
|
.Sh HISTORY
|
|
|
|
These functions first appeared as part of
|
|
|
|
.Xr libufs 3
|
|
|
|
in
|
|
|
|
.Fx 5.0 .
|
|
|
|
.Sh AUTHORS
|
2014-06-23 08:23:05 +00:00
|
|
|
.An Juli Mallett Aq Mt jmallett@FreeBSD.org
|