block.c (4417ab7adf1613799054be5afedf810fc2524ee8) | block.c (cfa1a5723f0fc8eb6563fb1d19c206fd5e40cd41) |
---|---|
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 --- 4005 unchanged lines hidden (view full) --- 4014 return; 4015 } 4016 } 4017} 4018 4019static int bdrv_inactivate_recurse(BlockDriverState *bs, 4020 bool setting_flag) 4021{ | 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 --- 4005 unchanged lines hidden (view full) --- 4014 return; 4015 } 4016 } 4017} 4018 4019static int bdrv_inactivate_recurse(BlockDriverState *bs, 4020 bool setting_flag) 4021{ |
4022 BdrvChild *child; | 4022 BdrvChild *child, *parent; |
4023 int ret; 4024 4025 if (!setting_flag && bs->drv->bdrv_inactivate) { 4026 ret = bs->drv->bdrv_inactivate(bs); 4027 if (ret < 0) { 4028 return ret; 4029 } 4030 } 4031 4032 QLIST_FOREACH(child, &bs->children, next) { 4033 ret = bdrv_inactivate_recurse(child->bs, setting_flag); 4034 if (ret < 0) { 4035 return ret; 4036 } 4037 } 4038 4039 if (setting_flag) { 4040 bs->open_flags |= BDRV_O_INACTIVE; | 4023 int ret; 4024 4025 if (!setting_flag && bs->drv->bdrv_inactivate) { 4026 ret = bs->drv->bdrv_inactivate(bs); 4027 if (ret < 0) { 4028 return ret; 4029 } 4030 } 4031 4032 QLIST_FOREACH(child, &bs->children, next) { 4033 ret = bdrv_inactivate_recurse(child->bs, setting_flag); 4034 if (ret < 0) { 4035 return ret; 4036 } 4037 } 4038 4039 if (setting_flag) { 4040 bs->open_flags |= BDRV_O_INACTIVE; |
4041 4042 QLIST_FOREACH(parent, &bs->parents, next_parent) { 4043 if (parent->role->inactivate) { 4044 ret = parent->role->inactivate(parent); 4045 if (ret < 0) { 4046 bs->open_flags &= ~BDRV_O_INACTIVE; 4047 return ret; 4048 } 4049 } 4050 } |
|
4041 } 4042 return 0; 4043} 4044 4045int bdrv_inactivate_all(void) 4046{ 4047 BlockDriverState *bs = NULL; 4048 BdrvNextIterator it; --- 791 unchanged lines hidden --- | 4051 } 4052 return 0; 4053} 4054 4055int bdrv_inactivate_all(void) 4056{ 4057 BlockDriverState *bs = NULL; 4058 BdrvNextIterator it; --- 791 unchanged lines hidden --- |