[PATCH 0/9] Changing qemu_mutex_locks to lock guard macros

Mahmoud Mandour posted 9 patches 3 years, 1 month ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20210311031538.5325-1-ma.mandourr@gmail.com
Maintainers: Markus Armbruster <armbru@redhat.com>, Eric Blake <eblake@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Juan Quintela <quintela@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Christian Schoenebeck <qemu_oss@crudebyte.com>, Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>, Max Reitz <mreitz@redhat.com>, Stefan Berger <stefanb@linux.vnet.ibm.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Greg Kurz <groug@kaod.org>, Eric Auger <eric.auger@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>
backends/tpm/tpm_emulator.c |   8 +-
block/curl.c                |  13 +--
block/nbd.c                 | 188 +++++++++++++++++-------------------
chardev/char.c              |   3 +-
hw/9pfs/9p-synth.c          |  12 +--
hw/hyperv/vmbus.c           |  13 +--
hw/virtio/virtio-iommu.c    |  78 +++++++--------
migration/migration.c       |   6 +-
migration/ram.c             |   6 +-
monitor/monitor.c           |   8 +-
monitor/qmp.c               |  51 +++++-----
util/filemonitor-inotify.c  |  24 ++---
util/vfio-helpers.c         |  23 ++---
13 files changed, 192 insertions(+), 241 deletions(-)
[PATCH 0/9] Changing qemu_mutex_locks to lock guard macros
Posted by Mahmoud Mandour 3 years, 1 month ago
Hello, 

This is my first contribution to the qemu project, in which
I attempt to replace some usages of qemu_mutex_lock calls and 
the respective qemu_mutex_unlock calls with QEMU_LOCK_GUARD macros. 

As it is a matter of subjectivity on which we should base whether we would 
change qemu_mutex_lock/unlock with a lock guard, I tried as much as I could
to only change it where beneficial to readibility and simplicity. 

I tried to only change it where it would eliminate goto paths 
or if the span of locking/unlocking is so spacious that it's 
not immediately obvious that the particular calls to 
qemu_mutex_lock/unlock are a matching pair.

Mahmoud Mandour (9):
  tpm: Changed a qemu_mutex_lock to QEMU_LOCK_GUARD
  block: Replaced qemu_mutex_lock calls with QEMU_LOCK_GUARD
  char: Replaced a qemu_mutex_lock with QEMU_LOCK_GUARD
  util: Replaced qemu_mutex_lock with QEMU_LOCK_GUARDs
  monitor: Replaced qemu_mutex_lock calls with QEMU_LOCK_GUARD
  migration: Replaced qemu_mutex_lock calls with QEMU_LOCK_GUARD
  virtio-iommu: Replaced qemu_mutex_lock calls with QEMU_LOCK_GUARD
  hw/9pfs/9p-synth: Replaced qemu_mutex_lock with QEMU_LOCK_GUARD
  hw/hyperv/vmbus: replaced qemu_mutex_lock with QEMU_LOCK_GUARD

 backends/tpm/tpm_emulator.c |   8 +-
 block/curl.c                |  13 +--
 block/nbd.c                 | 188 +++++++++++++++++-------------------
 chardev/char.c              |   3 +-
 hw/9pfs/9p-synth.c          |  12 +--
 hw/hyperv/vmbus.c           |  13 +--
 hw/virtio/virtio-iommu.c    |  78 +++++++--------
 migration/migration.c       |   6 +-
 migration/ram.c             |   6 +-
 monitor/monitor.c           |   8 +-
 monitor/qmp.c               |  51 +++++-----
 util/filemonitor-inotify.c  |  24 ++---
 util/vfio-helpers.c         |  23 ++---
 13 files changed, 192 insertions(+), 241 deletions(-)

-- 
2.25.1