From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: stefano.stabellini@eu.citrix.com
Subject: [Qemu-devel] [RFH PATCH 1/2] xen: do not use __-named variables in mapcache
Date: Wed, 14 Jan 2015 11:20:55 +0100 [thread overview]
Message-ID: <1421230856-22736-2-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1421230856-22736-1-git-send-email-pbonzini@redhat.com>
Keep the namespace clean.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
xen-mapcache.c | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/xen-mapcache.c b/xen-mapcache.c
index 66da1a6..458069b 100644
--- a/xen-mapcache.c
+++ b/xen-mapcache.c
@@ -199,8 +199,8 @@ uint8_t *xen_map_cache(hwaddr phys_addr, hwaddr size,
MapCacheEntry *entry, *pentry = NULL;
hwaddr address_index;
hwaddr address_offset;
- hwaddr __size = size;
- hwaddr __test_bit_size = size;
+ hwaddr cache_size = size;
+ hwaddr test_bit_size;
bool translated = false;
tryagain:
@@ -209,22 +209,22 @@ tryagain:
trace_xen_map_cache(phys_addr);
- /* __test_bit_size is always a multiple of XC_PAGE_SIZE */
+ /* test_bit_size is always a multiple of XC_PAGE_SIZE */
if (size) {
- __test_bit_size = size + (phys_addr & (XC_PAGE_SIZE - 1));
+ test_bit_size = size + (phys_addr & (XC_PAGE_SIZE - 1));
- if (__test_bit_size % XC_PAGE_SIZE) {
- __test_bit_size += XC_PAGE_SIZE - (__test_bit_size % XC_PAGE_SIZE);
+ if (test_bit_size % XC_PAGE_SIZE) {
+ test_bit_size += XC_PAGE_SIZE - (test_bit_size % XC_PAGE_SIZE);
}
} else {
- __test_bit_size = XC_PAGE_SIZE;
+ test_bit_size = XC_PAGE_SIZE;
}
if (mapcache->last_entry != NULL &&
mapcache->last_entry->paddr_index == address_index &&
- !lock && !__size &&
+ !lock && !size &&
test_bits(address_offset >> XC_PAGE_SHIFT,
- __test_bit_size >> XC_PAGE_SHIFT,
+ test_bit_size >> XC_PAGE_SHIFT,
mapcache->last_entry->valid_mapping)) {
trace_xen_map_cache_return(mapcache->last_entry->vaddr_base + address_offset);
return mapcache->last_entry->vaddr_base + address_offset;
@@ -232,20 +232,20 @@ tryagain:
/* size is always a multiple of MCACHE_BUCKET_SIZE */
if (size) {
- __size = size + address_offset;
- if (__size % MCACHE_BUCKET_SIZE) {
- __size += MCACHE_BUCKET_SIZE - (__size % MCACHE_BUCKET_SIZE);
+ cache_size = size + address_offset;
+ if (cache_size % MCACHE_BUCKET_SIZE) {
+ cache_size += MCACHE_BUCKET_SIZE - (cache_size % MCACHE_BUCKET_SIZE);
}
} else {
- __size = MCACHE_BUCKET_SIZE;
+ cache_size = MCACHE_BUCKET_SIZE;
}
entry = &mapcache->entry[address_index % mapcache->nr_buckets];
while (entry && entry->lock && entry->vaddr_base &&
- (entry->paddr_index != address_index || entry->size != __size ||
+ (entry->paddr_index != address_index || entry->size != cache_size ||
!test_bits(address_offset >> XC_PAGE_SHIFT,
- __test_bit_size >> XC_PAGE_SHIFT,
+ test_bit_size >> XC_PAGE_SHIFT,
entry->valid_mapping))) {
pentry = entry;
entry = entry->next;
@@ -253,19 +253,19 @@ tryagain:
if (!entry) {
entry = g_malloc0(sizeof (MapCacheEntry));
pentry->next = entry;
- xen_remap_bucket(entry, __size, address_index);
+ xen_remap_bucket(entry, cache_size, address_index);
} else if (!entry->lock) {
if (!entry->vaddr_base || entry->paddr_index != address_index ||
- entry->size != __size ||
+ entry->size != cache_size ||
!test_bits(address_offset >> XC_PAGE_SHIFT,
- __test_bit_size >> XC_PAGE_SHIFT,
+ test_bit_size >> XC_PAGE_SHIFT,
entry->valid_mapping)) {
- xen_remap_bucket(entry, __size, address_index);
+ xen_remap_bucket(entry, cache_size, address_index);
}
}
if(!test_bits(address_offset >> XC_PAGE_SHIFT,
- __test_bit_size >> XC_PAGE_SHIFT,
+ test_bit_size >> XC_PAGE_SHIFT,
entry->valid_mapping)) {
mapcache->last_entry = NULL;
if (!translated && mapcache->phys_offset_to_gaddr) {
--
1.8.3.1
next prev parent reply other threads:[~2015-01-14 10:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-14 10:20 [Qemu-devel] [RFH PATCH 0/2] xen-mapcache: fixes for unlocked memory access Paolo Bonzini
2015-01-14 10:20 ` Paolo Bonzini [this message]
2015-01-14 11:44 ` [Qemu-devel] [RFH PATCH 1/2] xen: do not use __-named variables in mapcache Stefano Stabellini
2015-01-14 10:20 ` [Qemu-devel] [RFH PATCH 2/2] xen: add a lock for the mapcache Paolo Bonzini
2015-01-14 11:52 ` Stefano Stabellini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1421230856-22736-2-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefano.stabellini@eu.citrix.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).