Subject: kern/4098: {KERNFS,NULLFS,UMAPFS,UNION}_DIAGNOSTIC kernel compile errors
To: None <gnats-bugs@gnats.netbsd.org>
From: None <apb@iafrica.com>
List: netbsd-bugs
Date: 09/08/1997 10:57:54
>Number:         4098
>Category:       kern
>Synopsis:       {KERNFS,NULLFS,UMAPFS,UNION}_DIAGNOSTIC kernel compile errors
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep  8 02:05:00 1997
>Last-Modified:
>Originator:     Alan Barrett
>Organization:
not much
>Release:        NetBSD-current 1997-09-07
>Environment:
NetBSD/i386 1.2G Sun Sep 7 16:10:07 GMT+0200 1997
>Description:
Several compile errors occur during builds of a kernel configured
with the following options:

	file-system     KERNFS          # /kern
	options         KERNFS_DIAGNOSTIC
	file-system     NULLFS          # loopback file system
	options         NULLFS_DIAGNOSTIC
	file-system     PROCFS          # /proc
	options         PROCFS_DIAGNOSTIC
	file-system     UMAPFS          # NULLFS + uid and gid remapping
	options         UMAPFS_DIAGNOSTIC
	file-system     UNION           # union file system
	options         UNION_DIAGNOSTIC

The errors are all in code protected by #ifdef <foo>_DIAGNOSTIC, and
are mostly printf format mismatches (using %x or %lx format to print a
pointer value, or using %x to print a long value), but there are also a
few other errors about undefined functions and variables.

>How-To-Repeat:
	Try to build a kernel with the options mentioned above.
>Fix:
	The appended patch fixes all the printf format mismatches,
	and handles the undefined functions and variables in a way
	that might not be correct, but at least stops the compiler
	from complaining.

--- sys/miscfs/kernfs/kernfs_vfsops.c	Sun Dec 22 15:08:16 1996
+++ sys/miscfs/kernfs/kernfs_vfsops.c	Mon Sep  8 10:07:48 1997
@@ -119,7 +119,7 @@
 	struct vnode *rvp;
 
 #ifdef KERNFS_DIAGNOSTIC
