-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevices.hpp
More file actions
44 lines (37 loc) · 1.07 KB
/
devices.hpp
File metadata and controls
44 lines (37 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef _DEVICES_HPP
#define _DEVICES_HPP
#include <libudev.h>
#include <list>
//TODO: perf: use async forblong operation: mounting! , udev scan? , fstab and mtab scan ?
//TODO: good error managment
class Devices {
public:
Devices();
~Devices();
bool isBigDiskConnected() const;
int getUdevFd() const;
void manageChanges();
bool isCopyAvailable() const;
protected:
enum MountStatus {
umounted,
ro,
rw,
system,
ignored,
undefined
};
udev *_udev;
udev_monitor *_monitor;
int _udevFd;
bool _bigDiskConnected;
std::list<char*> _copyables;
bool _mount(udev_device*, bool readOnly, MountStatus currentStatus = undefined) const;
bool _umount(udev_device*, MountStatus currentStatus = undefined) const;
bool _umount(const char*) const;
MountStatus _getStatus(udev_device*) const;
void _checkSizes();
void _onAdded(udev_device*);
void _onRemoved(udev_device*);
};
#endif // _DEVICES_HPP