zdb patch

Hidetoshi Shimokawa simokawa at FreeBSD.ORG
Sat Apr 14 13:31:24 UTC 2007


Here is a patch for zdb.
Now we can 'zdb -u pool' :-)

==== //depot/user/simokawa/firewire/contrib/opensolaris/lib/libzpool/common/kernel.c#2 - /home/p4/firewire/contrib/opensolaris/lib/libzpool/common/kernel.c ====
@@ -38,6 +38,7 @@
 #include <sys/zfs_context.h>
 #include <sys/zmod.h>
 #include <sys/utsname.h>
+#include <sys/disk.h>
 
 /*
  * Emulation of kernel services in userland.
@@ -291,7 +292,11 @@
 
 	ASSERT(abstime > 0);
 top:
+#if 0
 	delta = abstime - lbolt;
+#else /* for compatibility with FreeBSD kernel */
+	delta = abstime;
+#endif
 	if (delta <= 0)
 		return (-1);
 
@@ -413,7 +418,11 @@
 	*vpp = vp = umem_zalloc(sizeof (vnode_t), UMEM_NOFAIL);
 
 	vp->v_fd = fd;
-	vp->v_size = st.st_size;
+	if (st.st_mode & S_IFCHR) {
+		ioctl(fd, DIOCGMEDIASIZE, &vp->v_size);
+	} else {
+		vp->v_size = st.st_size;
+	}
 	vp->v_path = spa_strdup(path);
 
 	return (0);


/\ Hidetoshi Shimokawa
\/  simokawa at FreeBSD.ORG


More information about the freebsd-current mailing list