-	printf("kernfs_mount(mp = %x)\n", mp);
+	printf("kernfs_mount(mp = %p)\n", mp);
 #endif
 
 	/*
@@ -137,7 +137,7 @@
 	rvp->v_type = VDIR;
 	rvp->v_flag |= VROOT;
 #ifdef KERNFS_DIAGNOSTIC
-	printf("kernfs_mount: root vp = %x\n", rvp);
+	printf("kernfs_mount: root vp = %p\n", rvp);
 #endif
 	fmp->kf_root = rvp;
 	mp->mnt_flag |= MNT_LOCAL;
@@ -178,7 +178,7 @@
 	struct vnode *rootvp = VFSTOKERNFS(mp)->kf_root;
 
 #ifdef KERNFS_DIAGNOSTIC
-	printf("kernfs_unmount(mp = %x)\n", mp);
+	printf("kernfs_unmount(mp = %p)\n", mp);
 #endif
 
 	if (mntflags & MNT_FORCE) {
@@ -225,7 +225,7 @@
 	struct vnode *vp;
 
 #ifdef KERNFS_DIAGNOSTIC
-	printf("kernfs_root(mp = %x)\n", mp);
+	printf("kernfs_root(mp = %p)\n", mp);
 #endif
 
 	/*
@@ -258,7 +258,7 @@
 {
 
 #ifdef KERNFS_DIAGNOSTIC
-	printf("kernfs_statfs(mp = %x)\n", mp);
+	printf("kernfs_statfs(mp = %p)\n", mp);
 #endif
 
 #ifdef COMPAT_09
--- sys/miscfs/kernfs/kernfs_vnops.c	Sun May 11 13:21:44 1997
+++ sys/miscfs/kernfs/kernfs_vnops.c	Mon Sep  8 10:08:05 1997
@@ -306,8 +306,8 @@
 	int error, i;
 
 #ifdef KERNFS_DIAGNOSTIC
-	printf("kernfs_lookup(%x)\n", ap);
-	printf("kernfs_lookup(dp = %x, vpp = %x, cnp = %x)\n", dvp, vpp, ap->a_cnp);
+	printf("kernfs_lookup(%p)\n", ap);
+	printf("kernfs_lookup(dp = %p, vpp = %p, cnp = %p)\n", dvp, vpp, ap->a_cnp);
 	printf("kernfs_lookup(%s)\n", pname);
 #endif
 
@@ -370,7 +370,7 @@
 	*vpp = fvp;
 
 #ifdef KERNFS_DIAGNOSTIC
-	printf("kernfs_lookup: newvp = %x\n", fvp);
+	printf("kernfs_lookup: newvp = %p\n", fvp);
 #endif
 	return (0);
 }
@@ -625,7 +625,7 @@
 	struct vnode *vp = ap->a_vp;
 
 #ifdef KERNFS_DIAGNOSTIC
-	printf("kernfs_inactive(%x)\n", vp);
+	printf("kernfs_inactive(%p)\n", vp);
 #endif
 	/*
 	 * Clear out the v_type field to avoid
@@ -645,7 +645,7 @@
 	struct vnode *vp = ap->a_vp;
 
 #ifdef KERNFS_DIAGNOSTIC
-	printf("kernfs_reclaim(%x)\n", vp);
+	printf("kernfs_reclaim(%p)\n", vp);
 #endif
 	if (vp->v_data) {
 		FREE(vp->v_data, M_TEMP);
--- sys/miscfs/nullfs/null_subr.c	Mon Oct 14 18:41:06 1996
+++ sys/miscfs/nullfs/null_subr.c	Sun Sep  7 16:09:34 1997
@@ -302,7 +302,6 @@
 	return (0);
 }
 
-#ifdef notyet
 #ifdef NULLFS_DIAGNOSTIC
 struct vnode *
 null_checkvp(vp, fil, lno)
@@ -318,38 +317,43 @@
 	 */
 	if (vp->v_op != null_vnodeop_p) {
 		printf ("null_checkvp: on non-null-node\n");
+#ifdef notyet
 		while (null_checkvp_barrier) /*WAIT*/ ;
+#endif
 		panic("null_checkvp");
 	};
 #endif
 	if (a->null_lowervp == NULL) {
 		/* Should never happen */
 		int i; u_long *p;
-		printf("vp = %x, ZERO ptr\n", vp);
+		printf("vp = %p, ZERO ptr\n", vp);
 		for (p = (u_long *) a, i = 0; i < 8; i++)
-			printf(" %x", p[i]);
+			printf(" %lx", p[i]);
 		printf("\n");
 		/* wait for debugger */
+#ifdef notyet
 		while (null_checkvp_barrier) /*WAIT*/ ;
+#endif
 		panic("null_checkvp");
 	}
 	if (a->null_lowervp->v_usecount < 1) {
 		int i; u_long *p;
-		printf("vp = %x, unref'ed lowervp\n", vp);
+		printf("vp = %p, unref'ed lowervp\n", vp);
 		for (p = (u_long *) a, i = 0; i < 8; i++)
-			printf(" %x", p[i]);
+			printf(" %lx", p[i]);
 		printf("\n");
 		/* wait for debugger */
+#ifdef notyet
 		while (null_checkvp_barrier) /*WAIT*/ ;
+#endif
 		panic ("null with unref'ed lowervp");
 	};
 #ifdef notyet
-	printf("null %x/%d -> %x/%d [%s, %d]\n",
+	printf("null %p/%d -> %p/%d [%s, %d]\n",
 	        NULLTOV(a), NULLTOV(a)->v_usecount,
 		a->null_lowervp, a->null_lowervp->v_usecount,
 		fil, lno);
 #endif
 	return a->null_lowervp;
 }
-#endif
 #endif
--- sys/miscfs/nullfs/null_vfsops.c	Tue Mar 11 14:21:34 1997
+++ sys/miscfs/nullfs/null_vfsops.c	Sun Sep  7 15:29:44 1997
@@ -87,7 +87,7 @@
 	size_t size;
 
 #ifdef NULLFS_DIAGNOSTIC
