From owner-freebsd-arch@FreeBSD.ORG Wed Jan 5 08:22:56 2005 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CE52316A4CE for ; Wed, 5 Jan 2005 08:22:56 +0000 (GMT) Received: from mail.freebsd.org.cn (dns3.freebsd.org.cn [61.129.66.75]) by mx1.FreeBSD.org (Postfix) with SMTP id 6424F43D2F for ; Wed, 5 Jan 2005 08:22:48 +0000 (GMT) (envelope-from delphij@frontfree.net) Received: (qmail 62506 invoked by uid 0); 5 Jan 2005 08:15:24 -0000 Received: from unknown (HELO beastie.frontfree.net) (219.239.99.7) by mail.freebsd.org.cn with SMTP; 5 Jan 2005 08:15:24 -0000 Received: from localhost (localhost.frontfree.net [127.0.0.1]) by beastie.frontfree.net (Postfix) with ESMTP id 8C21913195B for ; Wed, 5 Jan 2005 16:22:38 +0800 (CST) Received: from beastie.frontfree.net ([127.0.0.1]) by localhost (beastie.frontfree.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 00147-02 for ; Wed, 5 Jan 2005 16:22:27 +0800 (CST) Received: by beastie.frontfree.net (Postfix, from userid 1001) id 4E826134B96; Wed, 5 Jan 2005 16:22:26 +0800 (CST) Date: Wed, 5 Jan 2005 16:22:26 +0800 From: Xin LI To: freebsd-arch@FreeBSD.org Message-ID: <20050105082226.GA1899@frontfree.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="BOKacYhQ+x31HxR3" Content-Disposition: inline User-Agent: Mutt/1.4.2.1i X-GPG-key-ID/Fingerprint: 0xCAEEB8C0 / 43B8 B703 B8DD 0231 B333 DC28 39FB 93A0 CAEE B8C0 X-GPG-Public-Key: http://www.delphij.net/delphij.asc X-Operating-System: FreeBSD beastie.frontfree.net 5.3-delphij FreeBSD 5.3-delphij #11: Tue Oct 26 14:12:03 CST 2004 delphij@beastie.frontfree.net:/usr/obj/usr/src/sys/BEASTIE i386 X-URL: http://www.delphij.net X-By: delphij@beastie.frontfree.net X-Location: Beijing, China X-Virus-Scanned: by amavisd-new at frontfree.net Subject: RFC: Two fields in kld_sym_lookup and nlist structures X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jan 2005 08:22:57 -0000 --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Dear folks, While I was traversing our source tree, I found that kld_sym_lookup's symname and nlist's n_name are defined as char *. On the other hand, it seems that the usual usage of them looks like: nlist[0].n_name =3D "foo"; Which generates warnings on higher warning levels, since "foo" is a string constatnt, and n_name is supposed to be a variable char *. Can we change these fields into const char *? A preliminary patch looks like: Index: sys/sys/linker.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/linker.h,v retrieving revision 1.39 diff -u -r1.39 linker.h --- sys/sys/linker.h 27 Aug 2004 01:10:16 -0000 1.39 +++ sys/sys/linker.h 5 Jan 2005 07:46:03 -0000 @@ -270,7 +270,7 @@ =20 struct kld_sym_lookup { int version; /* set to sizeof(struct kld_sym_lookup) */ - char *symname; /* Symbol name we are looking up */ + const char *symname; /* Symbol name we are looking up */ u_long symvalue; size_t symsize; }; Index: sys/sys/nlist_aout.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/nlist_aout.h,v retrieving revision 1.11 diff -u -r1.11 nlist_aout.h --- sys/sys/nlist_aout.h 7 Apr 2004 04:19:49 -0000 1.11 +++ sys/sys/nlist_aout.h 5 Jan 2005 07:56:06 -0000 @@ -51,11 +51,11 @@ struct nlist { #ifdef _AOUT_INCLUDE_ union { - char *n_name; /* symbol name (in memory) */ + const char *n_name; /* symbol name (in memory) */ long n_strx; /* file string table offset (on disk) */ } n_un; #else - char *n_name; /* symbol name (in memory) */ + const char *n_name; /* symbol name (in memory) */ int : 8 * (sizeof(long) > sizeof(char *) ? sizeof(long) - sizeof(char *) : sizeof(char *) - sizeof(long)); #endif Cheers, --=20 Xin LI http://www.delphij.net/ See complete headers for GPG key and other information. --BOKacYhQ+x31HxR3 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQFB26PC/cVsHxFZiIoRAjjVAJ0SZ4sE66b/NX9yAMwa05Ej2pOwTQCgiOh5 kfSW0HMfC2VtAQI2+oYJI+I= =VPsU -----END PGP SIGNATURE----- --BOKacYhQ+x31HxR3--