12 #include "storage/IStorageProvider.h" 23 bool m_isRemovable =
false;
24 std::vector<std::string> m_mediaCompatibility;
26 explicit Drive(
const char *
object);
32 bool IsOptical()
const;
37 std::string ToString()
const;
43 Drive *m_drive =
nullptr;
45 std::string m_driveobject;
48 bool m_isSystem =
false;
51 explicit Block(
const char *
object);
59 std::string ToString()
const;
65 Block *m_block =
nullptr;
67 explicit Filesystem(
const char *
object);
68 ~Filesystem() =
default;
76 std::string GetDisplayName()
const;
81 bool IsApproved()
const;
86 bool IsMounted()
const;
96 bool IsOptical()
const;
102 MEDIA_DETECT::STORAGE::Type GetStorageType()
const;
107 std::string GetMountPoint()
const;
111 void ResetMountPoint();
116 void SetMountPoint(
const std::string& mountPoint);
121 std::string GetObject()
const;
126 std::string ToString()
const;
139 bool m_isMounted =
false;
140 std::string m_object;
141 std::string m_mountPoint;
144 typedef std::map<std::string, Drive *> DriveMap;
145 typedef std::map<std::string, Block *> BlockMap;
146 typedef std::map<std::string, Filesystem *> FilesystemMap;
152 void Initialize()
override;
156 static bool HasUDisks2();
158 bool Eject(
const std::string &mountpath)
override;
160 std::vector<std::string> GetDiskUsage()
override;
162 void GetLocalDrives(VECSOURCES &localDrives)
override 163 { GetDisks(localDrives,
false); }
165 void GetRemovableDrives(VECSOURCES &removableDrives)
override 166 { GetDisks(removableDrives,
true); }
176 FilesystemMap m_filesystems;
178 std::string m_daemonVersion;
180 void GetDisks(VECSOURCES &devices,
bool enumerateRemovable);
182 void DriveAdded(Drive *drive);
183 bool DriveRemoved(
const std::string&
object);
184 void BlockAdded(Block *block,
bool isNew =
true);
185 bool BlockRemoved(
const std::string&
object);
186 void FilesystemAdded(Filesystem *
fs,
bool isNew =
true);
190 void HandleInterfacesAdded(DBusMessage *msg);
193 bool DrivePropertiesChanged(
const char *
object, DBusMessageIter *propsIter);
194 bool BlockPropertiesChanged(
const char *
object, DBusMessageIter *propsIter);
195 bool FilesystemPropertiesChanged(
const char *
object, DBusMessageIter *propsIter,
IStorageEventsCallback *callback);
199 template<
class Object,
class Function>
200 void ParseProperties(Object *ref, DBusMessageIter *dictIter, Function f);
201 void ParseInterfaces(DBusMessageIter *dictIter);
202 void ParseDriveProperty(Drive *drive,
const char *key, DBusMessageIter *varIter);
203 void ParseBlockProperty(Block *block,
const char *key, DBusMessageIter *varIter);
204 void ParseFilesystemProperty(Filesystem *fs,
const char *key, DBusMessageIter *varIter);
205 std::string ParseByteArray(DBusMessageIter *arrIter);
206 void HandleManagedObjects(DBusMessage *msg);
207 void ParseInterface(
const char *
object,
const char *iface, DBusMessageIter *propsIter);
209 static void AppendEmptyOptions(DBusMessageIter *argsIter);
Definition: DBusUtil.h:38
Definition: UDisks2Provider.h:17
Definition: IStorageProvider.h:65
Definition: IStorageProvider.h:44