]> git.proxmox.com Git - mirror_qemu.git/blob - block/blkdebug.c
blkdebug: Sanity check block layer guarantees
[mirror_qemu.git] / block / blkdebug.c
1 /*
2 * Block protocol for I/O error injection
3 *
4 * Copyright (c) 2010 Kevin Wolf <kwolf@redhat.com>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24
25 #include "qemu/osdep.h"
26 #include "qapi/error.h"
27 #include "qemu/cutils.h"
28 #include "qemu/config-file.h"
29 #include "block/block_int.h"
30 #include "qemu/module.h"
31 #include "qapi/qmp/qbool.h"
32 #include "qapi/qmp/qdict.h"
33 #include "qapi/qmp/qint.h"
34 #include "qapi/qmp/qstring.h"
35 #include "sysemu/qtest.h"
36
37 typedef struct BDRVBlkdebugState {
38 int state;
39 int new_state;
40 int align;
41
42 /* For blkdebug_refresh_filename() */
43 char *config_file;
44
45 QLIST_HEAD(, BlkdebugRule) rules[BLKDBG__MAX];
46 QSIMPLEQ_HEAD(, BlkdebugRule) active_rules;
47 QLIST_HEAD(, BlkdebugSuspendedReq) suspended_reqs;
48 } BDRVBlkdebugState;
49
50 typedef struct BlkdebugAIOCB {
51 BlockAIOCB common;
52 int ret;
53 } BlkdebugAIOCB;
54
55 typedef struct BlkdebugSuspendedReq {
56 Coroutine *co;
57 char *tag;
58 QLIST_ENTRY(BlkdebugSuspendedReq) next;
59 } BlkdebugSuspendedReq;
60
61 enum {
62 ACTION_INJECT_ERROR,
63 ACTION_SET_STATE,
64 ACTION_SUSPEND,
65 };
66
67 typedef struct BlkdebugRule {
68 BlkdebugEvent event;
69 int action;
70 int state;
71 union {
72 struct {
73 int error;
74 int immediately;
75 int once;
76 int64_t offset;
77 } inject;
78 struct {
79 int new_state;
80 } set_state;
81 struct {
82 char *tag;
83 } suspend;
84 } options;
85 QLIST_ENTRY(BlkdebugRule) next;
86 QSIMPLEQ_ENTRY(BlkdebugRule) active_next;
87 } BlkdebugRule;
88
89 static QemuOptsList inject_error_opts = {
90 .name = "inject-error",
91 .head = QTAILQ_HEAD_INITIALIZER(inject_error_opts.head),
92 .desc = {
93 {
94 .name = "event",
95 .type = QEMU_OPT_STRING,
96 },
97 {
98 .name = "state",
99 .type = QEMU_OPT_NUMBER,
100 },
101 {
102 .name = "errno",
103 .type = QEMU_OPT_NUMBER,
104 },
105 {
106 .name = "sector",
107 .type = QEMU_OPT_NUMBER,
108 },
109 {
110 .name = "once",
111 .type = QEMU_OPT_BOOL,
112 },
113 {
114 .name = "immediately",
115 .type = QEMU_OPT_BOOL,
116 },
117 { /* end of list */ }
118 },
119 };
120
121 static QemuOptsList set_state_opts = {
122 .name = "set-state",
123 .head = QTAILQ_HEAD_INITIALIZER(set_state_opts.head),
124 .desc = {
125 {
126 .name = "event",
127 .type = QEMU_OPT_STRING,
128 },
129 {
130 .name = "state",
131 .type = QEMU_OPT_NUMBER,
132 },
133 {
134 .name = "new_state",
135 .type = QEMU_OPT_NUMBER,
136 },
137 { /* end of list */ }
138 },
139 };
140
141 static QemuOptsList *config_groups[] = {
142 &inject_error_opts,
143 &set_state_opts,
144 NULL
145 };
146
147 static int get_event_by_name(const char *name, BlkdebugEvent *event)
148 {
149 int i;
150
151 for (i = 0; i < BLKDBG__MAX; i++) {
152 if (!strcmp(BlkdebugEvent_lookup[i], name)) {
153 *event = i;
154 return 0;
155 }
156 }
157
158 return -1;
159 }
160
161 struct add_rule_data {
162 BDRVBlkdebugState *s;
163 int action;
164 };
165
166 static int add_rule(void *opaque, QemuOpts *opts, Error **errp)
167 {
168 struct add_rule_data *d = opaque;
169 BDRVBlkdebugState *s = d->s;
170 const char* event_name;
171 BlkdebugEvent event;
172 struct BlkdebugRule *rule;
173 int64_t sector;
174
175 /* Find the right event for the rule */
176 event_name = qemu_opt_get(opts, "event");
177 if (!event_name) {
178 error_setg(errp, "Missing event name for rule");
179 return -1;
180 } else if (get_event_by_name(event_name, &event) < 0) {
181 error_setg(errp, "Invalid event name \"%s\"", event_name);
182 return -1;
183 }
184
185 /* Set attributes common for all actions */
186 rule = g_malloc0(sizeof(*rule));
187 *rule = (struct BlkdebugRule) {
188 .event = event,
189 .action = d->action,
190 .state = qemu_opt_get_number(opts, "state", 0),
191 };
192
193 /* Parse action-specific options */
194 switch (d->action) {
195 case ACTION_INJECT_ERROR:
196 rule->options.inject.error = qemu_opt_get_number(opts, "errno", EIO);
197 rule->options.inject.once = qemu_opt_get_bool(opts, "once", 0);
198 rule->options.inject.immediately =
199 qemu_opt_get_bool(opts, "immediately", 0);
200 sector = qemu_opt_get_number(opts, "sector", -1);
201 rule->options.inject.offset =
202 sector == -1 ? -1 : sector * BDRV_SECTOR_SIZE;
203 break;
204
205 case ACTION_SET_STATE:
206 rule->options.set_state.new_state =
207 qemu_opt_get_number(opts, "new_state", 0);
208 break;
209
210 case ACTION_SUSPEND:
211 rule->options.suspend.tag =
212 g_strdup(qemu_opt_get(opts, "tag"));
213 break;
214 };
215
216 /* Add the rule */
217 QLIST_INSERT_HEAD(&s->rules[event], rule, next);
218
219 return 0;
220 }
221
222 static void remove_rule(BlkdebugRule *rule)
223 {
224 switch (rule->action) {
225 case ACTION_INJECT_ERROR:
226 case ACTION_SET_STATE:
227 break;
228 case ACTION_SUSPEND:
229 g_free(rule->options.suspend.tag);
230 break;
231 }
232
233 QLIST_REMOVE(rule, next);
234 g_free(rule);
235 }
236
237 static int read_config(BDRVBlkdebugState *s, const char *filename,
238 QDict *options, Error **errp)
239 {
240 FILE *f = NULL;
241 int ret;
242 struct add_rule_data d;
243 Error *local_err = NULL;
244
245 if (filename) {
246 f = fopen(filename, "r");
247 if (f == NULL) {
248 error_setg_errno(errp, errno, "Could not read blkdebug config file");
249 return -errno;
250 }
251
252 ret = qemu_config_parse(f, config_groups, filename);
253 if (ret < 0) {
254 error_setg(errp, "Could not parse blkdebug config file");
255 ret = -EINVAL;
256 goto fail;
257 }
258 }
259
260 qemu_config_parse_qdict(options, config_groups, &local_err);
261 if (local_err) {
262 error_propagate(errp, local_err);
263 ret = -EINVAL;
264 goto fail;
265 }
266
267 d.s = s;
268 d.action = ACTION_INJECT_ERROR;
269 qemu_opts_foreach(&inject_error_opts, add_rule, &d, &local_err);
270 if (local_err) {
271 error_propagate(errp, local_err);
272 ret = -EINVAL;
273 goto fail;
274 }
275
276 d.action = ACTION_SET_STATE;
277 qemu_opts_foreach(&set_state_opts, add_rule, &d, &local_err);
278 if (local_err) {
279 error_propagate(errp, local_err);
280 ret = -EINVAL;
281 goto fail;
282 }
283
284 ret = 0;
285 fail:
286 qemu_opts_reset(&inject_error_opts);
287 qemu_opts_reset(&set_state_opts);
288 if (f) {
289 fclose(f);
290 }
291 return ret;
292 }
293
294 /* Valid blkdebug filenames look like blkdebug:path/to/config:path/to/image */
295 static void blkdebug_parse_filename(const char *filename, QDict *options,
296 Error **errp)
297 {
298 const char *c;
299
300 /* Parse the blkdebug: prefix */
301 if (!strstart(filename, "blkdebug:", &filename)) {
302 /* There was no prefix; therefore, all options have to be already
303 present in the QDict (except for the filename) */
304 qdict_put_str(options, "x-image", filename);
305 return;
306 }
307
308 /* Parse config file path */
309 c = strchr(filename, ':');
310 if (c == NULL) {
311 error_setg(errp, "blkdebug requires both config file and image path");
312 return;
313 }
314
315 if (c != filename) {
316 QString *config_path;
317 config_path = qstring_from_substr(filename, 0, c - filename - 1);
318 qdict_put(options, "config", config_path);
319 }
320
321 /* TODO Allow multi-level nesting and set file.filename here */
322 filename = c + 1;
323 qdict_put_str(options, "x-image", filename);
324 }
325
326 static QemuOptsList runtime_opts = {
327 .name = "blkdebug",
328 .head = QTAILQ_HEAD_INITIALIZER(runtime_opts.head),
329 .desc = {
330 {
331 .name = "config",
332 .type = QEMU_OPT_STRING,
333 .help = "Path to the configuration file",
334 },
335 {
336 .name = "x-image",
337 .type = QEMU_OPT_STRING,
338 .help = "[internal use only, will be removed]",
339 },
340 {
341 .name = "align",
342 .type = QEMU_OPT_SIZE,
343 .help = "Required alignment in bytes",
344 },
345 { /* end of list */ }
346 },
347 };
348
349 static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags,
350 Error **errp)
351 {
352 BDRVBlkdebugState *s = bs->opaque;
353 QemuOpts *opts;
354 Error *local_err = NULL;
355 uint64_t align;
356 int ret;
357
358 opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
359 qemu_opts_absorb_qdict(opts, options, &local_err);
360 if (local_err) {
361 error_propagate(errp, local_err);
362 ret = -EINVAL;
363 goto out;
364 }
365
366 /* Read rules from config file or command line options */
367 s->config_file = g_strdup(qemu_opt_get(opts, "config"));
368 ret = read_config(s, s->config_file, options, errp);
369 if (ret) {
370 goto out;
371 }
372
373 /* Set initial state */
374 s->state = 1;
375
376 /* Open the image file */
377 bs->file = bdrv_open_child(qemu_opt_get(opts, "x-image"), options, "image",
378 bs, &child_file, false, &local_err);
379 if (local_err) {
380 ret = -EINVAL;
381 error_propagate(errp, local_err);
382 goto out;
383 }
384
385 /* Set request alignment */
386 align = qemu_opt_get_size(opts, "align", 0);
387 if (align < INT_MAX && is_power_of_2(align)) {
388 s->align = align;
389 } else if (align) {
390 error_setg(errp, "Invalid alignment");
391 ret = -EINVAL;
392 goto out;
393 }
394
395 ret = 0;
396 goto out;
397
398 out:
399 if (ret < 0) {
400 g_free(s->config_file);
401 }
402 qemu_opts_del(opts);
403 return ret;
404 }
405
406 static int inject_error(BlockDriverState *bs, BlkdebugRule *rule)
407 {
408 BDRVBlkdebugState *s = bs->opaque;
409 int error = rule->options.inject.error;
410 bool immediately = rule->options.inject.immediately;
411
412 if (rule->options.inject.once) {
413 QSIMPLEQ_REMOVE(&s->active_rules, rule, BlkdebugRule, active_next);
414 remove_rule(rule);
415 }
416
417 if (!immediately) {
418 aio_co_schedule(qemu_get_current_aio_context(), qemu_coroutine_self());
419 qemu_coroutine_yield();
420 }
421
422 return -error;
423 }
424
425 static int coroutine_fn
426 blkdebug_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes,
427 QEMUIOVector *qiov, int flags)
428 {
429 BDRVBlkdebugState *s = bs->opaque;
430 BlkdebugRule *rule = NULL;
431
432 /* Sanity check block layer guarantees */
433 assert(QEMU_IS_ALIGNED(offset, bs->bl.request_alignment));
434 assert(QEMU_IS_ALIGNED(bytes, bs->bl.request_alignment));
435 if (bs->bl.max_transfer) {
436 assert(bytes <= bs->bl.max_transfer);
437 }
438
439 QSIMPLEQ_FOREACH(rule, &s->active_rules, active_next) {
440 uint64_t inject_offset = rule->options.inject.offset;
441
442 if (inject_offset == -1 ||
443 (inject_offset >= offset && inject_offset < offset + bytes))
444 {
445 break;
446 }
447 }
448
449 if (rule && rule->options.inject.error) {
450 return inject_error(bs, rule);
451 }
452
453 return bdrv_co_preadv(bs->file, offset, bytes, qiov, flags);
454 }
455
456 static int coroutine_fn
457 blkdebug_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes,
458 QEMUIOVector *qiov, int flags)
459 {
460 BDRVBlkdebugState *s = bs->opaque;
461 BlkdebugRule *rule = NULL;
462
463 /* Sanity check block layer guarantees */
464 assert(QEMU_IS_ALIGNED(offset, bs->bl.request_alignment));
465 assert(QEMU_IS_ALIGNED(bytes, bs->bl.request_alignment));
466 if (bs->bl.max_transfer) {
467 assert(bytes <= bs->bl.max_transfer);
468 }
469
470 QSIMPLEQ_FOREACH(rule, &s->active_rules, active_next) {
471 uint64_t inject_offset = rule->options.inject.offset;
472
473 if (inject_offset == -1 ||
474 (inject_offset >= offset && inject_offset < offset + bytes))
475 {
476 break;
477 }
478 }
479
480 if (rule && rule->options.inject.error) {
481 return inject_error(bs, rule);
482 }
483
484 return bdrv_co_pwritev(bs->file, offset, bytes, qiov, flags);
485 }
486
487 static int blkdebug_co_flush(BlockDriverState *bs)
488 {
489 BDRVBlkdebugState *s = bs->opaque;
490 BlkdebugRule *rule = NULL;
491
492 QSIMPLEQ_FOREACH(rule, &s->active_rules, active_next) {
493 if (rule->options.inject.offset == -1) {
494 break;
495 }
496 }
497
498 if (rule && rule->options.inject.error) {
499 return inject_error(bs, rule);
500 }
501
502 return bdrv_co_flush(bs->file->bs);
503 }
504
505
506 static void blkdebug_close(BlockDriverState *bs)
507 {
508 BDRVBlkdebugState *s = bs->opaque;
509 BlkdebugRule *rule, *next;
510 int i;
511
512 for (i = 0; i < BLKDBG__MAX; i++) {
513 QLIST_FOREACH_SAFE(rule, &s->rules[i], next, next) {
514 remove_rule(rule);
515 }
516 }
517
518 g_free(s->config_file);
519 }
520
521 static void suspend_request(BlockDriverState *bs, BlkdebugRule *rule)
522 {
523 BDRVBlkdebugState *s = bs->opaque;
524 BlkdebugSuspendedReq r;
525
526 r = (BlkdebugSuspendedReq) {
527 .co = qemu_coroutine_self(),
528 .tag = g_strdup(rule->options.suspend.tag),
529 };
530
531 remove_rule(rule);
532 QLIST_INSERT_HEAD(&s->suspended_reqs, &r, next);
533
534 if (!qtest_enabled()) {
535 printf("blkdebug: Suspended request '%s'\n", r.tag);
536 }
537 qemu_coroutine_yield();
538 if (!qtest_enabled()) {
539 printf("blkdebug: Resuming request '%s'\n", r.tag);
540 }
541
542 QLIST_REMOVE(&r, next);
543 g_free(r.tag);
544 }
545
546 static bool process_rule(BlockDriverState *bs, struct BlkdebugRule *rule,
547 bool injected)
548 {
549 BDRVBlkdebugState *s = bs->opaque;
550
551 /* Only process rules for the current state */
552 if (rule->state && rule->state != s->state) {
553 return injected;
554 }
555
556 /* Take the action */
557 switch (rule->action) {
558 case ACTION_INJECT_ERROR:
559 if (!injected) {
560 QSIMPLEQ_INIT(&s->active_rules);
561 injected = true;
562 }
563 QSIMPLEQ_INSERT_HEAD(&s->active_rules, rule, active_next);
564 break;
565
566 case ACTION_SET_STATE:
567 s->new_state = rule->options.set_state.new_state;
568 break;
569
570 case ACTION_SUSPEND:
571 suspend_request(bs, rule);
572 break;
573 }
574 return injected;
575 }
576
577 static void blkdebug_debug_event(BlockDriverState *bs, BlkdebugEvent event)
578 {
579 BDRVBlkdebugState *s = bs->opaque;
580 struct BlkdebugRule *rule, *next;
581 bool injected;
582
583 assert((int)event >= 0 && event < BLKDBG__MAX);
584
585 injected = false;
586 s->new_state = s->state;
587 QLIST_FOREACH_SAFE(rule, &s->rules[event], next, next) {
588 injected = process_rule(bs, rule, injected);
589 }
590 s->state = s->new_state;
591 }
592
593 static int blkdebug_debug_breakpoint(BlockDriverState *bs, const char *event,
594 const char *tag)
595 {
596 BDRVBlkdebugState *s = bs->opaque;
597 struct BlkdebugRule *rule;
598 BlkdebugEvent blkdebug_event;
599
600 if (get_event_by_name(event, &blkdebug_event) < 0) {
601 return -ENOENT;
602 }
603
604
605 rule = g_malloc(sizeof(*rule));
606 *rule = (struct BlkdebugRule) {
607 .event = blkdebug_event,
608 .action = ACTION_SUSPEND,
609 .state = 0,
610 .options.suspend.tag = g_strdup(tag),
611 };
612
613 QLIST_INSERT_HEAD(&s->rules[blkdebug_event], rule, next);
614
615 return 0;
616 }
617
618 static int blkdebug_debug_resume(BlockDriverState *bs, const char *tag)
619 {
620 BDRVBlkdebugState *s = bs->opaque;
621 BlkdebugSuspendedReq *r, *next;
622
623 QLIST_FOREACH_SAFE(r, &s->suspended_reqs, next, next) {
624 if (!strcmp(r->tag, tag)) {
625 qemu_coroutine_enter(r->co);
626 return 0;
627 }
628 }
629 return -ENOENT;
630 }
631
632 static int blkdebug_debug_remove_breakpoint(BlockDriverState *bs,
633 const char *tag)
634 {
635 BDRVBlkdebugState *s = bs->opaque;
636 BlkdebugSuspendedReq *r, *r_next;
637 BlkdebugRule *rule, *next;
638 int i, ret = -ENOENT;
639
640 for (i = 0; i < BLKDBG__MAX; i++) {
641 QLIST_FOREACH_SAFE(rule, &s->rules[i], next, next) {
642 if (rule->action == ACTION_SUSPEND &&
643 !strcmp(rule->options.suspend.tag, tag)) {
644 remove_rule(rule);
645 ret = 0;
646 }
647 }
648 }
649 QLIST_FOREACH_SAFE(r, &s->suspended_reqs, next, r_next) {
650 if (!strcmp(r->tag, tag)) {
651 qemu_coroutine_enter(r->co);
652 ret = 0;
653 }
654 }
655 return ret;
656 }
657
658 static bool blkdebug_debug_is_suspended(BlockDriverState *bs, const char *tag)
659 {
660 BDRVBlkdebugState *s = bs->opaque;
661 BlkdebugSuspendedReq *r;
662
663 QLIST_FOREACH(r, &s->suspended_reqs, next) {
664 if (!strcmp(r->tag, tag)) {
665 return true;
666 }
667 }
668 return false;
669 }
670
671 static int64_t blkdebug_getlength(BlockDriverState *bs)
672 {
673 return bdrv_getlength(bs->file->bs);
674 }
675
676 static int blkdebug_truncate(BlockDriverState *bs, int64_t offset)
677 {
678 return bdrv_truncate(bs->file, offset, NULL);
679 }
680
681 static void blkdebug_refresh_filename(BlockDriverState *bs, QDict *options)
682 {
683 BDRVBlkdebugState *s = bs->opaque;
684 QDict *opts;
685 const QDictEntry *e;
686 bool force_json = false;
687
688 for (e = qdict_first(options); e; e = qdict_next(options, e)) {
689 if (strcmp(qdict_entry_key(e), "config") &&
690 strcmp(qdict_entry_key(e), "x-image"))
691 {
692 force_json = true;
693 break;
694 }
695 }
696
697 if (force_json && !bs->file->bs->full_open_options) {
698 /* The config file cannot be recreated, so creating a plain filename
699 * is impossible */
700 return;
701 }
702
703 if (!force_json && bs->file->bs->exact_filename[0]) {
704 snprintf(bs->exact_filename, sizeof(bs->exact_filename),
705 "blkdebug:%s:%s", s->config_file ?: "",
706 bs->file->bs->exact_filename);
707 }
708
709 opts = qdict_new();
710 qdict_put_str(opts, "driver", "blkdebug");
711
712 QINCREF(bs->file->bs->full_open_options);
713 qdict_put(opts, "image", bs->file->bs->full_open_options);
714
715 for (e = qdict_first(options); e; e = qdict_next(options, e)) {
716 if (strcmp(qdict_entry_key(e), "x-image")) {
717 qobject_incref(qdict_entry_value(e));
718 qdict_put_obj(opts, qdict_entry_key(e), qdict_entry_value(e));
719 }
720 }
721
722 bs->full_open_options = opts;
723 }
724
725 static void blkdebug_refresh_limits(BlockDriverState *bs, Error **errp)
726 {
727 BDRVBlkdebugState *s = bs->opaque;
728
729 if (s->align) {
730 bs->bl.request_alignment = s->align;
731 }
732 }
733
734 static int blkdebug_reopen_prepare(BDRVReopenState *reopen_state,
735 BlockReopenQueue *queue, Error **errp)
736 {
737 return 0;
738 }
739
740 static BlockDriver bdrv_blkdebug = {
741 .format_name = "blkdebug",
742 .protocol_name = "blkdebug",
743 .instance_size = sizeof(BDRVBlkdebugState),
744
745 .bdrv_parse_filename = blkdebug_parse_filename,
746 .bdrv_file_open = blkdebug_open,
747 .bdrv_close = blkdebug_close,
748 .bdrv_reopen_prepare = blkdebug_reopen_prepare,
749 .bdrv_child_perm = bdrv_filter_default_perms,
750
751 .bdrv_getlength = blkdebug_getlength,
752 .bdrv_truncate = blkdebug_truncate,
753 .bdrv_refresh_filename = blkdebug_refresh_filename,
754 .bdrv_refresh_limits = blkdebug_refresh_limits,
755
756 .bdrv_co_preadv = blkdebug_co_preadv,
757 .bdrv_co_pwritev = blkdebug_co_pwritev,
758 .bdrv_co_flush_to_disk = blkdebug_co_flush,
759
760 .bdrv_debug_event = blkdebug_debug_event,
761 .bdrv_debug_breakpoint = blkdebug_debug_breakpoint,
762 .bdrv_debug_remove_breakpoint
763 = blkdebug_debug_remove_breakpoint,
764 .bdrv_debug_resume = blkdebug_debug_resume,
765 .bdrv_debug_is_suspended = blkdebug_debug_is_suspended,
766 };
767
768 static void bdrv_blkdebug_init(void)
769 {
770 bdrv_register(&bdrv_blkdebug);
771 }
772
773 block_init(bdrv_blkdebug_init);