Added more (and conditional) debug stuff -- currently turned off.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6418 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2004-01-29 22:41:49 +00:00
parent 01338285a9
commit 4d61634cbe

View File

@ -25,6 +25,15 @@
# include "tracker.h" # include "tracker.h"
#endif #endif
#define TRACE_KERNEL 0
#if TRACE_KERNEL
# define FUNCTION() puts(__FUNCTION__)
# define TRACE(x...) printf(x)
#else
# define FUNCTION()
# define TRACE(x...)
#endif
#include <sys/stat.h> #include <sys/stat.h>
#define OMODE_MASK (O_RDONLY | O_WRONLY | O_RDWR) #define OMODE_MASK (O_RDONLY | O_WRONLY | O_RDWR)
@ -1597,13 +1606,14 @@ error1:
*/ */
int int
sys_rstat(bool kernel, int fd, const char *path, struct my_stat *st, sys_rstat(bool kernel, int fd, const char *path, struct my_stat *st, bool eatlink)
bool eatlink)
{ {
int err; int err;
vnode *vn; vnode *vn;
op_rstat *op; op_rstat *op;
FUNCTION();
err = get_file_fd(kernel, fd, path, eatlink, &vn); err = get_file_fd(kernel, fd, path, eatlink, &vn);
if (err) if (err)
goto error1; goto error1;
@ -1719,7 +1729,8 @@ sys_mount(bool kernel, const char *filesystem, int fd, const char *where,
for(ans=nshead; ans; ans=ans->next) for(ans=nshead; ans; ans=ans->next)
if ((ans->dev == dev) && (ans->ino == ino)) { if ((ans->dev == dev) && (ans->ino == ino)) {
UNLOCK(vnlock); UNLOCK(vnlock);
printf("KERNEL: trying to mount %s twice (already mounted as %s)\n", device, ans->fs->name); printf("KERNEL: trying to mount %s twice (already mounted as %s)\n",
device, ans->fs->name);
err = ENODEV; err = ENODEV;
goto error4; goto error4;
} }
@ -1901,7 +1912,7 @@ sys_open_query(bool kernel, int fd, const char *path, const char *query, ulong f
fsystem *fs; fsystem *fs;
vnode *root; vnode *root;
printf("sys_open_query() -- start\n"); TRACE("sys_open_query() -- start\n");
err = get_file_fd(TRUE, fd, path, TRUE, &root); err = get_file_fd(TRUE, fd, path, TRUE, &root);
if (err) if (err)
return err; return err;
@ -1916,7 +1927,7 @@ sys_open_query(bool kernel, int fd, const char *path, const char *query, ulong f
return EPERM; return EPERM;
} }
err = (*fs->ops.open_query)(ns->data, query, flags, port, token, cookie); err = (*fs->ops.open_query)(ns->data, query, flags, port, token, cookie);
printf("sys_open_query() -- end: %d\n",err); TRACE("sys_open_query() -- end: %d\n",err);
dec_vnode(root, FALSE); dec_vnode(root, FALSE);
return err; return err;
@ -2132,6 +2143,8 @@ parse_path(vnode *bvn, char **pstart, char *path, int eatsymlink, vnode **vnp)
vnode_id vnid; vnode_id vnid;
vnode *vn; vnode *vn;
TRACE("parse_path(path = %s)\n", path);
if (!path) { if (!path) {
*vnp = bvn; *vnp = bvn;
return 0; return 0;
@ -2249,8 +2262,10 @@ parse_path(vnode *bvn, char **pstart, char *path, int eatsymlink, vnode **vnp)
bvn = vn; bvn = vn;
} }
if (!err) if (!err) {
TRACE("parse_path() got vnode %Ld\n", bvn->vnid);
*vnp = bvn; *vnp = bvn;
}
return err; return err;
} }
@ -2315,7 +2330,7 @@ restart:
// out if needed. // out if needed.
if (vn->busy) { if (vn->busy) {
printf("new_vnode(): vnode exists and is busy!\n"); TRACE("new_vnode(): vnode exists and is busy!\n");
UNLOCK(vnlock); UNLOCK(vnlock);
snooze(5000); snooze(5000);
LOCK(vnlock); LOCK(vnlock);
@ -2429,6 +2444,8 @@ is_vnode_removed(nspace_id nsid, vnode_id vnid)
static void static void
inc_vnode(vnode *vn) inc_vnode(vnode *vn)
{ {
TRACE("inc_vnode(id = %Ld)\n", vn->vnid);
LOCK(vnlock); LOCK(vnlock);
vn->rcnt++; vn->rcnt++;
UNLOCK(vnlock); UNLOCK(vnlock);
@ -2441,6 +2458,7 @@ dec_vnode(vnode *vn, char r)
LOCK(vnlock); LOCK(vnlock);
vn->rcnt--; vn->rcnt--;
TRACE("dec_vnode(): id = %Ld, rcnt = %d (after decreasing)\n", vn->vnid, vn->rcnt);
if (vn->rcnt == 0) { if (vn->rcnt == 0) {
if (vn->remove) { if (vn->remove) {
vn->busy = TRUE; vn->busy = TRUE;