Style cleanup.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22591 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2007-10-17 00:03:23 +00:00
parent 287cc7652b
commit d712d042ea
+58 -8
View File
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------- /*
// This software is part of the OpenBeOS distribution and is covered * Copyright 2003-2007, Ingo Weinhold, [email protected].
// by the OpenBeOS license. * Distributed under the terms of the MIT License.
//--------------------------------------------------------------------- */
#include <DiskSystem.h> #include <DiskSystem.h>
#include <Partition.h> #include <Partition.h>
@@ -9,6 +9,7 @@
#include <syscalls.h> #include <syscalls.h>
#include <disk_device_manager/ddm_userland_interface.h> #include <disk_device_manager/ddm_userland_interface.h>
// constructor // constructor
BDiskSystem::BDiskSystem() BDiskSystem::BDiskSystem()
: fID(B_NO_INIT), : fID(B_NO_INIT),
@@ -18,6 +19,7 @@ BDiskSystem::BDiskSystem()
{ {
} }
// copy constructor // copy constructor
BDiskSystem::BDiskSystem(const BDiskSystem& other) BDiskSystem::BDiskSystem(const BDiskSystem& other)
: fID(other.fID), : fID(other.fID),
@@ -27,11 +29,13 @@ BDiskSystem::BDiskSystem(const BDiskSystem& other)
{ {
} }
// destructor // destructor
BDiskSystem::~BDiskSystem() BDiskSystem::~BDiskSystem()
{ {
} }
// InitCheck // InitCheck
status_t status_t
BDiskSystem::InitCheck() const BDiskSystem::InitCheck() const
@@ -39,6 +43,7 @@ BDiskSystem::InitCheck() const
return (fID > 0 ? B_OK : fID); return (fID > 0 ? B_OK : fID);
} }
// Name // Name
const char* const char*
BDiskSystem::Name() const BDiskSystem::Name() const
@@ -46,6 +51,7 @@ BDiskSystem::Name() const
return fName.String(); return fName.String();
} }
// PrettyName // PrettyName
const char* const char*
BDiskSystem::PrettyName() const BDiskSystem::PrettyName() const
@@ -53,6 +59,7 @@ BDiskSystem::PrettyName() const
return fPrettyName.String(); return fPrettyName.String();
} }
// SupportsDefragmenting // SupportsDefragmenting
bool bool
BDiskSystem::SupportsDefragmenting(bool* whileMounted) const BDiskSystem::SupportsDefragmenting(bool* whileMounted) const
@@ -63,33 +70,41 @@ BDiskSystem::SupportsDefragmenting(bool *whileMounted) const
*whileMounted = false; *whileMounted = false;
return false; return false;
} }
if (whileMounted) { if (whileMounted) {
*whileMounted = (IsFileSystem() *whileMounted = (IsFileSystem()
&& (fFlags & B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING_WHILE_MOUNTED)); && (fFlags & B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING_WHILE_MOUNTED));
} }
return true; return true;
} }
// SupportsRepairing // SupportsRepairing
bool bool
BDiskSystem::SupportsRepairing(bool checkOnly, bool* whileMounted) const BDiskSystem::SupportsRepairing(bool checkOnly, bool* whileMounted) const
{ {
uint32 mainBit = B_DISK_SYSTEM_SUPPORTS_REPAIRING; uint32 mainBit = B_DISK_SYSTEM_SUPPORTS_REPAIRING;
uint32 mountedBit = B_DISK_SYSTEM_SUPPORTS_REPAIRING_WHILE_MOUNTED; uint32 mountedBit = B_DISK_SYSTEM_SUPPORTS_REPAIRING_WHILE_MOUNTED;
if (checkOnly) { if (checkOnly) {
mainBit = B_DISK_SYSTEM_SUPPORTS_CHECKING; mainBit = B_DISK_SYSTEM_SUPPORTS_CHECKING;
mountedBit = B_DISK_SYSTEM_SUPPORTS_CHECKING_WHILE_MOUNTED; mountedBit = B_DISK_SYSTEM_SUPPORTS_CHECKING_WHILE_MOUNTED;
} }
if (InitCheck() != B_OK || !(fFlags & mainBit)) { if (InitCheck() != B_OK || !(fFlags & mainBit)) {
if (whileMounted) if (whileMounted)
*whileMounted = false; *whileMounted = false;
return false; return false;
} }
if (whileMounted) if (whileMounted)
*whileMounted = (IsFileSystem() && (fFlags & mountedBit)); *whileMounted = (IsFileSystem() && (fFlags & mountedBit));
return true; return true;
} }
// SupportsResizing // SupportsResizing
bool bool
BDiskSystem::SupportsResizing(bool* whileMounted) const BDiskSystem::SupportsResizing(bool* whileMounted) const
@@ -100,13 +115,16 @@ BDiskSystem::SupportsResizing(bool *whileMounted) const
*whileMounted = false; *whileMounted = false;
return false; return false;
} }
if (whileMounted) { if (whileMounted) {
*whileMounted = (IsFileSystem() *whileMounted = (IsFileSystem()
&& (fFlags & B_DISK_SYSTEM_SUPPORTS_RESIZING_WHILE_MOUNTED)); && (fFlags & B_DISK_SYSTEM_SUPPORTS_RESIZING_WHILE_MOUNTED));
} }
return true; return true;
} }
// SupportsResizingChild // SupportsResizingChild
bool bool
BDiskSystem::SupportsResizingChild() const BDiskSystem::SupportsResizingChild() const
@@ -115,6 +133,7 @@ BDiskSystem::SupportsResizingChild() const
&& (fFlags & B_DISK_SYSTEM_SUPPORTS_RESIZING_CHILD)); && (fFlags & B_DISK_SYSTEM_SUPPORTS_RESIZING_CHILD));
} }
// SupportsMoving // SupportsMoving
bool bool
BDiskSystem::SupportsMoving(bool* whileMounted) const BDiskSystem::SupportsMoving(bool* whileMounted) const
@@ -125,13 +144,16 @@ BDiskSystem::SupportsMoving(bool *whileMounted) const
*whileMounted = false; *whileMounted = false;
return false; return false;
} }
if (whileMounted) { if (whileMounted) {
*whileMounted = (IsFileSystem() *whileMounted = (IsFileSystem()
&& (fFlags & B_DISK_SYSTEM_SUPPORTS_MOVING_WHILE_MOUNTED)); && (fFlags & B_DISK_SYSTEM_SUPPORTS_MOVING_WHILE_MOUNTED));
} }
return true; return true;
} }
// SupportsMovingChild // SupportsMovingChild
bool bool
BDiskSystem::SupportsMovingChild() const BDiskSystem::SupportsMovingChild() const
@@ -140,6 +162,7 @@ BDiskSystem::SupportsMovingChild() const
&& (fFlags & B_DISK_SYSTEM_SUPPORTS_MOVING_CHILD)); && (fFlags & B_DISK_SYSTEM_SUPPORTS_MOVING_CHILD));
} }
// SupportsName // SupportsName
bool bool
BDiskSystem::SupportsName() const BDiskSystem::SupportsName() const
@@ -148,6 +171,7 @@ BDiskSystem::SupportsName() const
&& (fFlags & B_DISK_SYSTEM_SUPPORTS_NAME)); && (fFlags & B_DISK_SYSTEM_SUPPORTS_NAME));
} }
// SupportsContentName // SupportsContentName
bool bool
BDiskSystem::SupportsContentName() const BDiskSystem::SupportsContentName() const
@@ -156,6 +180,7 @@ BDiskSystem::SupportsContentName() const
&& (fFlags & B_DISK_SYSTEM_SUPPORTS_CONTENT_NAME)); && (fFlags & B_DISK_SYSTEM_SUPPORTS_CONTENT_NAME));
} }
// SupportsSettingName // SupportsSettingName
bool bool
BDiskSystem::SupportsSettingName() const BDiskSystem::SupportsSettingName() const
@@ -164,6 +189,7 @@ BDiskSystem::SupportsSettingName() const
&& (fFlags & B_DISK_SYSTEM_SUPPORTS_SETTING_NAME)); && (fFlags & B_DISK_SYSTEM_SUPPORTS_SETTING_NAME));
} }
// SupportsSettingContentName // SupportsSettingContentName
bool bool
BDiskSystem::SupportsSettingContentName(bool* whileMounted) const BDiskSystem::SupportsSettingContentName(bool* whileMounted) const
@@ -174,14 +200,17 @@ BDiskSystem::SupportsSettingContentName(bool *whileMounted) const
*whileMounted = false; *whileMounted = false;
return false; return false;
} }
if (whileMounted) { if (whileMounted) {
*whileMounted = (IsFileSystem() *whileMounted = (IsFileSystem()
&& (fFlags && (fFlags
& B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME_WHILE_MOUNTED)); & B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME_WHILE_MOUNTED));
} }
return true; return true;
} }
// SupportsSettingType // SupportsSettingType
bool bool
BDiskSystem::SupportsSettingType() const BDiskSystem::SupportsSettingType() const
@@ -190,6 +219,7 @@ BDiskSystem::SupportsSettingType() const
&& (fFlags & B_DISK_SYSTEM_SUPPORTS_SETTING_TYPE)); && (fFlags & B_DISK_SYSTEM_SUPPORTS_SETTING_TYPE));
} }
// SupportsSettingParameters // SupportsSettingParameters
bool bool
BDiskSystem::SupportsSettingParameters() const BDiskSystem::SupportsSettingParameters() const
@@ -198,6 +228,7 @@ BDiskSystem::SupportsSettingParameters() const
&& (fFlags & B_DISK_SYSTEM_SUPPORTS_SETTING_PARAMETERS)); && (fFlags & B_DISK_SYSTEM_SUPPORTS_SETTING_PARAMETERS));
} }
// SupportsSettingContentParameters // SupportsSettingContentParameters
bool bool
BDiskSystem::SupportsSettingContentParameters(bool* whileMounted) const BDiskSystem::SupportsSettingContentParameters(bool* whileMounted) const
@@ -208,14 +239,17 @@ BDiskSystem::SupportsSettingContentParameters(bool *whileMounted) const
*whileMounted = false; *whileMounted = false;
return false; return false;
} }
if (whileMounted) { if (whileMounted) {
*whileMounted = (IsFileSystem() uint32 whileMountedFlag
&& (fFlags = B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS_WHILE_MOUNTED;
& B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS_WHILE_MOUNTED)); *whileMounted = (IsFileSystem() && (fFlags & whileMountedFlag));
} }
return true; return true;
} }
// SupportsCreatingChild // SupportsCreatingChild
bool bool
BDiskSystem::SupportsCreatingChild() const BDiskSystem::SupportsCreatingChild() const
@@ -224,6 +258,7 @@ BDiskSystem::SupportsCreatingChild() const
&& (fFlags & B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD)); && (fFlags & B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD));
} }
// SupportsDeletingChild // SupportsDeletingChild
bool bool
BDiskSystem::SupportsDeletingChild() const BDiskSystem::SupportsDeletingChild() const
@@ -232,6 +267,7 @@ BDiskSystem::SupportsDeletingChild() const
&& (fFlags & B_DISK_SYSTEM_SUPPORTS_DELETING_CHILD)); && (fFlags & B_DISK_SYSTEM_SUPPORTS_DELETING_CHILD));
} }
// SupportsInitializing // SupportsInitializing
bool bool
BDiskSystem::SupportsInitializing() const BDiskSystem::SupportsInitializing() const
@@ -240,6 +276,7 @@ BDiskSystem::SupportsInitializing() const
&& (fFlags & B_DISK_SYSTEM_SUPPORTS_INITIALIZING)); && (fFlags & B_DISK_SYSTEM_SUPPORTS_INITIALIZING));
} }
// GetNextSupportedType // GetNextSupportedType
status_t status_t
BDiskSystem::GetNextSupportedType(BPartition* partition, int32* cookie, BDiskSystem::GetNextSupportedType(BPartition* partition, int32* cookie,
@@ -261,6 +298,7 @@ BDiskSystem::GetNextSupportedType(BPartition *partition, int32 *cookie,
partition->_ChangeCounter(), cookie, type); partition->_ChangeCounter(), cookie, type);
} }
// GetTypeForContentType // GetTypeForContentType
status_t status_t
BDiskSystem::GetTypeForContentType(const char* contentType, char* type) const BDiskSystem::GetTypeForContentType(const char* contentType, char* type) const
@@ -272,6 +310,7 @@ BDiskSystem::GetTypeForContentType(const char *contentType, char *type) const
return _kern_get_partition_type_for_content_type(fID, contentType, type); return _kern_get_partition_type_for_content_type(fID, contentType, type);
} }
// IsPartitioningSystem // IsPartitioningSystem
bool bool
BDiskSystem::IsPartitioningSystem() const BDiskSystem::IsPartitioningSystem() const
@@ -279,6 +318,7 @@ BDiskSystem::IsPartitioningSystem() const
return (InitCheck() == B_OK && !(fFlags & B_DISK_SYSTEM_IS_FILE_SYSTEM)); return (InitCheck() == B_OK && !(fFlags & B_DISK_SYSTEM_IS_FILE_SYSTEM));
} }
// IsFileSystem // IsFileSystem
bool bool
BDiskSystem::IsFileSystem() const BDiskSystem::IsFileSystem() const
@@ -286,6 +326,7 @@ BDiskSystem::IsFileSystem() const
return (InitCheck() == B_OK && (fFlags & B_DISK_SYSTEM_IS_FILE_SYSTEM)); return (InitCheck() == B_OK && (fFlags & B_DISK_SYSTEM_IS_FILE_SYSTEM));
} }
// IsSubSystemFor // IsSubSystemFor
bool bool
BDiskSystem::IsSubSystemFor(BPartition* parent) const BDiskSystem::IsSubSystemFor(BPartition* parent) const
@@ -296,6 +337,7 @@ BDiskSystem::IsSubSystemFor(BPartition *parent) const
parent->_ChangeCounter())); parent->_ChangeCounter()));
} }
// = // =
BDiskSystem& BDiskSystem&
BDiskSystem::operator=(const BDiskSystem& other) BDiskSystem::operator=(const BDiskSystem& other)
@@ -308,34 +350,43 @@ BDiskSystem::operator=(const BDiskSystem& other)
return *this; return *this;
} }
// _SetTo // _SetTo
status_t status_t
BDiskSystem::_SetTo(disk_system_id id) BDiskSystem::_SetTo(disk_system_id id)
{ {
_Unset(); _Unset();
if (id < 0) if (id < 0)
return fID; return fID;
user_disk_system_info info; user_disk_system_info info;
status_t error = _kern_get_disk_system_info(id, &info); status_t error = _kern_get_disk_system_info(id, &info);
if (error != B_OK) if (error != B_OK)
return (fID = error); return (fID = error);
return _SetTo(&info); return _SetTo(&info);
} }
// _SetTo // _SetTo
status_t status_t
BDiskSystem::_SetTo(user_disk_system_info* info) BDiskSystem::_SetTo(user_disk_system_info* info)
{ {
_Unset(); _Unset();
if (!info) if (!info)
return (fID = B_BAD_VALUE); return (fID = B_BAD_VALUE);
fID = info->id; fID = info->id;
fName = info->name; fName = info->name;
fPrettyName = info->pretty_name; fPrettyName = info->pretty_name;
fFlags = info->flags; fFlags = info->flags;
return B_OK; return B_OK;
} }
// _Unset // _Unset
void void
BDiskSystem::_Unset() BDiskSystem::_Unset()
@@ -345,4 +396,3 @@ BDiskSystem::_Unset()
fPrettyName = (const char*)NULL; fPrettyName = (const char*)NULL;
fFlags = 0; fFlags = 0;
} }