[PATCH 7/7] Drop virAtomic module

Michal Privoznik mprivozn at redhat.com
Sat Feb 1 06:33:49 UTC 2020


Now, that every use of virAtomic was replaced with its g_atomic
equivalent, let's remove the module.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 configure.ac                      |  1 -
 m4/virt-atomic.m4                 | 77 --------------------------
 src/Makefile.am                   |  6 ---
 src/libvirt_atomic.syms           | 11 ----
 src/libxl/libxl_domain.c          |  1 -
 src/libxl/libxl_driver.c          |  1 -
 src/lxc/lxc_process.c             |  1 -
 src/nwfilter/nwfilter_dhcpsnoop.c |  1 -
 src/qemu/qemu_conf.c              |  1 -
 src/qemu/qemu_domain.c            |  1 -
 src/qemu/qemu_process.c           |  1 -
 src/test/test_driver.c            |  1 -
 src/util/Makefile.inc.am          |  2 -
 src/util/viratomic.c              | 35 ------------
 src/util/viratomic.h              | 90 -------------------------------
 src/util/virobject.c              |  1 -
 src/util/virprocess.c             |  1 -
 src/util/virsystemd.c             |  1 -
 18 files changed, 233 deletions(-)
 delete mode 100644 m4/virt-atomic.m4
 delete mode 100644 src/libvirt_atomic.syms
 delete mode 100644 src/util/viratomic.c
 delete mode 100644 src/util/viratomic.h

diff --git a/configure.ac b/configure.ac
index b1f75fa751..5bd9bc841a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -302,7 +302,6 @@ LIBVIRT_ARG_YAJL
 
 LIBVIRT_CHECK_ACL
 LIBVIRT_CHECK_APPARMOR
-LIBVIRT_CHECK_ATOMIC
 LIBVIRT_CHECK_ATTR
 LIBVIRT_CHECK_AUDIT
 LIBVIRT_CHECK_BASH_COMPLETION
diff --git a/m4/virt-atomic.m4 b/m4/virt-atomic.m4
deleted file mode 100644
index d96f7a2bac..0000000000
--- a/m4/virt-atomic.m4
+++ /dev/null
@@ -1,77 +0,0 @@
-dnl The atomic implementation check
-dnl
-dnl Copyright (C) 2016 Red Hat, Inc.
-dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License, or (at your option) any later version.
-dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl Lesser General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library.  If not, see
-dnl <http://www.gnu.org/licenses/>.
-dnl
-
-AC_DEFUN([LIBVIRT_CHECK_ATOMIC], [
-  AC_REQUIRE([LIBVIRT_CHECK_PTHREAD])
-
-  dnl We need to decide at configure time if libvirt will use real atomic
-  dnl operations ("lock free") or emulated ones with a mutex.
-  dnl
-  dnl Note that the atomic ops are only available with GCC on x86 when
-  dnl using -march=i486 or higher.  If we detect that the atomic ops are
-  dnl not available but would be available given the right flags, we want
-  dnl to abort and advise the user to fix their CFLAGS.  It's better to do
-  dnl that then to silently fall back on emulated atomic ops just because
-  dnl the user had the wrong build environment.
-
-  atomic_ops=
-
-  AC_MSG_CHECKING([for atomic ops implementation])
-
-  AC_TRY_COMPILE([], [__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4;],[
-    atomic_ops=gcc
-  ],[])
-
-  if test "$atomic_ops" = "" ; then
-    SAVE_CFLAGS="${CFLAGS}"
-    CFLAGS="-march=i486"
-    AC_TRY_COMPILE([],
-                   [__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4;],
-                   [AC_MSG_ERROR([Libvirt must be built with -march=i486 or later.])],
-                   [])
-    CFLAGS="${SAVE_CFLAGS}"
-
-    case "$host" in
-      *-*-mingw* | *-*-msvc* )
-        atomic_ops=win32
-        ;;
-      *)
-        if test "$ac_cv_header_pthread_h" = "yes" ; then
-          atomic_ops=pthread
-        else
-          AC_MSG_ERROR([Libvirt must be built with GCC or have pthread.h on non-Win32 platforms])
-        fi
-        ;;
-    esac
-  fi
-
-  case "$atomic_ops" in
-    gcc)
-      AC_DEFINE([VIR_ATOMIC_OPS_GCC],[1],[Use GCC atomic ops])
-      ;;
-    win32)
-      AC_DEFINE([VIR_ATOMIC_OPS_WIN32],[1],[Use Win32 atomic ops])
-      ;;
-    pthread)
-      AC_DEFINE([VIR_ATOMIC_OPS_PTHREAD],[1],[Use pthread atomic ops emulation])
-      ;;
-  esac
-  AM_CONDITIONAL([WITH_ATOMIC_OPS_PTHREAD],[test "$atomic_ops" = "pthread"])
-  AC_MSG_RESULT([$atomic_ops])
-])
diff --git a/src/Makefile.am b/src/Makefile.am
index 58355c5337..7bb6127ca4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -390,12 +390,6 @@ else ! WITH_SSH2
 SYM_FILES += $(srcdir)/libvirt_libssh2.syms
 endif ! WITH_SSH2
 
-if WITH_ATOMIC_OPS_PTHREAD
-USED_SYM_FILES += $(srcdir)/libvirt_atomic.syms
-else ! WITH_ATOMIC_OPS_PTHREAD
-SYM_FILES += $(srcdir)/libvirt_atomic.syms
-endif ! WITH_ATOMIC_OPS_PTHREAD
-
 if WITH_LIBSSH
 USED_SYM_FILES += $(srcdir)/libvirt_libssh.syms
 else ! WITH_LIBSSH
diff --git a/src/libvirt_atomic.syms b/src/libvirt_atomic.syms
deleted file mode 100644
index e2c23637d1..0000000000
--- a/src/libvirt_atomic.syms
+++ /dev/null
@@ -1,11 +0,0 @@
-#
-# These symbols are dependent upon !VIR_ATOMIC_OPS_GCC.
-#
-
-# util/viratomic.h
-virAtomicLock;
-
-# Let emacs know we want case-insensitive sorting
-# Local Variables:
-# sort-fold-case: t
-# End:
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index d53363dc02..c8b68665af 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -26,7 +26,6 @@
 #include "libxl_capabilities.h"
 
 #include "viralloc.h"
-#include "viratomic.h"
 #include "virfile.h"
 #include "virerror.h"
 #include "virhook.h"
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 41cbb67e3a..2b06f1be1e 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -50,7 +50,6 @@
 #include "virstring.h"
 #include "virsysinfo.h"
 #include "viraccessapicheck.h"
-#include "viratomic.h"
 #include "virhostdev.h"
 #include "virpidfile.h"
 #include "locking/domain_lock.h"
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index d8ddea6d24..da2541e684 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -48,7 +48,6 @@
 #include "lxc_hostdev.h"
 #include "virhook.h"
 #include "virstring.h"
-#include "viratomic.h"
 #include "virprocess.h"
 #include "virsystemd.h"
 #include "netdev_bandwidth_conf.h"
diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c
index c4341ee3e2..e7f5b511ae 100644
--- a/src/nwfilter/nwfilter_dhcpsnoop.c
+++ b/src/nwfilter/nwfilter_dhcpsnoop.c
@@ -55,7 +55,6 @@
 #include "nwfilter_ipaddrmap.h"
 #include "virnetdev.h"
 #include "virfile.h"
-#include "viratomic.h"
 #include "virsocketaddr.h"
 #include "virthreadpool.h"
 #include "configmake.h"
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 0b119cbe78..024f3c1634 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -45,7 +45,6 @@
 #include "virfile.h"
 #include "virsocket.h"
 #include "virstring.h"
-#include "viratomic.h"
 #include "storage_conf.h"
 #include "configmake.h"
 
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index d3045b4bcd..cb691ca048 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -51,7 +51,6 @@
 #include "virstoragefile.h"
 #include "virstring.h"
 #include "virthreadjob.h"
-#include "viratomic.h"
 #include "virprocess.h"
 #include "vircrypto.h"
 #include "virrandom.h"
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index ed14ce5ea2..ddcc763cfd 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -79,7 +79,6 @@
 #include "virnetdevopenvswitch.h"
 #include "virnetdevmidonet.h"
 #include "virbitmap.h"
-#include "viratomic.h"
 #include "virnuma.h"
 #include "virstring.h"
 #include "virhostdev.h"
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index ba157c0686..6a629988ef 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -59,7 +59,6 @@
 #include "virstring.h"
 #include "cpu/cpu.h"
 #include "virauth.h"
-#include "viratomic.h"
 #include "virdomainobjlist.h"
 #include "virinterfaceobj.h"
 #include "virhostcpu.h"
diff --git a/src/util/Makefile.inc.am b/src/util/Makefile.inc.am
index 528c9f6cfe..2abdca548c 100644
--- a/src/util/Makefile.inc.am
+++ b/src/util/Makefile.inc.am
@@ -11,8 +11,6 @@ UTIL_SOURCES = \
 	util/virarch.h \
 	util/virarptable.c \
 	util/virarptable.h \
-	util/viratomic.c \
-	util/viratomic.h \
 	util/viraudit.c \
 	util/viraudit.h \
 	util/virauth.c \
diff --git a/src/util/viratomic.c b/src/util/viratomic.c
deleted file mode 100644
index 278a749b6e..0000000000
--- a/src/util/viratomic.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * viratomic.c: atomic integer operations
- *
- * Copyright (C) 2012 Red Hat, Inc.
- *
- * Based on code taken from GLib 2.32, under the LGPLv2+
- *
- * Copyright (C) 2011 Ryan Lortie
- *
- * 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/>.
- *
- */
-
-#include <config.h>
-
-#include "viratomic.h"
-
-
-#ifdef VIR_ATOMIC_OPS_PTHREAD
-
-pthread_mutex_t virAtomicLock = PTHREAD_MUTEX_INITIALIZER;
-
-#endif
diff --git a/src/util/viratomic.h b/src/util/viratomic.h
deleted file mode 100644
index 1ddc7019f9..0000000000
--- a/src/util/viratomic.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * viratomic.h: atomic integer operations
- *
- * Copyright (C) 2012-2020 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/>.
- *
- * APIs in this header should no longer be used. Direct
- * use of the g_atomic APIs is preferred & existing code
- * should be converted as needed.
- */
-
-#pragma once
-
-#include "internal.h"
-
-/**
- * virAtomicIntCompareExchange:
- * Compares atomic to oldval and, if equal, sets it to newval. If
- * atomic was not equal to oldval then no change occurs.
- *
- * This compare and exchange is done atomically.
- *
- * Think of this operation as an atomic version of
- * { if (*atomic == oldval) { *atomic = newval; return true; }
- *    else return false; }
- *
- * This call acts as a full compiler and hardware memory barrier.
- */
-#define virAtomicIntCompareExchange(i, oldi, newi) \
-    (!!g_atomic_int_compare_and_exchange(i, oldi, newi))
-
-/**
- * virAtomicIntAdd:
- * Atomically adds val to the value of atomic.
- *
- * Think of this operation as an atomic version of
- * { tmp = *atomic; *atomic += val; return tmp; }
- *
- * This call acts as a full compiler and hardware memory barrier.
- */
-#define virAtomicIntAdd(i, v) g_atomic_int_add(i, v)
-
-/**
- * virAtomicIntAnd:
- * Performs an atomic bitwise 'and' of the value of atomic
- * and val, storing the result back in atomic.
- *
- * This call acts as a full compiler and hardware memory barrier.
- *
- * Think of this operation as an atomic version of
- * { tmp = *atomic; *atomic &= val; return tmp; }
- */
-#define virAtomicIntAnd(i, v) g_atomic_int_and(i, v)
-
-/**
- * virAtomicIntOr:
- * Performs an atomic bitwise 'or' of the value of atomic
- * and val, storing the result back in atomic.
- *
- * Think of this operation as an atomic version of
- * { tmp = *atomic; *atomic |= val; return tmp; }
- *
- * This call acts as a full compiler and hardware memory barrier.
- */
-#define virAtomicIntOr(i, v) g_atomic_int_or(i, v)
-
-/**
- * virAtomicIntXor:
- * Performs an atomic bitwise 'xor' of the value of atomic
- * and val, storing the result back in atomic.
- *
- * Think of this operation as an atomic version of
- * { tmp = *atomic; *atomic ^= val; return tmp; }
- *
- * This call acts as a full compiler and hardware memory barrier.
- */
-#define virAtomicIntXor(i, v) g_atomic_int_xor(i, v)
diff --git a/src/util/virobject.c b/src/util/virobject.c
index 7749d89243..c71781550f 100644
--- a/src/util/virobject.c
+++ b/src/util/virobject.c
@@ -25,7 +25,6 @@
 #include "virobject.h"
 #include "virthread.h"
 #include "viralloc.h"
-#include "viratomic.h"
 #include "virerror.h"
 #include "virlog.h"
 #include "virprobe.h"
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index 689db4f19d..23e149def4 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -57,7 +57,6 @@
 # include <windows.h>
 #endif
 
-#include "viratomic.h"
 #include "virprocess.h"
 #include "virerror.h"
 #include "viralloc.h"
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index 6b47f4fa36..1d41ed34f7 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -25,7 +25,6 @@
 #include "virsystemdpriv.h"
 
 #include "virsystemd.h"
-#include "viratomic.h"
 #include "virbuffer.h"
 #include "virdbus.h"
 #include "virstring.h"
-- 
2.24.1




More information about the libvir-list mailing list