When building with gcc-5 (particularly gcc-5.3.0 now) and having pdwtags
installed (package dwarves) make check fails with the following error:
$ make lock_protocol-struct
GEN lock_protocol-struct
--- lock_protocol-structs 2016-01-13 15:04:59.318809607 +0100
+++ lock_protocol-struct-t3 2016-01-13 15:05:17.703501234 +0100
@@ -26,10 +26,6 @@
virLockSpaceProtocolNonNullString name;
u_int flags;
};
-enum virLockSpaceProtocolAcquireResourceFlags {
- VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_SHARED = 1,
- VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_AUTOCREATE = 2,
-};
struct virLockSpaceProtocolAcquireResourceArgs {
virLockSpaceProtocolNonNullString path;
virLockSpaceProtocolNonNullString name;
Makefile:10415: recipe for target 'lock_protocol-struct' failed
make: *** [lock_protocol-struct] Error 1
That happens because without any specific options gcc doesn't keep enum
information in the resulting binary object. I managed to isolate the
parameters of gcc that caused this issue to disappear, however I
remember that they influenced the resulting binaries quite a bit and
were definitely not something we would want to add as mandatory to the
build process.
So to deal with this cleanly, let's take that enum and separate it out
to its own header file. Since it is only used in the lockd driver and
the protocol, lock_driver_lockd.h feels like a suitable name.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/Makefile.am | 1 +
src/lock_protocol-structs | 4 ----
src/locking/lock_driver_lockd.c | 2 ++
src/locking/lock_driver_lockd.h | 30 ++++++++++++++++++++++++++++++
src/locking/lock_protocol.x | 6 +-----
5 files changed, 34 insertions(+), 9 deletions(-)
create mode 100644 src/locking/lock_driver_lockd.h
diff --git a/src/Makefile.am b/src/Makefile.am
index aa5ab6929b91..0e0db9bac6da 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -249,6 +249,7 @@ MAINTAINERCLEANFILES += $(LOCK_DAEMON_GENERATED)
LOCK_DRIVER_LOCKD_SOURCES = \
locking/lock_driver_lockd.c \
+ locking/lock_driver_lockd.h \
$(NULL)
LOCK_DAEMON_SOURCES = \
diff --git a/src/lock_protocol-structs b/src/lock_protocol-structs
index 8e8b84fb3b50..41be9ce34717 100644
--- a/src/lock_protocol-structs
+++ b/src/lock_protocol-structs
@@ -26,10 +26,6 @@ struct virLockSpaceProtocolDeleteResourceArgs {
virLockSpaceProtocolNonNullString name;
u_int flags;
};
-enum virLockSpaceProtocolAcquireResourceFlags {
- VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_SHARED = 1,
- VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_AUTOCREATE = 2,
-};
struct virLockSpaceProtocolAcquireResourceArgs {
virLockSpaceProtocolNonNullString path;
virLockSpaceProtocolNonNullString name;
diff --git a/src/locking/lock_driver_lockd.c b/src/locking/lock_driver_lockd.c
index 5b89ca142b0b..181261170506 100644
--- a/src/locking/lock_driver_lockd.c
+++ b/src/locking/lock_driver_lockd.c
@@ -34,6 +34,8 @@
#include "configmake.h"
#include "virstring.h"
+#include "lock_driver_lockd.h"
+
#define VIR_FROM_THIS VIR_FROM_LOCKING
VIR_LOG_INIT("locking.lock_driver_lockd");
diff --git a/src/locking/lock_driver_lockd.h b/src/locking/lock_driver_lockd.h
new file mode 100644
index 000000000000..baf346adaf6c
--- /dev/null
+++ b/src/locking/lock_driver_lockd.h
@@ -0,0 +1,30 @@
+/*
+ * lock_driver_lockd.h: Locking for domain lifecycle operations
+ *
+ * Copyright (C) 2010-2011 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <
http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef __VIR_LOCK_DRIVER_LOCKD_H__
+# define __VIR_LOCK_DRIVER_LOCKD_H__
+
+enum virLockSpaceProtocolAcquireResourceFlags {
+ VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_SHARED = 1,
+ VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_AUTOCREATE = 2,
+};
+
+#endif /* __VIR_LOCK_DRIVER_LOCKD_H__ */
diff --git a/src/locking/lock_protocol.x b/src/locking/lock_protocol.x
index a77a78490cb6..6d4cec39e244 100644
--- a/src/locking/lock_protocol.x
+++ b/src/locking/lock_protocol.x
@@ -2,6 +2,7 @@
*/
%#include "internal.h"
+%#include "lock_driver_lockd.h"
typedef opaque virLockSpaceProtocolUUID[VIR_UUID_BUFLEN];
@@ -50,11 +51,6 @@ struct virLockSpaceProtocolDeleteResourceArgs {
unsigned int flags;
};
-enum virLockSpaceProtocolAcquireResourceFlags {
- VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_SHARED = 1,
- VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_AUTOCREATE = 2
-};
-
struct virLockSpaceProtocolAcquireResourceArgs {
virLockSpaceProtocolNonNullString path;
virLockSpaceProtocolNonNullString name;
--
2.7.0