aboutsummaryrefslogtreecommitdiff
path: root/migration/rdma.c
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2020-09-23 11:56:46 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2020-09-23 16:07:44 +0100
commitd73415a315471ac0b127ed3fad45c8ec5d711de1 (patch)
treebae20b3a39968fdfb4340b1a39b533333a8e6fd0 /migration/rdma.c
parented7db34b5aedba4487fd949b2e545eef954f093e (diff)
qemu/atomic.h: rename atomic_ to qatomic_
clang's C11 atomic_fetch_*() functions only take a C11 atomic type pointer argument. QEMU uses direct types (int, etc) and this causes a compiler error when a QEMU code calls these functions in a source file that also included <stdatomic.h> via a system header file: $ CC=clang CXX=clang++ ./configure ... && make ../util/async.c:79:17: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid) Avoid using atomic_*() names in QEMU's atomic.h since that namespace is used by <stdatomic.h>. Prefix QEMU's APIs with 'q' so that atomic.h and <stdatomic.h> can co-exist. I checked /usr/include on my machine and searched GitHub for existing "qatomic_" users but there seem to be none. This patch was generated using: $ git grep -h -o '\<atomic\(64\)\?_[a-z0-9_]\+' include/qemu/atomic.h | \ sort -u >/tmp/changed_identifiers $ for identifier in $(</tmp/changed_identifiers); do sed -i "s%\<$identifier\>%q$identifier%g" \ $(git grep -I -l "\<$identifier\>") done I manually fixed line-wrap issues and misaligned rST tables. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20200923105646.47864-1-stefanha@redhat.com>
Diffstat (limited to 'migration/rdma.c')
-rw-r--r--migration/rdma.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/migration/rdma.c b/migration/rdma.c
index 3bd30d46ad..0340841fad 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -2678,7 +2678,7 @@ static ssize_t qio_channel_rdma_writev(QIOChannel *ioc,
size_t len = 0;
RCU_READ_LOCK_GUARD();
- rdma = atomic_rcu_read(&rioc->rdmaout);
+ rdma = qatomic_rcu_read(&rioc->rdmaout);
if (!rdma) {
return -EIO;
@@ -2760,7 +2760,7 @@ static ssize_t qio_channel_rdma_readv(QIOChannel *ioc,
size_t done = 0;
RCU_READ_LOCK_GUARD();
- rdma = atomic_rcu_read(&rioc->rdmain);
+ rdma = qatomic_rcu_read(&rioc->rdmain);
if (!rdma) {
return -EIO;
@@ -2875,9 +2875,9 @@ qio_channel_rdma_source_prepare(GSource *source,
RCU_READ_LOCK_GUARD();
if (rsource->condition == G_IO_IN) {
- rdma = atomic_rcu_read(&rsource->rioc->rdmain);
+ rdma = qatomic_rcu_read(&rsource->rioc->rdmain);
} else {
- rdma = atomic_rcu_read(&rsource->rioc->rdmaout);
+ rdma = qatomic_rcu_read(&rsource->rioc->rdmaout);
}
if (!rdma) {
@@ -2902,9 +2902,9 @@ qio_channel_rdma_source_check(GSource *source)
RCU_READ_LOCK_GUARD();
if (rsource->condition == G_IO_IN) {
- rdma = atomic_rcu_read(&rsource->rioc->rdmain);
+ rdma = qatomic_rcu_read(&rsource->rioc->rdmain);
} else {
- rdma = atomic_rcu_read(&rsource->rioc->rdmaout);
+ rdma = qatomic_rcu_read(&rsource->rioc->rdmaout);
}
if (!rdma) {
@@ -2932,9 +2932,9 @@ qio_channel_rdma_source_dispatch(GSource *source,
RCU_READ_LOCK_GUARD();
if (rsource->condition == G_IO_IN) {
- rdma = atomic_rcu_read(&rsource->rioc->rdmain);
+ rdma = qatomic_rcu_read(&rsource->rioc->rdmain);
} else {
- rdma = atomic_rcu_read(&rsource->rioc->rdmaout);
+ rdma = qatomic_rcu_read(&rsource->rioc->rdmaout);
}
if (!rdma) {
@@ -3035,12 +3035,12 @@ static int qio_channel_rdma_close(QIOChannel *ioc,
rdmain = rioc->rdmain;
if (rdmain) {
- atomic_rcu_set(&rioc->rdmain, NULL);
+ qatomic_rcu_set(&rioc->rdmain, NULL);
}
rdmaout = rioc->rdmaout;
if (rdmaout) {
- atomic_rcu_set(&rioc->rdmaout, NULL);
+ qatomic_rcu_set(&rioc->rdmaout, NULL);
}
rcu->rdmain = rdmain;
@@ -3060,8 +3060,8 @@ qio_channel_rdma_shutdown(QIOChannel *ioc,
RCU_READ_LOCK_GUARD();
- rdmain = atomic_rcu_read(&rioc->rdmain);
- rdmaout = atomic_rcu_read(&rioc->rdmain);
+ rdmain = qatomic_rcu_read(&rioc->rdmain);
+ rdmaout = qatomic_rcu_read(&rioc->rdmain);
switch (how) {
case QIO_CHANNEL_SHUTDOWN_READ:
@@ -3131,7 +3131,7 @@ static size_t qemu_rdma_save_page(QEMUFile *f, void *opaque,
int ret;
RCU_READ_LOCK_GUARD();
- rdma = atomic_rcu_read(&rioc->rdmaout);
+ rdma = qatomic_rcu_read(&rioc->rdmaout);
if (!rdma) {
return -EIO;
@@ -3451,7 +3451,7 @@ static int qemu_rdma_registration_handle(QEMUFile *f, void *opaque)
int i = 0;
RCU_READ_LOCK_GUARD();
- rdma = atomic_rcu_read(&rioc->rdmain);
+ rdma = qatomic_rcu_read(&rioc->rdmain);
if (!rdma) {
return -EIO;
@@ -3714,7 +3714,7 @@ rdma_block_notification_handle(QIOChannelRDMA *rioc, const char *name)
int found = -1;
RCU_READ_LOCK_GUARD();
- rdma = atomic_rcu_read(&rioc->rdmain);
+ rdma = qatomic_rcu_read(&rioc->rdmain);
if (!rdma) {
return -EIO;
@@ -3762,7 +3762,7 @@ static int qemu_rdma_registration_start(QEMUFile *f, void *opaque,
RDMAContext *rdma;
RCU_READ_LOCK_GUARD();
- rdma = atomic_rcu_read(&rioc->rdmaout);
+ rdma = qatomic_rcu_read(&rioc->rdmaout);
if (!rdma) {
return -EIO;
}
@@ -3793,7 +3793,7 @@ static int qemu_rdma_registration_stop(QEMUFile *f, void *opaque,
int ret = 0;
RCU_READ_LOCK_GUARD();
- rdma = atomic_rcu_read(&rioc->rdmaout);
+ rdma = qatomic_rcu_read(&rioc->rdmaout);
if (!rdma) {
return -EIO;
}