db/update/VirtualDirectory: pass device_id to MakeVirtualDirectoryIfModified()

This commit is contained in:
Max Kellermann 2019-09-03 19:49:32 +02:00
parent a873137702
commit 29fd3172ee
3 changed files with 13 additions and 6 deletions

View File

@ -46,12 +46,11 @@ UpdateWalk::UpdateContainerFile(Directory &directory,
{
const ScopeDatabaseLock protect;
contdir = MakeVirtualDirectoryIfModified(directory, name,
info);
info,
DEVICE_CONTAINER);
if (contdir == nullptr)
/* not modified */
return true;
contdir->device = DEVICE_CONTAINER;
}
const auto pathname = storage.MapFS(contdir->GetPath());

View File

@ -23,7 +23,8 @@
Directory *
UpdateWalk::MakeVirtualDirectoryIfModified(Directory &parent, const char *name,
const StorageFileInfo &info) noexcept
const StorageFileInfo &info,
unsigned virtual_device) noexcept
{
Directory *directory = parent.FindChild(name);
@ -32,7 +33,9 @@ UpdateWalk::MakeVirtualDirectoryIfModified(Directory &parent, const char *name,
if (directory->IsMount())
return nullptr;
if (directory->mtime == info.mtime && !walk_discard) {
if (directory->mtime == info.mtime &&
directory->device == virtual_device &&
!walk_discard) {
/* not modified */
return nullptr;
}
@ -43,5 +46,6 @@ UpdateWalk::MakeVirtualDirectoryIfModified(Directory &parent, const char *name,
directory = parent.MakeChild(name);
directory->mtime = info.mtime;
directory->device = virtual_device;
return directory;
}

View File

@ -141,10 +141,14 @@ private:
* exists already and is unmodified.
*
* The caller must lock the database.
*
* @param virtual_device one of the DEVICE_* constants
* specifying the kind of virtual directory
*/
Directory *MakeVirtualDirectoryIfModified(Directory &parent,
const char *name,
const StorageFileInfo &info) noexcept;
const StorageFileInfo &info,
unsigned virtual_device) noexcept;
Directory *DirectoryMakeChildChecked(Directory &parent,
const char *uri_utf8,