From: Markus Armbruster <armbru@redhat.com>
To: "Gonglei (Arei)" <arei.gonglei@huawei.com>
Cc: "chenliang (T)" <chenliang88@huawei.com>,
"Huangweidong (C)" <weidong.huang@huawei.com>,
"mst@redhat.com" <mst@redhat.com>,
"aik@ozlabs.ru" <aik@ozlabs.ru>,
"hutao@cn.fujitsu.com" <hutao@cn.fujitsu.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
Luiz Capitulino <lcapitulino@redhat.com>,
"kraxel@redhat.com" <kraxel@redhat.com>,
"akong@redhat.com" <akong@redhat.com>,
"agraf@suse.de" <agraf@suse.de>,
"aliguori@amazon.com" <aliguori@amazon.com>,
"gaowanlong@cn.fujitsu.com" <gaowanlong@cn.fujitsu.com>,
Eduardo Habkost <ehabkost@redhat.com>,
Luonengjun <luonengjun@huawei.com>,
"Huangpeng (Peter)" <peter.huangpeng@huawei.com>,
"hani@linux.com" <hani@linux.com>,
"stefanha@redhat.com" <stefanha@redhat.com>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"kwolf@redhat.com" <kwolf@redhat.com>,
"peter.crosthwaite@xilinx.com" <peter.crosthwaite@xilinx.com>,
"imammedo@redhat.com" <imammedo@redhat.com>,
"afaerber@suse.de" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH v4 1/8] bootindex: add modify_boot_device_path function
Date: Mon, 04 Aug 2014 09:53:20 +0200 [thread overview]
Message-ID: <87wqaobsi7.fsf@blackfin.pond.sub.org> (raw)
In-Reply-To: <33183CC9F5247A488A2544077AF1902086C24C8C@SZXEMA503-MBS.china.huawei.com> (Gonglei's message of "Mon, 4 Aug 2014 07:02:27 +0000")
"Gonglei (Arei)" <arei.gonglei@huawei.com> writes:
> Hi,
>
>>
>> > On Thu, Jul 31, 2014 at 05:47:26PM +0800, arei.gonglei@huawei.com wrote:
>> > [...]
>> > > +void modify_boot_device_path(int32_t bootindex, DeviceState *dev,
>> > > + const char *suffix)
>> > > +{
>> > > + FWBootEntry *i, *old_entry = NULL;
>> > > +
>> > > + assert(dev != NULL || suffix != NULL);
>> > > +
>> > > + if (bootindex >= 0) {
>> > > + QTAILQ_FOREACH(i, &fw_boot_order, link) {
>> > > + if (i->bootindex == bootindex) {
>> > > + qerror_report(ERROR_CLASS_GENERIC_ERROR,
>> > > + "The bootindex %d has already been
>> used",
>> > > + bootindex);
>> >
>> > Isn't an Error** parameter preferable here, instead of using
>> > qerror_report()?
>>
>> Good catch. I'm not following this series, but using qerror_report() is
>> almost always wrong these days.
Yes. http://wiki.qemu.org/CodeTransitions#Error_reporting explains:
qerror_report() is a transitional interface to help with converting
existing HMP commands to QMP. It should not be used elsewhere. Use
Error objects instead with error_propagate() and error_setg()
instead.
> Would you give me some advice? Thanks.
> Using error_report() instead of qerror_report()?
Depends on how the function is used.
If you know this can only run during QEMU startup (e.g. command line
processing) or in a *human* monitor, error_report() is fine.
If the error is propagated up the call chain to some place that reports
it via its Error ** parameter to its caller, then you should consider
passing an Error object created with error_setg() here up the call
chain.
Not the case right now, as your modify_boot_device_path() cannot fail.
Whether that's appropriate I can't tell without examining more of your
patch.
next prev parent reply other threads:[~2014-08-04 7:54 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-31 9:47 [Qemu-devel] [PATCH v4 0/8] modify boot order of guest, and take effect after rebooting arei.gonglei
2014-07-31 9:47 ` [Qemu-devel] [PATCH v4 1/8] bootindex: add modify_boot_device_path function arei.gonglei
2014-08-01 13:36 ` Eduardo Habkost
2014-08-01 13:40 ` Luiz Capitulino
2014-08-04 7:02 ` Gonglei (Arei)
2014-08-04 7:53 ` Markus Armbruster [this message]
2014-08-04 8:14 ` Gonglei (Arei)
2014-07-31 9:47 ` [Qemu-devel] [PATCH v4 2/8] bootindex: add del_boot_device_path function arei.gonglei
2014-07-31 9:47 ` [Qemu-devel] [PATCH v4 3/8] fw_cfg: add fw_cfg_machine_reset function arei.gonglei
2014-07-31 9:47 ` [Qemu-devel] [PATCH v4 4/8] bootindex: delete bootindex when device is removed arei.gonglei
2014-08-01 14:45 ` Eduardo Habkost
2014-08-04 6:33 ` Gonglei (Arei)
2014-07-31 9:47 ` [Qemu-devel] [PATCH v4 5/8] qmp: add set-bootindex command arei.gonglei
2014-07-31 9:47 ` [Qemu-devel] [PATCH v4 6/8] qemu-monitor: HMP set-bootindex wrapper arei.gonglei
2014-07-31 9:47 ` [Qemu-devel] [PATCH v4 7/8] qmp: add query-bootindex command arei.gonglei
2014-07-31 9:47 ` [Qemu-devel] [PATCH v4 8/8] qemu-monitor: add HMP "info-bootindex" command arei.gonglei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wqaobsi7.fsf@blackfin.pond.sub.org \
--to=armbru@redhat.com \
--cc=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=aik@ozlabs.ru \
--cc=akong@redhat.com \
--cc=aliguori@amazon.com \
--cc=arei.gonglei@huawei.com \
--cc=chenliang88@huawei.com \
--cc=ehabkost@redhat.com \
--cc=gaowanlong@cn.fujitsu.com \
--cc=hani@linux.com \
--cc=hutao@cn.fujitsu.com \
--cc=imammedo@redhat.com \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=luonengjun@huawei.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.crosthwaite@xilinx.com \
--cc=peter.huangpeng@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=weidong.huang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.