block.c (8e419aefa07ca8e640f8db50b450378e84d60a11) block.c (779020cbdc67011026c10fb620f701bfc6b85547)
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

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

1099{
1100 QLIST_REMOVE(child, next);
1101 QLIST_REMOVE(child, next_parent);
1102 g_free(child);
1103}
1104
1105void bdrv_unref_child(BlockDriverState *parent, BdrvChild *child)
1106{
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

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

1099{
1100 QLIST_REMOVE(child, next);
1101 QLIST_REMOVE(child, next_parent);
1102 g_free(child);
1103}
1104
1105void bdrv_unref_child(BlockDriverState *parent, BdrvChild *child)
1106{
1107 BlockDriverState *child_bs = child->bs;
1107 BlockDriverState *child_bs;
1108
1108
1109 if (child == NULL) {
1110 return;
1111 }
1112
1109 if (child->bs->inherits_from == parent) {
1110 child->bs->inherits_from = NULL;
1111 }
1112
1113 if (child->bs->inherits_from == parent) {
1114 child->bs->inherits_from = NULL;
1115 }
1116
1117 child_bs = child->bs;
1113 bdrv_detach_child(child);
1114 bdrv_unref(child_bs);
1115}
1116
1117/*
1118 * Sets the backing file link of a BDS. A new reference is created; callers
1119 * which don't need their own reference any more must call bdrv_unref().
1120 */

--- 3031 unchanged lines hidden ---
1118 bdrv_detach_child(child);
1119 bdrv_unref(child_bs);
1120}
1121
1122/*
1123 * Sets the backing file link of a BDS. A new reference is created; callers
1124 * which don't need their own reference any more must call bdrv_unref().
1125 */

--- 3031 unchanged lines hidden ---