From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59753) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9wec-0000g4-Bb for qemu-devel@nongnu.org; Fri, 18 Dec 2015 10:09:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9web-0004g9-8L for qemu-devel@nongnu.org; Fri, 18 Dec 2015 10:09:10 -0500 From: Kevin Wolf Date: Fri, 18 Dec 2015 16:07:51 +0100 Message-Id: <1450451274-7472-46-git-send-email-kwolf@redhat.com> In-Reply-To: <1450451274-7472-1-git-send-email-kwolf@redhat.com> References: <1450451274-7472-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 45/48] block/qapi: always report full_backing_filename List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: John Snow Always report full_backing_filename, even if it's the same as backing_filename. In the next patch, full_backing_filename may be omitted if it cannot be generated instead of allowing e.g. drive_query to abort if it runs into this scenario. The presence or absence of the "full" field becomes useful information. Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 1450122916-4706-3-git-send-email-jsnow@redhat.com Signed-off-by: Max Reitz --- block/qapi.c | 7 ++++--- tests/qemu-iotests/043.out | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/block/qapi.c b/block/qapi.c index 563dd31..3d8e434 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -251,9 +251,10 @@ void bdrv_query_image_info(BlockDriverState *bs, return; } - if (strcmp(backing_filename, backing_filename2) != 0) { - info->full_backing_filename = - g_strdup(backing_filename2); + /* Always report the full_backing_filename if present, even if it's the + * same as backing_filename. That they are same is useful info. */ + if (backing_filename2) { + info->full_backing_filename = g_strdup(backing_filename2); info->has_full_backing_filename = true; } diff --git a/tests/qemu-iotests/043.out b/tests/qemu-iotests/043.out index 33f8cc3..b37d2a3 100644 --- a/tests/qemu-iotests/043.out +++ b/tests/qemu-iotests/043.out @@ -44,6 +44,7 @@ cluster_size: 65536 "filename": "TEST_DIR/t.IMGFMT", "cluster-size": 65536, "format": "IMGFMT", + "full-backing-filename": "TEST_DIR/t.IMGFMT.2.base", "backing-filename": "TEST_DIR/t.IMGFMT.2.base", "dirty-flag": false }, @@ -52,6 +53,7 @@ cluster_size: 65536 "filename": "TEST_DIR/t.IMGFMT.2.base", "cluster-size": 65536, "format": "IMGFMT", + "full-backing-filename": "TEST_DIR/t.IMGFMT.1.base", "backing-filename": "TEST_DIR/t.IMGFMT.1.base", "dirty-flag": false }, -- 1.8.3.1