diff options
author | Paolo Bonzini | 2012-09-20 16:50:32 +0200 |
---|---|---|
committer | Luiz Capitulino | 2012-09-26 17:42:19 +0200 |
commit | 9a3a88956c7f32130ad20011f7c3c161fa5876d8 (patch) | |
tree | cc67bd956555d12298fe7b1db2a1f564075bb0b9 /hw | |
parent | qapi: add "unix" to the set of reserved words (diff) | |
download | qemu-9a3a88956c7f32130ad20011f7c3c161fa5876d8.tar.gz qemu-9a3a88956c7f32130ad20011f7c3c161fa5876d8.tar.xz qemu-9a3a88956c7f32130ad20011f7c3c161fa5876d8.zip |
pci-assign: use monitor_handle_fd_param
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>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/kvm/pci-assign.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/hw/kvm/pci-assign.c b/hw/kvm/pci-assign.c index 05b93d9a51..7a0998c518 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); |