Added obfsinode kernel debugger command.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6262 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol 2004-01-25 00:11:34 +00:00
parent 2aa106d6b7
commit 91e6897c63
3 changed files with 46 additions and 0 deletions

View File

@ -2047,6 +2047,19 @@ Inode::Create(Transaction *transaction, Inode *parent, const char *name, int32 m
return B_OK;
}
void
Inode::KDumpMe()
{
kprintf("Inode {\n");
CachedBlock::KDumpMe();
kprintf("fTree = 0x%08lx\n", fTree);
kprintf("fAttributes = 0x%08lx\n", fAttributes);
kprintf("fLock {}\n");
kprintf("fOldSize = 0x%16Lx\n", fOldSize);
kprintf("fOldLastModified = 0x%16Lx\n", fOldLastModified);
kprintf("}\n");
}
// #pragma mark -

View File

@ -71,6 +71,8 @@ class CachedBlock {
off_t BlockNumber() const { return fBlockNumber; }
uint32 BlockSize() const { return fVolume->BlockSize(); }
uint32 BlockShift() const { return fVolume->BlockShift(); }
void KDumpMe();
private:
CachedBlock(const CachedBlock &);
@ -177,6 +179,8 @@ class Inode : public CachedBlock {
off_t OldSize() { return fOldSize; }
off_t OldLastModified() { return fOldLastModified; }
void KDumpMe();
private:
Inode(const Inode &);
Inode &operator=(const Inode &);
@ -375,6 +379,15 @@ CachedBlock::WriteBack(Transaction *transaction)
return transaction->WriteBlocks(fBlockNumber, fBlock);
}
inline void
CachedBlock::KDumpMe()
{
kprintf("CachedBlock {\n");
kprintf("fVolume = 0x%08lx\n", fVolume);
kprintf("fBlockNumber = 0x%16Lx\n", fBlockNumber);
kprintf("fBlock = 0x%08lx\n", fBlock);
kprintf("}\n");
}
/** Converts the "omode", the open flags given to bfs_open(), into
* access modes, e.g. since O_RDONLY requires read access to the

View File

@ -222,12 +222,29 @@ vnode_ops fs_entry = {
int32 api_version = B_CUR_FS_API_VERSION;
#ifdef DEBUG
//#warn Don't mount more than once... would register twice the debugger commands!
int db_obfsinode(int argc, char **argv)
{
Inode *ino;
if (argc < 2) {
kprintf("usage: obfsinode ptr\n");
return 0;
}
ino = (Inode *)parse_expression(argv[1]);
ino->KDumpMe();
return 0;
}
#endif
static int
bfs_mount(nspace_id nsid, const char *device, ulong flags, void *parms,
size_t len, void **data, vnode_id *rootID)
{
FUNCTION();
#ifdef DEBUG
add_debugger_command("obfsinode", db_obfsinode, "dump an OpenBFS Inode");
#endif
Volume *volume = new Volume(nsid);
if (volume == NULL)
@ -256,6 +273,9 @@ bfs_unmount(void *ns)
status_t status = volume->Unmount();
delete volume;
#ifdef DEBUG
remove_debugger_command("obfsinode", db_obfsinode);
#endif
RETURN_ERROR(status);
}