qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: qemu-devel@nongnu.org
Cc: eblake@redhat.com, pbonzini@redhat.com
Subject: [Qemu-devel] [PATCH 1/3] pci-assign: use monitor_handle_fd_param
Date: Thu, 20 Sep 2012 17:28:01 -0300	[thread overview]
Message-ID: <1348172883-26997-2-git-send-email-lcapitulino@redhat.com> (raw)
In-Reply-To: <1348172883-26997-1-git-send-email-lcapitulino@redhat.com>

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);
-- 
1.7.12.315.g682ce8b

  reply	other threads:[~2012-09-20 20:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-20 20:28 [Qemu-devel] [PATCH v2 0/3]: qapi: convert add_client Luiz Capitulino
2012-09-20 20:28 ` Luiz Capitulino [this message]
2012-09-20 20:28 ` [Qemu-devel] [PATCH 2/3] monitor: add Error * argument to monitor_get_fd Luiz Capitulino
2012-09-20 20:28 ` [Qemu-devel] [PATCH 3/3] qapi: convert add_client Luiz Capitulino
  -- strict thread matches above, loose matches on Subject: below --
2012-09-24 21:55 [Qemu-devel] [PATCH v3 0/3] " 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
2012-09-26  7:54     ` Markus Armbruster
2012-09-25 20:24 [Qemu-devel] [PATCH v4 0/3] qapi: convert add_client Luiz Capitulino
2012-09-25 20:24 ` [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=1348172883-26997-2-git-send-email-lcapitulino@redhat.com \
    --to=lcapitulino@redhat.com \
    --cc=eblake@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).