Main index | Section 3 | Options |
#include <sys/param.h>
#include <sys/mount.h>
#include <ufs/ufs/ufsmount.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
#include <libufs.h>
The sbget() function first allocates a buffer to hold the superblock. Using the devfd file descriptor that references the filesystem disk, sbget() reads the superblock located at the byte offset specified by sblockloc into the allocated buffer. If successful, it returns a pointer to the buffer containing the superblock in fsp. The sbget() function is safe to use in threaded applications.
The sbput() function writes the superblock specified by fs to the location from which it was read on the disk referenced by the devfd file descriptor. Additionally, the sbput() function will update the first numaltwrite alternate superblock locations. To update all the alternate superblocks, specify a numaltwrite value of fs->fs_ncg. The sbput() function is safe to use in threaded applications. Note that the sbput() function needs to be called only if the superblock has been modified and the on-disk copy needs to be updated.
The sbread() function reads the standard filesystem superblock into the d_sb, structure embedded in the given user-land UFS disk structure.
The sbwrite() function writes the superblock from the d_sb, structure embedded in the given user-land UFS disk structure to the location from which it was read. Additionally, the sbwrite() function will write to all the alternate superblock locations if the all value is non-zero.
The errors returned by sbput() and sbwrite() include any of the errors specified for the library function bwrite(3).
SBREAD (3) | January 19, 2018 |
Main index | Section 3 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
“ | The number of UNIX installations has grown to 10, with more expected. | ” |
— UNIX Programming Manual, 1972 |