From owner-freebsd-net@FreeBSD.ORG Wed Oct 11 09:41:04 2006 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0D5F616A538; Wed, 11 Oct 2006 09:41:04 +0000 (UTC) (envelope-from ru@rambler-co.ru) Received: from relay0.rambler.ru (relay0.rambler.ru [81.19.66.187]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6D12743D6A; Wed, 11 Oct 2006 09:40:54 +0000 (GMT) (envelope-from ru@rambler-co.ru) Received: from relay0.rambler.ru (localhost [127.0.0.1]) by relay0.rambler.ru (Postfix) with ESMTP id AFA765EBA; Wed, 11 Oct 2006 13:40:46 +0400 (MSD) Received: from edoofus.park.rambler.ru (unknown [81.19.65.108]) by relay0.rambler.ru (Postfix) with ESMTP id 744115FD4; Wed, 11 Oct 2006 13:40:46 +0400 (MSD) Received: (from ru@localhost) by edoofus.park.rambler.ru (8.13.8/8.13.8) id k9B9enJc025109; Wed, 11 Oct 2006 13:40:49 +0400 (MSD) (envelope-from ru) Date: Wed, 11 Oct 2006 13:40:49 +0400 From: Ruslan Ermilov To: freebsd-net@freebsd.org, andre@freebsd.org Message-ID: <20061011094049.GA24964@rambler-co.ru> References: <20061011090241.GA2831@FreeBSD.czest.pl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ZGiS0Q5IWpPtfppv" Content-Disposition: inline In-Reply-To: <20061011090241.GA2831@FreeBSD.czest.pl> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: No virus found Cc: Subject: Re: [PATCH] Make hash.h usable in the kernel X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Oct 2006 09:41:04 -0000 --ZGiS0Q5IWpPtfppv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Oct 11, 2006 at 11:02:41AM +0200, Wojciech A. Koszek wrote: > Hello, >=20 > I'm working on potential consumer of functions from sys/hash.h. Currently= , I > can't make them work without modyfication in my sample KLD. This is a pat= ch > which fixes the problem: >=20 > http://people.freebsd.org/~wkoszek/patches/hash.h.0.patch >=20 > It makes following program.. >=20 > http://people.freebsd.org/~wkoszek/hash.c >=20 > ..compile without warnings with WARNS=3D5. If noone objects, I'd like to > commit it. >=20 This is a wrong fix. A correct fix would be: %%% Index: sys/sys/hash.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/sys/hash.h,v retrieving revision 1.2 diff -u -p -r1.2 hash.h --- sys/sys/hash.h 12 Mar 2006 15:34:33 -0000 1.2 +++ sys/sys/hash.h 11 Oct 2006 09:38:50 -0000 @@ -86,7 +86,7 @@ hash32_strn(const void *buf, size_t len, * namei() hashing of path name parts. */ static __inline uint32_t -hash32_stre(const void *buf, int end, char **ep, uint32_t hash) +hash32_stre(const void *buf, int end, const char **ep, uint32_t hash) { const unsigned char *p =3D buf; =20 @@ -94,7 +94,7 @@ hash32_stre(const void *buf, int end, ch hash =3D HASHSTEP(hash, *p++); =20 if (ep) - *ep =3D (char *)p; + *ep =3D (const char *)p; =20 return hash; } @@ -105,7 +105,7 @@ hash32_stre(const void *buf, int end, ch * as a helper for the namei() hashing of path name parts. */ static __inline uint32_t -hash32_strne(const void *buf, size_t len, int end, char **ep, uint32_t has= h) +hash32_strne(const void *buf, size_t len, int end, const char **ep, uint32= _t hash) { const unsigned char *p =3D buf; =20 @@ -113,7 +113,7 @@ hash32_strne(const void *buf, size_t len hash =3D HASHSTEP(hash, *p++); =20 if (ep) - *ep =3D (char *)p; + *ep =3D (const char *)p; =20 return hash; } Index: share/man/man9/hash.9 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/share/man/man9/hash.9,v retrieving revision 1.2 diff -u -p -r1.2 hash.9 --- share/man/man9/hash.9 30 Sep 2006 17:09:59 -0000 1.2 +++ share/man/man9/hash.9 11 Oct 2006 09:39:43 -0000 @@ -47,9 +47,11 @@ .Ft uint32_t .Fn hash32_strn "void *buf" "size_t len" "uint32_t hash" .Ft uint32_t -.Fn hash32_stre "void *buf" "int end" "char **ep" "uint32_t hash" +.Fn hash32_stre "void *buf" "int end" "const char **ep" "uint32_t hash" .Ft uint32_t -.Fn hash32_strne "void *buf" "size_t len" "int end" "char **ep" "uint32_t = hash" +.Fo hash32_strne +.Fa "void *buf" "size_t len" "int end" "const char **ep" "uint32_t hash" +.Fc .Sh DESCRIPTION The .Fn hash32 %%% Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --ZGiS0Q5IWpPtfppv Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (FreeBSD) iD8DBQFFLLwhqRfpzJluFF4RArHFAKCavXGrFUiltnw+bTAEsuUsaMa12gCdHzSV t+PLVfQnzeZYweUvFAVi9jI= =mtKN -----END PGP SIGNATURE----- --ZGiS0Q5IWpPtfppv--