Fix some style problems in migration
v2 cover Fix some style problems in migration
Recently I am reading migration related code, find some style problems in migration directory while using checkpatch.pl to check migration code. Fix the error style problems.
v2:
- fix Signed-off-by error
- fix printf format error: "%0x" -> "0x%x"
Bihong Yu (8):
migration: Do not use C99 // comments
migration: Don't use '#' flag of printf format
migration: Add spaces around operator
migration: Open brace '{' following struct go on the same line
migration: Add braces {} for if statement
migration: Do not initialise statics and globals to 0 or NULL
migration: Open brace '{' following function declarations go on the
next line
migration: Delete redundant spaces
migration/block.c | 4 ++-- migration/migration.c | 4 ++-- migration/migration.h | 3 +-- migration/postcopy-ram.c | 2 +- migration/ram.c | 14 ++++++++------ migration/rdma.c | 7 ++++--- migration/savevm.c | 4 ++-- migration/vmstate.c | 10 +++++----- 8 files changed, 25 insertions(+), 23 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v2 1/8 migration: Do not use C99 // comments
--- migration/block.c | 2 +- migration/rdma.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
migration/block.c +1 -1
@@ -40,7 +40,7 @@#define MAX_IO_BUFFERS 512#define MAX_PARALLEL_IO 16 -//#define DEBUG_BLK_MIGRATION +/* #define DEBUG_BLK_MIGRATION */ #ifdef DEBUG_BLK_MIGRATION #define DPRINTF (fmt, ...) \
migration/rdma.c +1 -1
@@ -1288,7 +1288,7 @@ const char *print_wrid(int wrid)* workload information or LRU information is available, do not attempt to use * this feature except for basic testing. */ -//#define RDMA_UNREGISTRATION_EXAMPLE +/* #define RDMA_UNREGISTRATION_EXAMPLE */ /* * Perform a non-optimized memory unregistration after every transfer
Signature · 1 line
1.8.3.1
Re: [PATCH v2 1/8] migration: Do not use C99 // comments
Quoted 2 lines · * Bihong Yu ([email protected]) wrote:
Signed-off-by Bihong Yu <[email protected]>Reviewed-by Chuan Zheng <[email protected]>
another task at some point would be to rewrite the DPRINTF's in migration/block.c to use trace_ instead.
Quoted 34 lines
--- migration/block.c | 2 +- migration/rdma.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)migration/block.c +1
-1@@ -40,7 +40,7 @@#define MAX_IO_BUFFERS 512#define MAX_PARALLEL_IO 16 -//#define DEBUG_BLK_MIGRATION +/* #define DEBUG_BLK_MIGRATION */ #ifdef DEBUG_BLK_MIGRATION #define DPRINTF (fmt, ...) \migration/rdma.c +1
-1@@ -1288,7 +1288,7 @@ const char *print_wrid(int wrid)* workload information or LRU information is available, do not attempt to use * this feature except for basic testing. */ -//#define RDMA_UNREGISTRATION_EXAMPLE +/* #define RDMA_UNREGISTRATION_EXAMPLE */ /* * Perform a non-optimized memory unregistration after every transfer Signature · 1 line
1.8.3.1
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Re: [PATCH v2 1/8] migration: Do not use C99 // comments
Thank you for your review. OK, I will try to rewrite the DPRINTF to use trace_ instead.
Quoted 43 lines · Dr. David Alan Gilbert
Quoted 2 lines · * Bihong Yu ([email protected]) wrote:
Signed-off-by Bihong Yu <[email protected]>Reviewed-by Chuan Zheng <[email protected]>Reviewed-by Dr. David Alan Gilbert <[email protected]>another task at some point would be to rewrite the DPRINTF's in
migration/block.cto usetrace_instead.Quoted 34 lines
--- migration/block.c | 2 +- migration/rdma.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)migration/block.c +1
-1@@ -40,7 +40,7 @@#define MAX_IO_BUFFERS 512#define MAX_PARALLEL_IO 16 -//#define DEBUG_BLK_MIGRATION +/* #define DEBUG_BLK_MIGRATION */ #ifdef DEBUG_BLK_MIGRATION #define DPRINTF (fmt, ...) \migration/rdma.c +1
-1@@ -1288,7 +1288,7 @@ const char *print_wrid(int wrid)* workload information or LRU information is available, do not attempt to use * this feature except for basic testing. */ -//#define RDMA_UNREGISTRATION_EXAMPLE +/* #define RDMA_UNREGISTRATION_EXAMPLE */ /* * Perform a non-optimized memory unregistration after every transfer Signature · 1 line
1.8.3.1
Re: [PATCH v2 1/8] migration: Do not use C99 // comments
Also DEBUG_CACHE in migration/page_cache.c is need to rebase on trace_calls.
Quoted 48 lines · Bihong Yu
Thank you for your review. OK, I will try to rewrite the DPRINTF to use
trace_instead.Quoted 38 lines · Dr. David Alan Gilbert
Quoted 2 lines · * Bihong Yu ([email protected]) wrote:
Signed-off-by Bihong Yu <[email protected]>Reviewed-by Chuan Zheng <[email protected]>Reviewed-by Dr. David Alan Gilbert <[email protected]>another task at some point would be to rewrite the DPRINTF's in
migration/block.cto usetrace_instead.Quoted 29 lines
--- migration/block.c | 2 +- migration/rdma.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)migration/block.c +1
-1@@ -40,7 +40,7 @@#define MAX_IO_BUFFERS 512#define MAX_PARALLEL_IO 16 -//#define DEBUG_BLK_MIGRATION +/* #define DEBUG_BLK_MIGRATION */ #ifdef DEBUG_BLK_MIGRATION #define DPRINTF (fmt, ...) \migration/rdma.c +1
-1@@ -1288,7 +1288,7 @@ const char *print_wrid(int wrid)* workload information or LRU information is available, do not attempt to use * this feature except for basic testing. */ -//#define RDMA_UNREGISTRATION_EXAMPLE +/* #define RDMA_UNREGISTRATION_EXAMPLE */ Quoted 5 lines
Quoted 5 lines
migration/rdma.c +0
-0/* * Perform a non-optimized memory unregistration after every transfer Signature · 1 line
1.8.3.1.
Signature · 1 line
Thanks, Chuan
Re: [PATCH v2 1/8] migration: Do not use C99 // comments
OK, I will modify it later.
Quoted 52 lines · Zheng Chuan
Also
DEBUG_CACHEinmigration/page_cache.cis need to rebase ontrace_calls.Quoted 48 lines · Bihong Yu
Thank you for your review. OK, I will try to rewrite the DPRINTF to use
trace_instead.Quoted 38 lines · Dr. David Alan Gilbert
Quoted 2 lines · * Bihong Yu ([email protected]) wrote:
Signed-off-by Bihong Yu <[email protected]>Reviewed-by Chuan Zheng <[email protected]>Reviewed-by Dr. David Alan Gilbert <[email protected]>another task at some point would be to rewrite the DPRINTF's in
migration/block.cto usetrace_instead.Quoted 29 lines
--- migration/block.c | 2 +- migration/rdma.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)migration/block.c +1
-1@@ -40,7 +40,7 @@#define MAX_IO_BUFFERS 512#define MAX_PARALLEL_IO 16 -//#define DEBUG_BLK_MIGRATION +/* #define DEBUG_BLK_MIGRATION */ #ifdef DEBUG_BLK_MIGRATION #define DPRINTF (fmt, ...) \migration/rdma.c +1
-1@@ -1288,7 +1288,7 @@ const char *print_wrid(int wrid)* workload information or LRU information is available, do not attempt to use * this feature except for basic testing. */ -//#define RDMA_UNREGISTRATION_EXAMPLE +/* #define RDMA_UNREGISTRATION_EXAMPLE */ Quoted 5 lines
Quoted 5 lines
migration/rdma.c +0
-0/* * Perform a non-optimized memory unregistration after every transfer Signature · 1 line
1.8.3.1.
PATCH v2 2/8 migration: Don't use '#' flag of printf format
In reply to Bihong Yu--- migration/block.c | 2 +- migration/ram.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
migration/block.c +1 -1
@@ -998,7 +998,7 @@ static int block_load(QEMUFile *f, void *opaque, int version_id) (addr == 100) ? '\n' : '\r');fflush (stdout); }else if (!(flags &BLK_MIG_FLAG_EOS )) { -fprintf (stderr,"Unknown block migration flags: %#x\n" , flags); +fprintf (stderr,"Unknown block migration flags: 0x%x\n" , flags);return -EINVAL ; } ret =qemu_file_get_error (f);
migration/ram.c +2 -2
@@ -3298,7 +3298,7 @@ static int ram_load_postcopy(QEMUFile *f)multifd_recv_sync_main ();break ;default : -error_report ("Unknown combination of migration flags: %#x" +error_report ("Unknown combination of migration flags: 0x%x" " (postcopy mode)" , flags); ret = -EINVAL ;break ;
@@ -3576,7 +3576,7 @@ static int ram_load_precopy(QEMUFile *f)if (flags &RAM_SAVE_FLAG_HOOK ) {ram_control_load_hook (f,RAM_CONTROL_HOOK ,NULL ); }else { -error_report ("Unknown combination of migration flags: %#x" , +error_report ("Unknown combination of migration flags: 0x%x" , flags); ret = -EINVAL ; }
Signature · 1 line
1.8.3.1
Re: [PATCH v2 2/8] migration: Don't use '#' flag of printf format
Quoted 2 lines · * Bihong Yu ([email protected]) wrote:
Signed-off-by Bihong Yu <[email protected]>Reviewed-by Chuan Zheng <[email protected]>
Quoted 43 lines
--- migration/block.c | 2 +- migration/ram.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)migration/block.c +1
-1@@ -998,7 +998,7 @@ static int block_load(QEMUFile *f, void *opaque, int version_id) (addr == 100) ? '\n' : '\r');fflush (stdout); }else if (!(flags &BLK_MIG_FLAG_EOS )) { -fprintf (stderr,"Unknown block migration flags: %#x\n" , flags); +fprintf (stderr,"Unknown block migration flags: 0x%x\n" , flags);return -EINVAL ; } ret =qemu_file_get_error (f);migration/ram.c +2
-2@@ -3298,7 +3298,7 @@ static int ram_load_postcopy(QEMUFile *f)multifd_recv_sync_main ();break ;default : -error_report ("Unknown combination of migration flags: %#x" +error_report ("Unknown combination of migration flags: 0x%x" " (postcopy mode)" , flags); ret = -EINVAL ;break ;@@ -3576,7 +3576,7 @@ static int ram_load_precopy(QEMUFile *f)if (flags &RAM_SAVE_FLAG_HOOK ) {ram_control_load_hook (f,RAM_CONTROL_HOOK ,NULL ); }else { -error_report ("Unknown combination of migration flags: %#x" , +error_report ("Unknown combination of migration flags: 0x%x" , flags); ret = -EINVAL ; }Signature · 1 line
1.8.3.1
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Re: [PATCH v2 2/8] migration: Don't use '#' flag of printf format
In reply to Bihong YuQuoted 6 lines · Bihong Yu
Signed-off-by Bihong Yu <[email protected]>Reviewed-by Chuan Zheng <[email protected]>--- migration/block.c | 2 +- migration/ram.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
PATCH v2 3/8 migration: Add spaces around operator
In reply to Bihong Yu--- migration/migration.c | 4 ++-- migration/postcopy-ram.c | 2 +- migration/ram.c | 2 +- migration/savevm.c | 2 +- migration/vmstate.c | 10 +++++----- 5 files changed, 10 insertions(+), 10 deletions(-)
migration/migration.c +2 -2
@@ -2478,8 +2478,8 @@ static void migrate_handle_rp_req_pages(MigrationState *ms, const char* rbname,* Since we currently insist on matching page sizes, just sanity check * we're being asked for whole host pages. */ -if (start & (our_host_ps-1 ) || - (len & (our_host_ps-1 ))) { +if (start & (our_host_ps -1 ) || + (len & (our_host_ps -1 ))) {error_report ("%s: Misaligned page request, start: " RAM_ADDR_FMT " len: %zd" , __func__, start, len);mark_source_rp_bad (ms);
migration/postcopy-ram.c +1 -1
@@ -403,7 +403,7 @@ bool postcopy_ram_supported_by_host(MigrationIncomingState *mis) strerror(errno)); goto out; } -g_assert (((size_t )testarea & (pagesize-1 )) ==0 ); +g_assert (((size_t )testarea & (pagesize -1 )) ==0 ); reg_struct.range.start = (uintptr_t )testarea; reg_struct.range.len = pagesize;
migration/ram.c +1 -1
@@ -1563,7 +1563,7 @@ int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len) rs->last_req_rb = ramblock; }trace_ram_save_queue_pages (ramblock->idstr, start, len); -if (start+len > ramblock->used_length) { +if (start + len > ramblock->used_length) {error_report ("%s request overrun start=" RAM_ADDR_FMT " len=" RAM_ADDR_FMT " blocklen=" RAM_ADDR_FMT , __func__, start, len, ramblock->used_length);
migration/savevm.c +1 -1
@@ -521,7 +521,7 @@ static const VMStateDescription vmstate_configuration = { VMSTATE_VBUFFER_ALLOC_UINT32(name, SaveState, 0, NULL, len),VMSTATE_END_OF_LIST () }, - .subsections = (const VMStateDescription *[]) { + .subsections = (const VMStateDescription * []) { &vmstate_target_page_bits, &vmstate_capabilites, &vmstate_uuid,
migration/vmstate.c +5 -5
@@ -32,13 +32,13 @@ static int vmstate_n_elems(void *opaque, const VMStateField *field)if (field->flags &VMS_ARRAY ) { n_elems = field->num; }else if (field->flags &VMS_VARRAY_INT32 ) { - n_elems = *(int32_t *)(opaque+field->num_offset); + n_elems = *(int32_t *)(opaque + field->num_offset); }else if (field->flags &VMS_VARRAY_UINT32 ) { - n_elems = *(uint32_t *)(opaque+field->num_offset); + n_elems = *(uint32_t *)(opaque + field->num_offset); }else if (field->flags &VMS_VARRAY_UINT16 ) { - n_elems = *(uint16_t *)(opaque+field->num_offset); + n_elems = *(uint16_t *)(opaque + field->num_offset); }else if (field->flags &VMS_VARRAY_UINT8 ) { - n_elems = *(uint8_t *)(opaque+field->num_offset); + n_elems = *(uint8_t *)(opaque + field->num_offset); }if (field->flags &VMS_MULTIPLY_ELEMENTS ) {
@@ -54,7 +54,7 @@ static int vmstate_size(void *opaque, const VMStateField *field)int size = field->size;if (field->flags &VMS_VBUFFER ) { - size = *(int32_t *)(opaque+field->size_offset); + size = *(int32_t *)(opaque + field->size_offset);if (field->flags &VMS_MULTIPLY ) { size *= field->size; }
Signature · 1 line
1.8.3.1
Re: [PATCH v2 3/8] migration: Add spaces around operator
Quoted 2 lines · * Bihong Yu ([email protected]) wrote:
Signed-off-by Bihong Yu <[email protected]>Reviewed-by Chuan Zheng <[email protected]>
Yes that's OK, I'm a bit sturprised we need the space afte rthe * in the VMStateDescription case, I wouldn't necessarily go and change them all.
Quoted 96 lines
--- migration/migration.c | 4 ++-- migration/postcopy-ram.c | 2 +- migration/ram.c | 2 +- migration/savevm.c | 2 +- migration/vmstate.c | 10 +++++----- 5 files changed, 10 insertions(+), 10 deletions(-)migration/migration.c +2
-2@@ -2478,8 +2478,8 @@ static void migrate_handle_rp_req_pages(MigrationState *ms, const char* rbname,* Since we currently insist on matching page sizes, just sanity check * we're being asked for whole host pages. */ -if (start & (our_host_ps-1 ) || - (len & (our_host_ps-1 ))) { +if (start & (our_host_ps -1 ) || + (len & (our_host_ps -1 ))) {error_report ("%s: Misaligned page request, start: " RAM_ADDR_FMT " len: %zd" , __func__, start, len);mark_source_rp_bad (ms);migration/postcopy-ram.c +1
-1@@ -403,7 +403,7 @@ bool postcopy_ram_supported_by_host(MigrationIncomingState *mis) strerror(errno)); goto out; } -g_assert (((size_t )testarea & (pagesize-1 )) ==0 ); +g_assert (((size_t )testarea & (pagesize -1 )) ==0 ); reg_struct.range.start = (uintptr_t )testarea; reg_struct.range.len = pagesize;migration/ram.c +1
-1@@ -1563,7 +1563,7 @@ int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len) rs->last_req_rb = ramblock; }trace_ram_save_queue_pages (ramblock->idstr, start, len); -if (start+len > ramblock->used_length) { +if (start + len > ramblock->used_length) {error_report ("%s request overrun start=" RAM_ADDR_FMT " len=" RAM_ADDR_FMT " blocklen=" RAM_ADDR_FMT , __func__, start, len, ramblock->used_length);migration/savevm.c +1
-1@@ -521,7 +521,7 @@ static const VMStateDescription vmstate_configuration = { VMSTATE_VBUFFER_ALLOC_UINT32(name, SaveState, 0, NULL, len),VMSTATE_END_OF_LIST () }, - .subsections = (const VMStateDescription *[]) { + .subsections = (const VMStateDescription * []) { &vmstate_target_page_bits, &vmstate_capabilites, &vmstate_uuid,migration/vmstate.c +5
-5@@ -32,13 +32,13 @@ static int vmstate_n_elems(void *opaque, const VMStateField *field)if (field->flags &VMS_ARRAY ) { n_elems = field->num; }else if (field->flags &VMS_VARRAY_INT32 ) { - n_elems = *(int32_t *)(opaque+field->num_offset); + n_elems = *(int32_t *)(opaque + field->num_offset); }else if (field->flags &VMS_VARRAY_UINT32 ) { - n_elems = *(uint32_t *)(opaque+field->num_offset); + n_elems = *(uint32_t *)(opaque + field->num_offset); }else if (field->flags &VMS_VARRAY_UINT16 ) { - n_elems = *(uint16_t *)(opaque+field->num_offset); + n_elems = *(uint16_t *)(opaque + field->num_offset); }else if (field->flags &VMS_VARRAY_UINT8 ) { - n_elems = *(uint8_t *)(opaque+field->num_offset); + n_elems = *(uint8_t *)(opaque + field->num_offset); }if (field->flags &VMS_MULTIPLY_ELEMENTS ) {@@ -54,7 +54,7 @@ static int vmstate_size(void *opaque, const VMStateField *field)int size = field->size;if (field->flags &VMS_VBUFFER ) { - size = *(int32_t *)(opaque+field->size_offset); + size = *(int32_t *)(opaque + field->size_offset);if (field->flags &VMS_MULTIPLY ) { size *= field->size; }Signature · 1 line
1.8.3.1
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Re: [PATCH v2 3/8] migration: Add spaces around operator
Quoted 6 lines · Dr. David Alan Gilbert
Quoted 2 lines · * Bihong Yu ([email protected]) wrote:
Signed-off-by Bihong Yu <[email protected]>Reviewed-by Chuan Zheng <[email protected]>Yes that's OK, I'm a bit sturprised we need the space afte rthe * in the VMStateDescription case, I wouldn't necessarily go and change them all.
We don't: it's not the binary multiplication operator *, where we want a space on both sides, it's a pointer declarator, where we want a space on the left only.
Example:
int *pa, *pb, *pc;
*pa = *pb * *pc;Note the space on both side of binary operator * (multiplication), but only on the left side of the pointer declarator's * and the unary operator * (indirection).
Quoted 1 line
Reviewed-by Dr. David Alan Gilbert <[email protected]>
[...]
Quoted 5 lines
Quoted 5 lines
migration/savevm.c +0
-0@@ -521,7 +521,7 @@ static const VMStateDescription vmstate_configuration = {
Quoted 8 lines
migration/savevm.c static const VMStateDescription vmstate_configuration = { · line 527
Quoted 8 lines
migration/savevm.c +1
-1VMSTATE_VBUFFER_ALLOC_UINT32(name, SaveState, 0, NULL, len),VMSTATE_END_OF_LIST () }, - .subsections = (const VMStateDescription *[]) { + .subsections = (const VMStateDescription * []) { &vmstate_target_page_bits, &vmstate_capabilites, &vmstate_uuid,
Should be
.subsections = (const VMStateDescription *[]) {[...]
Re: [PATCH v2 3/8] migration: Add spaces around operator
Yes, I used to think "const VMStateDescription *[]" was right, but when I search similar expressions, most of all are "xxx * []". Such as:fsdev/qemu-fsdev.c:54: .opts = (const char * [])hw/intc/s390_flic_kvm.c:567: .subsections = (const VMStateDescription * [])
...
So, I keep the same style. Should I change it to "const VMStateDescription *[]"?
Quoted 46 lines · Markus Armbruster
Quoted 6 lines · Dr. David Alan Gilbert
Quoted 2 lines · * Bihong Yu ([email protected]) wrote:
Signed-off-by Bihong Yu <[email protected]>Reviewed-by Chuan Zheng <[email protected]>Yes that's OK, I'm a bit sturprised we need the space afte rthe * in the VMStateDescription case, I wouldn't necessarily go and change them all.
We don't: it's not the binary multiplication operator *, where we want a space on both sides, it's a pointer declarator, where we want a space on the left only.
Example:
int *pa, *pb, *pc; *pa = *pb * *pc;Note the space on both side of binary operator * (multiplication), but only on the left side of the pointer declarator's * and the unary operator * (indirection).
Quoted 1 line
Reviewed-by Dr. David Alan Gilbert <[email protected]>[...]
Quoted 5 lines
Quoted 5 lines
migration/savevm.c +0
-0@@ -521,7 +521,7 @@ static const VMStateDescription vmstate_configuration = {Quoted 8 lines
migration/savevm.c static const VMStateDescription vmstate_configuration = { · line 527
Quoted 8 lines
migration/savevm.c +1
-1VMSTATE_VBUFFER_ALLOC_UINT32(name, SaveState, 0, NULL, len),VMSTATE_END_OF_LIST () }, - .subsections = (const VMStateDescription *[]) { + .subsections = (const VMStateDescription * []) { &vmstate_target_page_bits, &vmstate_capabilites, &vmstate_uuid,Should be
.subsections = (const VMStateDescription *[]) {[...]
.
Re: [PATCH v2 3/8] migration: Add spaces around operator
Quoted 5 lines · Bihong Yu
Yes, I used to think "const VMStateDescription *[]" was right, but when I search similar expressions, most of all are "xxx * []". Such as:
fsdev/qemu-fsdev.c:54: .opts = (const char * [])hw/intc/s390_flic_kvm.c:567: .subsections = (const VMStateDescription * [])
...
All three variations occur in the code: no space, space on both sides, space only on the left.
Quoted 1 line
So, I keep the same style. Should I change it to "const VMStateDescription *[]"?
Dropping the change to savevm.c should be fine.
Changing it to "VMStateDescription *[]" should be also fine.
I figure you can keep David's R-by in both cases.
[...]
Re: [PATCH v2 3/8] migration: Add spaces around operator
OK, I will change it to "VMStateDescription *[]". Thank you for your review.
Quoted 23 lines · Markus Armbruster
Quoted 5 lines · Bihong Yu
Yes, I used to think "const VMStateDescription *[]" was right, but when I search similar expressions, most of all are "xxx * []". Such as:
fsdev/qemu-fsdev.c:54: .opts = (const char * [])hw/intc/s390_flic_kvm.c:567: .subsections = (const VMStateDescription * [])
...All three variations occur in the code: no space, space on both sides, space only on the left.
Quoted 1 line
So, I keep the same style. Should I change it to "const VMStateDescription *[]"?
Dropping the change to
savevm.cshould be fine.Changing it to "VMStateDescription *[]" should be also fine.
I figure you can keep David's R-by in both cases.
[...]
.
PATCH v2 4/8 migration: Open brace '{' following struct go on the same line
In reply to Bihong Yu--- migration/migration.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
migration/migration.h +1 -2
@@ -124,8 +124,7 @@ struct MigrationClass {DeviceClass parent_class; }; -struct MigrationState -{ +struct MigrationState {/*< private >*/ DeviceState parent_obj;
Signature · 1 line
1.8.3.1
Re: [PATCH v2 4/8] migration: Open brace '{' following struct go on the same line
Quoted 2 lines · * Bihong Yu ([email protected]) wrote:
Signed-off-by Bihong Yu <[email protected]>Reviewed-by Chuan Zheng <[email protected]>
Yes, I think that line probably predates the coding standard :-)
Quoted 21 lines
--- migration/migration.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)migration/migration.h +1
-2@@ -124,8 +124,7 @@ struct MigrationClass {DeviceClass parent_class; }; -struct MigrationState -{ +struct MigrationState {/*< private >*/ DeviceState parent_obj;Signature · 1 line
1.8.3.1
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
PATCH v2 5/8 migration: Add braces {} for if statement
In reply to Bihong Yu--- migration/ram.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
migration/ram.c +4 -2
@@ -101,14 +101,16 @@ static struct {static void XBZRLE_cache_lock (void ) { -if (migrate_use_xbzrle ()) +if (migrate_use_xbzrle ()) {qemu_mutex_lock (&XBZRLE .lock); + } }static void XBZRLE_cache_unlock (void ) { -if (migrate_use_xbzrle ()) +if (migrate_use_xbzrle ()) {qemu_mutex_unlock (&XBZRLE .lock); + } }/**
Signature · 1 line
1.8.3.1
Re: [PATCH v2 5/8] migration: Add braces {} for if statement
Quoted 2 lines · * Bihong Yu ([email protected]) wrote:
Signed-off-by Bihong Yu <[email protected]>Reviewed-by Chuan Zheng <[email protected]>
Quoted 30 lines
--- migration/ram.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)migration/ram.c +4
-2@@ -101,14 +101,16 @@ static struct {static void XBZRLE_cache_lock (void ) { -if (migrate_use_xbzrle ()) +if (migrate_use_xbzrle ()) {qemu_mutex_lock (&XBZRLE .lock); + } }static void XBZRLE_cache_unlock (void ) { -if (migrate_use_xbzrle ()) +if (migrate_use_xbzrle ()) {qemu_mutex_unlock (&XBZRLE .lock); + } }/** Signature · 1 line
1.8.3.1
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Re: [PATCH v2 5/8] migration: Add braces {} for if statement
In reply to Bihong YuQuoted 5 lines · Bihong Yu
Signed-off-by Bihong Yu <[email protected]>Reviewed-by Chuan Zheng <[email protected]>--- migration/ram.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
PATCH v2 6/8 migration: Do not initialise statics and globals to 0 or NULL
In reply to Bihong Yu--- migration/ram.c | 2 +- migration/savevm.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
migration/ram.c +1 -1
@@ -2743,7 +2743,7 @@ static int load_xbzrle(QEMUFile *f, ram_addr_t addr, void *host)*/ static inline RAMBlock *ram_block_from_stream (QEMUFile *f,int flags) { -static RAMBlock *block =NULL ; +static RAMBlock *block;char id[256 ];uint8_t len;
migration/savevm.c +1 -1
@@ -64,7 +64,7 @@#include "qemu/bitmap.h" #include "net/announce.h" -const unsigned int postcopy_ram_discard_version =0 ; +const unsigned int postcopy_ram_discard_version;/* Subcommands for QEMU_VM_COMMAND */ enum qemu_vm_cmd {
Signature · 1 line
1.8.3.1
Re: [PATCH v2 6/8] migration: Do not initialise statics and globals to 0 or NULL
Quoted 2 lines · * Bihong Yu ([email protected]) wrote:
Signed-off-by Bihong Yu <[email protected]>Reviewed-by Chuan Zheng <[email protected]>
OK, sometimes I find initialisation clearer
Quoted 34 lines
--- migration/ram.c | 2 +- migration/savevm.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)migration/ram.c +1
-1@@ -2743,7 +2743,7 @@ static int load_xbzrle(QEMUFile *f, ram_addr_t addr, void *host)*/ static inline RAMBlock *ram_block_from_stream (QEMUFile *f,int flags) { -static RAMBlock *block =NULL ; +static RAMBlock *block;char id[256 ];uint8_t len;migration/savevm.c +1
-1@@ -64,7 +64,7 @@#include "qemu/bitmap.h" #include "net/announce.h" -const unsigned int postcopy_ram_discard_version =0 ; +const unsigned int postcopy_ram_discard_version;/* Subcommands for QEMU_VM_COMMAND */ enum qemu_vm_cmd {Signature · 1 line
1.8.3.1
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Re: [PATCH v2 6/8] migration: Do not initialise statics and globals to 0 or NULL
Quoted 14 lines · Dr. David Alan Gilbert
Quoted 2 lines · * Bihong Yu ([email protected]) wrote:
Signed-off-by Bihong Yu <[email protected]>Reviewed-by Chuan Zheng <[email protected]>OK, sometimes I find initialisation clearer
Reviewed-by Dr. David Alan Gilbert <[email protected]>Quoted 5 lines
--- migration/ram.c | 2 +- migration/savevm.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Quoted 10 lines
migration/ram.c static int load_xbzrle(QEMUFile *f, ram_addr_t addr, void *host) · line 2746
Quoted 10 lines
migration/ram.c +1
-1@@ -2743,7 +2743,7 @@ static int load_xbzrle(QEMUFile *f, ram_addr_t addr, void *host)*/ static inline RAMBlock *ram_block_from_stream (QEMUFile *f,int flags) { -static RAMBlock *block =NULL ; +static RAMBlock *block;
OK.
Quoted 11 lines
Quoted 11 lines
migration/ram.c +0
-0char id[256 ];uint8_t len;migration/savevm.c +0
-0@@ -64,7 +64,7 @@#include "qemu/bitmap.h" #include "net/announce.h"
Quoted 2 lines
migration/savevm.c line 67
Quoted 2 lines
migration/savevm.c +1
-1-const unsigned int postcopy_ram_discard_version =0 ; +const unsigned int postcopy_ram_discard_version;
I agree with Dave, this one is clearer initialized.
Quoted 6 lines
Quoted 6 lines
migration/savevm.c +0
-0/* Subcommands for QEMU_VM_COMMAND */ enum qemu_vm_cmd {Signature · 1 line
1.8.3.1
PATCH v2 7/8 migration: Open brace '{' following function declarations go on the next line
In reply to Bihong Yu--- migration/rdma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
migration/rdma.c +2 -1
@@ -273,7 +273,8 @@ static uint64_t htonll(uint64_t v)return u.llv; } -static uint64_t ntohll (uint64_t v) { +static uint64_t ntohll (uint64_t v) +{union {uint32_t lv[2 ];uint64_t llv; } u; u.llv = v;return ((uint64_t )ntohl (u.lv[0 ]) <<32 ) | (uint64_t )ntohl (u.lv[1 ]);
Signature · 1 line
1.8.3.1
Re: [PATCH v2 7/8] migration: Open brace '{' following function declarations go on the next line
Quoted 2 lines · * Bihong Yu ([email protected]) wrote:
Signed-off-by Bihong Yu <[email protected]>Reviewed-by Chuan Zheng <[email protected]>
Quoted 21 lines
--- migration/rdma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)migration/rdma.c +2
-1@@ -273,7 +273,8 @@ static uint64_t htonll(uint64_t v)return u.llv; } -static uint64_t ntohll (uint64_t v) { +static uint64_t ntohll (uint64_t v) +{union {uint32_t lv[2 ];uint64_t llv; } u; u.llv = v;return ((uint64_t )ntohl (u.lv[0 ]) <<32 ) | (uint64_t )ntohl (u.lv[1 ]);Signature · 1 line
1.8.3.1
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
PATCH v2 8/8 migration: Delete redundant spaces
In reply to Bihong Yu--- migration/rdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
migration/rdma.c +1 -1
@@ -855,7 +855,7 @@ static int qemu_rdma_broken_ipv6_kernel(struct ibv_context *verbs, Error **errp)*/ if (!verbs) {int num_devices, x; -struct ibv_device ** dev_list =ibv_get_device_list (&num_devices); +struct ibv_device **dev_list =ibv_get_device_list (&num_devices);bool roce_found = false;bool ib_found = false;
Signature · 1 line
1.8.3.1
Re: [PATCH v2 8/8] migration: Delete redundant spaces
Quoted 2 lines · * Bihong Yu ([email protected]) wrote:
Signed-off-by Bihong Yu <[email protected]>Reviewed-by Chuan Zheng <[email protected]>
Quoted 20 lines
--- migration/rdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)migration/rdma.c +1
-1@@ -855,7 +855,7 @@ static int qemu_rdma_broken_ipv6_kernel(struct ibv_context *verbs, Error **errp)*/ if (!verbs) {int num_devices, x; -struct ibv_device ** dev_list =ibv_get_device_list (&num_devices); +struct ibv_device **dev_list =ibv_get_device_list (&num_devices);bool roce_found = false;bool ib_found = false;Signature · 1 line
1.8.3.1
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Re: [PATCH v2 8/8] migration: Delete redundant spaces
In reply to Bihong YuQuoted 5 lines · Bihong Yu
Signed-off-by Bihong Yu <[email protected]>Reviewed-by Chuan Zheng <[email protected]>--- migration/rdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)