Fix typos: super block -> superblock (#8974)
Signed-off-by: Przemysław Buczkowski <[email protected]> Signed-off-by: Matt Madia <[email protected]>
This commit is contained in:
committed by
Matt Madia
parent
a6f39df3f7
commit
46cf7a5a73
@@ -28,11 +28,11 @@
|
|||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
It resides in the first first 1024 bytes of a BFS disk which usually refers to the
|
It resides in the first first 1024 bytes of a BFS disk which usually refers to the
|
||||||
first two sectors of the partition in question. Since the BFS super block is located
|
first two sectors of the partition in question. Since the BFS superblock is located
|
||||||
at byte offset 512, and about 170 bytes large, this section is already reserved,
|
at byte offset 512, and about 170 bytes large, this section is already reserved,
|
||||||
and thus cannot be used by the loader itself.<br>
|
and thus cannot be used by the loader itself.<br>
|
||||||
The MBR only loads the first sector of a partition into memory, so it has to load
|
The MBR only loads the first sector of a partition into memory, so it has to load
|
||||||
the super block (and the rest of its implementation) by itself.
|
the superblock (and the rest of its implementation) by itself.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
The loader must be able to load the real boot loader from a certain path, and
|
The loader must be able to load the real boot loader from a certain path, and
|
||||||
|
|||||||
@@ -597,7 +597,7 @@ BlockAllocator::InitializeAndClearBitmap(Transaction& transaction)
|
|||||||
memset(buffer, 0, numBits >> 3);
|
memset(buffer, 0, numBits >> 3);
|
||||||
|
|
||||||
off_t offset = 1;
|
off_t offset = 1;
|
||||||
// the bitmap starts directly after the super block
|
// the bitmap starts directly after the superblock
|
||||||
|
|
||||||
// initialize the AllocationGroup objects and clear the on-disk bitmap
|
// initialize the AllocationGroup objects and clear the on-disk bitmap
|
||||||
|
|
||||||
@@ -926,7 +926,7 @@ BlockAllocator::AllocateBlocks(Transaction& transaction, int32 groupIndex,
|
|||||||
|
|
||||||
fVolume->SuperBlock().used_blocks
|
fVolume->SuperBlock().used_blocks
|
||||||
= HOST_ENDIAN_TO_BFS_INT64(fVolume->UsedBlocks() + bestLength);
|
= HOST_ENDIAN_TO_BFS_INT64(fVolume->UsedBlocks() + bestLength);
|
||||||
// We are not writing back the disk's super block - it's
|
// We are not writing back the disk's superblock - it's
|
||||||
// either done by the journaling code, or when the disk
|
// either done by the journaling code, or when the disk
|
||||||
// is unmounted.
|
// is unmounted.
|
||||||
// If the value is not correct at mount time, it will be
|
// If the value is not correct at mount time, it will be
|
||||||
|
|||||||
@@ -2556,7 +2556,7 @@ Inode::Remove(Transaction& transaction, const char* name, ino_t* _id,
|
|||||||
adds the created inode to that parent directory. If an attribute directory
|
adds the created inode to that parent directory. If an attribute directory
|
||||||
is created, it will also automatically be added to the \a parent inode as
|
is created, it will also automatically be added to the \a parent inode as
|
||||||
such. However, the indices root node, and the regular root node won't be
|
such. However, the indices root node, and the regular root node won't be
|
||||||
added to the super block.
|
added to the superblock.
|
||||||
It will also create the initial B+tree for the inode if it's a directory
|
It will also create the initial B+tree for the inode if it's a directory
|
||||||
of any kind.
|
of any kind.
|
||||||
\a name may be \c NULL, but only if no \a parent is given.
|
\a name may be \c NULL, but only if no \a parent is given.
|
||||||
|
|||||||
@@ -499,10 +499,10 @@ Journal::_ReplayRunArray(int32* _start)
|
|||||||
// TODO: eventually check other well known offsets, like the
|
// TODO: eventually check other well known offsets, like the
|
||||||
// root and index dirs
|
// root and index dirs
|
||||||
if (offset == 0) {
|
if (offset == 0) {
|
||||||
// This log entry writes over the super block - check if
|
// This log entry writes over the superblock - check if
|
||||||
// it's valid!
|
// it's valid!
|
||||||
if (Volume::CheckSuperBlock(data) != B_OK) {
|
if (Volume::CheckSuperBlock(data) != B_OK) {
|
||||||
FATAL(("Log contains invalid super block!\n"));
|
FATAL(("Log contains invalid superblock!\n"));
|
||||||
RETURN_ERROR(B_BAD_DATA);
|
RETURN_ERROR(B_BAD_DATA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -663,7 +663,7 @@ Journal::_TransactionWritten(int32 transactionID, int32 event, void* _logEntry)
|
|||||||
|
|
||||||
delete logEntry;
|
delete logEntry;
|
||||||
|
|
||||||
// update the super block, and change the disk's state, if necessary
|
// update the superblock, and change the disk's state, if necessary
|
||||||
|
|
||||||
if (update) {
|
if (update) {
|
||||||
if (superBlock.log_start == superBlock.log_end)
|
if (superBlock.log_start == superBlock.log_end)
|
||||||
@@ -671,7 +671,7 @@ Journal::_TransactionWritten(int32 transactionID, int32 event, void* _logEntry)
|
|||||||
|
|
||||||
status_t status = journal->fVolume->WriteSuperBlock();
|
status_t status = journal->fVolume->WriteSuperBlock();
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
FATAL(("_TransactionWritten: could not write back super block: %s\n",
|
FATAL(("_TransactionWritten: could not write back superblock: %s\n",
|
||||||
strerror(status)));
|
strerror(status)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -864,7 +864,7 @@ Journal::_WriteTransactionToLog()
|
|||||||
logEntry->SetTransactionID(fTransactionID);
|
logEntry->SetTransactionID(fTransactionID);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Update the log end pointer in the super block
|
// Update the log end pointer in the superblock
|
||||||
|
|
||||||
fVolume->SuperBlock().flags = SUPER_BLOCK_DISK_DIRTY;
|
fVolume->SuperBlock().flags = SUPER_BLOCK_DISK_DIRTY;
|
||||||
fVolume->SuperBlock().log_end = HOST_ENDIAN_TO_BFS_INT64(logPosition);
|
fVolume->SuperBlock().log_end = HOST_ENDIAN_TO_BFS_INT64(logPosition);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
//! super block, mounting, etc.
|
//! superblock, mounting, etc.
|
||||||
|
|
||||||
|
|
||||||
#include "Attribute.h"
|
#include "Attribute.h"
|
||||||
@@ -342,13 +342,13 @@ Volume::Mount(const char* deviceName, uint32 flags)
|
|||||||
if (opener.IsReadOnly())
|
if (opener.IsReadOnly())
|
||||||
fFlags |= VOLUME_READ_ONLY;
|
fFlags |= VOLUME_READ_ONLY;
|
||||||
|
|
||||||
// read the super block
|
// read the superblock
|
||||||
if (Identify(fDevice, &fSuperBlock) != B_OK) {
|
if (Identify(fDevice, &fSuperBlock) != B_OK) {
|
||||||
FATAL(("invalid super block!\n"));
|
FATAL(("invalid superblock!\n"));
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize short hands to the super block (to save byte swapping)
|
// initialize short hands to the superblock (to save byte swapping)
|
||||||
fBlockSize = fSuperBlock.BlockSize();
|
fBlockSize = fSuperBlock.BlockSize();
|
||||||
fBlockShift = fSuperBlock.BlockShift();
|
fBlockShift = fSuperBlock.BlockShift();
|
||||||
fAllocationGroupShift = fSuperBlock.AllocationGroupShift();
|
fAllocationGroupShift = fSuperBlock.AllocationGroupShift();
|
||||||
@@ -633,7 +633,7 @@ Volume::CheckSuperBlock(const uint8* data, uint32* _offset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef BFS_LITTLE_ENDIAN_ONLY
|
#ifndef BFS_LITTLE_ENDIAN_ONLY
|
||||||
// For PPC, the super block might be located at offset 0
|
// For PPC, the superblock might be located at offset 0
|
||||||
superBlock = (disk_super_block*)data;
|
superBlock = (disk_super_block*)data;
|
||||||
if (superBlock->IsValid()) {
|
if (superBlock->IsValid()) {
|
||||||
if (_offset != NULL)
|
if (_offset != NULL)
|
||||||
@@ -692,11 +692,11 @@ Volume::Initialize(int fd, const char* name, uint32 blockSize,
|
|||||||
|
|
||||||
off_t numBlocks = deviceSize / blockSize;
|
off_t numBlocks = deviceSize / blockSize;
|
||||||
|
|
||||||
// create valid super block
|
// create valid superblock
|
||||||
|
|
||||||
fSuperBlock.Initialize(name, numBlocks, blockSize);
|
fSuperBlock.Initialize(name, numBlocks, blockSize);
|
||||||
|
|
||||||
// initialize short hands to the super block (to save byte swapping)
|
// initialize short hands to the superblock (to save byte swapping)
|
||||||
fBlockSize = fSuperBlock.BlockSize();
|
fBlockSize = fSuperBlock.BlockSize();
|
||||||
fBlockShift = fSuperBlock.BlockShift();
|
fBlockShift = fSuperBlock.BlockShift();
|
||||||
fAllocationGroupShift = fSuperBlock.AllocationGroupShift();
|
fAllocationGroupShift = fSuperBlock.AllocationGroupShift();
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
//! Super block, mounting, etc.
|
//! Superblock, mounting, etc.
|
||||||
|
|
||||||
|
|
||||||
#include "Volume.h"
|
#include "Volume.h"
|
||||||
@@ -270,7 +270,7 @@ Volume::Mount(const char* deviceName, uint32 flags)
|
|||||||
if (opener.IsReadOnly())
|
if (opener.IsReadOnly())
|
||||||
fFlags |= VOLUME_READ_ONLY;
|
fFlags |= VOLUME_READ_ONLY;
|
||||||
|
|
||||||
// read the super block
|
// read the superblock
|
||||||
status_t status = Identify(fDevice, &fSuperBlock);
|
status_t status = Identify(fDevice, &fSuperBlock);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
ERROR("Volume::Mount(): Identify() failed\n");
|
ERROR("Volume::Mount(): Identify() failed\n");
|
||||||
@@ -526,7 +526,7 @@ Volume::Identify(int fd, btrfs_super_block* superBlock)
|
|||||||
return B_IO_ERROR;
|
return B_IO_ERROR;
|
||||||
|
|
||||||
if (!superBlock->IsValid()) {
|
if (!superBlock->IsValid()) {
|
||||||
ERROR("invalid super block!\n");
|
ERROR("invalid superblock!\n");
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
//! Super block, mounting, etc.
|
//! Superblock, mounting, etc.
|
||||||
|
|
||||||
|
|
||||||
#include "Volume.h"
|
#include "Volume.h"
|
||||||
@@ -310,7 +310,7 @@ Volume::Mount(const char* deviceName, uint32 flags)
|
|||||||
if (opener.IsReadOnly())
|
if (opener.IsReadOnly())
|
||||||
fFlags |= VOLUME_READ_ONLY;
|
fFlags |= VOLUME_READ_ONLY;
|
||||||
|
|
||||||
// read the super block
|
// read the superblock
|
||||||
status_t status = Identify(fDevice, &fSuperBlock);
|
status_t status = Identify(fDevice, &fSuperBlock);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
ERROR("Volume::Mount(): Identify() failed\n");
|
ERROR("Volume::Mount(): Identify() failed\n");
|
||||||
@@ -502,7 +502,7 @@ Volume::Identify(int fd, exfat_super_block* superBlock)
|
|||||||
return B_IO_ERROR;
|
return B_IO_ERROR;
|
||||||
|
|
||||||
if (!superBlock->IsValid()) {
|
if (!superBlock->IsValid()) {
|
||||||
ERROR("invalid super block!\n");
|
ERROR("invalid superblock!\n");
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
//! Super block, mounting, etc.
|
//! Superblock, mounting, etc.
|
||||||
|
|
||||||
|
|
||||||
#include "Volume.h"
|
#include "Volume.h"
|
||||||
@@ -300,7 +300,7 @@ Volume::Mount(const char* deviceName, uint32 flags)
|
|||||||
fSuperBlock.CompatibleFeatures(), fSuperBlock.IncompatibleFeatures(),
|
fSuperBlock.CompatibleFeatures(), fSuperBlock.IncompatibleFeatures(),
|
||||||
fSuperBlock.ReadOnlyFeatures());
|
fSuperBlock.ReadOnlyFeatures());
|
||||||
|
|
||||||
// read the super block
|
// read the superblock
|
||||||
status_t status = Identify(fDevice, &fSuperBlock);
|
status_t status = Identify(fDevice, &fSuperBlock);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
FATAL("Volume::Mount(): Identify() failed\n");
|
FATAL("Volume::Mount(): Identify() failed\n");
|
||||||
@@ -311,7 +311,7 @@ Volume::Mount(const char* deviceName, uint32 flags)
|
|||||||
if (!IsReadOnly() && _UnsupportedReadOnlyFeatures(fSuperBlock) != 0)
|
if (!IsReadOnly() && _UnsupportedReadOnlyFeatures(fSuperBlock) != 0)
|
||||||
return B_UNSUPPORTED;
|
return B_UNSUPPORTED;
|
||||||
|
|
||||||
// initialize short hands to the super block (to save byte swapping)
|
// initialize short hands to the superblock (to save byte swapping)
|
||||||
fBlockShift = fSuperBlock.BlockShift();
|
fBlockShift = fSuperBlock.BlockShift();
|
||||||
if (fBlockShift < 10 || fBlockShift > 16)
|
if (fBlockShift < 10 || fBlockShift > 16)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
@@ -930,7 +930,7 @@ Volume::Identify(int fd, ext2_super_block* superBlock)
|
|||||||
return B_IO_ERROR;
|
return B_IO_ERROR;
|
||||||
|
|
||||||
if (!superBlock->IsValid()) {
|
if (!superBlock->IsValid()) {
|
||||||
FATAL("invalid super block!\n");
|
FATAL("invalid superblock!\n");
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,12 +30,12 @@ using std::nothrow;
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class DirEntry
|
\class DirEntry
|
||||||
\brief Represents the on-disk structure for super block of the FS.
|
\brief Represents the on-disk structure for superblock of the FS.
|
||||||
|
|
||||||
There exist two versions of the structure and this class can deal with both
|
There exist two versions of the structure and this class can deal with both
|
||||||
of them. This class can also handle a very old layout that puts the super
|
of them. This class can also handle a very old layout that puts the super
|
||||||
block in a different location. The Init() methods tries to find and read
|
block in a different location. The Init() methods tries to find and read
|
||||||
the super block from disk.
|
the superblock from disk.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// read_super_block
|
// read_super_block
|
||||||
@@ -47,13 +47,13 @@ read_super_block(int device, off_t offset, const char *magic,
|
|||||||
{
|
{
|
||||||
super_block_t *superBlock = NULL;
|
super_block_t *superBlock = NULL;
|
||||||
status_t error = B_OK;
|
status_t error = B_OK;
|
||||||
// allocate memory for the super block
|
// allocate memory for the superblock
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
superBlock = new(nothrow) super_block_t;
|
superBlock = new(nothrow) super_block_t;
|
||||||
if (!superBlock)
|
if (!superBlock)
|
||||||
error = B_NO_MEMORY;
|
error = B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
// read the super block
|
// read the superblock
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
size_t size = sizeof(super_block_t);
|
size_t size = sizeof(super_block_t);
|
||||||
if (read_pos(device, offset, superBlock, size) != (int32)size)
|
if (read_pos(device, offset, superBlock, size) != (int32)size)
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ static inline C max(const C &a, const C &b) { return (a > b ? a : b); }
|
|||||||
\brief Represents a volume.
|
\brief Represents a volume.
|
||||||
|
|
||||||
The Volume class bundles all functionality related to a volume.
|
The Volume class bundles all functionality related to a volume.
|
||||||
It knows the super block and has some basic functionality needed
|
It knows the superblock and has some basic functionality needed
|
||||||
for handling VNodes. Actually it should be the layer that provides the
|
for handling VNodes. Actually it should be the layer that provides the
|
||||||
abstraction from VNodes. The design is not strict in this respect
|
abstraction from VNodes. The design is not strict in this respect
|
||||||
(the whole thing evolved while I was in the process of understanding
|
(the whole thing evolved while I was in the process of understanding
|
||||||
@@ -97,7 +97,7 @@ Volume::Identify(int fd, partition_data *partition)
|
|||||||
if (fDevice < 0)
|
if (fDevice < 0)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
// read and analyze super block
|
// read and analyze superblock
|
||||||
return _ReadSuperBlock();
|
return _ReadSuperBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ Volume::Mount(fs_volume *fsVolume, const char *path)
|
|||||||
if (fDevice < 0)
|
if (fDevice < 0)
|
||||||
SET_ERROR(error, errno);
|
SET_ERROR(error, errno);
|
||||||
}
|
}
|
||||||
// read and analyze super block
|
// read and analyze superblock
|
||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
error = _ReadSuperBlock();
|
error = _ReadSuperBlock();
|
||||||
|
|
||||||
@@ -534,12 +534,12 @@ Volume::_ReadSuperBlock()
|
|||||||
error = B_NO_MEMORY;
|
error = B_NO_MEMORY;
|
||||||
// check FS state
|
// check FS state
|
||||||
if (error == B_OK && fSuperBlock->GetState() != REISERFS_VALID_FS) {
|
if (error == B_OK && fSuperBlock->GetState() != REISERFS_VALID_FS) {
|
||||||
FATAL(("The super block indicates a non-valid FS! Bailing out."));
|
FATAL(("The superblock indicates a non-valid FS! Bailing out."));
|
||||||
error = B_ERROR;
|
error = B_ERROR;
|
||||||
}
|
}
|
||||||
// check FS version
|
// check FS version
|
||||||
if (error == B_OK && fSuperBlock->GetVersion() > REISERFS_VERSION_2) {
|
if (error == B_OK && fSuperBlock->GetVersion() > REISERFS_VERSION_2) {
|
||||||
FATAL(("The super block indicates a version greater than 2 (%u)! "
|
FATAL(("The superblock indicates a version greater than 2 (%u)! "
|
||||||
"Bailing out.", fSuperBlock->GetVersion()));
|
"Bailing out.", fSuperBlock->GetVersion()));
|
||||||
error = B_ERROR;
|
error = B_ERROR;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ struct reiserfs_de_head
|
|||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// super block's field values
|
// superblock's field values
|
||||||
//
|
//
|
||||||
#define REISERFS_VERSION_0 0 /* undistributed bitmap */
|
#define REISERFS_VERSION_0 0 /* undistributed bitmap */
|
||||||
#define REISERFS_VERSION_1 1 /* distributed bitmap and resizer*/
|
#define REISERFS_VERSION_1 1 /* distributed bitmap and resizer*/
|
||||||
@@ -232,7 +232,7 @@ struct reiserfs_de_head
|
|||||||
#define R5_HASH 3
|
#define R5_HASH 3
|
||||||
#define DEFAULT_HASH R5_HASH
|
#define DEFAULT_HASH R5_HASH
|
||||||
|
|
||||||
/* this is the on disk super block */
|
/* this is the on disk superblock */
|
||||||
|
|
||||||
struct reiserfs_super_block
|
struct reiserfs_super_block
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ file_system obfs {
|
|||||||
is_buffer false
|
is_buffer false
|
||||||
}
|
}
|
||||||
|
|
||||||
# dump super block
|
# dump superblock
|
||||||
ioctl 56743 {
|
ioctl 56743 {
|
||||||
buffer_size 0
|
buffer_size 0
|
||||||
write_buffer_size 0
|
write_buffer_size 0
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ main(int argc, char **argv)
|
|||||||
if (argc < 2 || !strcmp(argv[1], "--help")) {
|
if (argc < 2 || !strcmp(argv[1], "--help")) {
|
||||||
char *filename = strrchr(argv[0],'/');
|
char *filename = strrchr(argv[0],'/');
|
||||||
fprintf(stderr,"usage: %s [-srib] <device> [allocation_group start]\n"
|
fprintf(stderr,"usage: %s [-srib] <device> [allocation_group start]\n"
|
||||||
"\t-s\tdump super block\n"
|
"\t-s\tdump superblock\n"
|
||||||
"\t-r\tdump root node\n"
|
"\t-r\tdump root node\n"
|
||||||
" the following options need the allocation_group/start "
|
" the following options need the allocation_group/start "
|
||||||
"parameters:\n"
|
"parameters:\n"
|
||||||
@@ -214,7 +214,7 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (disk.ValidateSuperBlock() < B_OK) {
|
if (disk.ValidateSuperBlock() < B_OK) {
|
||||||
fprintf(stderr, "The disk's super block is corrupt (or it's not a BFS "
|
fprintf(stderr, "The disk's superblock is corrupt (or it's not a BFS "
|
||||||
"device)!\n");
|
"device)!\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -286,7 +286,7 @@ main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (disk.ValidateSuperBlock() != B_OK) {
|
if (disk.ValidateSuperBlock() != B_OK) {
|
||||||
fprintf(stderr, "The disk's super block is corrupt!\n");
|
fprintf(stderr, "The disk's superblock is corrupt!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,7 +307,7 @@ main(int argc, char** argv)
|
|||||||
disk.Log().allocation_group, disk.Log().start,
|
disk.Log().allocation_group, disk.Log().start,
|
||||||
disk.Log().length);
|
disk.Log().length);
|
||||||
} else if (block < 1) {
|
} else if (block < 1) {
|
||||||
printf("Super Block intersects\n");
|
printf("Superblock intersects\n");
|
||||||
} else if (block < 1 + disk.BitmapSize()) {
|
} else if (block < 1 + disk.BitmapSize()) {
|
||||||
printf("Block bitmap intersects (start %d, end %lu)\n", 1,
|
printf("Block bitmap intersects (start %d, end %lu)\n", 1,
|
||||||
disk.BitmapSize());
|
disk.BitmapSize());
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#ifndef DISK_H
|
#ifndef DISK_H
|
||||||
#define DISK_H
|
#define DISK_H
|
||||||
/* Disk - handles BFS super block, disk access etc.
|
/* Disk - handles BFS superblock, disk access etc.
|
||||||
**
|
**
|
||||||
** Copyright (c) 2001-2003 pinc Software. All Rights Reserved.
|
** Copyright (c) 2001-2003 pinc Software. All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -709,7 +709,7 @@ usage(char *name)
|
|||||||
"\t-i\trecreate indices on target disk\n"
|
"\t-i\trecreate indices on target disk\n"
|
||||||
"\t-d\tdump missing and recreated i-nodes\n"
|
"\t-d\tdump missing and recreated i-nodes\n"
|
||||||
"\t-r\tdisk access in raw mode (use only if the partition table is invalid)\n"
|
"\t-r\tdisk access in raw mode (use only if the partition table is invalid)\n"
|
||||||
"\t-s\trecreate super block and exit (for experts only, don't use this\n"
|
"\t-s\trecreate superblock and exit (for experts only, don't use this\n"
|
||||||
"\t\tif you don't know what you're doing)\n"
|
"\t\tif you don't know what you're doing)\n"
|
||||||
"\t-v\tverbose output\n", name);
|
"\t-v\tverbose output\n", name);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
@@ -804,15 +804,15 @@ main(int argc, char **argv)
|
|||||||
bool recreatedSuperBlock = false;
|
bool recreatedSuperBlock = false;
|
||||||
|
|
||||||
if (disk.ValidateSuperBlock() < B_OK) {
|
if (disk.ValidateSuperBlock() < B_OK) {
|
||||||
fprintf(stderr, "The disk's super block is corrupt!\n");
|
fprintf(stderr, "The disk's superblock is corrupt!\n");
|
||||||
if (disk.RecreateSuperBlock() < B_OK) {
|
if (disk.RecreateSuperBlock() < B_OK) {
|
||||||
fprintf(stderr, "Can't recreate the disk's super block, sorry!\n");
|
fprintf(stderr, "Can't recreate the disk's superblock, sorry!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
recreatedSuperBlock = true;
|
recreatedSuperBlock = true;
|
||||||
}
|
}
|
||||||
if (gVerbose) {
|
if (gVerbose) {
|
||||||
puts("\n*** The super block:\n");
|
puts("\n*** The superblock:\n");
|
||||||
dump_super_block(disk.SuperBlock());
|
dump_super_block(disk.SuperBlock());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -825,7 +825,7 @@ main(int argc, char **argv)
|
|||||||
status_t status = disk.WriteAt(512, disk.SuperBlock(),
|
status_t status = disk.WriteAt(512, disk.SuperBlock(),
|
||||||
sizeof(disk_super_block));
|
sizeof(disk_super_block));
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
fprintf(stderr, "Could not write super block: %s!\n",
|
fprintf(stderr, "Could not write superblock: %s!\n",
|
||||||
strerror(status));
|
strerror(status));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ sync \- flush file system buffers
|
|||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.\" Add any additional description here
|
.\" Add any additional description here
|
||||||
.PP
|
.PP
|
||||||
Force changed blocks to disk, update the super block.
|
Force changed blocks to disk, update the superblock.
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-help\fR
|
\fB\-\-help\fR
|
||||||
display this help and exit
|
display this help and exit
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* sync - update the super block
|
/* sync - update the superblock
|
||||||
Copyright (C) 1994-2004, 2008-2010 Free Software Foundation, Inc.
|
Copyright (C) 1994-2004, 2008-2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
@@ -40,7 +40,7 @@ usage (int status)
|
|||||||
{
|
{
|
||||||
printf (_("Usage: %s [OPTION]\n"), program_name);
|
printf (_("Usage: %s [OPTION]\n"), program_name);
|
||||||
fputs (_("\
|
fputs (_("\
|
||||||
Force changed blocks to disk, update the super block.\n\
|
Force changed blocks to disk, update the superblock.\n\
|
||||||
\n\
|
\n\
|
||||||
"), stdout);
|
"), stdout);
|
||||||
fputs (HELP_OPTION_DESCRIPTION, stdout);
|
fputs (HELP_OPTION_DESCRIPTION, stdout);
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ Volume::Volume(boot::Partition *partition)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE(("bfs: we do have a valid super block (name = %s)!\n", fSuperBlock.name));
|
TRACE(("bfs: we do have a valid superblock (name = %s)!\n", fSuperBlock.name));
|
||||||
|
|
||||||
fRootNode = new(nothrow) BFS::Directory(*this, Root());
|
fRootNode = new(nothrow) BFS::Directory(*this, Root());
|
||||||
if (fRootNode == NULL)
|
if (fRootNode == NULL)
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ fill_disk_identifier_v2(disk_identifier &disk, const drive_parameters ¶meter
|
|||||||
static off_t
|
static off_t
|
||||||
get_next_check_sum_offset(int32 index, off_t maxSize)
|
get_next_check_sum_offset(int32 index, off_t maxSize)
|
||||||
{
|
{
|
||||||
// The boot block often contains the disk super block, and should be
|
// The boot block often contains the disk superblock, and should be
|
||||||
// unique enough for most cases
|
// unique enough for most cases
|
||||||
if (index < 2)
|
if (index < 2)
|
||||||
return index * 512;
|
return index * 512;
|
||||||
|
|||||||
@@ -368,7 +368,7 @@ fill_disk_identifier_v2(disk_identifier &disk, const drive_parameters ¶meter
|
|||||||
static off_t
|
static off_t
|
||||||
get_next_check_sum_offset(int32 index, off_t maxSize)
|
get_next_check_sum_offset(int32 index, off_t maxSize)
|
||||||
{
|
{
|
||||||
// The boot block often contains the disk super block, and should be
|
// The boot block often contains the disk superblock, and should be
|
||||||
// unique enough for most cases
|
// unique enough for most cases
|
||||||
if (index < 2)
|
if (index < 2)
|
||||||
return index * 512;
|
return index * 512;
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ dumpLogEntry(int device, disk_super_block &superBlock, int32 &start, uint8 *bloc
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
off_t value = array[arrayIndex];
|
off_t value = array[arrayIndex];
|
||||||
printf("%7ld: %Ld%s\n", index, value, value == 0 ? " (super block)" :
|
printf("%7ld: %Ld%s\n", index, value, value == 0 ? " (superblock)" :
|
||||||
value < bitmapSize + 1 ? " (bitmap block)" : "");
|
value < bitmapSize + 1 ? " (bitmap block)" : "");
|
||||||
|
|
||||||
if (data != NULL) {
|
if (data != NULL) {
|
||||||
@@ -208,12 +208,12 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
disk_super_block superBlock;
|
disk_super_block superBlock;
|
||||||
if (read_pos(device, 512, &superBlock, sizeof(disk_super_block)) < (ssize_t)sizeof(disk_super_block)) {
|
if (read_pos(device, 512, &superBlock, sizeof(disk_super_block)) < (ssize_t)sizeof(disk_super_block)) {
|
||||||
fprintf(stderr, "%s: could not read super block.\n", sProgramName);
|
fprintf(stderr, "%s: could not read superblock.\n", sProgramName);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!superBlock.IsValid()) {
|
if (!superBlock.IsValid()) {
|
||||||
fprintf(stderr, "%s: invalid super block!\n", sProgramName);
|
fprintf(stderr, "%s: invalid superblock!\n", sProgramName);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -568,7 +568,7 @@ BlockAllocator::AllocateBlocks(Transaction *transaction, int32 group, uint16 sta
|
|||||||
|
|
||||||
fVolume->SuperBlock().used_blocks =
|
fVolume->SuperBlock().used_blocks =
|
||||||
HOST_ENDIAN_TO_BFS_INT64(fVolume->UsedBlocks() + numBlocks);
|
HOST_ENDIAN_TO_BFS_INT64(fVolume->UsedBlocks() + numBlocks);
|
||||||
// We are not writing back the disk's super block - it's
|
// We are not writing back the disk's superblock - it's
|
||||||
// either done by the journaling code, or when the disk
|
// either done by the journaling code, or when the disk
|
||||||
// is unmounted.
|
// is unmounted.
|
||||||
// If the value is not correct at mount time, it will be
|
// If the value is not correct at mount time, it will be
|
||||||
|
|||||||
@@ -1928,7 +1928,7 @@ Inode::Remove(Transaction *transaction, const char *name, off_t *_id, bool isDir
|
|||||||
* adds the created inode to that parent directory. If an attribute directory
|
* adds the created inode to that parent directory. If an attribute directory
|
||||||
* is created, it will also automatically added to the parent inode as such.
|
* is created, it will also automatically added to the parent inode as such.
|
||||||
* However, the indices root node, and the regular root node won't be added
|
* However, the indices root node, and the regular root node won't be added
|
||||||
* to the super block.
|
* to the superblock.
|
||||||
* It will also create the initial B+tree for the inode if it's a directory
|
* It will also create the initial B+tree for the inode if it's a directory
|
||||||
* of any kind.
|
* of any kind.
|
||||||
* If the "_id" or "_inode" variable is given and non-NULL to store the inode's
|
* If the "_id" or "_inode" variable is given and non-NULL to store the inode's
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ Journal::blockNotify(off_t blockNumber, size_t numBlocks, void *arg)
|
|||||||
|
|
||||||
free(logEntry);
|
free(logEntry);
|
||||||
|
|
||||||
// update the super block, and change the disk's state, if necessary
|
// update the superblock, and change the disk's state, if necessary
|
||||||
|
|
||||||
if (update) {
|
if (update) {
|
||||||
journal->fVolume->LogStart() = superBlock.log_start;
|
journal->fVolume->LogStart() = superBlock.log_start;
|
||||||
@@ -317,7 +317,7 @@ Journal::blockNotify(off_t blockNumber, size_t numBlocks, void *arg)
|
|||||||
|
|
||||||
status_t status = journal->fVolume->WriteSuperBlock();
|
status_t status = journal->fVolume->WriteSuperBlock();
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
FATAL(("blockNotify: could not write back super block: %s\n", strerror(status)));
|
FATAL(("blockNotify: could not write back superblock: %s\n", strerror(status)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -421,7 +421,7 @@ Journal::WriteLogEntry()
|
|||||||
|
|
||||||
fUsed += array->CountItems();
|
fUsed += array->CountItems();
|
||||||
|
|
||||||
// Update the log end pointer in the super block
|
// Update the log end pointer in the superblock
|
||||||
fVolume->SuperBlock().flags = HOST_ENDIAN_TO_BFS_INT32(SUPER_BLOCK_DISK_DIRTY);
|
fVolume->SuperBlock().flags = HOST_ENDIAN_TO_BFS_INT32(SUPER_BLOCK_DISK_DIRTY);
|
||||||
fVolume->SuperBlock().log_end = HOST_ENDIAN_TO_BFS_INT64(logPosition);
|
fVolume->SuperBlock().log_end = HOST_ENDIAN_TO_BFS_INT64(logPosition);
|
||||||
fVolume->LogEnd() = logPosition;
|
fVolume->LogEnd() = logPosition;
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ kernel_interface
|
|||||||
general stuff
|
general stuff
|
||||||
|
|
||||||
- There are also some comments with a leading "ToDo:" directly in the code which may not be mentioned here.
|
- There are also some comments with a leading "ToDo:" directly in the code which may not be mentioned here.
|
||||||
- implement mkbfs (try to do it in OpenBeOS style directly - only write the super block from user space)
|
- implement mkbfs (try to do it in OpenBeOS style directly - only write the superblock from user space)
|
||||||
|
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|||||||
+4
-4
@@ -30,10 +30,10 @@ using std::nothrow;
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class DirEntry
|
\class DirEntry
|
||||||
\brief Represents the on-disk structure for super block of the FS.
|
\brief Represents the on-disk structure for superblock of the FS.
|
||||||
|
|
||||||
There exist two versions of the structure and this class can deal with
|
There exist two versions of the structure and this class can deal with
|
||||||
both of them. The Init() methods tries to find and read the super block
|
both of them. The Init() methods tries to find and read the superblock
|
||||||
from disk.
|
from disk.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -46,13 +46,13 @@ read_super_block(int device, off_t offset, const char *magic,
|
|||||||
{
|
{
|
||||||
super_block_t *superBlock = NULL;
|
super_block_t *superBlock = NULL;
|
||||||
status_t error = B_OK;
|
status_t error = B_OK;
|
||||||
// allocate memory for the super block
|
// allocate memory for the superblock
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
superBlock = new(nothrow) super_block_t;
|
superBlock = new(nothrow) super_block_t;
|
||||||
if (!superBlock)
|
if (!superBlock)
|
||||||
error = B_NO_MEMORY;
|
error = B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
// read the super block
|
// read the superblock
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
size_t size = sizeof(super_block_t);
|
size_t size = sizeof(super_block_t);
|
||||||
if (read_pos(device, offset, superBlock, size) != (int32)size)
|
if (read_pos(device, offset, superBlock, size) != (int32)size)
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ static inline C max(const C &a, const C &b) { return (a > b ? a : b); }
|
|||||||
\brief Represents a volume.
|
\brief Represents a volume.
|
||||||
|
|
||||||
The Volume class bundles all functionality related to a volume.
|
The Volume class bundles all functionality related to a volume.
|
||||||
It knows the super block and has some basic functionality needed
|
It knows the superblock and has some basic functionality needed
|
||||||
for handling VNodes. Actually it should be the layer that provides the
|
for handling VNodes. Actually it should be the layer that provides the
|
||||||
abstraction from VNodes. The design is not strict in this respect
|
abstraction from VNodes. The design is not strict in this respect
|
||||||
(the whole thing evolved while I was in the process of understanding
|
(the whole thing evolved while I was in the process of understanding
|
||||||
@@ -111,7 +111,7 @@ Volume::Mount(nspace_id id, const char *path)
|
|||||||
if (fDevice < 0)
|
if (fDevice < 0)
|
||||||
SET_ERROR(error, errno);
|
SET_ERROR(error, errno);
|
||||||
}
|
}
|
||||||
// read and analyze super block
|
// read and analyze superblock
|
||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
error = _ReadSuperBlock();
|
error = _ReadSuperBlock();
|
||||||
// create and init block cache
|
// create and init block cache
|
||||||
@@ -497,12 +497,12 @@ Volume::_ReadSuperBlock()
|
|||||||
error = B_NO_MEMORY;
|
error = B_NO_MEMORY;
|
||||||
// check FS state
|
// check FS state
|
||||||
if (error == B_OK && fSuperBlock->GetState() != REISERFS_VALID_FS) {
|
if (error == B_OK && fSuperBlock->GetState() != REISERFS_VALID_FS) {
|
||||||
FATAL(("The super block indicates a non-valid FS! Bailing out."));
|
FATAL(("The superblock indicates a non-valid FS! Bailing out."));
|
||||||
error = B_ERROR;
|
error = B_ERROR;
|
||||||
}
|
}
|
||||||
// check FS version
|
// check FS version
|
||||||
if (error == B_OK && fSuperBlock->GetVersion() > REISERFS_VERSION_2) {
|
if (error == B_OK && fSuperBlock->GetVersion() > REISERFS_VERSION_2) {
|
||||||
FATAL(("The super block indicates a version greater than 2 (%u)! "
|
FATAL(("The superblock indicates a version greater than 2 (%u)! "
|
||||||
"Bailing out.", fSuperBlock->GetVersion()));
|
"Bailing out.", fSuperBlock->GetVersion()));
|
||||||
error = B_ERROR;
|
error = B_ERROR;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ struct reiserfs_de_head
|
|||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// super block's field values
|
// superblock's field values
|
||||||
//
|
//
|
||||||
#define REISERFS_VERSION_0 0 /* undistributed bitmap */
|
#define REISERFS_VERSION_0 0 /* undistributed bitmap */
|
||||||
#define REISERFS_VERSION_1 1 /* distributed bitmap and resizer*/
|
#define REISERFS_VERSION_1 1 /* distributed bitmap and resizer*/
|
||||||
@@ -232,7 +232,7 @@ struct reiserfs_de_head
|
|||||||
#define R5_HASH 3
|
#define R5_HASH 3
|
||||||
#define DEFAULT_HASH R5_HASH
|
#define DEFAULT_HASH R5_HASH
|
||||||
|
|
||||||
/* this is the on disk super block */
|
/* this is the on disk superblock */
|
||||||
|
|
||||||
struct reiserfs_super_block
|
struct reiserfs_super_block
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ file_system obfs {
|
|||||||
is_buffer false
|
is_buffer false
|
||||||
}
|
}
|
||||||
|
|
||||||
# dump super block
|
# dump superblock
|
||||||
ioctl 56743 {
|
ioctl 56743 {
|
||||||
buffer_size 0
|
buffer_size 0
|
||||||
write_buffer_size 0
|
write_buffer_size 0
|
||||||
|
|||||||
@@ -722,7 +722,7 @@ BlockAllocator::_FreeInBitmapBlock(uint64 base, uint32 count,
|
|||||||
status_t
|
status_t
|
||||||
BlockAllocator::_UpdateSuperBlock(Transaction& transaction)
|
BlockAllocator::_UpdateSuperBlock(Transaction& transaction)
|
||||||
{
|
{
|
||||||
// write the super block
|
// write the superblock
|
||||||
Block block;
|
Block block;
|
||||||
if (!block.GetWritable(fVolume, kCheckSumFSSuperBlockOffset / B_PAGE_SIZE,
|
if (!block.GetWritable(fVolume, kCheckSumFSSuperBlockOffset / B_PAGE_SIZE,
|
||||||
transaction)) {
|
transaction)) {
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ Volume::Initialize(const char* name)
|
|||||||
transaction.KeepNode(fRootDirectory);
|
transaction.KeepNode(fRootDirectory);
|
||||||
fRootDirectory->SetHardLinks(1);
|
fRootDirectory->SetHardLinks(1);
|
||||||
|
|
||||||
// write the super block
|
// write the superblock
|
||||||
Block block;
|
Block block;
|
||||||
if (!block.GetZero(this, kCheckSumFSSuperBlockOffset / B_PAGE_SIZE,
|
if (!block.GetZero(this, kCheckSumFSSuperBlockOffset / B_PAGE_SIZE,
|
||||||
transaction)) {
|
transaction)) {
|
||||||
@@ -432,7 +432,7 @@ Volume::SetName(const char* name)
|
|||||||
// we lock the volume now, to keep the locking order (transaction -> volume)
|
// we lock the volume now, to keep the locking order (transaction -> volume)
|
||||||
MutexLocker locker(fLock);
|
MutexLocker locker(fLock);
|
||||||
|
|
||||||
// update the super block
|
// update the superblock
|
||||||
Block block;
|
Block block;
|
||||||
if (!block.GetWritable(this, kCheckSumFSSuperBlockOffset / B_PAGE_SIZE,
|
if (!block.GetWritable(this, kCheckSumFSSuperBlockOffset / B_PAGE_SIZE,
|
||||||
transaction)) {
|
transaction)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user