From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38383) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0s54-0001vy-75 for qemu-devel@nongnu.org; Fri, 05 Jun 2015 09:54:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0s4z-0005M6-Dr for qemu-devel@nongnu.org; Fri, 05 Jun 2015 09:54:42 -0400 Received: from mail-wg0-x234.google.com ([2a00:1450:400c:c00::234]:36357) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0s4z-0005Li-6e for qemu-devel@nongnu.org; Fri, 05 Jun 2015 09:54:37 -0400 Received: by wgbgq6 with SMTP id gq6so57492396wgb.3 for ; Fri, 05 Jun 2015 06:54:36 -0700 (PDT) From: "=?UTF-8?B?S8WRdsOhZ8OzIFpvbHTDoW4=?=" Message-ID: <5571AA1B.8060800@gmail.com> Date: Fri, 05 Jun 2015 15:54:35 +0200 MIME-Version: 1.0 References: <2e2fabdd19c4c81d40535244813fe42646557089.1433424889.git.DirtY.iCE.hu@gmail.com> <1433431821.3736.52.camel@nilsson.home.kraxel.org> <5570CC69.2060409@gmail.com> <1433501871.4142.9.camel@redhat.com> In-Reply-To: <1433501871.4142.9.camel@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [RFC PATCH v2] qapi for audio backends List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org Hi, 2015-06-05 12:57 keltezéssel, Gerd Hoffmann írta: >> Yeah, I've already hit a problem. The opts_visitor doesn't really handle >> nested structs (it just flattens it into a single, non hierarchic >> namespace), which is a problem because of the input and output options. >> First I need to make them required (the in and out in Audiodev) if I >> want the current visitor to visit them at all, but it's still not enough. > > I think we should improve the visitor instead of making in & out > mandatory just because the current implementation (which simply > implements the stuff needed for Netdev) can't handle it. It's not that simple I think. The visit_optional only receives a field name, but no info about the type of the field, but it has to decide if it wants the field using only this info. So sort of hacking an if (strcmp(name, "in") == 0 || strcmp(name, "out") == 0) ... into the option visitor code, the only way is probably to add a type parameter to visit_optional (struct/union/uint32/whatever) and in the opts visitor if type is struct or union, force visiting it. Is it ok? > There is always the option to be more specific (in.frequency=...) if > setting all parameters named 'frequency' doesn't do what you want. Also > I wouldn't worry too much about possible cases which don't exist right > now. I'd suggest to go for (0). Alright. Thanks, Zoltan