qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Konstantin Kostiuk <kkostiuk@redhat.com>
To: Kfir Manor <kfir@daynix.com>
Cc: qemu-devel@nongnu.org, Michael Roth <michael.roth@amd.com>,
	 Yan Vugenfirer <yan@daynix.com>
Subject: Re: [PATCH 1/2] qga:/qga-win: adding a empty PCI address creation function
Date: Mon, 21 Nov 2022 10:33:36 +0200	[thread overview]
Message-ID: <CAPMcbCoqx8ftro5esmTnWCHFKBOvkEkrax7+QOfB_zeuTiQ6Fg@mail.gmail.com> (raw)
In-Reply-To: <20221120140044.752503-2-kfir@daynix.com>

[-- Attachment #1: Type: text/plain, Size: 1574 bytes --]

Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>

On Sun, Nov 20, 2022 at 4:09 PM Kfir Manor <kfir@daynix.com> wrote:

> Refactoring code to avoid duplication of creating an empty PCI address
> code.
>
> Signed-off-by: Kfir Manor <kfir@daynix.com>
> ---
>  qga/commands-win32.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/qga/commands-win32.c b/qga/commands-win32.c
> index ec9f55b453..a645480496 100644
> --- a/qga/commands-win32.c
> +++ b/qga/commands-win32.c
> @@ -599,6 +599,18 @@ static void
> get_pci_address_for_device(GuestPCIAddress *pci,
>      }
>  }
>
> +static GuestPCIAddress *get_empty_pci_address(void)
> +{
> +    GuestPCIAddress *pci = NULL;
> +
> +    pci = g_malloc0(sizeof(*pci));
> +    pci->domain = -1;
> +    pci->slot = -1;
> +    pci->function = -1;
> +    pci->bus = -1;
> +    return pci;
> +}
> +
>  static GuestPCIAddress *get_pci_info(int number, Error **errp)
>  {
>      HDEVINFO dev_info = INVALID_HANDLE_VALUE;
> @@ -608,13 +620,7 @@ static GuestPCIAddress *get_pci_info(int number,
> Error **errp)
>      SP_DEVICE_INTERFACE_DATA dev_iface_data;
>      HANDLE dev_file;
>      int i;
> -    GuestPCIAddress *pci = NULL;
> -
> -    pci = g_malloc0(sizeof(*pci));
> -    pci->domain = -1;
> -    pci->slot = -1;
> -    pci->function = -1;
> -    pci->bus = -1;
> +    GuestPCIAddress *pci = get_empty_pci_address();
>
>      dev_info = SetupDiGetClassDevs(&GUID_DEVINTERFACE_DISK, 0, 0,
>                                     DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
> --
> 2.38.1
>
>

[-- Attachment #2: Type: text/html, Size: 2210 bytes --]

  reply	other threads:[~2022-11-21  8:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-20 14:00 [PATCH 0/2] qemu-ga-win: 'guest-get-fsinfo' command wont query storage devices of bus type USB Kfir Manor
2022-11-20 14:00 ` [PATCH 1/2] qga:/qga-win: adding a empty PCI address creation function Kfir Manor
2022-11-21  8:33   ` Konstantin Kostiuk [this message]
2022-11-20 14:00 ` [PATCH 2/2] qga:/qga-win: skip getting pci info for USB disks Kfir Manor
2022-11-21  8:33   ` Konstantin Kostiuk
2022-11-21  6:38 ` [PATCH 0/2] qemu-ga-win: 'guest-get-fsinfo' command wont query storage devices of bus type USB Marc-André Lureau
2022-12-26 14:02   ` Konstantin Kostiuk

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=CAPMcbCoqx8ftro5esmTnWCHFKBOvkEkrax7+QOfB_zeuTiQ6Fg@mail.gmail.com \
    --to=kkostiuk@redhat.com \
    --cc=kfir@daynix.com \
    --cc=michael.roth@amd.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yan@daynix.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 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).