Patch by Sean Bartell:
* SuperBlock: In case of ReiserFS 3.6 we were stil loading only the old superblock format. * Added support for ReiserFS labels (volume names). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36132 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -109,7 +109,7 @@ PRINT(("SuperBlock: ReiserFS 3.5\n"));
|
|||||||
fFormatVersion = REISERFS_3_5;
|
fFormatVersion = REISERFS_3_5;
|
||||||
// try new version and new layout
|
// try new version and new layout
|
||||||
} else if (read_super_block(device, REISERFS_DISK_OFFSET_IN_BYTES + offset,
|
} else if (read_super_block(device, REISERFS_DISK_OFFSET_IN_BYTES + offset,
|
||||||
REISER2FS_SUPER_MAGIC_STRING, &fOldData) == B_OK) {
|
REISER2FS_SUPER_MAGIC_STRING, &fCurrentData) == B_OK) {
|
||||||
PRINT(("SuperBlock: ReiserFS 3.6\n"));
|
PRINT(("SuperBlock: ReiserFS 3.6\n"));
|
||||||
fFormatVersion = REISERFS_3_6;
|
fFormatVersion = REISERFS_3_6;
|
||||||
// failure
|
// failure
|
||||||
@@ -119,3 +119,16 @@ PRINT(("SuperBlock: ReiserFS 3.6\n"));
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// GetLabel
|
||||||
|
status_t
|
||||||
|
SuperBlock::GetLabel(char* buffer, size_t bufferSize) const
|
||||||
|
{
|
||||||
|
if (GetFormatVersion() == REISERFS_3_6 && fCurrentData->s_label[0]) {
|
||||||
|
size_t len = MIN(sizeof(fCurrentData->s_label), bufferSize - 1);
|
||||||
|
memcpy(buffer, fCurrentData->s_label, len);
|
||||||
|
buffer[len] = '\0';
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
return B_ENTRY_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|||||||
@@ -85,6 +85,8 @@ public:
|
|||||||
: le2h(fOldData->s_tree_height));
|
: le2h(fOldData->s_tree_height));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
status_t GetLabel(char* buffer, size_t bufferSize) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32 fFormatVersion;
|
uint32 fFormatVersion;
|
||||||
union {
|
union {
|
||||||
|
|||||||
@@ -262,10 +262,12 @@ Volume::GetName() const
|
|||||||
void
|
void
|
||||||
Volume::UpdateName(partition_id partitionID)
|
Volume::UpdateName(partition_id partitionID)
|
||||||
{
|
{
|
||||||
|
if (fSuperBlock->GetLabel(fVolumeName, sizeof(fVolumeName)) == B_OK)
|
||||||
|
return;
|
||||||
if (get_default_partition_content_name(partitionID, "ReiserFS",
|
if (get_default_partition_content_name(partitionID, "ReiserFS",
|
||||||
fVolumeName, sizeof(fVolumeName)) != B_OK) {
|
fVolumeName, sizeof(fVolumeName)) == B_OK)
|
||||||
strlcpy(fVolumeName, "ReiserFS Volume", sizeof(fVolumeName));
|
return;
|
||||||
}
|
strlcpy(fVolumeName, "ReiserFS Volume", sizeof(fVolumeName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -272,7 +272,14 @@ struct reiserfs_super_block
|
|||||||
superblock. -Hans */
|
superblock. -Hans */
|
||||||
uint16 s_reserved;
|
uint16 s_reserved;
|
||||||
uint32 s_inode_generation;
|
uint32 s_inode_generation;
|
||||||
char s_unused[124] ; /* zero filled by mkreiserfs */
|
uint32 s_flags;
|
||||||
|
char s_uuid[16];
|
||||||
|
char s_label[16];
|
||||||
|
uint16 s_mnt_count;
|
||||||
|
uint16 s_max_mnt_count;
|
||||||
|
uint32 s_lastcheck;
|
||||||
|
uint32 s_check_interval;
|
||||||
|
char s_unused[76] ; /* zero filled by mkreiserfs */
|
||||||
} _PACKED;
|
} _PACKED;
|
||||||
|
|
||||||
#define SB_SIZE (sizeof(struct reiserfs_super_block))
|
#define SB_SIZE (sizeof(struct reiserfs_super_block))
|
||||||
|
|||||||
Reference in New Issue
Block a user