diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2021-03-17 18:28:03 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2021-03-17 18:28:03 +0000 |
commit | 69259911f948ad2755bd1f2c999dd60ac322c890 (patch) | |
tree | a7561d2bcfebaf384c3fe4820545e66b1b68fc76 /hw | |
parent | ce90fecbeb8312ffc5340e0d53d9a76b2aa8bf6e (diff) | |
parent | e4fd889f51094a8e76274ca1e9e0ed70375166f0 (diff) | |
download | qemu-69259911f948ad2755bd1f2c999dd60ac322c890.zip qemu-69259911f948ad2755bd1f2c999dd60ac322c890.tar.gz qemu-69259911f948ad2755bd1f2c999dd60ac322c890.tar.bz2 |
Merge remote-tracking branch 'remotes/cschoenebeck/tags/pull-9p-20210316' into staging
9pfs: code cleanup
* Use lock-guard design pattern instead of manual lock/unlock.
# gpg: Signature made Tue 16 Mar 2021 10:49:09 GMT
# gpg: using RSA key 96D8D110CF7AF8084F88590134C2B58765A47395
# gpg: issuer "qemu_oss@crudebyte.com"
# gpg: Good signature from "Christian Schoenebeck <qemu_oss@crudebyte.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg: There is no indication that the signature belongs to the owner.
# Primary key fingerprint: ECAB 1A45 4014 1413 BA38 4926 30DB 47C3 A012 D5F4
# Subkey fingerprint: 96D8 D110 CF7A F808 4F88 5901 34C2 B587 65A4 7395
* remotes/cschoenebeck/tags/pull-9p-20210316:
hw/9pfs/9p-synth: Replaced qemu_mutex_lock with QEMU_LOCK_GUARD
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/9pfs/9p-synth.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/hw/9pfs/9p-synth.c b/hw/9pfs/9p-synth.c index 7eb210f..473ef91 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; } |