block.c (36fe13317bfc3414745528c6c08cea2904ca49ec) | block.c (20018e12cfde4847a0e90f0f9942804c20c14894) |
---|---|
1/* 2 * QEMU System Emulator block driver 3 * 4 * Copyright (c) 2003 Fabrice Bellard 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 --- 645 unchanged lines hidden (view full) --- 654 *writethrough = true; 655 } else { 656 return -1; 657 } 658 659 return 0; 660} 661 | 1/* 2 * QEMU System Emulator block driver 3 * 4 * Copyright (c) 2003 Fabrice Bellard 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 --- 645 unchanged lines hidden (view full) --- 654 *writethrough = true; 655 } else { 656 return -1; 657 } 658 659 return 0; 660} 661 |
662static void bdrv_child_cb_drained_begin(BdrvChild *child) 663{ 664 BlockDriverState *bs = child->opaque; 665 bdrv_drained_begin(bs); 666} 667 668static void bdrv_child_cb_drained_end(BdrvChild *child) 669{ 670 BlockDriverState *bs = child->opaque; 671 bdrv_drained_end(bs); 672} 673 |
|
662/* 663 * Returns the options and flags that a temporary snapshot should get, based on 664 * the originally requested flags (the originally requested image will have 665 * flags like a backing file) 666 */ 667static void bdrv_temp_snapshot_options(int *child_flags, QDict *child_options, 668 int parent_flags, QDict *parent_options) 669{ --- 30 unchanged lines hidden (view full) --- 700 flags &= ~(BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING | BDRV_O_COPY_ON_READ | 701 BDRV_O_NO_IO); 702 703 *child_flags = flags; 704} 705 706const BdrvChildRole child_file = { 707 .inherit_options = bdrv_inherited_options, | 674/* 675 * Returns the options and flags that a temporary snapshot should get, based on 676 * the originally requested flags (the originally requested image will have 677 * flags like a backing file) 678 */ 679static void bdrv_temp_snapshot_options(int *child_flags, QDict *child_options, 680 int parent_flags, QDict *parent_options) 681{ --- 30 unchanged lines hidden (view full) --- 712 flags &= ~(BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING | BDRV_O_COPY_ON_READ | 713 BDRV_O_NO_IO); 714 715 *child_flags = flags; 716} 717 718const BdrvChildRole child_file = { 719 .inherit_options = bdrv_inherited_options, |
720 .drained_begin = bdrv_child_cb_drained_begin, 721 .drained_end = bdrv_child_cb_drained_end, |
|
708}; 709 710/* 711 * Returns the options and flags that bs->file should get if the use of formats 712 * (and not only protocols) is permitted for it, based on the given options and 713 * flags for the parent BDS 714 */ 715static void bdrv_inherited_fmt_options(int *child_flags, QDict *child_options, 716 int parent_flags, QDict *parent_options) 717{ 718 child_file.inherit_options(child_flags, child_options, 719 parent_flags, parent_options); 720 721 *child_flags &= ~(BDRV_O_PROTOCOL | BDRV_O_NO_IO); 722} 723 724const BdrvChildRole child_format = { 725 .inherit_options = bdrv_inherited_fmt_options, | 722}; 723 724/* 725 * Returns the options and flags that bs->file should get if the use of formats 726 * (and not only protocols) is permitted for it, based on the given options and 727 * flags for the parent BDS 728 */ 729static void bdrv_inherited_fmt_options(int *child_flags, QDict *child_options, 730 int parent_flags, QDict *parent_options) 731{ 732 child_file.inherit_options(child_flags, child_options, 733 parent_flags, parent_options); 734 735 *child_flags &= ~(BDRV_O_PROTOCOL | BDRV_O_NO_IO); 736} 737 738const BdrvChildRole child_format = { 739 .inherit_options = bdrv_inherited_fmt_options, |
740 .drained_begin = bdrv_child_cb_drained_begin, 741 .drained_end = bdrv_child_cb_drained_end, |
|
726}; 727 728/* 729 * Returns the options and flags that bs->backing should get, based on the 730 * given options and flags for the parent BDS 731 */ 732static void bdrv_backing_options(int *child_flags, QDict *child_options, 733 int parent_flags, QDict *parent_options) --- 11 unchanged lines hidden (view full) --- 745 /* snapshot=on is handled on the top layer */ 746 flags &= ~(BDRV_O_SNAPSHOT | BDRV_O_TEMPORARY); 747 748 *child_flags = flags; 749} 750 751static const BdrvChildRole child_backing = { 752 .inherit_options = bdrv_backing_options, | 742}; 743 744/* 745 * Returns the options and flags that bs->backing should get, based on the 746 * given options and flags for the parent BDS 747 */ 748static void bdrv_backing_options(int *child_flags, QDict *child_options, 749 int parent_flags, QDict *parent_options) --- 11 unchanged lines hidden (view full) --- 761 /* snapshot=on is handled on the top layer */ 762 flags &= ~(BDRV_O_SNAPSHOT | BDRV_O_TEMPORARY); 763 764 *child_flags = flags; 765} 766 767static const BdrvChildRole child_backing = { 768 .inherit_options = bdrv_backing_options, |
769 .drained_begin = bdrv_child_cb_drained_begin, 770 .drained_end = bdrv_child_cb_drained_end, |
|
753}; 754 755static int bdrv_open_flags(BlockDriverState *bs, int flags) 756{ 757 int open_flags = flags; 758 759 /* 760 * Clear flags that are internal to the block layer before opening the --- 429 unchanged lines hidden (view full) --- 1190} 1191 1192BdrvChild *bdrv_attach_child(BlockDriverState *parent_bs, 1193 BlockDriverState *child_bs, 1194 const char *child_name, 1195 const BdrvChildRole *child_role) 1196{ 1197 BdrvChild *child = bdrv_root_attach_child(child_bs, child_name, child_role, | 771}; 772 773static int bdrv_open_flags(BlockDriverState *bs, int flags) 774{ 775 int open_flags = flags; 776 777 /* 778 * Clear flags that are internal to the block layer before opening the --- 429 unchanged lines hidden (view full) --- 1208} 1209 1210BdrvChild *bdrv_attach_child(BlockDriverState *parent_bs, 1211 BlockDriverState *child_bs, 1212 const char *child_name, 1213 const BdrvChildRole *child_role) 1214{ 1215 BdrvChild *child = bdrv_root_attach_child(child_bs, child_name, child_role, |
1198 NULL); | 1216 parent_bs); |
1199 QLIST_INSERT_HEAD(&parent_bs->children, child, next); 1200 return child; 1201} 1202 1203static void bdrv_detach_child(BdrvChild *child) 1204{ 1205 if (child->next.le_prev) { 1206 QLIST_REMOVE(child, next); --- 2799 unchanged lines hidden --- | 1217 QLIST_INSERT_HEAD(&parent_bs->children, child, next); 1218 return child; 1219} 1220 1221static void bdrv_detach_child(BdrvChild *child) 1222{ 1223 if (child->next.le_prev) { 1224 QLIST_REMOVE(child, next); --- 2799 unchanged lines hidden --- |