All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	mst@redhat.com, afaerber@suse.de,
	Stefan Hajnoczi <stefanha@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH V2] net: don't use set/get_pointer() in set/get_netdev()
Date: Mon, 13 Oct 2014 12:53:46 +0800	[thread overview]
Message-ID: <543B5ADA.5070308@redhat.com> (raw)
In-Reply-To: <543B4784.4030603@redhat.com>

On 10/13/2014 11:31 AM, Jason Wang wrote:
> On 10/10/2014 09:03 PM, Markus Armbruster wrote:
>> Jason Wang <jasowang@redhat.com> writes:
>>
>>> Commit 1ceef9f27359cbe92ef124bf74de6f792e71f6fb (net: multiqueue
>>> support) tries to use set_pointer() and get_pointer() to set and get
>>> NICPeers which is not a pointer defined in DEFINE_PROP_NETDEV. This
>>> trick works but result a unclean and fragile implementation (e.g
>>> print_netdev and parse_netdev).
>>>
>>> This patch solves this issue by not using set/get_pinter() and set and
>>> get netdev directly in set_netdev() and get_netdev(). After this the
>>> parse_netdev() and print_netdev() were no longer used and dropped from
>>> the source.
>>>
>>> Cc: Markus Armbruster <armbru@redhat.com>
>>> Cc: Stefan Hajnoczi <stefanha@redhat.com>
>>> Cc: Peter Maydell <peter.maydell@linaro.org>
>>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>>> ---
>>> Changes from V1:
>>> - validate ncs pointer before accessing them, this fixes the qtest failure
>>>   on arm.
>>> ---
>>>  hw/core/qdev-properties-system.c | 71 ++++++++++++++++++++++------------------
>>>  1 file changed, 39 insertions(+), 32 deletions(-)
>>>
>>> diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
>>> index ae0900f..6939ea5 100644
>>> --- a/hw/core/qdev-properties-system.c
>>> +++ b/hw/core/qdev-properties-system.c
>>> @@ -176,41 +176,67 @@ PropertyInfo qdev_prop_chr = {
>>>  };
>>>  
[...]
>>>          goto err;
>>>      }
>>>  
>>>      for (i = 0; i < queues; i++) {
>>>          if (peers[i] == NULL) {
>>> -            ret = -ENOENT;
>>> +            err = -ENOENT;
>>>              goto err;
>>>          }
>>>  
>>>          if (peers[i]->peer) {
>>> -            ret = -EEXIST;
>>> +            err = -EEXIST;
>>>              goto err;
>>>          }
>>>  
>>>          if (ncs[i]) {
>>> -            ret = -EINVAL;
>>> +            err = -EINVAL;
>> error_set_from_qdev_prop_error() does not accept -EINVAL, either.
> Ok.

Just have a check, error_set_from_qdev_prop_error() can accept -EINVAL,
so I will only call error_setg() directly for -E2BIG.

      reply	other threads:[~2014-10-13  4:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-09  3:10 [Qemu-devel] [PATCH V2] net: don't use set/get_pointer() in set/get_netdev() Jason Wang
2014-10-10 13:03 ` Markus Armbruster
2014-10-13  3:31   ` Jason Wang
2014-10-13  4:53     ` Jason Wang [this message]

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=543B5ADA.5070308@redhat.com \
    --to=jasowang@redhat.com \
    --cc=afaerber@suse.de \
    --cc=armbru@redhat.com \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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.