blkdebug.c (33c6cae44eccea5e627c2dc5cbf31456db90fc38) blkdebug.c (4cc70e933731ebf4309e1f1ce90973a0de04f28f)
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

--- 591 unchanged lines hidden (view full) ---

600 if (!strcmp(r->tag, tag)) {
601 qemu_coroutine_enter(r->co, NULL);
602 return 0;
603 }
604 }
605 return -ENOENT;
606}
607
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

--- 591 unchanged lines hidden (view full) ---

600 if (!strcmp(r->tag, tag)) {
601 qemu_coroutine_enter(r->co, NULL);
602 return 0;
603 }
604 }
605 return -ENOENT;
606}
607
608static int blkdebug_debug_remove_breakpoint(BlockDriverState *bs,
609 const char *tag)
610{
611 BDRVBlkdebugState *s = bs->opaque;
612 BlkdebugSuspendedReq *r;
613 BlkdebugRule *rule, *next;
614 int i, ret = -ENOENT;
608
615
616 for (i = 0; i < BLKDBG_EVENT_MAX; i++) {
617 QLIST_FOREACH_SAFE(rule, &s->rules[i], next, next) {
618 if (rule->action == ACTION_SUSPEND &&
619 !strcmp(rule->options.suspend.tag, tag)) {
620 remove_rule(rule);
621 ret = 0;
622 }
623 }
624 }
625 QLIST_FOREACH(r, &s->suspended_reqs, next) {
626 if (!strcmp(r->tag, tag)) {
627 qemu_coroutine_enter(r->co, NULL);
628 ret = 0;
629 }
630 }
631 return ret;
632}
633
609static bool blkdebug_debug_is_suspended(BlockDriverState *bs, const char *tag)
610{
611 BDRVBlkdebugState *s = bs->opaque;
612 BlkdebugSuspendedReq *r;
613
614 QLIST_FOREACH(r, &s->suspended_reqs, next) {
615 if (!strcmp(r->tag, tag)) {
616 return true;

--- 17 unchanged lines hidden (view full) ---

634 .bdrv_close = blkdebug_close,
635 .bdrv_getlength = blkdebug_getlength,
636
637 .bdrv_aio_readv = blkdebug_aio_readv,
638 .bdrv_aio_writev = blkdebug_aio_writev,
639
640 .bdrv_debug_event = blkdebug_debug_event,
641 .bdrv_debug_breakpoint = blkdebug_debug_breakpoint,
634static bool blkdebug_debug_is_suspended(BlockDriverState *bs, const char *tag)
635{
636 BDRVBlkdebugState *s = bs->opaque;
637 BlkdebugSuspendedReq *r;
638
639 QLIST_FOREACH(r, &s->suspended_reqs, next) {
640 if (!strcmp(r->tag, tag)) {
641 return true;

--- 17 unchanged lines hidden (view full) ---

659 .bdrv_close = blkdebug_close,
660 .bdrv_getlength = blkdebug_getlength,
661
662 .bdrv_aio_readv = blkdebug_aio_readv,
663 .bdrv_aio_writev = blkdebug_aio_writev,
664
665 .bdrv_debug_event = blkdebug_debug_event,
666 .bdrv_debug_breakpoint = blkdebug_debug_breakpoint,
667 .bdrv_debug_remove_breakpoint
668 = blkdebug_debug_remove_breakpoint,
642 .bdrv_debug_resume = blkdebug_debug_resume,
643 .bdrv_debug_is_suspended = blkdebug_debug_is_suspended,
644};
645
646static void bdrv_blkdebug_init(void)
647{
648 bdrv_register(&bdrv_blkdebug);
649}
650
651block_init(bdrv_blkdebug_init);
669 .bdrv_debug_resume = blkdebug_debug_resume,
670 .bdrv_debug_is_suspended = blkdebug_debug_is_suspended,
671};
672
673static void bdrv_blkdebug_init(void)
674{
675 bdrv_register(&bdrv_blkdebug);
676}
677
678block_init(bdrv_blkdebug_init);