From owner-freebsd-current@FreeBSD.ORG Thu Feb 15 18:35:05 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 17CC216A406 for ; Thu, 15 Feb 2007 18:35:05 +0000 (UTC) (envelope-from max@love2party.net) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.174]) by mx1.freebsd.org (Postfix) with ESMTP id 9D32C13C442 for ; Thu, 15 Feb 2007 18:35:04 +0000 (UTC) (envelope-from max@love2party.net) Received: from [88.66.16.42] (helo=amd64.laiers.local) by mrelayeu.kundenserver.de (node=mrelayeu2) with ESMTP (Nemesis), id 0MKwtQ-1HHlRd35PB-0003J4; Thu, 15 Feb 2007 19:35:02 +0100 From: Max Laier Organization: FreeBSD To: freebsd-current@freebsd.org Date: Thu, 15 Feb 2007 19:34:53 +0100 User-Agent: KMail/1.9.5 References: <20070215094342.B91479@xorpc.icir.org> In-Reply-To: <20070215094342.B91479@xorpc.icir.org> X-Face: ,,8R(x[kmU]tKN@>gtH1yQE4aslGdu+2]; R]*pL,U>^H?)gW@49@wdJ`H<=?utf-8?q?=25=7D*=5FBD=0A=09U=5For=3D=5CmOZf764=26nYj=3DJYbR1PW0ud?=>|!~,,CPC.1-D$FG@0h3#'5"k{V]a~.<=?utf-8?q?mZ=7D44=23Se=7Em=0A=09Fe=7E=5C=5DX5B=5D=5Fxj?=(ykz9QKMw_l0C2AQ]}Ym8)fU MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart3018003.kHYPkS2kDF"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200702151934.59638.max@love2party.net> X-Provags-ID: kundenserver.de abuse@kundenserver.de login:61c499deaeeba3ba5be80f48ecc83056 X-Provags-ID2: V01U2FsdGVkX19zxqkk96xSXgDjK5S4fVsSRpg3C6aZ3wc7UMv2PFzKmKd1Clc9V2m+CLT+D7ug+FiZpQXXp+sAkyKBLbsanVx3mnPEkPhl0gsujnQalJqMRA== Cc: Luigi Rizzo Subject: Re: one last firmware(9) issue 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: Thu, 15 Feb 2007 18:35:05 -0000 --nextPart3018003.kHYPkS2kDF Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Thursday 15 February 2007 18:43, Luigi Rizzo wrote: > I have committed the cleanup to firmware(9) discussed earlier > on this list, see the commit log below. There is a remaining issue > on which i would like some advice. From the commit log: > > Note also that there is a subtle issue with the implementation of > firmware_register(): currently, as in the previous version, we just > store a reference to the 'imagename' argument, but we should rather > copy it because there is no guarantee that this is a static string. > > Now, what do you think is the best way to handle this ? The existing > code tries not to allocate memory on a firmware_register(), not > sure if it is on purpose (e.g. to avoid sleeping) or for other > reasons. To preserve this, we should use static buffers for the > image names, and pick a reasonable size for them (128 ? 256 ? 1025 ?). > > If on the other hand, we can afford a malloc in firmware_register(), > i'd move the whole registry to a linked list, to avoid the hard limit > of 30 slots in the firmware table. > > suggestions ? I say, let the caller deal with it. After all the caller must ensure that= =20 the firmware itself stays in memory until they call firmware_unregister,=20 why should we jump through all the hoops for the name? The linked list is another thing. As I recall, the static array is only=20 there due to our lazyness. It's a lot easier to use a static array and I=20 don't forsee us using more than 30 firmware images at a time. OTOH, it=20 would of course be nice to have a more flexible system. I'm not 100%=20 certain what the locking constrains for firmware_register() are. Usually=20 it is called from the mod_event of a firmware module, which in turn is=20 called from the linker subsystem. There might be some locks involved=20 that would prevent you from sleeping, but that's just a wild guess. Thanks for taking care of this, by the way. Much appreciated. =2D-=20 /"\ Best regards, | mlaier@freebsd.org \ / Max Laier | ICQ #67774661 X http://pf4freebsd.love2party.net/ | mlaier@EFnet / \ ASCII Ribbon Campaign | Against HTML Mail and News --nextPart3018003.kHYPkS2kDF Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (FreeBSD) iD8DBQBF1KfTXyyEoT62BG0RAme7AJ9t675pniD6Gzszp2Z/7+ptN221sgCfQg3W xn018rLc9EKGyWrIW4D87L0= =o/NM -----END PGP SIGNATURE----- --nextPart3018003.kHYPkS2kDF--