block.c (3e44c8e08a4b84ec1f4f1eb249d33005bb9cf572) | block.c (c8f6d58edb0defbe1e90d44419ec8ec6d711c341) |
---|---|
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 --- 3108 unchanged lines hidden (view full) --- 3117/** 3118 * Truncate file to 'offset' bytes (needed only for file protocols) 3119 */ 3120int bdrv_truncate(BdrvChild *child, int64_t offset) 3121{ 3122 BlockDriverState *bs = child->bs; 3123 BlockDriver *drv = bs->drv; 3124 int ret; | 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 --- 3108 unchanged lines hidden (view full) --- 3117/** 3118 * Truncate file to 'offset' bytes (needed only for file protocols) 3119 */ 3120int bdrv_truncate(BdrvChild *child, int64_t offset) 3121{ 3122 BlockDriverState *bs = child->bs; 3123 BlockDriver *drv = bs->drv; 3124 int ret; |
3125 3126 assert(child->perm & BLK_PERM_RESIZE); 3127 |
|
3125 if (!drv) 3126 return -ENOMEDIUM; 3127 if (!drv->bdrv_truncate) 3128 return -ENOTSUP; 3129 if (bs->read_only) 3130 return -EACCES; 3131 3132 ret = drv->bdrv_truncate(bs, offset); --- 1467 unchanged lines hidden --- | 3128 if (!drv) 3129 return -ENOMEDIUM; 3130 if (!drv->bdrv_truncate) 3131 return -ENOTSUP; 3132 if (bs->read_only) 3133 return -EACCES; 3134 3135 ret = drv->bdrv_truncate(bs, offset); --- 1467 unchanged lines hidden --- |