qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, stefanha@redhat.com
Subject: [Qemu-devel] [PATCH 2/6] blkdebug: Factor out remove_rule()
Date: Thu,  6 Dec 2012 14:32:56 +0100	[thread overview]
Message-ID: <1354800780-10683-3-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1354800780-10683-1-git-send-email-kwolf@redhat.com>

The cleanup work to remove a rule depends on the type of the rule. It's
easy for the existing rules as there is no data that must be cleaned up
and is specific to a type yet, but the next patch will change this.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/blkdebug.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/block/blkdebug.c b/block/blkdebug.c
index c9041ec..859792b 100644
--- a/block/blkdebug.c
+++ b/block/blkdebug.c
@@ -234,6 +234,18 @@ static int add_rule(QemuOpts *opts, void *opaque)
     return 0;
 }
 
+static void remove_rule(BlkdebugRule *rule)
+{
+    switch (rule->action) {
+    case ACTION_INJECT_ERROR:
+    case ACTION_SET_STATE:
+        break;
+    }
+
+    QLIST_REMOVE(rule, next);
+    g_free(rule);
+}
+
 static int read_config(BDRVBlkdebugState *s, const char *filename)
 {
     FILE *f;
@@ -402,8 +414,7 @@ static void blkdebug_close(BlockDriverState *bs)
 
     for (i = 0; i < BLKDBG_EVENT_MAX; i++) {
         QLIST_FOREACH_SAFE(rule, &s->rules[i], next, next) {
-            QLIST_REMOVE(rule, next);
-            g_free(rule);
+            remove_rule(rule);
         }
     }
 }
-- 
1.7.6.5

  parent reply	other threads:[~2012-12-06 13:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-06 13:32 [Qemu-devel] [PATCH 0/6] blkdebug/qcow2/qemu-iotests: Add some AIO testing Kevin Wolf
2012-12-06 13:32 ` [Qemu-devel] [PATCH 1/6] blkdebug: Allow usage without config file Kevin Wolf
2012-12-06 13:32 ` Kevin Wolf [this message]
2012-12-06 13:32 ` [Qemu-devel] [PATCH 3/6] blkdebug: Implement suspend/resume of AIO requests Kevin Wolf
2012-12-06 13:32 ` [Qemu-devel] [PATCH 4/6] qemu-io: Add AIO debugging commands Kevin Wolf
2012-12-06 13:32 ` [Qemu-devel] [PATCH 5/6] qcow2: Move BLKDBG_EVENT out of the lock Kevin Wolf
2012-12-06 13:33 ` [Qemu-devel] [PATCH 6/6] qemu-iotests: Test concurrent cluster allocations Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1354800780-10683-3-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).