From 12beb22c1db0d17aef02e6ae732f219ff817ee76 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 3 Sep 2019 19:51:20 +0200 Subject: [PATCH] db/update/VirtualDirectory: add LockMakeVirtualDirectoryIfModified() --- src/db/update/VirtualDirectory.cxx | 12 ++++++++++++ src/db/update/Walk.hxx | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/src/db/update/VirtualDirectory.cxx b/src/db/update/VirtualDirectory.cxx index 5183374c5..52e03e63c 100644 --- a/src/db/update/VirtualDirectory.cxx +++ b/src/db/update/VirtualDirectory.cxx @@ -18,6 +18,7 @@ */ #include "Walk.hxx" +#include "db/DatabaseLock.hxx" #include "db/plugins/simple/Directory.hxx" #include "storage/FileInfo.hxx" @@ -49,3 +50,14 @@ UpdateWalk::MakeVirtualDirectoryIfModified(Directory &parent, const char *name, directory->device = virtual_device; return directory; } + +Directory * +UpdateWalk::LockMakeVirtualDirectoryIfModified(Directory &parent, + const char *name, + const StorageFileInfo &info, + unsigned virtual_device) noexcept +{ + const ScopeDatabaseLock protect; + return MakeVirtualDirectoryIfModified(parent, name, + info, virtual_device); +} diff --git a/src/db/update/Walk.hxx b/src/db/update/Walk.hxx index ac7a5bd5b..e54e398b9 100644 --- a/src/db/update/Walk.hxx +++ b/src/db/update/Walk.hxx @@ -150,6 +150,11 @@ private: const StorageFileInfo &info, unsigned virtual_device) noexcept; + Directory *LockMakeVirtualDirectoryIfModified(Directory &parent, + const char *name, + const StorageFileInfo &info, + unsigned virtual_device) noexcept; + Directory *DirectoryMakeChildChecked(Directory &parent, const char *uri_utf8, const char *name_utf8) noexcept;