Cleaned up the debug mess mmu_man has created (thanks anyway!).

Fixed a bug where the debug commands would be added in bfs_mount(), but
not removed (since bfs_unmount() is only called if bfs_mount() doesn't
fail).
Switched to kernel_cpp.h/cpp.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6290 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2004-01-25 14:46:24 +00:00
parent a893229e08
commit aef00d7b03
@@ -6,7 +6,6 @@
#include "Debug.h" #include "Debug.h"
#include "cpp.h"
#include "Volume.h" #include "Volume.h"
#include "Inode.h" #include "Inode.h"
#include "Index.h" #include "Index.h"
@@ -14,6 +13,8 @@
#include "Query.h" #include "Query.h"
#include "bfs_control.h" #include "bfs_control.h"
#include <kernel_cpp.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
@@ -222,29 +223,12 @@ vnode_ops fs_entry = {
int32 api_version = B_CUR_FS_API_VERSION; 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 static int
bfs_mount(nspace_id nsid, const char *device, ulong flags, void *parms, bfs_mount(nspace_id nsid, const char *device, ulong flags, void *parms,
size_t len, void **data, vnode_id *rootID) size_t len, void **data, vnode_id *rootID)
{ {
FUNCTION(); FUNCTION();
#ifdef DEBUG
add_debugger_command("obfsinode", db_obfsinode, "dump an OpenBFS Inode");
#endif
Volume *volume = new Volume(nsid); Volume *volume = new Volume(nsid);
if (volume == NULL) if (volume == NULL)
@@ -256,6 +240,10 @@ bfs_mount(nspace_id nsid, const char *device, ulong flags, void *parms,
*rootID = volume->ToVnode(volume->Root()); *rootID = volume->ToVnode(volume->Root());
INFORM(("mounted \"%s\" (root node at %Ld, device = %s)\n", INFORM(("mounted \"%s\" (root node at %Ld, device = %s)\n",
volume->Name(), *rootID, device)); volume->Name(), *rootID, device));
#ifdef DEBUG
add_debugger_commands();
#endif
} }
else else
delete volume; delete volume;
@@ -274,7 +262,7 @@ bfs_unmount(void *ns)
delete volume; delete volume;
#ifdef DEBUG #ifdef DEBUG
remove_debugger_command("obfsinode", db_obfsinode); remove_debugger_commands();
#endif #endif
RETURN_ERROR(status); RETURN_ERROR(status);
} }