- Adds parameters column to DriveSetup.
- Parse and display "active" parameter. Fixes ticket: #4417 - Removes const declaration in PartitionMap::Check. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38987 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -805,15 +805,15 @@ PartitionMap::Check(off_t sessionSize) const
|
|||||||
|
|
||||||
// 2. check overlapping of partitions and location of partition tables
|
// 2. check overlapping of partitions and location of partition tables
|
||||||
bool result = true;
|
bool result = true;
|
||||||
const Partition** byOffset = new(nothrow) const Partition*[partitionCount];
|
Partition** byOffset = new(nothrow) Partition*[partitionCount];
|
||||||
off_t* tableOffsets = new(nothrow) off_t[partitionCount - 3];
|
off_t* tableOffsets = new(nothrow) off_t[partitionCount - 3];
|
||||||
if (byOffset && tableOffsets) {
|
if (byOffset && tableOffsets) {
|
||||||
// fill the arrays
|
// fill the arrays
|
||||||
int32 byOffsetCount = 0;
|
int32 byOffsetCount = 0;
|
||||||
int32 tableOffsetCount = 1; // primary partition table
|
int32 tableOffsetCount = 1; // primary partition table
|
||||||
tableOffsets[0] = 0; //
|
tableOffsets[0] = 0;
|
||||||
for (int32 i = 0; i < partitionCount; i++) {
|
for (int32 i = 0; i < partitionCount; i++) {
|
||||||
const Partition* partition = PartitionAt(i);
|
Partition* partition = (Partition*)PartitionAt(i);
|
||||||
if (!partition->IsExtended())
|
if (!partition->IsExtended())
|
||||||
byOffset[byOffsetCount++] = partition;
|
byOffset[byOffsetCount++] = partition;
|
||||||
|
|
||||||
@@ -825,16 +825,16 @@ PartitionMap::Check(off_t sessionSize) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sort the arrays
|
// sort the arrays
|
||||||
qsort(byOffset, byOffsetCount, sizeof(const Partition*),
|
qsort(byOffset, byOffsetCount, sizeof(Partition*),
|
||||||
cmp_partition_offset);
|
cmp_partition_offset);
|
||||||
qsort(tableOffsets, tableOffsetCount, sizeof(off_t), cmp_offset);
|
qsort(tableOffsets, tableOffsetCount, sizeof(off_t), cmp_offset);
|
||||||
|
|
||||||
// check for overlappings
|
// check for overlappings
|
||||||
off_t nextOffset = 0;
|
off_t nextOffset = 0;
|
||||||
for (int32 i = 0; i < byOffsetCount; i++) {
|
for (int32 i = 0; i < byOffsetCount; i++) {
|
||||||
const Partition* partition = byOffset[i];
|
Partition* partition = byOffset[i];
|
||||||
if (partition->Offset() < nextOffset && i > 0) {
|
if (partition->Offset() < nextOffset && i > 0) {
|
||||||
Partition* previousPartition = (Partition*)byOffset[i - 1];
|
Partition* previousPartition = byOffset[i - 1];
|
||||||
off_t previousSize = previousPartition->Size()
|
off_t previousSize = previousPartition->Size()
|
||||||
- (nextOffset - partition->Offset());
|
- (nextOffset - partition->Offset());
|
||||||
TRACE(("intel: PartitionMap::Check(): "));
|
TRACE(("intel: PartitionMap::Check(): "));
|
||||||
@@ -860,8 +860,8 @@ PartitionMap::Check(off_t sessionSize) const
|
|||||||
"for different extended partitions!\n"));
|
"for different extended partitions!\n"));
|
||||||
result = false;
|
result = false;
|
||||||
break;
|
break;
|
||||||
} else if (is_inside_partitions(tableOffsets[i], byOffset,
|
} else if (is_inside_partitions(tableOffsets[i],
|
||||||
byOffsetCount)) {
|
(const Partition**)byOffset, byOffsetCount)) {
|
||||||
TRACE(("intel: PartitionMap::Check(): a partition table "
|
TRACE(("intel: PartitionMap::Check(): a partition table "
|
||||||
"lies inside a non-extended partition!\n"));
|
"lies inside a non-extended partition!\n"));
|
||||||
result = false;
|
result = false;
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
#include <Locale.h>
|
#include <Locale.h>
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
|
|
||||||
|
#include <driver_settings.h>
|
||||||
|
|
||||||
#include "Support.h"
|
#include "Support.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -184,7 +186,8 @@ enum {
|
|||||||
kFilesystemColumn,
|
kFilesystemColumn,
|
||||||
kVolumeNameColumn,
|
kVolumeNameColumn,
|
||||||
kMountedAtColumn,
|
kMountedAtColumn,
|
||||||
kSizeColumn
|
kSizeColumn,
|
||||||
|
kParametersColumn
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -231,6 +234,24 @@ PartitionListRow::PartitionListRow(BPartition* partition)
|
|||||||
char size[1024];
|
char size[1024];
|
||||||
SetField(new BStringField(string_for_size(partition->Size(), size,
|
SetField(new BStringField(string_for_size(partition->Size(), size,
|
||||||
sizeof(size))), kSizeColumn);
|
sizeof(size))), kSizeColumn);
|
||||||
|
|
||||||
|
if (partition->Parameters() != NULL) {
|
||||||
|
BString parameters;
|
||||||
|
|
||||||
|
// check parameters
|
||||||
|
void* handle = parse_driver_settings_string(partition->Parameters());
|
||||||
|
if (handle != NULL) {
|
||||||
|
bool active = get_driver_boolean_parameter(handle, "active", false, true);
|
||||||
|
if (active)
|
||||||
|
parameters += "Active";
|
||||||
|
|
||||||
|
delete_driver_settings(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetField(new BStringField(parameters), kParametersColumn);
|
||||||
|
} else {
|
||||||
|
SetField(new BStringField(kUnavailableString), kParametersColumn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -273,6 +294,8 @@ PartitionListView::PartitionListView(const BRect& frame, uint32 resizeMode)
|
|||||||
B_TRUNCATE_MIDDLE), kMountedAtColumn);
|
B_TRUNCATE_MIDDLE), kMountedAtColumn);
|
||||||
AddColumn(new PartitionColumn(B_TRANSLATE("Size"), 100, 50, 500,
|
AddColumn(new PartitionColumn(B_TRANSLATE("Size"), 100, 50, 500,
|
||||||
B_TRUNCATE_END, B_ALIGN_RIGHT), kSizeColumn);
|
B_TRUNCATE_END, B_ALIGN_RIGHT), kSizeColumn);
|
||||||
|
AddColumn(new PartitionColumn(B_TRANSLATE("Parameters"), 150, 50, 500,
|
||||||
|
B_TRUNCATE_MIDDLE), kParametersColumn);
|
||||||
|
|
||||||
SetSortingEnabled(false);
|
SetSortingEnabled(false);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user