From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3ECEC433EF for ; Wed, 13 Oct 2021 14:34:26 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 954F6610C8 for ; Wed, 13 Oct 2021 14:34:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 954F6610C8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=greensocs.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:58794 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mafKr-0003wr-95 for qemu-devel@archiver.kernel.org; Wed, 13 Oct 2021 10:34:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46368) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mafGm-0000fD-8j; Wed, 13 Oct 2021 10:30:12 -0400 Received: from beetle.greensocs.com ([5.135.226.135]:59842) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mafGj-0004dQ-SR; Wed, 13 Oct 2021 10:30:11 -0400 Received: from [192.168.15.165] (unknown [195.68.53.70]) by beetle.greensocs.com (Postfix) with ESMTPSA id D0C2721C32; Wed, 13 Oct 2021 14:30:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greensocs.com; s=mail; t=1634135406; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z6HgMh5IMSwLEmZN5256moVuZUZTLWR6X/E7D989GAM=; b=1v5ahRx7kFy03JQEDgOMnsn6lCXMTvv/S4+cDS/eYY03VM2Fab7wi/9CaK/uJ+1vtCgm0H djgb9bc2m613XpLeGkEmpMC45AEY450QTrKfNQkbp7R8rGkXeXJIUrvGXVoFt5dFaeY82p KtyNyCsawGqJgUOc6OJpIm0RPipPZhg= Message-ID: <11aa7a10-62ec-ebde-030c-5919e36ec34d@greensocs.com> Date: Wed, 13 Oct 2021 16:30:05 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.2 Subject: Re: [RFC PATCH v2 04/16] softmmu/qdev-monitor: add error handling in qdev_set_id Content-Language: en-US-large To: Alistair Francis References: <20210922161405.140018-1-damien.hedde@greensocs.com> <20210922161405.140018-5-damien.hedde@greensocs.com> From: Damien Hedde In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=5.135.226.135; envelope-from=damien.hedde@greensocs.com; helo=beetle.greensocs.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , David Hildenbrand , "qemu-devel@nongnu.org Developers" , Peter Xu , mirela.grujic@greensocs.com, Alistair Francis , Gerd Hoffmann , Ani Sinha , Eric Blake , Stefano Stabellini , "Michael S. Tsirkin" , Markus Armbruster , Anthony Perard , =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , Igor Mammedov , Eduardo Habkost , "Dr. David Alan Gilbert" , Paul Durrant , Eric Auger , "open list:X86" , "open list:RISC-V" , Kevin Wolf , =?UTF-8?Q?Daniel_P=2e_Berrang=c3=a9?= , Mark Burton , Edgar Iglesias , Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 10/13/21 09:10, Alistair Francis wrote: > On Thu, Sep 23, 2021 at 2:29 AM Damien Hedde wrote: >> >> qdev_set_id() is mostly used when the user adds a device (using >> -device cli option or device_add qmp command). This commit adds >> an error parameter to handle the case where the given id is >> already taken. >> >> Also document the function and add a return value in order to >> be able to capture success/failure: the function now returns the >> id in case of success, or NULL in case of failure. >> >> The commit modifies the 2 calling places (qdev-monitor and >> xen-legacy-backend) to add the error object parameter. >> >> Note that the id is, right now, guaranteed to be unique because >> all ids came from the "device" QemuOptsList where the id is used >> as key. This addition is a preparation for a future commit which >> will relax the uniqueness. >> >> Signed-off-by: Damien Hedde > > Reviewed-by: Alistair Francis > > Alistair > CC'ing Kevin who integrated this patch into his series about "qdev: Add JSON -device" https://lists.gnu.org/archive/html/qemu-devel/2021-10/msg01826.html Thanks, -- Damien