diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2020-02-06 16:22:05 +0000 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2020-02-06 16:22:05 +0000 |
| commit | 863d2ed5823f90c42dcd481687cc99cbc9c4a17c (patch) | |
| tree | aa97d37140f93f48fc52401891dcd767fd3f0b39 /block.c | |
| parent | 2021b7c9716cd579e20b4993ed75842f4e0deb34 (diff) | |
| parent | a541fcc27c98b96da187c7d4573f3270f3ddd283 (diff) | |
| download | focaccia-qemu-863d2ed5823f90c42dcd481687cc99cbc9c4a17c.tar.gz focaccia-qemu-863d2ed5823f90c42dcd481687cc99cbc9c4a17c.zip | |
Merge remote-tracking branch 'remotes/maxreitz/tags/pull-block-2020-02-06' into staging
Block patches: - Drop BDRV_SECTOR_SIZE from qcow2 - Allow Python iotests to be added to the auto group (and add some) - Fix for the backup job - Fix memleak in bdrv_refresh_filename() - Use GStrings in two places for greater efficiency (than manually handling string allocation) # gpg: Signature made Thu 06 Feb 2020 12:50:14 GMT # gpg: using RSA key 91BEB60A30DB3E8857D11829F407DB0061D5CF40 # gpg: issuer "mreitz@redhat.com" # gpg: Good signature from "Max Reitz <mreitz@redhat.com>" [full] # Primary key fingerprint: 91BE B60A 30DB 3E88 57D1 1829 F407 DB00 61D5 CF40 * remotes/maxreitz/tags/pull-block-2020-02-06: iotests: add test for backup-top failure on permission activation block/backup-top: fix failure path qcow2: Use BDRV_SECTOR_SIZE instead of the hardcoded value qcow2: Don't require aligned offsets in qcow2_co_copy_range_from() qcow2: Use bs->bl.request_alignment when updating an L1 entry qcow2: Tighten cluster_offset alignment assertions qcow2: Don't round the L1 table allocation up to the sector size iotests: Enable more tests in the 'auto' group to improve test coverage iotests: Skip Python-based tests if QEMU does not support virtio-blk iotests: Check for the availability of the required devices in 267 and 127 iotests: Test 183 does not work on macOS and OpenBSD iotests: Test 041 only works on certain systems iotests: remove 'linux' from default supported platforms qcow2: Use a GString in report_unsupported_feature() block: fix memleaks in bdrv_refresh_filename block: Use a GString in bdrv_perm_names() qcow2: Assert that host cluster offsets fit in L2 table entries Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'block.c')
| -rw-r--r-- | block.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/block.c b/block.c index 6c2b2bd2e2..9c810534d6 100644 --- a/block.c +++ b/block.c @@ -1998,18 +1998,19 @@ char *bdrv_perm_names(uint64_t perm) { 0, NULL } }; - char *result = g_strdup(""); + GString *result = g_string_sized_new(30); struct perm_name *p; for (p = permissions; p->name; p++) { if (perm & p->perm) { - char *old = result; - result = g_strdup_printf("%s%s%s", old, *old ? ", " : "", p->name); - g_free(old); + if (result->len > 0) { + g_string_append(result, ", "); + } + g_string_append(result, p->name); } } - return result; + return g_string_free(result, FALSE); } /* @@ -6441,6 +6442,7 @@ void bdrv_refresh_filename(BlockDriverState *bs) child->bs->exact_filename); pstrcpy(bs->filename, sizeof(bs->filename), child->bs->filename); + qobject_unref(bs->full_open_options); bs->full_open_options = qobject_ref(child->bs->full_open_options); return; |