All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Luiz Capitulino <lcapitulino@redhat.com>
Cc: pbonzini@redhat.com, eblake@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/3] pci-assign: use monitor_handle_fd_param
Date: Tue, 25 Sep 2012 13:03:19 +0200	[thread overview]
Message-ID: <8762722wlk.fsf@blackfin.pond.sub.org> (raw)
In-Reply-To: <1348523754-6897-2-git-send-email-lcapitulino@redhat.com> (Luiz Capitulino's message of "Mon, 24 Sep 2012 18:55:52 -0300")

Luiz Capitulino <lcapitulino@redhat.com> writes:

> From: Paolo Bonzini <pbonzini@redhat.com>
>
> There is no need to open-code the choice between a file descriptor
> number or a named one.  Just use monitor_handle_fd_param, which
> also takes care of printing the error message.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> ---
>  hw/kvm/pci-assign.c | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/hw/kvm/pci-assign.c b/hw/kvm/pci-assign.c
> index 05b93d9..7a0998c 100644
> --- a/hw/kvm/pci-assign.c
> +++ b/hw/kvm/pci-assign.c
> @@ -579,15 +579,9 @@ static int get_real_device(AssignedDevice *pci_dev, uint16_t r_seg,
>      snprintf(name, sizeof(name), "%sconfig", dir);
>  
>      if (pci_dev->configfd_name && *pci_dev->configfd_name) {
> -        if (qemu_isdigit(pci_dev->configfd_name[0])) {
> -            dev->config_fd = strtol(pci_dev->configfd_name, NULL, 0);
> -        } else {
> -            dev->config_fd = monitor_get_fd(cur_mon, pci_dev->configfd_name);
> -            if (dev->config_fd < 0) {
> -                error_report("%s: (%s) unkown", __func__,
> -                             pci_dev->configfd_name);
> -                return 1;
> -            }
> +        dev->config_fd = monitor_handle_fd_param(cur_mon, pci_dev->configfd_name);
> +        if (dev->config_fd < 0) {
> +            return 1;
>          }
>      } else {
>          dev->config_fd = open(name, O_RDWR);

Silent change: no longer accepts file descriptors in octal and hex.

Silent fix: now rejects junk after numeric file descriptor.  

Both are fine with me, but perhaps worth mentioning in the commit
message.

  reply	other threads:[~2012-09-25 11:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-24 21:55 [Qemu-devel] [PATCH v3 0/3] qapi: convert add_client Luiz Capitulino
2012-09-24 21:55 ` [Qemu-devel] [PATCH 1/3] pci-assign: use monitor_handle_fd_param Luiz Capitulino
2012-09-25 11:03   ` Markus Armbruster [this message]
2012-09-26  7:54     ` Markus Armbruster
2012-09-24 21:55 ` [Qemu-devel] [PATCH 2/3] monitor: add Error * argument to monitor_get_fd Luiz Capitulino
2012-09-25 11:06   ` Markus Armbruster
2012-09-24 21:55 ` [Qemu-devel] [PATCH 3/3] qapi: convert add_client Luiz Capitulino
2012-09-25 11:29   ` Markus Armbruster
2012-09-25 12:39     ` Luiz Capitulino
2012-09-25 14:04       ` Markus Armbruster
2012-09-25  6:34 ` [Qemu-devel] [PATCH v3 0/3] " Paolo Bonzini
  -- strict thread matches above, loose matches on Subject: below --
2012-09-25 20:24 [Qemu-devel] [PATCH v4 " Luiz Capitulino
2012-09-25 20:24 ` [Qemu-devel] [PATCH 1/3] pci-assign: use monitor_handle_fd_param Luiz Capitulino
2012-09-20 20:28 [Qemu-devel] [PATCH v2 0/3]: qapi: convert add_client Luiz Capitulino
2012-09-20 20:28 ` [Qemu-devel] [PATCH 1/3] pci-assign: use monitor_handle_fd_param Luiz Capitulino

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=8762722wlk.fsf@blackfin.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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.