| 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() and sbsearch() functions first allocate 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. The value UFS_STDSB may be specified for sblockloc to request that the standard location for the superblock be read. The sbsearch() function uses the devfd file descriptor that references the filesystem disk, to search first for the superblock at the standard location. If it is not found or is too damaged to use sbsearch() will attempt to find one of the filesystem's alternate superblocks. Flags are specified by or'ing the following values:
| UFS_NOCSUM | |
| Causes only the superblock itself to be returned, but does not read in any auxiliary data structures like the cylinder group summary information. | |
| UFS_NOMSG | Indicates that superblock inconsistency error messages should not be printed. |
If successful, sbget() and sbsearch() functions return a pointer to the buffer containing the superblock in fsp. The sbget() and sbsearch() functions are 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. The sbfind() function tries to find a usable superblock. It searchs first for the superblock at the standard location. If it is not found or is too damaged to use sbfind() will attempt to find one of the filesystem's alternate superblocks. If successful sbread() and sbfind() return a superblock in 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) | August 8, 2022 |
| Main index | Section 3 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
| “ | You have successfully logged in, Now press any key to log out | ” |