[systemd-devel] [PATCH] make Virtualization an anonymous enum

Thomas H.P. Andersen phomes at gmail.com
Sun Feb 23 13:05:18 PST 2014


From: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>

---
 src/detect-virt/detect-virt.c | 2 +-
 src/hostname/hostnamed.c      | 2 +-
 src/shared/condition-util.c   | 3 +--
 src/shared/virt.c             | 2 +-
 src/shared/virt.h             | 6 +++---
 src/test/test-architecture.c  | 2 +-
 6 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/detect-virt/detect-virt.c b/src/detect-virt/detect-virt.c
index 2f8b0eb..8cf8dcf 100644
--- a/src/detect-virt/detect-virt.c
+++ b/src/detect-virt/detect-virt.c
@@ -129,7 +129,7 @@ int main(int argc, char *argv[]) {
         switch (arg_mode) {
 
         case ANY_VIRTUALIZATION: {
-                Virtualization v;
+                int v;
 
                 v = detect_virtualization(&id);
                 if (v < 0) {
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
index e57891b..0f2455b 100644
--- a/src/hostname/hostnamed.c
+++ b/src/hostname/hostnamed.c
@@ -123,7 +123,7 @@ static const char* fallback_chassis(void) {
         int r;
         char *type;
         unsigned t;
-        Virtualization v;
+        int v;
 
         v = detect_virtualization(NULL);
 
diff --git a/src/shared/condition-util.c b/src/shared/condition-util.c
index 4aea3ca..9961cb4 100644
--- a/src/shared/condition-util.c
+++ b/src/shared/condition-util.c
@@ -121,8 +121,7 @@ bool condition_test_kernel_command_line(Condition *c) {
 }
 
 bool condition_test_virtualization(Condition *c) {
-        int b;
-        Virtualization v;
+        int b, v;
         const char *id;
 
         assert(c);
diff --git a/src/shared/virt.c b/src/shared/virt.c
index c79d35d..ec2ddcf 100644
--- a/src/shared/virt.c
+++ b/src/shared/virt.c
@@ -278,7 +278,7 @@ finish:
 }
 
 /* Returns a short identifier for the various VM/container implementations */
-Virtualization detect_virtualization(const char **id) {
+int detect_virtualization(const char **id) {
         int r;
 
         r = detect_container(id);
diff --git a/src/shared/virt.h b/src/shared/virt.h
index aa6ad35..7194ab2 100644
--- a/src/shared/virt.h
+++ b/src/shared/virt.h
@@ -24,12 +24,12 @@
 int detect_vm(const char **id);
 int detect_container(const char **id);
 
-typedef enum Virtualization {
+enum {
         VIRTUALIZATION_NONE = 0,
         VIRTUALIZATION_VM,
         VIRTUALIZATION_CONTAINER,
         _VIRTUALIZATION_MAX,
         _VIRTUALIZATION_INVALID = -1
-} Virtualization;
+};
 
-Virtualization detect_virtualization(const char **id);
+int detect_virtualization(const char **id);
diff --git a/src/test/test-architecture.c b/src/test/test-architecture.c
index b586c0d..7e171c7 100644
--- a/src/test/test-architecture.c
+++ b/src/test/test-architecture.c
@@ -26,7 +26,7 @@
 
 int main(int argc, char *argv[]) {
         Architecture a;
-        Virtualization v;
+        int v;
         const char *id = NULL;
 
         v = detect_virtualization(&id);
-- 
1.8.5.3



More information about the systemd-devel mailing list