From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40964) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dkwyy-0000rx-FE for qemu-devel@nongnu.org; Thu, 24 Aug 2017 14:35:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dkwyu-00049K-HK for qemu-devel@nongnu.org; Thu, 24 Aug 2017 14:35:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59400) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dkwyu-000490-BO for qemu-devel@nongnu.org; Thu, 24 Aug 2017 14:35:52 -0400 From: Markus Armbruster References: <1503564371-26090-1-git-send-email-armbru@redhat.com> <1503564371-26090-5-git-send-email-armbru@redhat.com> Date: Thu, 24 Aug 2017 20:35:49 +0200 In-Reply-To: (=?utf-8?Q?=22Marc-Andr=C3=A9?= Lureau"'s message of "Thu, 24 Aug 2017 12:50:40 +0200") Message-ID: <87tw0wdda2.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 04/16] tpm: Clean up model registration & lookup List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Cc: Stefan Berger , QEMU , Michael Roth Marc-Andr=C3=A9 Lureau writes: > Hi > > On Thu, Aug 24, 2017 at 10:45 AM, Markus Armbruster w= rote: >> We have a strict separation between enum TpmModel and tpm_models[]: >> >> * TpmModel may have any number of members. It just happens to have one. >> >> * tpm_register_model() uses the first empty slot in tmp_models[]. >> >> If you register more than tpm_models[] has space, >> tpn_register_model() fails. Its caller silently ignores the >> failure. > > tpm_ Will fix. >> >> Register the same TpmModel more than once has no effect other than >> wasting tpm_models[] slots: tpm_model_is_registered() is happy with >> the first one it finds. >> >> Since we only ever register one model, and tpm_models[] has space for >> just that one, this contraption even works. >> >> Turn tpm_models[] into a straight map from enum TpmType to bool. Much >> simpler. >> >> Cc: Stefan Berger >> Signed-off-by: Markus Armbruster > > Reviewed-by: Marc-Andr=C3=A9 Lureau Thanks! [...]