CompositeStorage: add method GetMount()
This commit is contained in:
src/storage
@ -210,6 +210,19 @@ CompositeStorage::~CompositeStorage()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Storage *
|
||||||
|
CompositeStorage::GetMount(const char *uri)
|
||||||
|
{
|
||||||
|
const ScopeLock protect(mutex);
|
||||||
|
|
||||||
|
auto result = FindStorage(uri);
|
||||||
|
if (*result.uri != 0)
|
||||||
|
/* not a mount point */
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
return result.directory->storage;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CompositeStorage::Mount(const char *uri, Storage *storage)
|
CompositeStorage::Mount(const char *uri, Storage *storage)
|
||||||
{
|
{
|
||||||
|
@ -95,6 +95,17 @@ public:
|
|||||||
CompositeStorage();
|
CompositeStorage();
|
||||||
virtual ~CompositeStorage();
|
virtual ~CompositeStorage();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the #Storage at the specified mount point. Returns
|
||||||
|
* nullptr if the given URI is not a mount point.
|
||||||
|
*
|
||||||
|
* The returned pointer is unprotected. No other thread is
|
||||||
|
* allowed to unmount the given mount point while the return
|
||||||
|
* value is being used.
|
||||||
|
*/
|
||||||
|
gcc_pure gcc_nonnull_all
|
||||||
|
Storage *GetMount(const char *uri);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call the given function for each mounted storage, including
|
* Call the given function for each mounted storage, including
|
||||||
* the root storage. Passes mount point URI and the a const
|
* the root storage. Passes mount point URI and the a const
|
||||||
|
Reference in New Issue
Block a user