Subject: pkg/37303: sysutils/lsof fails to build since sys/vnode.h,v. 1.173 2007/10/10
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Yakovetsky Vladimir <yx@x.ua>
List: pkgsrc-bugs
Date: 11/08/2007 10:10:13
>Number:         37303
>Category:       pkg
>Synopsis:       sysutils/lsof fails to build since sys/vnode.h,v. 1.173 2007/10/10
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Nov 08 10:10:12 +0000 2007
>Originator:     Yakovetsky Vladimir
>Release:        NetBSD 4.99.34
>Environment:
System: NetBSD lrou.x.ua 4.99.34 NetBSD 4.99.34 (lrou_odd-1.859) #0: Tue Nov 6 15:12:51 EET 2007 Yakovetsky Vladimir <yx@x.ua>@lrou.x.ua:/sys/arch/i386/compile/lrou_odd i386
Architecture: i386
Machine: i386

>Description:
	sysutils/lsof fails to build since sys/vnode.h,v. 1.173 2007/10/10

>How-To-Repeat:
% ident /usr/include/sys/vnode.h
/usr/include/sys/vnode.h:
     $NetBSD: vnode.h,v 1.173 2007/10/10 20:42:32 ad Exp $
% cd /usr/pkgsrc/sysutils/lsof && make
...
cc -O2 -mfpmath=sse -msse2 -march=pentium4 -finline-functions -fomit-frame-pointer -ffast-math  -DNETBSDV=4099000 -DHASGETBOOTFILE -DHASKVMGETPROC2 -DHASNFSPROTO -DHASIPv6 -DHASFDESCFS=1 -DHASFDLINK -DHASNULLFS -DHASPROCFS -DHASPROCFS_PFSROOT -DHASBUFQ_H -DHAS9660FS=1 -DHASMSDOSFS=1 -DHASKERNFS -DHASKERNFS_KFS_KT -DHASI_FFS1 -DHASEFFNLINK=i_ffs_effnlink -DHASEXT2FS -DHASI_E2FS_PTR -DHASLFS -DHASPTYFS -DHASTMPFS -DHASNFSVATTRP -DHAS_ADVLOCK_ARGS -DHAS_LWP_H -DHASCWDINFO -DHAS_SYS_PIPEH -DHASSTATVFS -DUVM -I/usr/obj/sysutils/lsof/work/lsof_4.78/lsof_4.78_src/dialects/n+obsd/include -DHAS_UVM_INCL -DLSOF_VSTR="4.99.34"  -O -DLSOF_MORE_SECURE=0 -DLSOF_LESS_SECURE_SOCKETS=0 -c rnmh.c
rnmh.c: In function 'ncache_isroot':
rnmh.c:262: error: 'struct vnode' has no member named 'v_flag'
rnmh.c:262: error: 'VROOT' undeclared (first use in this function)
rnmh.c:262: error: (Each undeclared identifier is reported only once
rnmh.c:262: error: for each function it appears in.)
*** Error code 1

Stop.

>Fix:
	below patches (patch-a[hi])

:r !sysutils/lsof/patches/patch-ah
--- dialects/n+obsd/dlsof.h~
+++ dialects/n+obsd/dlsof.h
@@ -589,4 +589,10 @@
 #  endif	/* defined(HASNCVPID) */
 # endif  /* defined(HASNCACHE) */

+/* since vnode.h,v 1.173 2007/10/10 */
+#if defined(NETBSDV) && __NetBSD_Version__>499003200
+#define VNODE_VFLAG	v_iflag
+#define NCACHE_VROOT	VV_ROOT
+#endif  /* defined(NETBSDV) && __NetBSD_Version__>499003200 */
+
 #endif	/* NETBSD_LSOF_H */

:r !sysutils/lsof/patches/patch-ai
--- dialects/n+obsd/dnode.c~
+++ dialects/n+obsd/dnode.c
@@ -64,6 +64,13 @@
 #define	PGSHIFT	pgshift
 # endif	/* !defined(PGSHIFT) */
 
+#if	!defined(NCACHE_VROOT)
+#define NCACHE_VROOT	VROOT	/* vnode is root of its file system */
+#endif /* !defined(NCACHE_VROOT) */
+
+#if	!defined(VNODE_VFLAG)
+#define VNODE_VFLAG	v_flag
+#endif /* !defined(VNODE_VFLAG) */
 
 /*
  * getmemsz() - get memory size of a /proc/<n>/mem entry
@@ -422,7 +429,7 @@
 	 */
 	    if (!v->v_data
 	    ||  kread((KA_T)v->v_data, (char *)&kn, sizeof(kn))) {
-		if (v->v_type != VDIR || !(v->v_flag && VROOT)) {
+		if (v->v_type != VDIR || !(v->VNODE_VFLAG && NCACHE_VROOT)) {
 		    (void) snpf(Namech, Namechl,
 			"can't read kernfs_node at: %s",
 			print_kptr((KA_T)v->v_data, (char *)NULL, 0));
@@ -457,7 +464,7 @@
 	 * size are fixed; otherwise, safely stat() the file to get the
 	 * inode number and size.
 	 */
-	    if (v->v_type == VDIR && (v->v_flag & VROOT)) {
+	    if (v->v_type == VDIR && (v->VNODE_VFLAG & NCACHE_VROOT)) {
 		(void) snpf(Namech, Namechl, "%s", _PATH_KERNFS);
 		ksb.st_ino = (ino_t)2;
 		ksb.st_size = DEV_BSIZE;