Conditionalize "stray" printouts under DIAGNOSTIC and DEBUG.

Make files compile if DEBUG is on (from  Alan Barrett).  Finally,
make coda an lkm.
This commit is contained in:
rvb 1998-09-25 15:01:12 +00:00
parent ed652e2a09
commit c559082b97
7 changed files with 139 additions and 38 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: coda_namecache.c,v 1.4 1998/09/15 02:02:58 rvb Exp $ */
/* $NetBSD: coda_namecache.c,v 1.5 1998/09/25 15:01:12 rvb Exp $ */
/*
*
@ -47,6 +47,11 @@
/*
* HISTORY
* $Log: coda_namecache.c,v $
* Revision 1.5 1998/09/25 15:01:12 rvb
* Conditionalize "stray" printouts under DIAGNOSTIC and DEBUG.
* Make files compile if DEBUG is on (from Alan Barrett). Finally,
* make coda an lkm.
*
* Revision 1.4 1998/09/15 02:02:58 rvb
* Final piece of rename cfs->coda
*
@ -227,6 +232,10 @@
#include <coda/cnode.h>
#include <coda/coda_namecache.h>
#ifdef DEBUG
#include <coda/coda_vnops.h>
#endif
#ifndef insque
#include <sys/systm.h>
#endif /* insque */
@ -278,7 +287,9 @@ coda_nc_init(void)
bzero(&coda_nc_stat, (sizeof(struct coda_nc_statistics)));
#ifdef DIAGNOSTIC
printf("CODA NAME CACHE: CACHE %d, HASH TBL %d\n", CODA_NC_CACHESIZE, CODA_NC_HASHSIZE);
#endif
CODA_ALLOC(coda_nc_heap, struct coda_cache *, TOTAL_CACHE_SIZE);
CODA_ALLOC(coda_nc_hash, struct coda_hash *, TOTAL_HASH_SIZE);

View File

