Date: Sat, 14 Apr 2007 15:46:53 +0200 From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: Hidetoshi Shimokawa <simokawa@FreeBSD.ORG> Cc: freebsd-current@freebsd.org Subject: Re: zdb patch Message-ID: <20070414134653.GF10527@garage.freebsd.pl> In-Reply-To: <86slb3t74o.wl%simokawa@FreeBSD.ORG> References: <86slb3t74o.wl%simokawa@FreeBSD.ORG>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On Sat, Apr 14, 2007 at 10:31:19PM +0900, Hidetoshi Shimokawa wrote:
> 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
What is this change for? It works ok without it here.
> 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);
Please commit, but:
1. Move 'include <sys/disk.h>' to lib/libzpool/common/sys/zfs_context.h
2. Use S_ISCHR() macro and drop { }:
if (S_ISCHR(st.st_mode))
ioctl(fd, DIOCGMEDIASIZE, &vp->v_size);
else
vp->v_size = st.st_size;
Thanks!
--
Pawel Jakub Dawidek http://www.wheel.pl
pjd@FreeBSD.org http://www.FreeBSD.org
FreeBSD committer Am I Evil? Yes, I Am!
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (FreeBSD)
iD8DBQFGINtNForvXbEpPzQRAtQvAKDBpbmFT9N+66cPw2r3nIS3XuZEvQCgoU8z
ovfmEH7EFkrLQDDY9LOl87E=
=jkGY
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070414134653.GF10527>
