[pve-devel] [PATCH v4 qemu] fix #1534: vma: Add extract filter for disk images

Fiona Ebner f.ebner at proxmox.com
Tue Aug 29 14:10:28 CEST 2023


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.





More information about the pve-devel mailing list