storage/udisks2: move code to SetMountPoint()
This commit is contained in:
parent
2434020971
commit
0a3aee9d82
|
@ -120,6 +120,9 @@ public:
|
||||||
const char *MapToRelativeUTF8(const char *uri_utf8) const noexcept override;
|
const char *MapToRelativeUTF8(const char *uri_utf8) const noexcept override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void SetMountPoint(const char *mount_point);
|
||||||
|
void LockSetMountPoint(const char *mount_point);
|
||||||
|
|
||||||
void OnListReply(ODBus::Message reply) noexcept;
|
void OnListReply(ODBus::Message reply) noexcept;
|
||||||
|
|
||||||
void MountWait();
|
void MountWait();
|
||||||
|
@ -131,6 +134,22 @@ private:
|
||||||
void OnUnmountNotify(ODBus::Message reply) noexcept;
|
void OnUnmountNotify(ODBus::Message reply) noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline void
|
||||||
|
UdisksStorage::SetMountPoint(const char *mount_point)
|
||||||
|
{
|
||||||
|
mounted_storage = CreateLocalStorage(Path::FromFS(mount_point));
|
||||||
|
mount_error = {};
|
||||||
|
want_mount = false;
|
||||||
|
cond.broadcast();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
UdisksStorage::LockSetMountPoint(const char *mount_point)
|
||||||
|
{
|
||||||
|
const std::lock_guard<Mutex> lock(mutex);
|
||||||
|
SetMountPoint(mount_point);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
UdisksStorage::OnListReply(ODBus::Message reply) noexcept
|
UdisksStorage::OnListReply(ODBus::Message reply) noexcept
|
||||||
{
|
{
|
||||||
|
@ -224,12 +243,7 @@ try {
|
||||||
throw std::runtime_error("Malformed 'Mount' response");
|
throw std::runtime_error("Malformed 'Mount' response");
|
||||||
|
|
||||||
const char *mount_path = i.GetString();
|
const char *mount_path = i.GetString();
|
||||||
|
LockSetMountPoint(mount_path);
|
||||||
const std::lock_guard<Mutex> lock(mutex);
|
|
||||||
mounted_storage = CreateLocalStorage(Path::FromFS(mount_path));
|
|
||||||
mount_error = {};
|
|
||||||
want_mount = false;
|
|
||||||
cond.broadcast();
|
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
const std::lock_guard<Mutex> lock(mutex);
|
const std::lock_guard<Mutex> lock(mutex);
|
||||||
mount_error = std::current_exception();
|
mount_error = std::current_exception();
|
||||||
|
|
Loading…
Reference in New Issue