block.c (33a610c398603efafd954c706ba07850835a5098) block.c (6a1b9ee152101868082dbf24ccb683af0431c85b)
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

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

1532 return ret;
1533 }
1534
1535 bdrv_child_set_perm(c, perm, shared);
1536
1537 return 0;
1538}
1539
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

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

1532 return ret;
1533 }
1534
1535 bdrv_child_set_perm(c, perm, shared);
1536
1537 return 0;
1538}
1539
1540#define DEFAULT_PERM_PASSTHROUGH (BLK_PERM_CONSISTENT_READ \
1541 | BLK_PERM_WRITE \
1542 | BLK_PERM_WRITE_UNCHANGED \
1543 | BLK_PERM_RESIZE)
1544#define DEFAULT_PERM_UNCHANGED (BLK_PERM_ALL & ~DEFAULT_PERM_PASSTHROUGH)
1545
1546void bdrv_filter_default_perms(BlockDriverState *bs, BdrvChild *c,
1547 const BdrvChildRole *role,
1548 uint64_t perm, uint64_t shared,
1549 uint64_t *nperm, uint64_t *nshared)
1550{
1551 if (c == NULL) {
1552 *nperm = perm & DEFAULT_PERM_PASSTHROUGH;
1553 *nshared = (shared & DEFAULT_PERM_PASSTHROUGH) | DEFAULT_PERM_UNCHANGED;
1554 return;
1555 }
1556
1557 *nperm = (perm & DEFAULT_PERM_PASSTHROUGH) |
1558 (c->perm & DEFAULT_PERM_UNCHANGED);
1559 *nshared = (shared & DEFAULT_PERM_PASSTHROUGH) |
1560 (c->shared_perm & DEFAULT_PERM_UNCHANGED);
1561}
1562
1540static void bdrv_replace_child(BdrvChild *child, BlockDriverState *new_bs,
1541 bool check_new_perm)
1542{
1543 BlockDriverState *old_bs = child->bs;
1544 uint64_t perm, shared_perm;
1545
1546 if (old_bs) {
1547 if (old_bs->quiesce_counter && child->role->drained_end) {

--- 2893 unchanged lines hidden ---
1563static void bdrv_replace_child(BdrvChild *child, BlockDriverState *new_bs,
1564 bool check_new_perm)
1565{
1566 BlockDriverState *old_bs = child->bs;
1567 uint64_t perm, shared_perm;
1568
1569 if (old_bs) {
1570 if (old_bs->quiesce_counter && child->role->drained_end) {

--- 2893 unchanged lines hidden ---