-	printf("nullfs_mount(mp = %x)\n", mp);
+	printf("nullfs_mount(mp = %p)\n", mp);
 #endif
 
 	/*
@@ -202,7 +202,7 @@
 	extern int doforce;
 
 #ifdef NULLFS_DIAGNOSTIC
-	printf("nullfs_unmount(mp = %x)\n", mp);
+	printf("nullfs_unmount(mp = %p)\n", mp);
 #endif
 
 	if (mntflags & MNT_FORCE) {
@@ -254,7 +254,7 @@
 	struct vnode *vp;
 
 #ifdef NULLFS_DIAGNOSTIC
-	printf("nullfs_root(mp = %x, vp = %x->%x)\n", mp,
+	printf("nullfs_root(mp = %p, vp = %p->%p)\n", mp,
 	    MOUNTTONULLMOUNT(mp)->nullm_rootvp,
 	    NULLVPTOLOWERVP(MOUNTTONULLMOUNT(mp)->nullm_rootvp));
 #endif
@@ -291,7 +291,7 @@
 	struct statfs mstat;
 
 #ifdef NULLFS_DIAGNOSTIC
-	printf("nullfs_statfs(mp = %x, vp = %x->%x)\n", mp,
+	printf("nullfs_statfs(mp = %p, vp = %p->%p)\n", mp,
 	    MOUNTTONULLMOUNT(mp)->nullm_rootvp,
 	    NULLVPTOLOWERVP(MOUNTTONULLMOUNT(mp)->nullm_rootvp));
 #endif
--- sys/miscfs/nullfs/null_vnops.c	Sun May 18 13:22:14 1997
+++ sys/miscfs/nullfs/null_vnops.c	Sun Sep  7 15:39:33 1997
@@ -512,7 +512,7 @@
 
 #ifdef NULLFS_DIAGNOSTIC
 	vprint("null_lock_e", ap->a_vp);
-	printf("retpc=%lx, retretpc=%lx\n", RETURN_PC(0), RETURN_PC(1));
+	printf("retpc=%p, retretpc=%p\n", RETURN_PC(0), RETURN_PC(1));
 #endif
 start:
 	while (vp->v_flag & VXLOCK) {
@@ -622,7 +622,7 @@
 	int flags = ap->a_cnp->cn_flags;
 
 #ifdef NULLFS_DIAGNOSTIC
-	printf("null_lookup: dvp=%lx, name='%s'\n",
+	printf("null_lookup: dvp=%p, name='%s'\n",
 	    ap->a_dvp, ap->a_cnp->cn_nameptr);
 #endif
 	/*
--- sys/miscfs/procfs/procfs_mem.c	Wed Aug 27 13:43:25 1997
+++ sys/miscfs/procfs/procfs_mem.c	Mon Sep  8 10:08:58 1997
@@ -317,7 +317,7 @@
 
 			printf("procfs: found vm object\n");
 			vm_map_lookup_done(map, out_entry);
-			printf("procfs: vm object = %x\n", object);
+			printf("procfs: vm object = %p\n", object);
 
 			/*
 			 * At this point, assuming no errors, object
@@ -327,7 +327,7 @@
 			 */
 
 			pager = object->pager;
-			printf("procfs: pager = %x\n", pager);
+			printf("procfs: pager = %p\n", pager);
 			if (pager)
 				printf("procfs: found pager, type = %d\n",
 				    pager->pg_type);
@@ -335,7 +335,7 @@
 				struct vnode *vp;
 
 				vp = (struct vnode *) pager->pg_handle;
-				printf("procfs: vp = 0x%x\n", vp);
+				printf("procfs: vp = %p\n", vp);
 				return (vp);
 			}
 		}
--- sys/miscfs/umapfs/umap_subr.c	Mon Oct 14 18:41:20 1996
+++ sys/miscfs/umapfs/umap_subr.c	Mon Sep  8 10:27:08 1997
@@ -145,7 +145,7 @@
 	struct vnode *vp;
 
 #ifdef UMAPFS_DIAGNOSTIC
-	printf("umap_node_find(mp = %x, target = %x)\n", mp, targetvp);
+	printf("umap_node_find(mp = %p, target = %p)\n", mp, targetvp);
 #endif
 
 	/*
@@ -176,7 +176,7 @@
 	}
 
 #ifdef UMAPFS_DIAGNOSTIC
-	printf("umap_node_find(%x, %x): NOT found\n", mp, targetvp);
+	printf("umap_node_find(%p, %p): NOT found\n", mp, targetvp);
 #endif
 
 	return (0);
@@ -303,7 +303,7 @@
 		 * Take another reference to the alias vnode
 		 */
 #ifdef UMAPFS_DIAGNOSTIC
