From b7bec5a423cc8bb7792e231e3d81d015d9278d91 Mon Sep 17 00:00:00 2001
From: John Snow <jsnow@redhat.com>
Date: Wed, 27 Mar 2019 17:22:25 +0100
Subject: [PATCH 086/163] qemu-nbd: Rename 'exp' variable clashing with
math::exp() symbol
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: John Snow <jsnow@redhat.com>
Message-id: <20190327172308.31077-13-jsnow@redhat.com>
Patchwork-id: 85184
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 12/55] qemu-nbd: Rename 'exp' variable clashing with math::exp() symbol
Bugzilla: 1691009
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Max Reitz <mreitz@redhat.com>
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
From: Philippe Mathieu-Daudé <philmd@redhat.com>
The use of a variable named 'exp' prevents includes to import <math.h>.
Rename it to avoid:
qemu-nbd.c:64:19: error: ‘exp’ redeclared as different kind of symbol
static NBDExport *exp;
^~~
In file included from /usr/include/features.h:428,
from /usr/include/bits/libc-header-start.h:33,
from /usr/include/stdint.h:26,
from /usr/lib/gcc/x86_64-redhat-linux/8/include/stdint.h:9,
from /source/qemu/include/qemu/osdep.h:80,
from /source/qemu/qemu-nbd.c:19:
/usr/include/bits/mathcalls.h:95:1: note: previous declaration of ‘exp’ was here
__MATHCALL_VEC (exp,, (_Mdouble_ __x));
^~~~~~~~~~~~~~
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190111163519.11457-1-philmd@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit 9d97658020db922b68da05faadcdd61f49fbbdc7)
Signed-off-by: John Snow <jsnow@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
qemu-nbd.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/qemu-nbd.c b/qemu-nbd.c
index 652199c..c37defb 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -61,7 +61,7 @@
#define MBR_SIZE 512
-static NBDExport *exp;
+static NBDExport *export;
static int verbose;
static char *srcpath;
static SocketAddress *saddr;
@@ -335,7 +335,7 @@ static int nbd_can_accept(void)
return state == RUNNING && nb_fds < shared;
}
-static void nbd_export_closed(NBDExport *exp)
+static void nbd_export_closed(NBDExport *export)
{
assert(state == TERMINATING);
state = TERMINATED;
@@ -1017,14 +1017,11 @@ int main(int argc, char **argv)
}
}
- exp = nbd_export_new(bs, dev_offset, fd_size, nbdflags, nbd_export_closed,
- writethrough, NULL, &local_err);
- if (!exp) {
- error_report_err(local_err);
- exit(EXIT_FAILURE);
- }
- nbd_export_set_name(exp, export_name);
- nbd_export_set_description(exp, export_description);
+ export = nbd_export_new(bs, dev_offset, fd_size, nbdflags,
+ nbd_export_closed, writethrough,
+ NULL, &error_fatal);
+ nbd_export_set_name(export, export_name);
+ nbd_export_set_description(export, export_description);
if (device) {
#if HAVE_NBD_DEVICE
@@ -1061,9 +1058,9 @@ int main(int argc, char **argv)
main_loop_wait(false);
if (state == TERMINATE) {
state = TERMINATING;
- nbd_export_close(exp);
- nbd_export_put(exp);
- exp = NULL;
+ nbd_export_close(export);
+ nbd_export_put(export);
+ export = NULL;
}
} while (state != TERMINATED);
--
1.8.3.1