block.c (f3947986d9bbbae1087c4c33880d3f8dbf1f1384) block.c (e12f3784097a26a1ba51be420f41038b4c0ae5d1)
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

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

4072 if (perm) {
4073 return true;
4074 }
4075 }
4076
4077 return false;
4078}
4079
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

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

4072 if (perm) {
4073 return true;
4074 }
4075 }
4076
4077 return false;
4078}
4079
4080BlockDriverState *check_to_replace_node(const char *node_name, Error **errp)
4080BlockDriverState *check_to_replace_node(BlockDriverState *parent_bs,
4081 const char *node_name, Error **errp)
4081{
4082 BlockDriverState *to_replace_bs = bdrv_find_node(node_name);
4083 AioContext *aio_context;
4084
4085 if (!to_replace_bs) {
4086 error_setg(errp, "Node name '%s' not found", node_name);
4087 return NULL;
4088 }

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

4095 goto out;
4096 }
4097
4098 /* We don't want arbitrary node of the BDS chain to be replaced only the top
4099 * most non filter in order to prevent data corruption.
4100 * Another benefit is that this tests exclude backing files which are
4101 * blocked by the backing blockers.
4102 */
4082{
4083 BlockDriverState *to_replace_bs = bdrv_find_node(node_name);
4084 AioContext *aio_context;
4085
4086 if (!to_replace_bs) {
4087 error_setg(errp, "Node name '%s' not found", node_name);
4088 return NULL;
4089 }

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

4096 goto out;
4097 }
4098
4099 /* We don't want arbitrary node of the BDS chain to be replaced only the top
4100 * most non filter in order to prevent data corruption.
4101 * Another benefit is that this tests exclude backing files which are
4102 * blocked by the backing blockers.
4103 */
4103 if (!bdrv_is_first_non_filter(to_replace_bs)) {
4104 if (!bdrv_recurse_is_first_non_filter(parent_bs, to_replace_bs)) {
4104 error_setg(errp, "Only top most non filter can be replaced");
4105 to_replace_bs = NULL;
4106 goto out;
4107 }
4108
4109out:
4110 aio_context_release(aio_context);
4111 return to_replace_bs;

--- 142 unchanged lines hidden ---
4105 error_setg(errp, "Only top most non filter can be replaced");
4106 to_replace_bs = NULL;
4107 goto out;
4108 }
4109
4110out:
4111 aio_context_release(aio_context);
4112 return to_replace_bs;

--- 142 unchanged lines hidden ---