于 2013-2-28 23:47, Stefan Hajnoczi 写道:
On Tue, Feb 26, 2013 at 06:40:20PM +0800, Wenchao Xia wrote:
diff --git a/block.c b/block.c
index 8d0145a..71fc9e7 100644
--- a/block.c
+++ b/block.c
@@ -2880,15 +2880,33 @@ SnapshotInfoList 
*bdrv_query_snapshot_infolist(BlockDriverState *bs,
      return head;
  }

-void collect_image_info(BlockDriverState *bs,
-                        ImageInfo *info,
-                        const char *filename)
+/* collect all internal snapshot info in a image for ImageInfo */
+static void collect_snapshots_info(BlockDriverState *bs,
+                                   ImageInfo *info,
+                                   Error **errp)
+{
+    SnapshotInfoList *info_list;
+
+    if (!bdrv_can_read_snapshot(bs)) {
+        return;
+    }
+    info_list = bdrv_query_snapshot_infolist(bs, NULL, NULL, errp);
+    if (info_list != NULL) {
+        info->has_snapshots = true;
+        info->snapshots = info_list;
+    }
+}

This is a pretty trivial function that is used only once.  Inlining the
code is clearer IMO.

OK.

--
Best Regards

Wenchao Xia


Reply via email to