2003-06-09 09:59:11 +00:00
|
|
|
.\" Author: Juli Mallett <jmallett@FreeBSD.org>
|
|
|
|
.\" Date: June 04, 2003
|
|
|
|
.\" Description:
|
|
|
|
.\" Manual page for libufs functions:
|
2018-01-26 00:58:32 +00:00
|
|
|
.\" sbget(3)
|
|
|
|
.\" sbput(3)
|
2003-06-09 09:59:11 +00:00
|
|
|
.\" sbread(3)
|
|
|
|
.\" sbwrite(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$
|
|
|
|
.\"
|
2018-01-26 00:58:32 +00:00
|
|
|
.Dd January 19, 2018
|
2003-06-09 09:59:11 +00:00
|
|
|
.Dt SBREAD 3
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
2018-01-26 00:58:32 +00:00
|
|
|
.Nm sbget , sbput , sbread , sbwrite
|
2004-07-05 06:53:34 +00:00
|
|
|
.Nd read and write superblocks 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 int
|
2018-01-26 00:58:32 +00:00
|
|
|
.Fn sbget "int devfd" "struct fs **fsp" "off_t sblockloc"
|
|
|
|
.Ft int
|
|
|
|
.Fn sbput "int devfd" "struct fs *fs" "int numaltwrite"
|
|
|
|
.Ft int
|
2003-06-09 09:59:11 +00:00
|
|
|
.Fn sbread "struct uufsd *disk"
|
|
|
|
.Ft int
|
|
|
|
.Fn sbwrite "struct uufsd *disk" "int all"
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
2018-01-26 00:58:32 +00:00
|
|
|
.Fn sbget
|
|
|
|
and
|
2003-06-09 09:59:11 +00:00
|
|
|
.Fn sbread
|
2018-01-26 00:58:32 +00:00
|
|
|
functions provide superblock reads for
|
|
|
|
.Xr libufs 3
|
|
|
|
consumers.
|
|
|
|
The
|
|
|
|
.Fn sbput
|
2003-06-09 09:59:11 +00:00
|
|
|
and
|
|
|
|
.Fn sbwrite
|
2018-01-26 00:58:32 +00:00
|
|
|
functions provide superblock writes for
|
2003-06-09 09:59:11 +00:00
|
|
|
.Xr libufs 3
|
|
|
|
consumers.
|
2018-01-26 00:58:32 +00:00
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn sbget
|
|
|
|
function first allocates a buffer to hold the superblock.
|
|
|
|
Using the
|
|
|
|
.Va devfd
|
|
|
|
file descriptor that references the filesystem disk,
|
|
|
|
.Fn sbget
|
|
|
|
reads the superblock located at the byte offset specified by
|
|
|
|
.Va sblockloc
|
|
|
|
into the allocated buffer.
|
|
|
|
If successful, it returns a pointer to the buffer containing the superblock in
|
|
|
|
.Va fsp .
|
|
|
|
The
|
|
|
|
.Fn sbget
|
|
|
|
function is safe to use in threaded applications.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn sbput
|
|
|
|
function writes the superblock specified by
|
|
|
|
.Va fs
|
|
|
|
to the location from which it was read on the disk referenced by the
|
|
|
|
.Va devfd
|
|
|
|
file descriptor.
|
|
|
|
Additionally, the
|
|
|
|
.Fn sbput
|
|
|
|
function will update the first
|
|
|
|
.Va numaltwrite
|
|
|
|
alternate superblock locations.
|
|
|
|
To update all the alternate superblocks,
|
|
|
|
specify a
|
|
|
|
.Va numaltwrite
|
|
|
|
value of
|
|
|
|
.Va fs->fs_ncg .
|
|
|
|
The
|
|
|
|
.Fn sbput
|
|
|
|
function is safe to use in threaded applications.
|
|
|
|
Note that the
|
|
|
|
.Fn sbput
|
|
|
|
function needs to be called only if the superblock has been
|
|
|
|
modified and the on-disk copy needs to be updated.
|
|
|
|
.Pp
|
2003-06-09 09:59:11 +00:00
|
|
|
The
|
|
|
|
.Fn sbread
|
2018-01-26 00:58:32 +00:00
|
|
|
function reads the standard filesystem superblock into the
|
|
|
|
.Va d_sb ,
|
|
|
|
structure embedded in the given user-land UFS disk structure.
|
|
|
|
.Pp
|
|
|
|
The
|
2003-06-09 09:59:11 +00:00
|
|
|
.Fn sbwrite
|
2018-01-26 00:58:32 +00:00
|
|
|
function writes the superblock from the
|
2004-07-05 06:53:34 +00:00
|
|
|
.Va d_sb ,
|
2018-01-26 00:58:32 +00:00
|
|
|
structure embedded in the given user-land UFS disk structure
|
|
|
|
to the location from which it was read.
|
2003-06-09 09:59:11 +00:00
|
|
|
Additionally, the
|
|
|
|
.Fn sbwrite
|
2018-01-26 00:58:32 +00:00
|
|
|
function will write to all the alternate superblock locations if the
|
2003-06-09 09:59:11 +00:00
|
|
|
.Fa all
|
|
|
|
value is non-zero.
|
2004-07-05 06:53:34 +00:00
|
|
|
.Sh RETURN VALUES
|
2018-01-26 00:58:32 +00:00
|
|
|
.Rv -std sbget sbput sbread sbwrite
|
2003-06-09 09:59:11 +00:00
|
|
|
.Sh ERRORS
|
2018-01-26 00:58:32 +00:00
|
|
|
The
|
|
|
|
.Fn sbget
|
|
|
|
and
|
2003-06-09 09:59:11 +00:00
|
|
|
.Fn sbread
|
2018-01-26 00:58:32 +00:00
|
|
|
functions may fail and set
|
2003-06-09 09:59:11 +00:00
|
|
|
.Va errno
|
|
|
|
for any of the errors specified for the library function
|
|
|
|
.Xr bread 3 .
|
|
|
|
Additionally, it may follow the
|
|
|
|
.Xr libufs 3
|
|
|
|
error methodologies in situations where no usable superblock could be
|
|
|
|
found.
|
|
|
|
.Pp
|
2018-01-26 00:58:32 +00:00
|
|
|
The
|
|
|
|
.Fn sbput
|
|
|
|
and
|
2003-06-09 09:59:11 +00:00
|
|
|
.Fn sbwrite
|
2018-01-26 00:58:32 +00:00
|
|
|
functions may fail and set
|
2003-06-09 09:59:11 +00:00
|
|
|
.Va errno
|
|
|
|
for any of the errors specified for the library function
|
|
|
|
.Xr bwrite 3 .
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr bread 3 ,
|
|
|
|
.Xr bwrite 3 ,
|
|
|
|
.Xr libufs 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
|