于 2013-3-30 4:10, Eric Blake 写道:
On 03/22/2013 08:19 AM, Wenchao Xia wrote:
   This is a code move patch, except in qmp_query_block bdrv_next(bs)
is used instead of direct traverse of global array 'bdrv_states'.

Mixing code motion and a code change isn't always the best, but at least
you were honest about it.  I don't know how easy it would be to split
this into two patches for straight code motion.

  It can't be split since build fail with original code, bdrv_states
is a static global variable in block.c.

   This patch also fix code style error reported by check script.

Signed-off-by: Wenchao Xia <xiaw...@linux.vnet.ibm.com>
---
  block.c               |   76 ------------------------------------------------
  block/qapi.c          |   77 +++++++++++++++++++++++++++++++++++++++++++++++++
  include/block/block.h |    1 -
  include/block/qapi.h  |    1 +
  4 files changed, 78 insertions(+), 77 deletions(-)

At any rate,

Reviewed-by: Eric Blake <ebl...@redhat.com>

-BlockInfoList *qmp_query_block(Error **errp)
-{
-    BlockInfoList *head = NULL, **p_next = &head;
-    BlockDriverState *bs;
-
-    QTAILQ_FOREACH(bs, &bdrv_states, list) {

+BlockInfoList *qmp_query_block(Error **errp)
+{
+    BlockInfoList *head = NULL, **p_next = &head;
+    BlockDriverState *bs = NULL;
+
+    while ((bs = bdrv_next(bs))) {

This is the tweak you made.



--
Best Regards

Wenchao Xia


Reply via email to