@ -1,4 +1,4 @@
/* $NetBSD: coda_psdev.c,v 1.4 1998/09/15 02:02:59 rvb Exp $ */
/* $NetBSD: coda_psdev.c,v 1.5 1998/09/25 15:01:13 rvb Exp $ */
/*
*
@ -52,6 +52,11 @@
/*
* HISTORY
* $Log: coda_psdev.c,v $
* Revision 1.5 1998/09/25 15:01:13 rvb
* Conditionalize "stray" printouts under DIAGNOSTIC and DEBUG.
* Make files compile if DEBUG is on (from Alan Barrett). Finally,
* make coda an lkm.
*
* Revision 1.4 1998/09/15 02:02:59 rvb
* Final piece of rename cfs->coda
*
@ -160,7 +165,12 @@
extern int coda_nc_initialized; /* Set if cache has been initialized */
#ifdef _LKM
#define NVCODA 4
#else
#include <vcoda.h>
#endif
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@ -176,6 +186,7 @@ extern int coda_nc_initialized; /* Set if cache has been initialized */
#include <coda/cnode.h>
#include <coda/coda_namecache.h>
#include <coda/coda_io.h>
#include <coda/coda_psdev.h>
#define CTL_C
@ -184,12 +195,6 @@ int coda_psdev_print_entry = 0;
#define ENTRY if(coda_psdev_print_entry) myprintf(("Entered %s\n",__FUNCTION__))
void vcodaattach(int n);
int vc_nb_open(dev_t dev, int flag, int mode, struct proc *p);
int vc_nb_close (dev_t dev, int flag, int mode, struct proc *p);
int vc_nb_read(dev_t dev, struct uio *uiop, int flag);
int vc_nb_write(dev_t dev, struct uio *uiop, int flag);
int vc_nb_ioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p);
int vc_nb_poll(dev_t dev, int events, struct proc *p);
struct vmsg {
struct queue vm_chain;
@ -346,7 +351,7 @@ vc_nb_read(dev, uiop, flag)
error = EINVAL;
}
#ifdef DIAGNOSTIC
#ifdef OLD_DIAGNOSTIC
if (vmp->vm_chain.forw == 0 || vmp->vm_chain.back == 0)
panic("vc_nb_read: bad chain");
#endif
@ -473,7 +478,7 @@ vc_nb_write(dev, uiop, flag)
int
vc_nb_ioctl(dev, cmd, addr, flag, p)
dev_t dev;
int cmd;
u_long cmd;
caddr_t addr;
int flag;
struct proc *p;
@ -627,15 +632,20 @@ coda_call(mntinfo, inSize, outSize, buffer)
if (error == 0)
break;
else if (error == EWOULDBLOCK) {
#ifdef DIAGNOSTIC
printf("coda_call: tsleep TIMEOUT %d sec\n", 2+2*i);
#endif
} else if (sigismember(&p->p_siglist, SIGIO)) {
sigaddset(&p->p_sigmask, SIGIO);
#ifdef DIAGNOSTIC
printf("coda_call: tsleep returns %d SIGIO, cnt %d\n", error, i);
#endif
} else {
sigset_t tmp;
tmp = p->p_siglist; /* array assignment */
sigminusset(&p->p_sigmask, &tmp);
#ifdef DIAGNOSTIC
printf("coda_call: tsleep returns %d, cnt %d\n", error, i);
printf("coda_call: siglist = %x.%x.%x.%x, sigmask = %x.%x.%x.%x, mask %x.%x.%x.%x\n",
p->p_siglist.__bits[0], p->p_siglist.__bits[1],
@ -643,13 +653,16 @@ coda_call(mntinfo, inSize, outSize, buffer)
p->p_sigmask.__bits[0], p->p_sigmask.__bits[1],
p->p_sigmask.__bits[2], p->p_sigmask.__bits[3],
tmp.__bits[0], tmp.__bits[1], tmp.__bits[2], tmp.__bits[3]);
#endif
break;
#ifdef notyet
sigminusset(&p->p_sigmask, &p->p_siglist);
printf("coda_call: siglist = %x.%x.%x.%x, sigmask = %x.%x.%x.%x\n",
p->p_siglist.__bits[0], p->p_siglist.__bits[1],
p->p_siglist.__bits[2], p->p_siglist.__bits[3],
p->p_sigmask.__bits[0], p->p_sigmask.__bits[1],
p->p_sigmask.__bits[2], p->p_sigmask.__bits[3]);
#endif
}
} while (error && i++ < 128);
p->p_siglist = psig_omask; /* array assignment */
@ -665,7 +678,11 @@ coda_call(mntinfo, inSize, outSize, buffer)
else if (!(vmp->vm_flags & VM_READ)) {
/* Interrupted before venus read it. */
if (codadebug||1)
#ifdef DIAGNOSTIC
if (1)
#else
if (codadebug)
#endif
myprintf(("interrupted before read: op = %d.%d, flags = %x\n",
vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags));
REMQUE(vmp->vm_chain);
@ -679,7 +696,11 @@ coda_call(mntinfo, inSize, outSize, buffer)
struct coda_in_hdr *dog;
struct vmsg *svmp;
if (codadebug||1)
#ifdef DIAGNOSTIC
if (1)
#else
if (codadebug)
#endif
myprintf(("Sending Venus a signal: op = %d.%d, flags = %x\n",
vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags));

40
sys/coda/coda_psdev.h Normal file
View File

@ -0,0 +1,40 @@
/* $NetBSD: coda_psdev.h,v 1.1 1998/09/25 15:01:13 rvb Exp $ */
/*
*
* Coda: an Experimental Distributed File System
* Release 3.1
*
* Copyright (c) 1998 Carnegie Mellon University
* All Rights Reserved
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation, and
* that credit is given to Carnegie Mellon University in all documents
* and publicity pertaining to direct or indirect use of this code or its
* derivatives.
*
* CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
* SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS
* FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON
* DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER
* RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
* ANY DERIVATIVE WORK.
*
* Carnegie Mellon encourages users of this software to return any
* improvements or extensions that they make, and to grant Carnegie
* Mellon the rights to redistribute these changes without encumbrance.
*
* @(#) coda/coda_psdev.h,v 1.1 1998/08/29 21:26:45 rvb Exp $
*/
int vc_nb_open(dev_t dev, int flag, int mode, struct proc *p);
int vc_nb_close (dev_t dev, int flag, int mode, struct proc *p);
int vc_nb_read(dev_t dev, struct uio *uiop, int flag);
int vc_nb_write(dev_t dev, struct uio *uiop, int flag);
int vc_nb_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p);
int vc_nb_poll(dev_t dev, int events, struct proc *p);

View File

