From owner-freebsd-current@FreeBSD.ORG Sat Apr 14 13:47:16 2007 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2B40D16A402; Sat, 14 Apr 2007 13:47:16 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (arm132.internetdsl.tpnet.pl [83.17.198.132]) by mx1.freebsd.org (Postfix) with ESMTP id B94CA13C45D; Sat, 14 Apr 2007 13:47:15 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 4B11545CD9; Sat, 14 Apr 2007 15:47:14 +0200 (CEST) Received: from localhost (154.81.datacomsa.pl [195.34.81.154]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id F21314569A; Sat, 14 Apr 2007 15:47:08 +0200 (CEST) Date: Sat, 14 Apr 2007 15:46:53 +0200 From: Pawel Jakub Dawidek To: Hidetoshi Shimokawa Message-ID: <20070414134653.GF10527@garage.freebsd.pl> References: <86slb3t74o.wl%simokawa@FreeBSD.ORG> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="wtjvnLv0o8UUzur2" Content-Disposition: inline In-Reply-To: <86slb3t74o.wl%simokawa@FreeBSD.ORG> X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 7.0-CURRENT i386 User-Agent: mutt-ng/devel-r804 (FreeBSD) X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-2.6 required=3.0 tests=BAYES_00 autolearn=ham version=3.0.4 Cc: freebsd-current@freebsd.org Subject: Re: zdb patch X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Apr 2007 13:47:16 -0000 --wtjvnLv0o8UUzur2 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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' :-) >=20 > =3D=3D=3D=3D //depot/user/simokawa/firewire/contrib/opensolaris/lib/libzp= ool/common/kernel.c#2 - /home/p4/firewire/contrib/opensolaris/lib/libzpool/= common/kernel.c =3D=3D=3D=3D > @@ -38,6 +38,7 @@ > #include > #include > #include > +#include > =20 > /* > * Emulation of kernel services in userland. > @@ -291,7 +292,11 @@ > =20 > ASSERT(abstime > 0); > top: > +#if 0 > delta =3D abstime - lbolt; > +#else /* for compatibility with FreeBSD kernel */ > + delta =3D abstime; > +#endif What is this change for? It works ok without it here. > if (delta <=3D 0) > return (-1); > =20 > @@ -413,7 +418,11 @@ > *vpp =3D vp =3D umem_zalloc(sizeof (vnode_t), UMEM_NOFAIL); > =20 > vp->v_fd =3D fd; > - vp->v_size =3D st.st_size; > + if (st.st_mode & S_IFCHR) { > + ioctl(fd, DIOCGMEDIASIZE, &vp->v_size); > + } else { > + vp->v_size =3D st.st_size; > + } > vp->v_path =3D spa_strdup(path); > =20 > return (0); Please commit, but: 1. Move 'include ' 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 =3D st.st_size; Thanks! --=20 Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --wtjvnLv0o8UUzur2 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (FreeBSD) iD8DBQFGINtNForvXbEpPzQRAtQvAKDBpbmFT9N+66cPw2r3nIS3XuZEvQCgoU8z ovfmEH7EFkrLQDDY9LOl87E= =jkGY -----END PGP SIGNATURE----- --wtjvnLv0o8UUzur2--