From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmOYs-0001zc-Sk for qemu-devel@nongnu.org; Thu, 06 Nov 2014 10:01:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XmOYm-0007y7-NH for qemu-devel@nongnu.org; Thu, 06 Nov 2014 10:01:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33616) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmOYm-0007xy-FA for qemu-devel@nongnu.org; Thu, 06 Nov 2014 10:01:16 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sA6F1EKK008620 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 6 Nov 2014 10:01:15 -0500 Date: Thu, 6 Nov 2014 23:01:11 +0800 From: Amos Kong Message-ID: <20141106150111.GA25471@air.redhat.com> References: <1415119766-9745-1-git-send-email-akong@redhat.com> <1415177267.11011.1.camel@nilsson.home.kraxel.org> <20141106063754.GF8764@air.redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="vkogqOf2sHV7VnPd" Content-Disposition: inline In-Reply-To: <20141106063754.GF8764@air.redhat.com> Subject: Re: [Qemu-devel] [PATCH] ui/input: strictly check console in finding input handler List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: mtosatti@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com --vkogqOf2sHV7VnPd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 06, 2014 at 02:37:54PM +0800, Amos Kong wrote: > On Wed, Nov 05, 2014 at 09:47:47AM +0100, Gerd Hoffmann wrote: > > On Mi, 2014-11-05 at 00:49 +0800, Amos Kong wrote: > > > qemu_input_find_handler() prefers a handler associated with con. > > > But if none exists, it takes any. This patch added a parameter > > > to strictly check console, in case we want to input event to > > > special console. >=20 > If console is assigned, it will try to find right handler by first > loop in qemu_input_find_handler(). The second loop is used to find > mask matched handler if console isn't assigned. >=20 > If we assigned console and didn't find handler in first loop, it > skip second loop body by 'continue', and return NULL. > It seems my concern is wrong, we don't need this repeated parameter. I was wrong, if we don't assign the console for qemu_input_find_handler(), it has chance to get an arbitrary console (mask matched). So the original issue this patch try to fix truely exists. =20 > NACK this patch. >=20 > Thanks. > =20 > > > 'input-send-event' has a parameter to assign special console, > > > so we should enable strict checking in finding handler. > >=20 > > I don't think we want do that by default. It only matters in case of a > > multiseat setup where you actually have multiple input devices of the > > same kind. Which isn't a very typical use case. > >=20 > > Options I see are: > >=20 > > (a) Turn console into an optional parameter, do strict checking in > > case it is present. > > (b) Add a optional 'strict' parameter. >=20 > --=20 > Amos. =46rom Markus: >=20 > Current behavior (please correct misunderstandings): >=20 > The guest must be running. > input-send-event parameter 'console' is mandatory. > The console identified by its value must exist. > If this console can accept the event, send it there. > Else, a console that can accept the event must exist. Send it > to > one of them. Which one exactly isn't specified. >=20 > Behavior with (a): >=20 > The guest must be running. > input-send-event parameter 'console' is optional. > If it's present, the console identified by its value must exist, > and > must be able to accept the event. Send it there. > Else, a console that can accept the event must exist. Send it > to > one of them. Which one exactly isn't specified. >=20 > "Must" means "or else command fails". >=20 > I think that's a clear improvement. It's actually what I expected > from > the command documentation, until I read the code. Thanks for your clear description, I now agree with Gerd's option (a), (a) is better than (b). So we need to change QMP to support optional console parameter and change qemu_input_find_handler() to support strict checking (as my patch). Gerd, I'd like to work on both of them, if you already work on it, please let me know, thanks.=20 --=20 Amos. --vkogqOf2sHV7VnPd Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJUW403AAoJELxSv6I5vP9j1rgP/35q3Z5e7PMGL/g74346N1Q5 VkPv+pJ22yNHHQswm2e2vo8n6W+jKLe8pGs7q8XMnkSsq4wBzO+V+uQf6DXW5tWt CCuJv+8/3mqDvCCR9Uq89FItw6pNMCf1kjUf9gdaN/DAg04vKWNDYnzxgyYndEZY GSi7C4nVB4/Ho0AvK5lIlK73UweR57p2+gSY6U/VtXRWq2e54SGmW1HPBH1/l6Jr 9CWjm3ABH3VnvP9nSJJpiR9Lt3kpnzzkPxxL5lECfF5X6xVAYLShbwcQiwKruLoP ibXXfvprDQLh3Pxx8QiquNoxz3oQXkKUBNcfHdu/MSoHwUtrLhPT4WSGVP4pikIt 1OdJQ6A4HS6lWLU2J7E/rGNKSBITeAYeVtl2crqBZIfsdlymjyoaCgAe3Ixz7gxk KtT0HAGdgR+dxxLzkLQ6I/uDT3VI7FlaqEF+wFV2L9eSYmKltct/vxa/pdxU9Etf LMCZbVv06VwKfdky7X3YH2sAVFS+R6p2LbgvnjbN2E4NGrtnyfb9zgPKphjvYhlK bwsAciBZggtziW132AVDXsal+ju3rEwHuJLLS2HukfV+A79HZAp1WptU0QY0PJ4w XkVZH+fePdg8HVCOSQwtnLT+JVsbRd0Xw9lce3Aij+YMI/dbvKADRFxj67etdIGf lQtiA2OaKIxYQxzYXIhj =i8Rp -----END PGP SIGNATURE----- --vkogqOf2sHV7VnPd--