Implemented all read-only (more precisely: not writing) methods. Small changes.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4029 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2003-07-20 17:15:35 +00:00
parent a1cd43f854
commit 2a596c013a
6 changed files with 98 additions and 63 deletions

View File

@ -71,15 +71,15 @@ public:
virtual bool IsSubSystemFor(KPartition *partition); virtual bool IsSubSystemFor(KPartition *partition);
virtual bool ValidateResize(KPartition *partition, off_t *size); virtual bool ValidateResize(KPartition *partition, off_t *size);
virtual bool ValidateResizeChild(KPartition *partition, off_t *size); virtual bool ValidateResizeChild(KPartition *child, off_t *size);
virtual bool ValidateMove(KPartition *partition, off_t *start); virtual bool ValidateMove(KPartition *partition, off_t *start);
virtual bool ValidateMoveChild(KPartition *partition, off_t *start); virtual bool ValidateMoveChild(KPartition *child, off_t *start);
virtual bool ValidateSetName(KPartition *partition, char *name); virtual bool ValidateSetName(KPartition *partition, char *name);
virtual bool ValidateSetContentName(KPartition *partition, char *name); virtual bool ValidateSetContentName(KPartition *partition, char *name);
virtual bool ValidateSetType(KPartition *partition, const char *type); virtual bool ValidateSetType(KPartition *partition, const char *type);
virtual bool ValidateSetParameters(KPartition *partition, virtual bool ValidateSetParameters(KPartition *partition,
const char *parameters); const char *parameters);
virtual bool ValidateSetContentParameters(KPartition *child, virtual bool ValidateSetContentParameters(KPartition *parameters,
const char *parameters); const char *parameters);
virtual bool ValidateInitialize(KPartition *partition, char *name, virtual bool ValidateInitialize(KPartition *partition, char *name,
const char *parameters); const char *parameters);
@ -87,10 +87,10 @@ public:
off_t *size, const char *type, off_t *size, const char *type,
const char *parameters); const char *parameters);
virtual int32 CountPartitionableSpaces(KPartition *partition); virtual int32 CountPartitionableSpaces(KPartition *partition);
virtual bool GetPartitionableSpaces(KPartition *partition, virtual status_t GetPartitionableSpaces(KPartition *partition,
partitionable_space_data *spaces, partitionable_space_data *buffer,
int32 count, int32 count,
int32 *actualCount = NULL); int32 *actualCount = NULL);
virtual status_t GetNextSupportedType(KPartition *partition, int32 *cookie, virtual status_t GetNextSupportedType(KPartition *partition, int32 *cookie,
char *type); char *type);

View File

@ -40,12 +40,11 @@ public:
virtual bool SupportsSettingContentParameters(KPartition *partition, virtual bool SupportsSettingContentParameters(KPartition *partition,
bool *whileMounted); bool *whileMounted);
virtual bool SupportsInitializing(KPartition *partition); virtual bool SupportsInitializing(KPartition *partition);
virtual bool IsSubSystemFor(KPartition *partition);
virtual bool ValidateResize(KPartition *partition, off_t *size); virtual bool ValidateResize(KPartition *partition, off_t *size);
virtual bool ValidateMove(KPartition *partition, off_t *start); virtual bool ValidateMove(KPartition *partition, off_t *start);
virtual bool ValidateSetContentName(KPartition *partition, char *name); virtual bool ValidateSetContentName(KPartition *partition, char *name);
virtual bool ValidateSetContentParameters(KPartition *child, virtual bool ValidateSetContentParameters(KPartition *partition,
const char *parameters); const char *parameters);
virtual bool ValidateInitialize(KPartition *partition, char *name, virtual bool ValidateInitialize(KPartition *partition, char *name,
const char *parameters); const char *parameters);

View File

@ -48,15 +48,15 @@ public:
virtual bool IsSubSystemFor(KPartition *partition); virtual bool IsSubSystemFor(KPartition *partition);
virtual bool ValidateResize(KPartition *partition, off_t *size); virtual bool ValidateResize(KPartition *partition, off_t *size);
virtual bool ValidateResizeChild(KPartition *partition, off_t *size); virtual bool ValidateResizeChild(KPartition *child, off_t *size);
virtual bool ValidateMove(KPartition *partition, off_t *start); virtual bool ValidateMove(KPartition *partition, off_t *start);
virtual bool ValidateMoveChild(KPartition *partition, off_t *start); virtual bool ValidateMoveChild(KPartition *child, off_t *start);
virtual bool ValidateSetName(KPartition *partition, char *name); virtual bool ValidateSetName(KPartition *partition, char *name);
virtual bool ValidateSetContentName(KPartition *partition, char *name); virtual bool ValidateSetContentName(KPartition *partition, char *name);
virtual bool ValidateSetType(KPartition *partition, const char *type); virtual bool ValidateSetType(KPartition *partition, const char *type);
virtual bool ValidateSetParameters(KPartition *partition, virtual bool ValidateSetParameters(KPartition *partition,
const char *parameters); const char *parameters);
virtual bool ValidateSetContentParameters(KPartition *child, virtual bool ValidateSetContentParameters(KPartition *parameters,
const char *parameters); const char *parameters);
virtual bool ValidateInitialize(KPartition *partition, char *name, virtual bool ValidateInitialize(KPartition *partition, char *name,
const char *parameters); const char *parameters);
@ -64,10 +64,10 @@ public:
off_t *size, const char *type, off_t *size, const char *type,
const char *parameters); const char *parameters);
virtual int32 CountPartitionableSpaces(KPartition *partition); virtual int32 CountPartitionableSpaces(KPartition *partition);
virtual bool GetPartitionableSpaces(KPartition *partition, virtual status_t GetPartitionableSpaces(KPartition *partition,
partitionable_space_data *spaces, partitionable_space_data *buffer,
int32 count, int32 count,
int32 *actualCount = NULL); int32 *actualCount = NULL);
virtual status_t GetNextSupportedType(KPartition *partition, int32 *cookie, virtual status_t GetNextSupportedType(KPartition *partition, int32 *cookie,
char *type); char *type);

