diff --git a/src/kits/storage/DiskSystemAddOnManager.cpp b/src/kits/storage/DiskSystemAddOnManager.cpp index 5ce63b2dc2..3fb1f8d348 100644 --- a/src/kits/storage/DiskSystemAddOnManager.cpp +++ b/src/kits/storage/DiskSystemAddOnManager.cpp @@ -10,6 +10,8 @@ #include #include +#include + #include #include #include @@ -22,6 +24,11 @@ #include +#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); diff --git a/src/kits/storage/PartitionDelegate.cpp b/src/kits/storage/PartitionDelegate.cpp index 3c1299f870..89cff37bbf 100644 --- a/src/kits/storage/PartitionDelegate.cpp +++ b/src/kits/storage/PartitionDelegate.cpp @@ -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; }