qcow2: Rename BDRVQcowState to BDRVQcow2State
PATCH 1/1 qcow2: Rename BDRVQcowState to BDRVQcow2State
BDRVQcowState is already used by qcow1, and gdb is always confused which one to use. Rename the qcow2 one so they can be distinguished.
--- block/qcow2-cache.c | 14 ++++----- block/qcow2-cluster.c | 48 +++++++++++++++---------------- block/qcow2-refcount.c | 58 ++++++++++++++++++------------------- block/qcow2-snapshot.c | 20 ++++++------- block/qcow2.c | 78 +++++++++++++++++++++++++------------------------- block/qcow2.h | 22 +++++++------- 6 files changed, 120 insertions(+), 120 deletions(-)
block/qcow2-cache.c +7 -7
@@ -55,14 +55,14 @@ struct Qcow2Cache {static inline void *qcow2_cache_get_table_addr (BlockDriverState *bs,Qcow2Cache *c,int table) { -BDRVQcowState *s = bs->opaque; +BDRVQcow2State *s = bs->opaque;return (uint8_t *) c->table_array + (size_t ) table * s->cluster_size; }static inline int qcow2_cache_get_table_idx (BlockDriverState *bs,Qcow2Cache *c,void *table) { -BDRVQcowState *s = bs->opaque; +BDRVQcow2State *s = bs->opaque;ptrdiff_t table_offset = (uint8_t *) table - (uint8_t *) c->table_array;int idx = table_offset / s->cluster_size;assert (idx >=0 && idx < c->size && table_offset % s->cluster_size ==0 );
@@ -73,7 +73,7 @@ static void qcow2_cache_table_release(BlockDriverState *bs, Qcow2Cache *c, int i, int num_tables) {#if QEMU_MADV_DONTNEED !=QEMU_MADV_INVALID -BDRVQcowState *s = bs->opaque; +BDRVQcow2State *s = bs->opaque;void *t =qcow2_cache_get_table_addr (bs, c, i);int align =getpagesize ();size_t mem_size = (size_t ) s->cluster_size * num_tables;
@@ -121,7 +121,7 @@ void qcow2_cache_clean_unused(BlockDriverState *bs, Qcow2Cache *c)Qcow2Cache *qcow2_cache_create (BlockDriverState *bs,int num_tables) { -BDRVQcowState *s = bs->opaque; +BDRVQcow2State *s = bs->opaque;Qcow2Cache *c; c =g_new0 (Qcow2Cache,1 );
@@ -172,7 +172,7 @@ static int qcow2_cache_flush_dependency(BlockDriverState *bs, Qcow2Cache *c)static int qcow2_cache_entry_flush (BlockDriverState *bs,Qcow2Cache *c,int i) { -BDRVQcowState *s = bs->opaque; +BDRVQcow2State *s = bs->opaque;int ret =0 ;if (!c->entries[i].dirty || !c->entries[i].offset) {
@@ -229,7 +229,7 @@ static int qcow2_cache_entry_flush(BlockDriverState *bs, Qcow2Cache *c, int i)int qcow2_cache_flush (BlockDriverState *bs,Qcow2Cache *c) { -BDRVQcowState *s = bs->opaque; +BDRVQcow2State *s = bs->opaque;int result =0 ;int ret;int i;
@@ -306,7 +306,7 @@ int qcow2_cache_empty(BlockDriverState *bs, Qcow2Cache *c)static int qcow2_cache_do_get (BlockDriverState *bs,Qcow2Cache *c,uint64_t offset,void **table,bool read_from_disk) { -BDRVQcowState *s = bs->opaque; +BDRVQcow2State *s = bs->opaque;int i;int ret;int lookup_index;
block/qcow2-cluster.c +24 -24
192 lines not on this page · raw message
block/qcow2-refcount.c +29 -29
232 lines not on this page · raw message
block/qcow2-snapshot.c +10 -10
@@ -29,7 +29,7 @@void qcow2_free_snapshots (BlockDriverState *bs) { -BDRVQcowState *s = bs->opaque; +BDRVQcow2State *s = bs->opaque;int i;for (i =0 ; i < s->nb_snapshots; i++) {
@@ -43,7 +43,7 @@ void qcow2_free_snapshots(BlockDriverState *bs)int qcow2_read_snapshots (BlockDriverState *bs) { -BDRVQcowState *s = bs->opaque; +BDRVQcow2State *s = bs->opaque;QCowSnapshotHeader h;QCowSnapshotExtraData extra;QCowSnapshot *sn;
@@ -136,7 +136,7 @@ fail:/* add at the end of the file a new list of snapshots */ static int qcow2_write_snapshots (BlockDriverState *bs) { -BDRVQcowState *s = bs->opaque; +BDRVQcow2State *s = bs->opaque;QCowSnapshot *sn;QCowSnapshotHeader h;QCowSnapshotExtraData extra;
@@ -278,7 +278,7 @@ fail:static void find_new_snapshot_id (BlockDriverState *bs,char *id_str,int id_str_size) { -BDRVQcowState *s = bs->opaque; +BDRVQcow2State *s = bs->opaque;QCowSnapshot *sn;int i;unsigned long id, id_max =0 ;
@@ -296,7 +296,7 @@ static int find_snapshot_by_id_and_name(BlockDriverState *bs,const char *id, const char *name) { - BDRVQcowState *s = bs->opaque; + BDRVQcow2State *s = bs->opaque;int i;if (id && name) {
@@ -338,7 +338,7 @@ static int find_snapshot_by_id_or_name(BlockDriverState *bs,/* if no id is provided, a new one is constructed */ int qcow2_snapshot_create (BlockDriverState *bs,QEMUSnapshotInfo *sn_info) { -BDRVQcowState *s = bs->opaque; +BDRVQcow2State *s = bs->opaque;QCowSnapshot *new_snapshot_list =NULL ;QCowSnapshot *old_snapshot_list =NULL ;QCowSnapshot sn1, *sn = &sn1;
@@ -461,7 +461,7 @@ fail:/* copy the snapshot 'snapshot_name' into the current disk image */ int qcow2_snapshot_goto (BlockDriverState *bs,const char *snapshot_id) { -BDRVQcowState *s = bs->opaque; +BDRVQcow2State *s = bs->opaque;QCowSnapshot *sn;int i, snapshot_index;int cur_l1_bytes, sn_l1_bytes;
@@ -587,7 +587,7 @@ int qcow2_snapshot_delete(BlockDriverState *bs,const char *name, Error **errp) { - BDRVQcowState *s = bs->opaque; + BDRVQcow2State *s = bs->opaque;QCowSnapshot sn;int snapshot_index, ret;
@@ -650,7 +650,7 @@ int qcow2_snapshot_delete(BlockDriverState *bs,int qcow2_snapshot_list (BlockDriverState *bs,QEMUSnapshotInfo **psn_tab) { -BDRVQcowState *s = bs->opaque; +BDRVQcow2State *s = bs->opaque;QEMUSnapshotInfo *sn_tab, *sn_info;QCowSnapshot *sn;int i;
@@ -683,7 +683,7 @@ int qcow2_snapshot_load_tmp(BlockDriverState *bs, Error **errp) {int i, snapshot_index; -BDRVQcowState *s = bs->opaque; +BDRVQcow2State *s = bs->opaque;QCowSnapshot *sn;uint64_t *new_l1_table;int new_l1_bytes;
block/qcow2.c +39 -39
312 lines not on this page · raw message
block/qcow2.h +11 -11
@@ -222,7 +222,7 @@ typedef uint64_t Qcow2GetRefcountFunc(const void *refcount_array,typedef void Qcow2SetRefcountFunc (void *refcount_array,uint64_t index,uint64_t value); -typedef struct BDRVQcowState { +typedef struct BDRVQcow2State { int cluster_bits; int cluster_size; int cluster_sectors;
@@ -293,7 +293,7 @@ typedef struct BDRVQcowState {* override) */ char *image_backing_file;char *image_backing_format; -} BDRVQcowState; +} BDRVQcow2State;struct QCowAIOCB ;
@@ -405,28 +405,28 @@ typedef enum QCow2MetadataOverlap {#define REFT_OFFSET_MASK 0xfffffffffffffe00ULL -static inline int64_t start_of_cluster (BDRVQcowState *s,int64_t offset) +static inline int64_t start_of_cluster (BDRVQcow2State *s,int64_t offset) {return offset & ~(s->cluster_size -1 ); } -static inline int64_t offset_into_cluster (BDRVQcowState *s,int64_t offset) +static inline int64_t offset_into_cluster (BDRVQcow2State *s,int64_t offset) {return offset & (s->cluster_size -1 ); } -static inline int size_to_clusters (BDRVQcowState *s,int64_t size) +static inline int size_to_clusters (BDRVQcow2State *s,int64_t size) {return (size + (s->cluster_size -1 )) >> s->cluster_bits; } -static inline int64_t size_to_l1 (BDRVQcowState *s,int64_t size) +static inline int64_t size_to_l1 (BDRVQcow2State *s,int64_t size) {int shift = s->cluster_bits + s->l2_bits;return (size + (1ULL << shift) -1 ) >> shift; } -static inline int offset_to_l2_index (BDRVQcowState *s,int64_t offset) +static inline int offset_to_l2_index (BDRVQcow2State *s,int64_t offset) {return (offset >> s->cluster_bits) & (s->l2_size -1 ); }
@@ -437,12 +437,12 @@ static inline int64_t align_offset(int64_t offset, int n)return offset; } -static inline int64_t qcow2_vm_state_offset (BDRVQcowState *s) +static inline int64_t qcow2_vm_state_offset (BDRVQcow2State *s) {return (int64_t )s->l1_vm_state_index << (s->cluster_bits + s->l2_bits); } -static inline uint64_t qcow2_max_refcount_clusters (BDRVQcowState *s) +static inline uint64_t qcow2_max_refcount_clusters (BDRVQcow2State *s) {return QCOW_MAX_REFTABLE_SIZE >> s->cluster_bits; }
@@ -461,7 +461,7 @@ static inline int qcow2_get_cluster_type(uint64_t l2_entry) }/* Check whether refcounts are eager or lazy */ -static inline bool qcow2_need_accurate_refcounts (BDRVQcowState *s) +static inline bool qcow2_need_accurate_refcounts (BDRVQcow2State *s) {return !(s->incompatible_features &QCOW2_INCOMPAT_DIRTY ); }
@@ -537,7 +537,7 @@ int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t min_size,int qcow2_write_l1_entry (BlockDriverState *bs,int l1_index);void qcow2_l2_cache_reset (BlockDriverState *bs);int qcow2_decompress_cluster (BlockDriverState *bs,uint64_t cluster_offset); -int qcow2_encrypt_sectors (BDRVQcowState *s,int64_t sector_num, +int qcow2_encrypt_sectors (BDRVQcow2State *s,int64_t sector_num,uint8_t *out_buf,const uint8_t *in_buf,int nb_sectors,bool enc,Error **errp);
Signature · 1 line
1.8.3.1
Quoted 4 lines · Kevin Wolf
BDRVQcowState is already used by qcow1, and gdb is always confused which one to use. Rename the qcow2 one so they can be distinguished.
Signed-off-by Kevin Wolf <[email protected]>
Quoted 8 lines
--- block/qcow2-cache.c | 14 ++++----- block/qcow2-cluster.c | 48 +++++++++++++++---------------- block/qcow2-refcount.c | 58 ++++++++++++++++++------------------- block/qcow2-snapshot.c | 20 ++++++------- block/qcow2.c | 78 +++++++++++++++++++++++++------------------------- block/qcow2.h | 22 +++++++------- 6 files changed, 120 insertions(+), 120 deletions(-)
Quoted 4 lines · Kevin Wolf
BDRVQcowState is already used by qcow1, and gdb is always confused which one to use. Rename the qcow2 one so they can be distinguished.
Signed-off-by Kevin Wolf <[email protected]>
Quoted 8 lines
--- block/qcow2-cache.c | 14 ++++----- block/qcow2-cluster.c | 48 +++++++++++++++---------------- block/qcow2-refcount.c | 58 ++++++++++++++++++------------------- block/qcow2-snapshot.c | 20 ++++++------- block/qcow2.c | 78 +++++++++++++++++++++++++------------------------- block/qcow2.h | 22 +++++++------- 6 files changed, 120 insertions(+), 120 deletions(-)
I never thought I'd see the day!
Quoted 4 lines · Kevin Wolf
BDRVQcowState is already used by qcow1, and gdb is always confused which one to use. Rename the qcow2 one so they can be distinguished.
Signed-off-by Kevin Wolf <[email protected]>
Berto