block.c (114cdfa908520ccc624fc8e5409252dc6e980f8a) block.c (b783e409bf17b92f4af8dc5d6bd040d0092f33e0)
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

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

472 if (drv->bdrv_getlength) {
473 bs->total_sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS;
474 }
475#ifndef _WIN32
476 if (bs->is_temporary) {
477 unlink(filename);
478 }
479#endif
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

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

472 if (drv->bdrv_getlength) {
473 bs->total_sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS;
474 }
475#ifndef _WIN32
476 if (bs->is_temporary) {
477 unlink(filename);
478 }
479#endif
480 if (bs->backing_file[0] != '\0') {
480 if ((flags & BDRV_O_NO_BACKING) == 0 && bs->backing_file[0] != '\0') {
481 /* if there is a backing file, use it */
482 BlockDriver *back_drv = NULL;
483 bs->backing_hd = bdrv_new("");
484 /* pass on read_only property to the backing_hd */
485 bs->backing_hd->read_only = bs->read_only;
486 path_combine(backing_filename, sizeof(backing_filename),
487 filename, bs->backing_file);
488 if (bs->backing_format[0] != '\0')

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

1347 return bs->filename;
1348 else
1349 return NULL;
1350}
1351
1352void bdrv_get_backing_filename(BlockDriverState *bs,
1353 char *filename, int filename_size)
1354{
481 /* if there is a backing file, use it */
482 BlockDriver *back_drv = NULL;
483 bs->backing_hd = bdrv_new("");
484 /* pass on read_only property to the backing_hd */
485 bs->backing_hd->read_only = bs->read_only;
486 path_combine(backing_filename, sizeof(backing_filename),
487 filename, bs->backing_file);
488 if (bs->backing_format[0] != '\0')

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

1347 return bs->filename;
1348 else
1349 return NULL;
1350}
1351
1352void bdrv_get_backing_filename(BlockDriverState *bs,
1353 char *filename, int filename_size)
1354{
1355 if (!bs->backing_hd) {
1355 if (!bs->backing_file) {
1356 pstrcpy(filename, filename_size, "");
1357 } else {
1358 pstrcpy(filename, filename_size, bs->backing_file);
1359 }
1360}
1361
1362int bdrv_write_compressed(BlockDriverState *bs, int64_t sector_num,
1363 const uint8_t *buf, int nb_sectors)

--- 789 unchanged lines hidden ---
1356 pstrcpy(filename, filename_size, "");
1357 } else {
1358 pstrcpy(filename, filename_size, bs->backing_file);
1359 }
1360}
1361
1362int bdrv_write_compressed(BlockDriverState *bs, int64_t sector_num,
1363 const uint8_t *buf, int nb_sectors)

--- 789 unchanged lines hidden ---