* Further cleanup while I was at it.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37334 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include "ExtendedPartitionAddOn.h"
|
||||
|
||||
#include <new>
|
||||
@@ -16,16 +17,18 @@
|
||||
|
||||
#include "IntelDiskSystem.h"
|
||||
|
||||
|
||||
//#define TRACE_EXTENDED_PARTITION_ADD_ON
|
||||
#undef TRACE
|
||||
#ifdef TRACE_EXTENDED_PARTITION_ADD_ON
|
||||
# define TRACE(x...) printf(x)
|
||||
# define TRACE(x...) printf(x)
|
||||
#else
|
||||
# define TRACE(x...) do {} while (false)
|
||||
# define TRACE(x...) do {} while (false)
|
||||
#endif
|
||||
|
||||
#define PTS_OFFSET (63 * Partition()->BlockSize())
|
||||
|
||||
|
||||
using std::nothrow;
|
||||
|
||||
|
||||
@@ -54,20 +57,18 @@ static const uint32 kDiskSystemFlags =
|
||||
// #pragma mark - ExtendedPartitionAddOn
|
||||
|
||||
|
||||
// constructor
|
||||
ExtendedPartitionAddOn::ExtendedPartitionAddOn()
|
||||
: BDiskSystemAddOn(kPartitionTypeIntelExtended, kDiskSystemFlags)
|
||||
:
|
||||
BDiskSystemAddOn(kPartitionTypeIntelExtended, kDiskSystemFlags)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// destructor
|
||||
ExtendedPartitionAddOn::~ExtendedPartitionAddOn()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// CreatePartitionHandle
|
||||
status_t
|
||||
ExtendedPartitionAddOn::CreatePartitionHandle(BMutablePartition* partition,
|
||||
BPartitionHandle** _handle)
|
||||
@@ -88,7 +89,6 @@ ExtendedPartitionAddOn::CreatePartitionHandle(BMutablePartition* partition,
|
||||
}
|
||||
|
||||
|
||||
// CanInitialize
|
||||
bool
|
||||
ExtendedPartitionAddOn::CanInitialize(const BMutablePartition* partition)
|
||||
{
|
||||
@@ -97,7 +97,6 @@ ExtendedPartitionAddOn::CanInitialize(const BMutablePartition* partition)
|
||||
}
|
||||
|
||||
|
||||
// GetInitializationParameterEditor
|
||||
status_t
|
||||
ExtendedPartitionAddOn::GetInitializationParameterEditor(
|
||||
const BMutablePartition* partition, BPartitionParameterEditor** editor)
|
||||
@@ -108,7 +107,6 @@ ExtendedPartitionAddOn::GetInitializationParameterEditor(
|
||||
}
|
||||
|
||||
|
||||
// ValidateInitialize
|
||||
status_t
|
||||
ExtendedPartitionAddOn::ValidateInitialize(const BMutablePartition* partition,
|
||||
BString* name, const char* parameters)
|
||||
@@ -126,7 +124,6 @@ ExtendedPartitionAddOn::ValidateInitialize(const BMutablePartition* partition,
|
||||
}
|
||||
|
||||
|
||||
// Initialize
|
||||
status_t
|
||||
ExtendedPartitionAddOn::Initialize(BMutablePartition* partition,
|
||||
const char* name, const char* parameters, BPartitionHandle** _handle)
|
||||
@@ -164,20 +161,18 @@ ExtendedPartitionAddOn::Initialize(BMutablePartition* partition,
|
||||
// #pragma mark - ExtendedPartitionHandle
|
||||
|
||||
|
||||
// constructor
|
||||
ExtendedPartitionHandle::ExtendedPartitionHandle(BMutablePartition* partition)
|
||||
: BPartitionHandle(partition)
|
||||
:
|
||||
BPartitionHandle(partition)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// destructor
|
||||
ExtendedPartitionHandle::~ExtendedPartitionHandle()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Init
|
||||
status_t
|
||||
ExtendedPartitionHandle::Init()
|
||||
{
|
||||
@@ -234,14 +229,13 @@ ExtendedPartitionHandle::Init()
|
||||
}
|
||||
|
||||
|
||||
// SupportedOperations
|
||||
uint32
|
||||
ExtendedPartitionHandle::SupportedOperations(uint32 mask)
|
||||
{
|
||||
uint32 flags = 0;
|
||||
|
||||
// creating child
|
||||
if (mask & B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD) {
|
||||
if ((mask & B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD) != 0) {
|
||||
BPartitioningInfo info;
|
||||
if (GetPartitioningInfo(&info) == B_OK
|
||||
&& info.CountPartitionableSpaces() > 1) {
|
||||
@@ -253,7 +247,6 @@ ExtendedPartitionHandle::SupportedOperations(uint32 mask)
|
||||
}
|
||||
|
||||
|
||||
// SupportedChildOperations
|
||||
uint32
|
||||
ExtendedPartitionHandle::SupportedChildOperations(
|
||||
const BMutablePartition* child, uint32 mask)
|
||||
@@ -262,7 +255,6 @@ ExtendedPartitionHandle::SupportedChildOperations(
|
||||
}
|
||||
|
||||
|
||||
// GetNextSupportedType
|
||||
status_t
|
||||
ExtendedPartitionHandle::GetNextSupportedType(const BMutablePartition* child,
|
||||
int32* cookie, BString* type)
|
||||
@@ -290,7 +282,6 @@ ExtendedPartitionHandle::GetNextSupportedType(const BMutablePartition* child,
|
||||
}
|
||||
|
||||
|
||||
// GetPartitioningInfo
|
||||
status_t
|
||||
ExtendedPartitionHandle::GetPartitioningInfo(BPartitioningInfo* info)
|
||||
{
|
||||
@@ -325,7 +316,6 @@ ExtendedPartitionHandle::GetPartitioningInfo(BPartitioningInfo* info)
|
||||
}
|
||||
|
||||
|
||||
// GetChildCreationParameterEditor
|
||||
status_t
|
||||
ExtendedPartitionHandle::GetChildCreationParameterEditor(const char* type,
|
||||
BPartitionParameterEditor** editor)
|
||||
@@ -335,7 +325,6 @@ ExtendedPartitionHandle::GetChildCreationParameterEditor(const char* type,
|
||||
}
|
||||
|
||||
|
||||
// ValidateCreateChild
|
||||
status_t
|
||||
ExtendedPartitionHandle::ValidateCreateChild(off_t* _offset, off_t* _size,
|
||||
const char* typeString, BString* name, const char* parameters)
|
||||
@@ -436,7 +425,6 @@ ExtendedPartitionHandle::ValidateCreateChild(off_t* _offset, off_t* _size,
|
||||
}
|
||||
|
||||
|
||||
// CreateChild
|
||||
status_t
|
||||
ExtendedPartitionHandle::CreateChild(off_t offset, off_t size,
|
||||
const char* typeString, const char* name, const char* _parameters,
|
||||
@@ -500,7 +488,6 @@ ExtendedPartitionHandle::CreateChild(off_t offset, off_t size,
|
||||
}
|
||||
|
||||
|
||||
// DeleteChild
|
||||
status_t
|
||||
ExtendedPartitionHandle::DeleteChild(BMutablePartition* child)
|
||||
{
|
||||
@@ -509,4 +496,3 @@ ExtendedPartitionHandle::DeleteChild(BMutablePartition* child)
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include "CreationParameterEditor.h"
|
||||
#include "PartitionMapAddOn.h"
|
||||
|
||||
@@ -21,9 +22,9 @@
|
||||
//#define TRACE_PARTITION_MAP_ADD_ON
|
||||
#undef TRACE
|
||||
#ifdef TRACE_PARTITION_MAP_ADD_ON
|
||||
# define TRACE(x...) printf(x)
|
||||
# define TRACE(x...) printf(x)
|
||||
#else
|
||||
# define TRACE(x...) do {} while (false)
|
||||
# define TRACE(x...) do {} while (false)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -55,20 +56,18 @@ static const uint32 kDiskSystemFlags =
|
||||
// #pragma mark - PartitionMapAddOn
|
||||
|
||||
|
||||
// constructor
|
||||
PartitionMapAddOn::PartitionMapAddOn()
|
||||
: BDiskSystemAddOn(kPartitionTypeIntel, kDiskSystemFlags)
|
||||
:
|
||||
BDiskSystemAddOn(kPartitionTypeIntel, kDiskSystemFlags)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// destructor
|
||||
PartitionMapAddOn::~PartitionMapAddOn()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// CreatePartitionHandle
|
||||
status_t
|
||||
PartitionMapAddOn::CreatePartitionHandle(BMutablePartition* partition,
|
||||
BPartitionHandle** _handle)
|
||||
@@ -88,7 +87,6 @@ PartitionMapAddOn::CreatePartitionHandle(BMutablePartition* partition,
|
||||
}
|
||||
|
||||
|
||||
// CanInitialize
|
||||
bool
|
||||
PartitionMapAddOn::CanInitialize(const BMutablePartition* partition)
|
||||
{
|
||||
@@ -97,7 +95,6 @@ PartitionMapAddOn::CanInitialize(const BMutablePartition* partition)
|
||||
}
|
||||
|
||||
|
||||
// GetInitializationParameterEditor
|
||||
status_t
|
||||
PartitionMapAddOn::GetInitializationParameterEditor(
|
||||
const BMutablePartition* partition, BPartitionParameterEditor** editor)
|
||||
@@ -108,7 +105,6 @@ PartitionMapAddOn::GetInitializationParameterEditor(
|
||||
}
|
||||
|
||||
|
||||
// ValidateInitialize
|
||||
status_t
|
||||
PartitionMapAddOn::ValidateInitialize(const BMutablePartition* partition,
|
||||
BString* name, const char* parameters)
|
||||
@@ -126,7 +122,6 @@ PartitionMapAddOn::ValidateInitialize(const BMutablePartition* partition,
|
||||
}
|
||||
|
||||
|
||||
// Initialize
|
||||
status_t
|
||||
PartitionMapAddOn::Initialize(BMutablePartition* partition, const char* name,
|
||||
const char* parameters, BPartitionHandle** _handle)
|
||||
@@ -163,20 +158,18 @@ PartitionMapAddOn::Initialize(BMutablePartition* partition, const char* name,
|
||||
// #pragma mark - PartitionMapHandle
|
||||
|
||||
|
||||
// constructor
|
||||
PartitionMapHandle::PartitionMapHandle(BMutablePartition* partition)
|
||||
: BPartitionHandle(partition)
|
||||
:
|
||||
BPartitionHandle(partition)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// destructor
|
||||
PartitionMapHandle::~PartitionMapHandle()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Init
|
||||
status_t
|
||||
PartitionMapHandle::Init()
|
||||
{
|
||||
@@ -220,7 +213,6 @@ PartitionMapHandle::Init()
|
||||
}
|
||||
|
||||
|
||||
// SupportedOperations
|
||||
uint32
|
||||
PartitionMapHandle::SupportedOperations(uint32 mask)
|
||||
{
|
||||
@@ -232,7 +224,7 @@ PartitionMapHandle::SupportedOperations(uint32 mask)
|
||||
| B_DISK_SYSTEM_SUPPORTS_INITIALIZING;
|
||||
|
||||
// creating child
|
||||
if (mask & B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD) {
|
||||
if ((mask & B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD) != 0) {
|
||||
BPartitioningInfo info;
|
||||
if (partition->CountChildren() < 4
|
||||
&& GetPartitioningInfo(&info) == B_OK
|
||||
@@ -245,7 +237,6 @@ PartitionMapHandle::SupportedOperations(uint32 mask)
|
||||
}
|
||||
|
||||
|
||||
// SupportedChildOperations
|
||||
uint32
|
||||
PartitionMapHandle::SupportedChildOperations(const BMutablePartition* child,
|
||||
uint32 mask)
|
||||
@@ -257,7 +248,6 @@ PartitionMapHandle::SupportedChildOperations(const BMutablePartition* child,
|
||||
}
|
||||
|
||||
|
||||
// GetNextSupportedType
|
||||
status_t
|
||||
PartitionMapHandle::GetNextSupportedType(const BMutablePartition* child,
|
||||
int32* cookie, BString* type)
|
||||
@@ -286,7 +276,6 @@ PartitionMapHandle::GetNextSupportedType(const BMutablePartition* child,
|
||||
}
|
||||
|
||||
|
||||
// GetPartitioningInfo
|
||||
status_t
|
||||
PartitionMapHandle::GetPartitioningInfo(BPartitioningInfo* info)
|
||||
{
|
||||
@@ -312,7 +301,6 @@ PartitionMapHandle::GetPartitioningInfo(BPartitioningInfo* info)
|
||||
}
|
||||
|
||||
|
||||
// GetChildCreationParameterEditor
|
||||
status_t
|
||||
PartitionMapHandle::GetChildCreationParameterEditor(const char* type,
|
||||
BPartitionParameterEditor** editor)
|
||||
@@ -328,7 +316,6 @@ PartitionMapHandle::GetChildCreationParameterEditor(const char* type,
|
||||
}
|
||||
|
||||
|
||||
// ValidateCreateChild
|
||||
status_t
|
||||
PartitionMapHandle::ValidateCreateChild(off_t* _offset, off_t* _size,
|
||||
const char* typeString, BString* name, const char* parameters)
|
||||
@@ -444,7 +431,6 @@ PartitionMapHandle::ValidateCreateChild(off_t* _offset, off_t* _size,
|
||||
}
|
||||
|
||||
|
||||
// CreateChild
|
||||
status_t
|
||||
PartitionMapHandle::CreateChild(off_t offset, off_t size,
|
||||
const char* typeString, const char* name, const char* parameters,
|
||||
@@ -533,7 +519,6 @@ PartitionMapHandle::CreateChild(off_t offset, off_t size,
|
||||
}
|
||||
|
||||
|
||||
// DeleteChild
|
||||
status_t
|
||||
PartitionMapHandle::DeleteChild(BMutablePartition* child)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user