View File

@ -312,7 +312,7 @@ KDiskSystem::ValidateResize(KPartition *partition, off_t *size)
// ValidateResizeChild // ValidateResizeChild
bool bool
KDiskSystem::ValidateResizeChild(KPartition *partition, off_t *size) KDiskSystem::ValidateResizeChild(KPartition *child, off_t *size)
{ {
// to be implemented by derived classes // to be implemented by derived classes
return false; return false;
@ -328,7 +328,7 @@ KDiskSystem::ValidateMove(KPartition *partition, off_t *start)
// ValidateMoveChild // ValidateMoveChild
bool bool
KDiskSystem::ValidateMoveChild(KPartition *partition, off_t *start) KDiskSystem::ValidateMoveChild(KPartition *child, off_t *start)
{ {
// to be implemented by derived classes // to be implemented by derived classes
return false; return false;
@ -369,7 +369,7 @@ KDiskSystem::ValidateSetParameters(KPartition *partition,
// ValidateSetContentParameters // ValidateSetContentParameters
bool bool
KDiskSystem::ValidateSetContentParameters(KPartition *child, KDiskSystem::ValidateSetContentParameters(KPartition *partition,
const char *parameters) const char *parameters)
{ {
// to be implemented by derived classes // to be implemented by derived classes
@ -404,13 +404,13 @@ KDiskSystem::CountPartitionableSpaces(KPartition *partition)
} }
// GetPartitionableSpaces // GetPartitionableSpaces
bool status_t
KDiskSystem::GetPartitionableSpaces(KPartition *partition, KDiskSystem::GetPartitionableSpaces(KPartition *partition,
partitionable_space_data *spaces, partitionable_space_data *buffer,
int32 count, int32 *actualCount) int32 count, int32 *actualCount)
{ {
// to be implemented by derived classes // to be implemented by derived classes
return false; return B_ERROR;
} }
// GetNextSupportedType // GetNextSupportedType

View File

@ -90,10 +90,15 @@ KFileSystem::FreeContentCookie(KPartition *partition)
bool bool
KFileSystem::SupportsDefragmenting(KPartition *partition, bool *whileMounted) KFileSystem::SupportsDefragmenting(KPartition *partition, bool *whileMounted)
{ {
// to be implemented bool _whileMounted = false;
if (whileMounted) if (!whileMounted)
*whileMounted = false; whileMounted = &_whileMounted;
return false; if (!partition || partition->DiskSystem() != this || !fModule
|| !fModule->supports_defragmenting) {
return (*whileMounted = false);
}
return fModule->supports_defragmenting(partition->PartitionData(),
whileMounted);
} }
// SupportsRepairing // SupportsRepairing
@ -101,30 +106,44 @@ bool
KFileSystem::SupportsRepairing(KPartition *partition, bool checkOnly, KFileSystem::SupportsRepairing(KPartition *partition, bool checkOnly,
bool *whileMounted) bool *whileMounted)
{ {
// to be implemented bool _whileMounted = false;
if (whileMounted) if (!whileMounted)
*whileMounted = false; whileMounted = &_whileMounted;
return false; if (!partition || partition->DiskSystem() != this || !fModule
|| !fModule->supports_repairing) {
return (*whileMounted = false);
}
return fModule->supports_repairing(partition->PartitionData(), checkOnly,
whileMounted);
} }
// SupportsResizing // SupportsResizing
bool bool
KFileSystem::SupportsResizing(KPartition *partition, bool *whileMounted) KFileSystem::SupportsResizing(KPartition *partition, bool *whileMounted)
{ {
// to be implemented bool _whileMounted = false;
if (whileMounted) if (!whileMounted)
*whileMounted = false; whileMounted = &_whileMounted;
return false; if (!partition || partition->DiskSystem() != this || !fModule
|| !fModule->supports_resizing) {
return (*whileMounted = false);
}
return fModule->supports_resizing(partition->PartitionData(),
whileMounted);
} }
// SupportsMoving // SupportsMoving
bool bool
KFileSystem::SupportsMoving(KPartition *partition, bool *isNoOp) KFileSystem::SupportsMoving(KPartition *partition, bool *isNoOp)
{ {
// to be implemented bool _isNoOp = false;
if (isNoOp) if (!isNoOp)
*isNoOp = false; isNoOp = &_isNoOp;
return false; if (!partition || partition->DiskSystem() != this || !fModule
|| !fModule->supports_moving) {
return (*isNoOp = false);
}
return fModule->supports_moving(partition->PartitionData(), isNoOp);
} }
// SupportsSettingContentName // SupportsSettingContentName
@ -132,8 +151,15 @@ bool
KFileSystem::SupportsSettingContentName(KPartition *partition, KFileSystem::SupportsSettingContentName(KPartition *partition,
bool *whileMounted) bool *whileMounted)
{ {
// to be implemented bool _whileMounted = false;
return false; if (!whileMounted)
whileMounted = &_whileMounted;
if (!partition || partition->DiskSystem() != this || !fModule
|| !fModule->supports_setting_content_name) {
return (*whileMounted = false);
}
return fModule->supports_setting_content_name(partition->PartitionData(),
whileMounted);
} }
// SupportsSettingContentParameters // SupportsSettingContentParameters
@ -141,57 +167,62 @@ bool
KFileSystem::SupportsSettingContentParameters(KPartition *partition, KFileSystem::SupportsSettingContentParameters(KPartition *partition,
bool *whileMounted) bool *whileMounted)
{ {
// to be implemented bool _whileMounted = false;
return false; if (!whileMounted)
whileMounted = &_whileMounted;
if (!partition || partition->DiskSystem() != this || !fModule
|| !fModule->supports_setting_content_parameters) {
return (*whileMounted = false);
}
return fModule->supports_setting_content_parameters(
partition->PartitionData(), whileMounted);
} }
// SupportsInitializing // SupportsInitializing
bool bool
KFileSystem::SupportsInitializing(KPartition *partition) KFileSystem::SupportsInitializing(KPartition *partition)
{ {
// to be implemented return (partition && fModule && fModule->supports_initializing
return false; && fModule->supports_initializing(partition->PartitionData()));
}
// IsSubSystemFor
bool
KFileSystem::IsSubSystemFor(KPartition *partition)
{
// to be implemented
return false;
} }
// ValidateResize // ValidateResize
bool bool
KFileSystem::ValidateResize(KPartition *partition, off_t *size) KFileSystem::ValidateResize(KPartition *partition, off_t *size)
{ {
// to be implemented return (partition && size && partition->DiskSystem() == this && fModule
return false; && fModule->validate_resize
&& fModule->validate_resize(partition->PartitionData(), size));
} }
// ValidateMove // ValidateMove
bool bool
KFileSystem::ValidateMove(KPartition *partition, off_t *start) KFileSystem::ValidateMove(KPartition *partition, off_t *start)
{ {
// to be implemented return (partition && start && partition->DiskSystem() == this && fModule
return false; && fModule->validate_move
&& fModule->validate_move(partition->PartitionData(), start));
} }
// ValidateSetContentName // ValidateSetContentName
bool bool
KFileSystem::ValidateSetContentName(KPartition *partition, char *name) KFileSystem::ValidateSetContentName(KPartition *partition, char *name)
{ {
// to be implemented return (partition && name && partition->DiskSystem() == this
return false; && fModule && fModule->validate_set_content_name
&& fModule->validate_set_content_name(partition->PartitionData(),
name));
} }
// ValidateSetContentParameters // ValidateSetContentParameters
bool bool
KFileSystem::ValidateSetContentParameters(KPartition *child, KFileSystem::ValidateSetContentParameters(KPartition *partition,
const char *parameters) const char *parameters)
{ {
// to be implemented return (partition && partition->DiskSystem() == this && fModule
return false; && fModule->validate_set_content_parameters
&& fModule->validate_set_content_parameters(
partition->PartitionData(), parameters));
} }
// ValidateInitialize // ValidateInitialize
@ -199,8 +230,9 @@ bool
KFileSystem::ValidateInitialize(KPartition *partition, char *name, KFileSystem::ValidateInitialize(KPartition *partition, char *name,
const char *parameters) const char *parameters)
{ {
// to be implemented return (partition && name && fModule && fModule->validate_initialize
return false; && fModule->validate_initialize(partition->PartitionData(), name,
parameters));
} }
// Defragment // Defragment

View File

@ -113,6 +113,10 @@ KPartition::PrepareForRemoval()
{ {
bool result = RemoveAllChildren(); bool result = RemoveAllChildren();
UnpublishDevice(); UnpublishDevice();
if (ParentDiskSystem())
ParentDiskSystem()->FreeCookie(this);
if (DiskSystem())
DiskSystem()->FreeContentCookie(this);
return result; return result;
} }