Use the new get_default_partition_content_name() to construct a useful
volume name -- ReiserFS volumes don't support names. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26404 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -78,6 +78,7 @@ Volume::Volume()
|
||||
fSettings(NULL),
|
||||
fNegativeEntries()
|
||||
{
|
||||
fVolumeName[0] = '\0';
|
||||
}
|
||||
|
||||
// destructor
|
||||
@@ -86,6 +87,7 @@ Volume::~Volume()
|
||||
Unmount();
|
||||
}
|
||||
|
||||
|
||||
// Identify
|
||||
status_t
|
||||
Volume::Identify(int fd, partition_data *partition)
|
||||
@@ -131,6 +133,10 @@ Volume::Mount(fs_volume *fsVolume, const char *path)
|
||||
// read and analyze super block
|
||||
if (error == B_OK)
|
||||
error = _ReadSuperBlock();
|
||||
|
||||
if (error == B_OK)
|
||||
UpdateName(fsVolume->partition);
|
||||
|
||||
// create and init block cache
|
||||
if (error == B_OK) {
|
||||
fBlockCache = new(nothrow) BlockCache;
|
||||
@@ -248,9 +254,21 @@ Volume::CountFreeBlocks() const
|
||||
const char *
|
||||
Volume::GetName() const
|
||||
{
|
||||
return fSettings->GetVolumeName();
|
||||
return fVolumeName;
|
||||
}
|
||||
|
||||
|
||||
// UpdateName
|
||||
void
|
||||
Volume::UpdateName(partition_id partitionID)
|
||||
{
|
||||
if (get_default_partition_content_name(partitionID, "ReiserFS",
|
||||
fVolumeName, sizeof(fVolumeName)) != B_OK) {
|
||||
strlcpy(fVolumeName, "ReiserFS Volume", sizeof(fVolumeName));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// GetDeviceName
|
||||
const char *
|
||||
Volume::GetDeviceName() const
|
||||
@@ -658,4 +676,3 @@ Volume::_InitNegativeEntries()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ public:
|
||||
off_t CountBlocks() const;
|
||||
off_t CountFreeBlocks() const;
|
||||
const char *GetName() const;
|
||||
void UpdateName(partition_id partitionID);
|
||||
const char *GetDeviceName() const;
|
||||
|
||||
BlockCache *GetBlockCache() const { return fBlockCache; }
|
||||
@@ -102,6 +103,7 @@ private:
|
||||
char *fDeviceName;
|
||||
Settings *fSettings;
|
||||
List<ino_t> fNegativeEntries;
|
||||
char fVolumeName[B_OS_NAME_LENGTH];
|
||||
};
|
||||
|
||||
#endif // VOLUME_H
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// kernel_interface.cpp
|
||||
//
|
||||
// Copyright (c) 2003-2004, Ingo Weinhold ([email protected])
|
||||
// Copyright (c) 2003-2008, Ingo Weinhold ([email protected])
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@@ -88,8 +88,10 @@ reiserfs_scan_partition(int fd, partition_data *partition, void *_cookie)
|
||||
partition->content_size = volume->CountBlocks()
|
||||
* volume->GetBlockSize();
|
||||
partition->block_size = volume->GetBlockSize();
|
||||
// TODO: Construct name from partition layout?
|
||||
partition->content_name = strdup("Untitled ReiserFS");
|
||||
|
||||
volume->UpdateName(partition->id);
|
||||
// must be done after setting the content size
|
||||
partition->content_name = strdup(volume->GetName());
|
||||
if (partition->content_name == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
@@ -163,9 +165,9 @@ reiserfs_read_fs_info(fs_volume* fs, struct fs_info *info)
|
||||
info->io_size = kOptimalIOSize;
|
||||
info->total_blocks = volume->CountBlocks();
|
||||
info->free_blocks = volume->CountFreeBlocks();
|
||||
strncpy(info->device_name, volume->GetDeviceName(),
|
||||
strlcpy(info->device_name, volume->GetDeviceName(),
|
||||
sizeof(info->device_name));
|
||||
strncpy(info->volume_name, volume->GetName(), sizeof(info->volume_name));
|
||||
strlcpy(info->volume_name, volume->GetName(), sizeof(info->volume_name));
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user