public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Filip Schauer <f.schauer@proxmox.com>
Subject: Re: [pve-devel] [PATCH v4 qemu] fix #1534: vma: Add extract filter for disk images
Date: Tue, 29 Aug 2023 14:10:28 +0200	[thread overview]
Message-ID: <f381fd3f-2927-8001-f436-c80447a8960a@proxmox.com> (raw)
In-Reply-To: <20230809140816.102070-1-f.schauer@proxmox.com>

Am 09.08.23 um 16:08 schrieb Filip Schauer:
> diff --git a/debian/patches/pve/0027-PVE-Backup-add-vma-backup-format-code.patch b/debian/patches/pve/0027-PVE-Backup-add-vma-backup-format-code.patch
> index 8471a6f..312727d 100644
> --- a/debian/patches/pve/0027-PVE-Backup-add-vma-backup-format-code.patch
> +++ b/debian/patches/pve/0027-PVE-Backup-add-vma-backup-format-code.patch
> @@ -1738,7 +1738,7 @@ new file mode 100644
>  index 0000000000..304f02bc84

Needs a rebase, because the index changed. I would've fixed it up while
applying, but I got two more suggestions:

> @@ -1928,6 +1929,9 @@ index 0000000000..304f02bc84
>  +        case 'h':
>  +            help();
>  +            break;
> ++        case 'd':
> ++            drive_list = optarg;

I think we can use g_strsplit() here already to split the string and
then just iterate over the result below, rather than splitting manually
for each iteration. Note that you need to free the result at the very
end as mentioned in the docs:

https://docs.gtk.org/glib/func.strsplit.html

> ++            break;
>  +        case 'r':
>  +            readmap = optarg;
>  +            break;

(...)

> @@ -2089,7 +2093,34 @@ index 0000000000..304f02bc84
>  +
>  +            BlockBackend *blk = NULL;
>  +
> -+            if (readmap) {
> ++            if (drive_list) {
> ++                skip = true;
> ++                size_t devname_len = strlen(di->devname);
> ++                const char *token = drive_list;
> ++                while (*token) {
> ++                    const char *comma = strchr(token, ',');
> ++                    if (comma == NULL) {
> ++                        comma = token + strlen(token);
> ++                    }
> ++
> ++                    size_t token_len = comma - token;
> ++                    if (token_len == devname_len && strncmp(token, di->devname, token_len) == 0) {

Passing devname_len to strncmp would avoid the token_len variable.




  reply	other threads:[~2023-08-29 12:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-09 14:08 Filip Schauer
2023-08-29 12:10 ` Fiona Ebner [this message]
2023-08-30  7:16   ` Fiona Ebner

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=f381fd3f-2927-8001-f436-c80447a8960a@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=f.schauer@proxmox.com \
    --cc=pve-devel@lists.proxmox.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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal