[libvirt] [PATCH 08/12] util: replace atomic ops impls with g_atomic_int*

Pavel Hrdina phrdina at redhat.com
Tue Jan 14 14:57:16 UTC 2020


On Fri, Jan 10, 2020 at 03:41:12PM +0000, Daniel P. Berrangé wrote:
> Libvirt's original atomic ops impls were largely copied
> from GLib's code at the time. The only API difference
> was that libvirt's virAtomicIntInc() would return a
> value, but g_atomic_int_inc was void. We thus use
> g_atomic_int_add(v, 1) instead, though this means
> virAtomicIntInc() now returns the original value,
> instead of the new value.
> 
> This rewrites libvirt's impl in terms of g_atomic_int*
> as a short term conversion. The key motivation was to
> quickly eliminate use of GNULIB's verify_expr() macro
> which is not a direct match for G_STATIC_ASSERT_EXPR.
> Long term all the callers should be updated to use
> g_atomic_int* directly.
> 
> Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
> ---
>  src/libxl/libxl_domain.c          |   2 +-
>  src/libxl/libxl_driver.c          |   2 +-
>  src/lxc/lxc_process.c             |   4 +-
>  src/nwfilter/nwfilter_dhcpsnoop.c |   6 +-
>  src/qemu/qemu_process.c           |   4 +-
>  src/util/viratomic.h              | 351 ++----------------------------
>  src/util/virprocess.c             |   2 +-
>  tests/viratomictest.c             |   2 +-
>  8 files changed, 26 insertions(+), 347 deletions(-)

Reviewed-by: Pavel Hrdina <phrdina at redhat.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200114/2b1735e7/attachment-0001.sig>


More information about the libvir-list mailing list