diff options
author | Laszlo Ersek <lersek@redhat.com> | 2014-05-20 13:39:43 +0200 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2014-06-11 10:10:28 -0400 |
commit | 22227f121bddb038a0335cf83a3c24f451e2e836 (patch) | |
tree | f4e17b92e8ac0b629e89c4bba3cd42bf88c22a04 /dump.c | |
parent | 92ba1401e0f81ea170803045c1ae366bf5d9d87e (diff) |
dump: eliminate DumpState.page_shift ("guest's page shift")
Just use TARGET_PAGE_BITS.
"DumpState.page_shift" used to have type "uint32_t", while the replacement
TARGET_PAGE_BITS has type "int". Since "DumpState.page_shift" was only
used as bit shift counts in the paddr_to_pfn() and pfn_to_paddr() macros,
this is safe.
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'dump.c')
-rw-r--r-- | dump.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -91,7 +91,6 @@ typedef struct DumpState { size_t note_buf_offset; /* the writing place in note_buf */ uint32_t nr_cpus; /* number of guest's cpu */ size_t page_size; /* guest's page size */ - uint32_t page_shift; /* guest's page shift */ uint64_t max_mapnr; /* the biggest guest's phys-mem's number */ size_t len_dump_bitmap; /* the size of the place used to store dump_bitmap in vmcore */ @@ -1086,7 +1085,7 @@ static bool get_next_page(GuestPhysBlock **blockptr, uint64_t *pfnptr, *blockptr = block; assert(block->target_start % s->page_size == 0); assert(block->target_end % s->page_size == 0); - *pfnptr = paddr_to_pfn(block->target_start, s->page_shift); + *pfnptr = paddr_to_pfn(block->target_start); if (bufptr) { *bufptr = block->host_addr; } @@ -1094,7 +1093,7 @@ static bool get_next_page(GuestPhysBlock **blockptr, uint64_t *pfnptr, } *pfnptr = *pfnptr + 1; - addr = pfn_to_paddr(*pfnptr, s->page_shift); + addr = pfn_to_paddr(*pfnptr); if ((addr >= block->target_start) && (addr + s->page_size <= block->target_end)) { @@ -1108,7 +1107,7 @@ static bool get_next_page(GuestPhysBlock **blockptr, uint64_t *pfnptr, } assert(block->target_start % s->page_size == 0); assert(block->target_end % s->page_size == 0); - *pfnptr = paddr_to_pfn(block->target_start, s->page_shift); + *pfnptr = paddr_to_pfn(block->target_start); buf = block->host_addr; } @@ -1534,7 +1533,7 @@ static void get_max_mapnr(DumpState *s) GuestPhysBlock *last_block; last_block = QTAILQ_LAST(&s->guest_phys_blocks.head, GuestPhysBlockHead); - s->max_mapnr = paddr_to_pfn(last_block->target_end, s->page_shift); + s->max_mapnr = paddr_to_pfn(last_block->target_end); } static int dump_init(DumpState *s, int fd, bool has_format, @@ -1612,7 +1611,6 @@ static int dump_init(DumpState *s, int fd, bool has_format, s->nr_cpus = nr_cpus; s->page_size = TARGET_PAGE_SIZE; - s->page_shift = ffs(s->page_size) - 1; get_max_mapnr(s); |