MCPcopy Create free account
hub / github.com/MusicPlayerDaemon/MPD / Mount

Method Mount

src/db/plugins/simple/SimpleDatabasePlugin.cxx:379–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

377}
378
379void
380SimpleDatabase::Mount(const char *uri, DatabasePtr db)
381{
382#if !CLANG_CHECK_VERSION(3,6)
383 /* disabled on clang due to -Wtautological-pointer-compare */
384 assert(uri != nullptr);
385#endif
386 assert(db != nullptr);
387 assert(*uri != 0);
388
389 ScopeDatabaseLock protect;
390
391 auto r = root->LookupDirectory(uri);
392 if (r.rest.data() == nullptr)
393 throw DatabaseError(DatabaseErrorCode::CONFLICT,
394 "Already exists");
395
396 if (r.rest.find('/') != std::string_view::npos)
397 throw DatabaseError(DatabaseErrorCode::NOT_FOUND,
398 "Parent not found");
399
400 Directory *mnt = r.directory->CreateChild(r.rest);
401 mnt->mounted_database = std::move(db);
402}
403
404static constexpr bool
405IsSafeChar(char ch)

Callers

nothing calls this directly

Calls 4

LookupDirectoryMethod · 0.80
findMethod · 0.80
CreateChildMethod · 0.80
OpenMethod · 0.45

Tested by

no test coverage detected