Added Dump(). Small fixes.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3605 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2003-06-22 23:04:56 +00:00
parent fcf461b32c
commit 9007acaee3
2 changed files with 42 additions and 4 deletions

View File

@ -149,6 +149,8 @@ public:
void SetContentCookie(void *cookie);
void *ContentCookie() const;
virtual void Dump(bool deep, int32 level);
private:
void _UpdateChildIndices(int32 index);
static int32 _NextID();

View File

@ -10,8 +10,10 @@
#include <Drivers.h>
#include <Errors.h>
//#include <Partition.h>
// TODO: Move the definitions needed in the kernel to a separate header.
// debugging
//#define DBG(x)
#define DBG(x) x
#define OUT printf
#include "KDiskDevice.h"
#include "KDiskDeviceManager.h"
@ -435,7 +437,7 @@ KPartition::SetVolumeID(dev_t volumeID)
dev_t
KPartition::VolumeID() const
{
return fPartitionData.id;
return fPartitionData.volume;
}
// Mount
@ -643,7 +645,7 @@ KPartition::SetDiskSystem(KDiskSystem *diskSystem)
// set and load new one
fDiskSystem = diskSystem;
if (fDiskSystem)
fDiskSystem->Load();
fDiskSystem->Load(); // can't fail, since it's already loaded
}
// DiskSystem
@ -703,6 +705,40 @@ KPartition::ContentCookie() const
return fPartitionData.content_cookie;
}
// Dump
void
KPartition::Dump(bool deep, int32 level)
{
if (level < 0 || level > 255)
return;
char prefix[256];
sprintf(prefix, "%*s%*s", (int)level, "", (int)level, "");
char path[B_PATH_NAME_LENGTH];
GetPath(path);
if (level > 0)
OUT("%spartition %ld: %s\n", prefix, ID(), path);
OUT("%s offset: %lld\n", prefix, Offset());
OUT("%s size: %lld\n", prefix, Size());
OUT("%s block size: %lu\n", prefix, BlockSize());
OUT("%s child count: %ld\n", prefix, CountChildren());
OUT("%s index: %ld\n", prefix, Index());
OUT("%s status: %lu\n", prefix, Status());
OUT("%s flags: %lx\n", prefix, Flags());
OUT("%s volume: %ld\n", prefix, VolumeID());
OUT("%s disk system: %s\n", prefix,
(DiskSystem() ? DiskSystem()->Name() : NULL));
OUT("%s name: %s\n", prefix, Name());
OUT("%s content name: %s\n", prefix, ContentName());
OUT("%s type: %s\n", prefix, Type());
OUT("%s content type: %s\n", prefix, ContentType());
OUT("%s params: %s\n", prefix, Parameters());
OUT("%s content params: %s\n", prefix, ContentParameters());
if (deep) {
for (int32 i = 0; KPartition *child = ChildAt(i); i++)
child->Dump(true, level + 1);
}
}
// _UpdateChildIndices
void
KPartition::_UpdateChildIndices(int32 index)