storage/udisks2: pass Path to SetMountPoint()

This commit is contained in:
Max Kellermann 2019-02-22 14:28:04 +01:00
parent 8002bc752f
commit 98258acc37
1 changed files with 7 additions and 7 deletions

View File

@ -120,8 +120,8 @@ 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 SetMountPoint(Path mount_point);
void LockSetMountPoint(const char *mount_point); void LockSetMountPoint(Path mount_point);
void OnListReply(ODBus::Message reply) noexcept; void OnListReply(ODBus::Message reply) noexcept;
@ -135,16 +135,16 @@ private:
}; };
inline void inline void
UdisksStorage::SetMountPoint(const char *mount_point) UdisksStorage::SetMountPoint(Path mount_point)
{ {
mounted_storage = CreateLocalStorage(Path::FromFS(mount_point)); mounted_storage = CreateLocalStorage(mount_point);
mount_error = {}; mount_error = {};
want_mount = false; want_mount = false;
cond.broadcast(); cond.broadcast();
} }
void void
UdisksStorage::LockSetMountPoint(const char *mount_point) UdisksStorage::LockSetMountPoint(Path mount_point)
{ {
const std::lock_guard<Mutex> lock(mutex); const std::lock_guard<Mutex> lock(mutex);
SetMountPoint(mount_point); SetMountPoint(mount_point);
@ -174,7 +174,7 @@ UdisksStorage::OnListReply(ODBus::Message reply) noexcept
/* already mounted: don't attempt to mount /* already mounted: don't attempt to mount
again, because this would result in again, because this would result in
org.freedesktop.UDisks2.Error.AlreadyMounted */ org.freedesktop.UDisks2.Error.AlreadyMounted */
LockSetMountPoint(mount_point.c_str()); LockSetMountPoint(Path::FromFS(mount_point.c_str()));
return; return;
} }
} catch (...) { } catch (...) {
@ -254,7 +254,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); LockSetMountPoint(Path::FromFS(mount_path));
} 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();