-		vprint("umap_node_create: exists", ap->umap_vnode);
+		vprint("umap_node_create: exists", aliasvp);
 #endif
 		/* VREF(aliasvp); */
 	} else {
@@ -360,9 +360,9 @@
 	if (a->umap_lowervp == NULL) {
 		/* Should never happen */
 		int i; u_long *p;
-		printf("vp = %x, ZERO ptr\n", vp);
+		printf("vp = %p, ZERO ptr\n", vp);
 		for (p = (u_long *) a, i = 0; i < 8; i++)
-			printf(" %x", p[i]);
+			printf(" %lx", p[i]);
 		printf("\n");
 		/* wait for debugger */
 		while (umap_checkvp_barrier) /*WAIT*/ ;
@@ -370,16 +370,16 @@
 	}
 	if (a->umap_lowervp->v_usecount < 1) {
 		int i; u_long *p;
-		printf("vp = %x, unref'ed lowervp\n", vp);
+		printf("vp = %p, unref'ed lowervp\n", vp);
 		for (p = (u_long *) a, i = 0; i < 8; i++)
-			printf(" %x", p[i]);
+			printf(" %lx", p[i]);
 		printf("\n");
 		/* wait for debugger */
 		while (umap_checkvp_barrier) /*WAIT*/ ;
 		panic ("umap with unref'ed lowervp");
 	}
 #if 0
-	printf("umap %x/%d -> %x/%d [%s, %d]\n",
+	printf("umap %p/%d -> %p/%d [%s, %d]\n",
 	        a->umap_vnode, a->umap_vnode->v_usecount,
 		a->umap_lowervp, a->umap_lowervp->v_usecount,
 		fil, lno);
--- sys/miscfs/umapfs/umap_vfsops.c	Tue Mar 11 14:21:34 1997
+++ sys/miscfs/umapfs/umap_vfsops.c	Mon Sep  8 10:10:35 1997
@@ -87,7 +87,7 @@
 	int error;
 
 #ifdef UMAPFS_DIAGNOSTIC
-	printf("umapfs_mount(mp = %x)\n", mp);
+	printf("umapfs_mount(mp = %p)\n", mp);
 #endif
 
 	/*
@@ -118,7 +118,7 @@
 	 */
 	lowerrootvp = ndp->ni_vp;
 #ifdef UMAPFS_DIAGNOSTIC
-	printf("vp = %x, check for VDIR...\n", lowerrootvp);
+	printf("vp = %p, check for VDIR...\n", lowerrootvp);
 #endif
 	vrele(ndp->ni_dvp);
 	ndp->ni_dvp = 0;
@@ -129,7 +129,7 @@
 	}
 
 #ifdef UMAPFS_DIAGNOSTIC
-	printf("mp = %x\n", mp);
+	printf("mp = %p\n", mp);
 #endif
 
 	amp = (struct umap_mount *) malloc(sizeof(struct umap_mount),
@@ -244,7 +244,7 @@
 	extern int doforce;
 
 #ifdef UMAPFS_DIAGNOSTIC
-	printf("umapfs_unmount(mp = %x)\n", mp);
+	printf("umapfs_unmount(mp = %p)\n", mp);
 #endif
 
 	if (mntflags & MNT_FORCE) {
@@ -296,7 +296,7 @@
 	struct vnode *vp;
 
 #ifdef UMAPFS_DIAGNOSTIC
-	printf("umapfs_root(mp = %x, vp = %x->%x)\n", mp,
+	printf("umapfs_root(mp = %p, vp = %p->%p)\n", mp,
 	    MOUNTTOUMAPMOUNT(mp)->umapm_rootvp,
 	    UMAPVPTOLOWERVP(MOUNTTOUMAPMOUNT(mp)->umapm_rootvp));
 #endif
@@ -333,7 +333,7 @@
 	struct statfs mstat;
 
 #ifdef UMAPFS_DIAGNOSTIC
-	printf("umapfs_statfs(mp = %x, vp = %x->%x)\n", mp,
+	printf("umapfs_statfs(mp = %p, vp = %p->%p)\n", mp,
 	    MOUNTTOUMAPMOUNT(mp)->umapm_rootvp,
 	    UMAPVPTOLOWERVP(MOUNTTOUMAPMOUNT(mp)->umapm_rootvp));
 #endif
--- sys/miscfs/union/union_vfsops.c	Mon May  5 13:20:32 1997
+++ sys/miscfs/union/union_vfsops.c	Sun Sep  7 15:41:21 1997
@@ -93,7 +93,7 @@
 	size_t size;
 
 #ifdef UNION_DIAGNOSTIC
-	printf("union_mount(mp = %x)\n", mp);
+	printf("union_mount(mp = %p)\n", mp);
 #endif
 
 	/*
@@ -295,7 +295,7 @@
 	extern int doforce;
 
 #ifdef UNION_DIAGNOSTIC
-	printf("union_unmount(mp = %x)\n", mp);
+	printf("union_unmount(mp = %p)\n", mp);
 #endif
 
 	if (mntflags & MNT_FORCE) {
@@ -436,7 +436,7 @@
 	int lbsize;
 
 #ifdef UNION_DIAGNOSTIC
-	printf("union_statfs(mp = %x, lvp = %x, uvp = %x)\n", mp,
+	printf("union_statfs(mp = %p, lvp = %p, uvp = %p)\n", mp,
 	    um->um_lowervp, um->um_uppervp);
 #endif
 
>Audit-Trail:
>Unformatted: