Support for the added partition content size attribute.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4128 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
ace55d9bfc
commit
738e4a700b
@ -57,6 +57,9 @@ public:
|
||||
void SetSize(off_t size);
|
||||
off_t Size() const;
|
||||
|
||||
void SetContentSize(off_t size);
|
||||
off_t ContentSize() const;
|
||||
|
||||
void SetBlockSize(uint32 blockSize);
|
||||
uint32 BlockSize() const;
|
||||
|
||||
|
@ -397,7 +397,12 @@ bfs_scan_partition(int fd, partition_data *partition, void *cookie)
|
||||
partition->block_size));
|
||||
superBlock = (disk_super_block*)cookie;
|
||||
// fill in the partition_data structure
|
||||
partition->status = B_PARTITION_VALID;
|
||||
partition->content_size
|
||||
= (off_t)superBlock->num_blocks * superBlock->block_size;
|
||||
if (partition->content_size <= partition->size)
|
||||
partition->status = B_PARTITION_VALID;
|
||||
else
|
||||
partition->status = B_PARTITION_CORRUPT;
|
||||
partition->flags |= B_PARTITION_FILE_SYSTEM;
|
||||
partition->block_size = superBlock->block_size;
|
||||
partition->content_name = strdup(superBlock->name);
|
||||
|
@ -533,6 +533,7 @@ pm_scan_partition(int fd, partition_data *partition, void *cookie)
|
||||
| B_PARTITION_READ_ONLY
|
||||
| B_DISK_SYSTEM_SUPPORTS_RESIZING_CHILD;
|
||||
// TODO: Update when write functionality is implemented.
|
||||
partition->content_size = partition->size;
|
||||
// (no content_name and content_parameters)
|
||||
// (content_type is set by the system)
|
||||
partition->content_cookie = map;
|
||||
@ -722,6 +723,7 @@ ep_scan_partition(int fd, partition_data *partition, void *cookie)
|
||||
partition->flags |= B_PARTITION_PARTITIONING_SYSTEM
|
||||
| B_PARTITION_READ_ONLY;
|
||||
// TODO: Update when write functionality is implemented.
|
||||
partition->content_size = partition->size;
|
||||
// (no content_name and content_parameters)
|
||||
// (content_type is set by the system)
|
||||
partition->content_cookie = primary;
|
||||
|
@ -41,6 +41,7 @@ KPartition::KPartition(partition_id id)
|
||||
fPartitionData.id = (id >= 0 ? id : _NextID());
|
||||
fPartitionData.offset = 0;
|
||||
fPartitionData.size = 0;
|
||||
fPartitionData.content_size = 0;
|
||||
fPartitionData.block_size = 0;
|
||||
fPartitionData.child_count = 0;
|
||||
fPartitionData.index = -1;
|
||||
@ -255,6 +256,20 @@ KPartition::Size() const
|
||||
return fPartitionData.size;
|
||||
}
|
||||
|
||||
// SetContentSize
|
||||
void
|
||||
KPartition::SetContentSize(off_t size)
|
||||
{
|
||||
fPartitionData.content_size = size;
|
||||
}
|
||||
|
||||
// ContentSize
|
||||
off_t
|
||||
KPartition::ContentSize() const
|
||||
{
|
||||
return fPartitionData.content_size;
|
||||
}
|
||||
|
||||
// SetBlockSize
|
||||
void
|
||||
KPartition::SetBlockSize(uint32 blockSize)
|
||||
@ -785,6 +800,11 @@ KPartition::UninitializeContents(bool logChanges)
|
||||
SetContentParameters(NULL);
|
||||
flags |= B_PARTITION_CHANGED_CONTENT_PARAMETERS;
|
||||
}
|
||||
// content size
|
||||
if (ContentSize() > 0) {
|
||||
SetContentSize(0);
|
||||
flags |= B_PARTITION_CHANGED_CONTENT_SIZE;
|
||||
}
|
||||
// block size
|
||||
if (Parent() && Parent()->BlockSize() != BlockSize()) {
|
||||
SetBlockSize(Parent()->BlockSize());
|
||||
@ -840,6 +860,7 @@ KPartition::WriteUserData(UserDataWriter &writer, user_partition_data *data)
|
||||
data->shadow_id = -1;
|
||||
data->offset = Offset();
|
||||
data->size = Size();
|
||||
data->content_size = ContentSize();
|
||||
data->block_size = BlockSize();
|
||||
data->status = Status();
|
||||
data->flags = Flags();
|
||||
@ -879,6 +900,7 @@ KPartition::Dump(bool deep, int32 level)
|
||||
OUT("%spartition %ld: %s\n", prefix, ID(), path);
|
||||
OUT("%s offset: %lld\n", prefix, Offset());
|
||||
OUT("%s size: %lld\n", prefix, Size());
|
||||
OUT("%s content size: %lld\n", prefix, ContentSize());
|
||||
OUT("%s block size: %lu\n", prefix, BlockSize());
|
||||
OUT("%s child count: %ld\n", prefix, CountChildren());
|
||||
OUT("%s index: %ld\n", prefix, Index());
|
||||
|
Loading…
Reference in New Issue
Block a user