All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 0/1] 9p queue 2021-03-16
@ 2021-03-16 10:49 Christian Schoenebeck
  2021-03-16 10:49 ` [PULL 1/1] hw/9pfs/9p-synth: Replaced qemu_mutex_lock with QEMU_LOCK_GUARD Christian Schoenebeck
  2021-03-17 19:23 ` [PULL 0/1] 9p queue 2021-03-16 Peter Maydell
  0 siblings, 2 replies; 3+ messages in thread
From: Christian Schoenebeck @ 2021-03-16 10:49 UTC (permalink / raw)
  To: qemu-devel, Peter Maydell; +Cc: Greg Kurz

The following changes since commit 2615a5e433aeb812c300d3a48e1a88e1303e2339:

  Merge remote-tracking branch 'remotes/stefanha-gitlab/tags/block-pull-request' into staging (2021-03-15 19:23:00 +0000)

are available in the Git repository at:

  https://github.com/cschoenebeck/qemu.git tags/pull-9p-20210316

for you to fetch changes up to e4fd889f51094a8e76274ca1e9e0ed70375166f0:

  hw/9pfs/9p-synth: Replaced qemu_mutex_lock with QEMU_LOCK_GUARD (2021-03-16 11:41:49 +0100)

----------------------------------------------------------------
9pfs: code cleanup

* Use lock-guard design pattern instead of manual lock/unlock.

----------------------------------------------------------------
Mahmoud Mandour (1):
      hw/9pfs/9p-synth: Replaced qemu_mutex_lock with QEMU_LOCK_GUARD

 hw/9pfs/9p-synth.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PULL 1/1] hw/9pfs/9p-synth: Replaced qemu_mutex_lock with QEMU_LOCK_GUARD
  2021-03-16 10:49 [PULL 0/1] 9p queue 2021-03-16 Christian Schoenebeck
@ 2021-03-16 10:49 ` Christian Schoenebeck
  2021-03-17 19:23 ` [PULL 0/1] 9p queue 2021-03-16 Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Christian Schoenebeck @ 2021-03-16 10:49 UTC (permalink / raw)
  To: qemu-devel, Peter Maydell; +Cc: Greg Kurz, Mahmoud Mandour

From: Mahmoud Mandour <ma.mandourr@gmail.com>

Replaced a call to qemu_mutex_lock and its respective call to
qemu_mutex_unlock and used QEMU_LOCK_GUARD macro in their place.
This simplifies the code by removing the call required to unlock
and also eliminates goto paths.

Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
Acked-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Message-Id: <20210311031538.5325-9-ma.mandourr@gmail.com>
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
---
 hw/9pfs/9p-synth.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/hw/9pfs/9p-synth.c b/hw/9pfs/9p-synth.c
index 7eb210ffa8..473ef914b0 100644
--- a/hw/9pfs/9p-synth.c
+++ b/hw/9pfs/9p-synth.c
@@ -79,11 +79,11 @@ int qemu_v9fs_synth_mkdir(V9fsSynthNode *parent, int mode,
     if (!parent) {
         parent = &synth_root;
     }
-    qemu_mutex_lock(&synth_mutex);
+    QEMU_LOCK_GUARD(&synth_mutex);
     QLIST_FOREACH(tmp, &parent->child, sibling) {
         if (!strcmp(tmp->name, name)) {
             ret = EEXIST;
-            goto err_out;
+            return ret;
         }
     }
     /* Add the name */
@@ -94,8 +94,6 @@ int qemu_v9fs_synth_mkdir(V9fsSynthNode *parent, int mode,
                       node->attr, node->attr->inode);
     *result = node;
     ret = 0;
-err_out:
-    qemu_mutex_unlock(&synth_mutex);
     return ret;
 }
 
@@ -116,11 +114,11 @@ int qemu_v9fs_synth_add_file(V9fsSynthNode *parent, int mode,
         parent = &synth_root;
     }
 
-    qemu_mutex_lock(&synth_mutex);
+    QEMU_LOCK_GUARD(&synth_mutex);
     QLIST_FOREACH(tmp, &parent->child, sibling) {
         if (!strcmp(tmp->name, name)) {
             ret = EEXIST;
-            goto err_out;
+            return ret;
         }
     }
     /* Add file type and remove write bits */
@@ -136,8 +134,6 @@ int qemu_v9fs_synth_add_file(V9fsSynthNode *parent, int mode,
     pstrcpy(node->name, sizeof(node->name), name);
     QLIST_INSERT_HEAD_RCU(&parent->child, node, sibling);
     ret = 0;
-err_out:
-    qemu_mutex_unlock(&synth_mutex);
     return ret;
 }
 
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PULL 0/1] 9p queue 2021-03-16
  2021-03-16 10:49 [PULL 0/1] 9p queue 2021-03-16 Christian Schoenebeck
  2021-03-16 10:49 ` [PULL 1/1] hw/9pfs/9p-synth: Replaced qemu_mutex_lock with QEMU_LOCK_GUARD Christian Schoenebeck
@ 2021-03-17 19:23 ` Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2021-03-17 19:23 UTC (permalink / raw)
  To: Christian Schoenebeck; +Cc: QEMU Developers, Greg Kurz

On Tue, 16 Mar 2021 at 11:00, Christian Schoenebeck
<qemu_oss@crudebyte.com> wrote:
>
> The following changes since commit 2615a5e433aeb812c300d3a48e1a88e1303e2339:
>
>   Merge remote-tracking branch 'remotes/stefanha-gitlab/tags/block-pull-request' into staging (2021-03-15 19:23:00 +0000)
>
> are available in the Git repository at:
>
>   https://github.com/cschoenebeck/qemu.git tags/pull-9p-20210316
>
> for you to fetch changes up to e4fd889f51094a8e76274ca1e9e0ed70375166f0:
>
>   hw/9pfs/9p-synth: Replaced qemu_mutex_lock with QEMU_LOCK_GUARD (2021-03-16 11:41:49 +0100)
>
> ----------------------------------------------------------------
> 9pfs: code cleanup
>
> * Use lock-guard design pattern instead of manual lock/unlock.
>
> ----------------------------------------------------------------
> Mahmoud Mandour (1):
>       hw/9pfs/9p-synth: Replaced qemu_mutex_lock with QEMU_LOCK_GUARD
>
>  hw/9pfs/9p-synth.c | 12 ++++--------

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/6.0
for any user-visible changes.

-- PMM


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-17 19:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-16 10:49 [PULL 0/1] 9p queue 2021-03-16 Christian Schoenebeck
2021-03-16 10:49 ` [PULL 1/1] hw/9pfs/9p-synth: Replaced qemu_mutex_lock with QEMU_LOCK_GUARD Christian Schoenebeck
2021-03-17 19:23 ` [PULL 0/1] 9p queue 2021-03-16 Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.