Added some debug output.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22604 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2007-10-17 22:27:23 +00:00
parent a3a0e88e70
commit 8c0dd56800
2 changed files with 37 additions and 5 deletions

View File

@ -10,6 +10,8 @@
#include <set>
#include <string>
#include <stdio.h>
#include <Directory.h>
#include <Entry.h>
#include <image.h>
@ -22,6 +24,11 @@
#include <DiskSystemAddOn.h>
#undef TRACE
//#define TRACE(format...)
#define TRACE(format...) printf(format)
using std::nothrow;
@ -267,6 +274,8 @@ DiskSystemAddOnManager::_LoadAddOns(StringSet& alreadyLoaded,
if (error != B_OK)
return error;
TRACE("DiskSystemAddOnManager::_LoadAddOns(): %s\n", path.Path());
error = path.Append("disk_systems");
if (error != B_OK)
return error;
@ -283,8 +292,10 @@ DiskSystemAddOnManager::_LoadAddOns(StringSet& alreadyLoaded,
entry_ref ref;
while (directory.GetNextRef(&ref) == B_OK) {
// skip, if already loaded
if (alreadyLoaded.find(ref.name) != alreadyLoaded.end())
if (alreadyLoaded.find(ref.name) != alreadyLoaded.end()) {
TRACE(" skipping \"%s\" -- already loaded\n", ref.name);
continue;
}
// get the entry path
BPath entryPath;
@ -292,13 +303,16 @@ DiskSystemAddOnManager::_LoadAddOns(StringSet& alreadyLoaded,
if (error != B_OK) {
if (error == B_NO_MEMORY)
return error;
TRACE(" skipping \"%s\" -- failed to get path\n", ref.name);
continue;
}
// load the add-on
image_id image = load_add_on(entryPath.Path());
if (image < 0)
if (image < 0) {
TRACE(" skipping \"%s\" -- failed to load add-on\n", ref.name);
continue;
}
AddOnImage* addOnImage = new(nothrow) AddOnImage(image);
if (!addOnImage) {
@ -311,13 +325,17 @@ DiskSystemAddOnManager::_LoadAddOns(StringSet& alreadyLoaded,
status_t (*getAddOns)(BList*);
error = get_image_symbol(image, "get_disk_system_add_ons",
B_SYMBOL_TYPE_TEXT, (void**)&getAddOns);
if (error != B_OK)
if (error != B_OK) {
TRACE(" skipping \"%s\" -- function symbol not found\n", ref.name);
continue;
}
BList addOns;
error = getAddOns(&addOns);
if (error != B_OK || addOns.IsEmpty())
if (error != B_OK || addOns.IsEmpty()) {
TRACE(" skipping \"%s\" -- getting add-ons failed\n", ref.name);
continue;
}
// create and add AddOn objects
int32 count = addOns.CountItems();
@ -337,6 +355,9 @@ DiskSystemAddOnManager::_LoadAddOns(StringSet& alreadyLoaded,
}
}
TRACE(" got %ld BDiskSystemAddOn(s) from add-on \"%s\"\n", count,
ref.name);
// add the add-on name to the set of already loaded add-ons
try {
alreadyLoaded.insert(ref.name);

View File

@ -10,6 +10,11 @@
#include "DiskSystemAddOnManager.h"
#undef TRACE
//#define TRACE(format...)
#define TRACE(format...) printf(format)
// constructor
BPartition::Delegate::Delegate(BPartition* partition)
: fPartition(partition),
@ -63,12 +68,18 @@ BPartition::Delegate::InitAfterHierarchy()
DiskSystemAddOnManager* manager = DiskSystemAddOnManager::Default();
BDiskSystemAddOn* addOn = manager->GetAddOn(
fMutablePartition.ContentType());
if (!addOn)
if (!addOn) {
TRACE("BPartition::Delegate::InitAfterHierarchy(): add-on for disk "
"system \"%s\" not found\n", fMutablePartition.ContentType());
return B_ENTRY_NOT_FOUND;
}
BPartitionHandle* handle;
status_t error = addOn->CreatePartitionHandle(&fMutablePartition, &handle);
if (error != B_OK) {
TRACE("BPartition::Delegate::InitAfterHierarchy(): Failed to create "
"partition handle for partition %ld, disk system: \"%s\": %s\n",
Partition()->ID(), addOn->Name(), strerror(error));
manager->PutAddOn(addOn);
return error;
}