block.c (d6fcdf06d9fc7d72151cc2069dc5c1adf5c21707) | block.c (93ed524e3de732f70b3b042e3c56bc4ed719498d) |
---|---|
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 --- 178 unchanged lines hidden (view full) --- 187 if (len > dest_size - 1) 188 len = dest_size - 1; 189 memcpy(dest, base_path, len); 190 dest[len] = '\0'; 191 pstrcat(dest, dest_size, filename); 192 } 193} 194 | 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 --- 178 unchanged lines hidden (view full) --- 187 if (len > dest_size - 1) 188 len = dest_size - 1; 189 memcpy(dest, base_path, len); 190 dest[len] = '\0'; 191 pstrcat(dest, dest_size, filename); 192 } 193} 194 |
195bool bdrv_is_read_only(BlockDriverState *bs) 196{ 197 return bs->read_only; 198} 199 |
|
195int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error **errp) 196{ 197 /* Do not set read_only if copy_on_read is enabled */ 198 if (bs->copy_on_read && read_only) { 199 error_setg(errp, "Can't set node '%s' to r/o with copy-on-read enabled", 200 bdrv_get_device_or_node_name(bs)); 201 return -EINVAL; 202 } --- 3167 unchanged lines hidden (view full) --- 3370/* return 0 as number of sectors if no device present or error */ 3371void bdrv_get_geometry(BlockDriverState *bs, uint64_t *nb_sectors_ptr) 3372{ 3373 int64_t nb_sectors = bdrv_nb_sectors(bs); 3374 3375 *nb_sectors_ptr = nb_sectors < 0 ? 0 : nb_sectors; 3376} 3377 | 200int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error **errp) 201{ 202 /* Do not set read_only if copy_on_read is enabled */ 203 if (bs->copy_on_read && read_only) { 204 error_setg(errp, "Can't set node '%s' to r/o with copy-on-read enabled", 205 bdrv_get_device_or_node_name(bs)); 206 return -EINVAL; 207 } --- 3167 unchanged lines hidden (view full) --- 3375/* return 0 as number of sectors if no device present or error */ 3376void bdrv_get_geometry(BlockDriverState *bs, uint64_t *nb_sectors_ptr) 3377{ 3378 int64_t nb_sectors = bdrv_nb_sectors(bs); 3379 3380 *nb_sectors_ptr = nb_sectors < 0 ? 0 : nb_sectors; 3381} 3382 |
3378bool bdrv_is_read_only(BlockDriverState *bs) 3379{ 3380 return bs->read_only; 3381} 3382 | |
3383bool bdrv_is_sg(BlockDriverState *bs) 3384{ 3385 return bs->sg; 3386} 3387 3388bool bdrv_is_encrypted(BlockDriverState *bs) 3389{ 3390 if (bs->backing && bs->backing->bs->encrypted) { --- 1402 unchanged lines hidden --- | 3383bool bdrv_is_sg(BlockDriverState *bs) 3384{ 3385 return bs->sg; 3386} 3387 3388bool bdrv_is_encrypted(BlockDriverState *bs) 3389{ 3390 if (bs->backing && bs->backing->bs->encrypted) { --- 1402 unchanged lines hidden --- |