@ -1,4 +1,4 @@
/* $NetBSD: coda_subr.c,v 1.4 1998/09/15 02:02:59 rvb Exp $ */
/* $NetBSD: coda_subr.c,v 1.5 1998/09/25 15:01:13 rvb Exp $ */
/*
*
@ -46,6 +46,11 @@
/*
* HISTORY
* $Log: coda_subr.c,v $
* Revision 1.5 1998/09/25 15:01:13 rvb
* Conditionalize "stray" printouts under DIAGNOSTIC and DEBUG.
* Make files compile if DEBUG is on (from Alan Barrett). Finally,
* make coda an lkm.
*
* Revision 1.4 1998/09/15 02:02:59 rvb
* Final piece of rename cfs->coda
*
@ -213,7 +218,11 @@
* 4. coda_cacheprint (under DEBUG) prints names with vnode/cnode address
*/
#ifdef _LKM
#define NVCODA 4
#else
#include <vcoda.h>
#endif
#include <sys/param.h>
#include <sys/systm.h>
@ -467,6 +476,7 @@ coda_unmounting(whoIam)
}
#ifdef DEBUG
void
coda_checkunmounting(mp)
struct mount *mp;
{
@ -488,7 +498,7 @@ loop:
}
}
int
void
coda_cacheprint(whoIam)
struct mount *whoIam;
{
@ -497,7 +507,7 @@ coda_cacheprint(whoIam)
int count = 0;
printf("coda_cacheprint: coda_ctlvp %p, cp %p", coda_ctlvp, VTOC(coda_ctlvp));
coda_nc_name(coda_ctlvp);
coda_nc_name(VTOC(coda_ctlvp));
printf("\n");
for (hash = 0; hash < CODA_CACHESIZE; hash++) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: coda_subr.h,v 1.4 1998/09/15 02:02:59 rvb Exp $ */
/* $NetBSD: coda_subr.h,v 1.5 1998/09/25 15:01:13 rvb Exp $ */
/*
*
@ -36,8 +36,8 @@ void coda_free(struct cnode *cp);
struct cnode *coda_find(ViceFid *fid);
void coda_flush(enum dc_status dcstat);
void coda_testflush(void);
int coda_checkunmounting(struct mount *mp);
int coda_cacheprint(struct mount *whoIam);
void coda_checkunmounting(struct mount *mp);
void coda_cacheprint(struct mount *whoIam);
void coda_debugon(void);
void coda_debugoff(void);
int coda_kill(struct mount *whoIam, enum dc_status dcstat);

View File

@ -1,4 +1,4 @@
/* $NetBSD: coda_vfsops.c,v 1.4 1998/09/15 02:03:00 rvb Exp $ */
/* $NetBSD: coda_vfsops.c,v 1.5 1998/09/25 15:01:13 rvb Exp $ */
/*
*
@ -47,6 +47,11 @@
/*
* HISTORY
* $Log: coda_vfsops.c,v $
* Revision 1.5 1998/09/25 15:01:13 rvb
* Conditionalize "stray" printouts under DIAGNOSTIC and DEBUG.
* Make files compile if DEBUG is on (from Alan Barrett). Finally,
* make coda an lkm.
*
* Revision 1.4 1998/09/15 02:03:00 rvb
* Final piece of rename cfs->coda
*
@ -185,7 +190,11 @@
*
*/
#ifdef _LKM
#define NVCODA 4
#else
#include <vcoda.h>
#endif
#include <sys/param.h>
#include <sys/systm.h>

View File

@ -6,7 +6,7 @@ mkdir
rmdir
symlink
*/
/* $NetBSD: coda_vnops.c,v 1.4 1998/09/15 02:03:00 rvb Exp $ */
/* $NetBSD: coda_vnops.c,v 1.5 1998/09/25 15:01:13 rvb Exp $ */
/*
*
@ -56,6 +56,11 @@ symlink
/*
* HISTORY
* $Log: coda_vnops.c,v $
* Revision 1.5 1998/09/25 15:01:13 rvb
* Conditionalize "stray" printouts under DIAGNOSTIC and DEBUG.
* Make files compile if DEBUG is on (from Alan Barrett). Finally,
* make coda an lkm.
*
* Revision 1.4 1998/09/15 02:03:00 rvb
* Final piece of rename cfs->coda
*
@ -298,12 +303,12 @@ struct vnodeopv_entry_desc coda_vnodeop_entries[] = {
{ &vop_default_desc, coda_vop_error },
{ &vop_lookup_desc, coda_lookup }, /* lookup */
{ &vop_create_desc, coda_create }, /* create */
{ &vop_mknod_desc, coda_vop_error }, /* mknod */
{ &vop_mknod_desc, coda_vop_error }, /* mknod */
{ &vop_open_desc, coda_open }, /* open */
{ &vop_close_desc, coda_close }, /* close */
{ &vop_access_desc, coda_access }, /* access */
{ &vop_getattr_desc, coda_getattr }, /* getattr */
{ &vop_setattr_desc, coda_setattr }, /* setattr */
{ &vop_getattr_desc, coda_getattr }, /* getattr */
{ &vop_setattr_desc, coda_setattr }, /* setattr */
{ &vop_read_desc, coda_read }, /* read */
{ &vop_write_desc, coda_write }, /* write */
{ &vop_ioctl_desc, coda_ioctl }, /* ioctl */
@ -315,28 +320,29 @@ struct vnodeopv_entry_desc coda_vnodeop_entries[] = {
{ &vop_rename_desc, coda_rename }, /* rename */
{ &vop_mkdir_desc, coda_mkdir }, /* mkdir */
{ &vop_rmdir_desc, coda_rmdir }, /* rmdir */
{ &vop_symlink_desc, coda_symlink }, /* symlink */
{ &vop_readdir_desc, coda_readdir }, /* readdir */
{ &vop_symlink_desc, coda_symlink }, /* symlink */
{ &vop_readdir_desc, coda_readdir }, /* readdir */
{ &vop_readlink_desc, coda_readlink }, /* readlink */
{ &vop_abortop_desc, coda_abortop }, /* abortop */
{ &vop_abortop_desc, coda_abortop }, /* abortop */
{ &vop_inactive_desc, coda_inactive }, /* inactive */
{ &vop_reclaim_desc, coda_reclaim }, /* reclaim */
{ &vop_reclaim_desc, coda_reclaim }, /* reclaim */
{ &vop_lock_desc, coda_lock }, /* lock */
{ &vop_unlock_desc, coda_unlock }, /* unlock */
{ &vop_bmap_desc, coda_bmap }, /* bmap */
{ &vop_strategy_desc, coda_strategy }, /* strategy */
{ &vop_print_desc, coda_vop_error }, /* print */
{ &vop_print_desc, coda_vop_error }, /* print */
{ &vop_islocked_desc, coda_islocked }, /* islocked */
{ &vop_pathconf_desc, coda_vop_error }, /* pathconf */
{ &vop_advlock_desc, coda_vop_nop }, /* advlock */
{ &vop_advlock_desc, coda_vop_nop }, /* advlock */
{ &vop_bwrite_desc, coda_vop_error }, /* bwrite */
{ &vop_lease_desc, coda_vop_nop }, /* lease */
{ &vop_blkatoff_desc, coda_vop_error }, /* blkatoff */
{ &vop_valloc_desc, coda_vop_error }, /* valloc */
{ &vop_vfree_desc, coda_vop_error }, /* vfree */
{ &vop_vfree_desc, coda_vop_error }, /* vfree */
{ &vop_truncate_desc, coda_vop_error }, /* truncate */
{ &vop_update_desc, coda_vop_error }, /* update */
{ &vop_seek_desc, genfs_seek }, /* seek */
{ &vop_poll_desc, genfs_poll }, /* poll */
{ (struct vnodeop_desc*)NULL, (int(*)(void *))NULL }
};
@ -497,11 +503,15 @@ coda_close(v)
if (IS_UNMOUNTING(cp)) {
if (cp->c_ovp) {
#ifdef DIAGNOSTIC
printf("coda_close: destroying container ref %d, ufs vp %p of vp %p/cp %p\n",
vp->v_usecount, cp->c_ovp, vp, cp);
#endif
vgone(cp->c_ovp);
} else {
#ifdef DIAGNOSTIC
printf("coda_close: NO container vp %p/cp %p\n", vp, cp);
#endif
}
return ENODEV;
} else {
@ -1044,7 +1054,7 @@ coda_inactive(v)
#endif
lockmgr(&cp->c_lock, LK_RELEASE, &vp->v_interlock);
} else {
#ifdef DIAGNOSTIC
#ifdef OLD_DIAGNOSTIC
if (CTOV(cp)->v_usecount) {
panic("coda_inactive: nonzero reference count");
}
@ -1318,11 +1328,11 @@ coda_create(v)
panic("unlocked parent but couldn't lock child");
}
}
#ifdef DIAGNOSTIC
#ifdef OLD_DIAGNOSTIC
else {
printf("coda_create: LOCKLEAF not set!\n");
}
#endif /* DIAGNOSTIC */
#endif
}
/* Have to free the previously saved name */
/*
@ -1514,13 +1524,13 @@ coda_rename(v)
/* Hmmm. The vnodes are already looked up. Perhaps they are locked?
This could be Bad. XXX */
#ifdef DIAGNOSTIC
#ifdef OLD_DIAGNOSTIC
if ((fcnp->cn_cred != tcnp->cn_cred)
|| (fcnp->cn_proc != tcnp->cn_proc))
{
panic("coda_rename: component names don't agree");
}
#endif DIAGNOSTIC
#endif
/* Check for rename involving control object. */
if (IS_CTL_NAME(odvp, fnm, flen) || IS_CTL_NAME(ndvp, tnm, tlen)) {
@ -1973,13 +1983,13 @@ coda_reclaim(v)
}
#endif
} else {
#ifdef DIAGNOSTIC
#ifdef OLD_DIAGNOSTIC
if (vp->v_usecount != 0)
vprint("coda_reclaim: pushing active", vp);
print("coda_reclaim: pushing active %p\n", vp);
if (VTOC(vp)->c_ovp) {
panic("coda_reclaim: c_ovp not void");
}
#endif DIAGNOSTIC
#endif
}
cache_purge(vp);
coda_free(VTOC(vp));