From 8175a2c342e4d0ac9e8390ce083b94d961d6440c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 1 Apr 2012 13:06:59 +0200 Subject: [PATCH] Fixed warning. --- src/tools/fs_shell/vfs.cpp | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/src/tools/fs_shell/vfs.cpp b/src/tools/fs_shell/vfs.cpp index 1b2a7b8bce..23e05724c0 100644 --- a/src/tools/fs_shell/vfs.cpp +++ b/src/tools/fs_shell/vfs.cpp @@ -441,31 +441,21 @@ find_mount(fssh_mount_id id) static fssh_status_t get_mount(fssh_mount_id id, struct fs_mount **_mount) { - struct fs_mount *mount; - fssh_status_t status; - - fssh_mutex_lock(&sMountMutex); - - mount = find_mount(id); - if (mount) { - // ToDo: the volume is locked (against removal) by locking - // its root node - investigate if that's a good idea - if (mount->root_vnode) - inc_vnode_ref_count(mount->root_vnode); - else { - // might have been called during a mount operation in which - // case the root node may still be NULL - mount = NULL; - } - } else - status = FSSH_B_BAD_VALUE; - - fssh_mutex_unlock(&sMountMutex); + MutexLocker locker(&sMountMutex); + struct fs_mount *mount = find_mount(id); if (mount == NULL) - return FSSH_B_BUSY; + return FSSH_B_BAD_VALUE; + if (mount->root_vnode == NULL) { + // might have been called during a mount operation in which + // case the root node may still be NULL + return FSSH_B_BUSY; + } + + inc_vnode_ref_count(mount->root_vnode); *_mount = mount; + return FSSH_B_OK; }