}
}
+void get_raw_devices(const std::string& in,
+ std::set<std::string> *ls)
+{
+ if (in.substr(0, 3) == "dm-") {
+ std::set<std::string> o;
+ get_dm_parents(in, &o);
+ for (auto& d : o) {
+ get_raw_devices(d, ls);
+ }
+ } else {
+ BlkDev d(in);
+ std::string wholedisk;
+ if (d.wholedisk(&wholedisk) == 0) {
+ std::cout << " wholedisk of " << in << " is " << wholedisk << std::endl;
+ ls->insert(wholedisk);
+ } else {
+ std::cout << " wholedisk of " << in << " failed" << std::endl;
+ ls->insert(in);
+ }
+ }
+}
+
int _get_vdo_stats_handle(const char *devname, std::string *vdo_name)
{
int vdo_fd = -1;
{
}
+void get_raw_devices(const std::string& in,
+ std::set<std::string> *ls)
+{
+}
+
int get_vdo_stats_handle(const char *devname, std::string *vdo_name)
{
return -1;
{
}
+void get_raw_devices(const std::string& in,
+ std::set<std::string> *ls)
+{
+}
+
int get_vdo_stats_handle(const char *devname, std::string *vdo_name)
{
return -1;
{
}
+void get_raw_devices(const std::string& in,
+ std::set<std::string> *ls)
+{
+}
+
int get_vdo_stats_handle(const char *devname, std::string *vdo_name)
{
return -1;
extern int block_device_get_metrics(const char *device, int timeout,
json_spirit::mValue *result);
+// do everything to translate a device to the raw physical devices that
+// back it, including partitions -> wholedisks and dm -> constituent devices.
+extern void get_raw_devices(const std::string& in,
+ std::set<std::string> *ls);
+
// for VDO
/// return an op fd for the sysfs stats dir, if this is a VDO device
extern int get_vdo_stats_handle(const char *devname, std::string *vdo_name);
/* virtual for testing purposes */
virtual const char *sysfsdir() const;
virtual int wholedisk(char* device, size_t max) const;
+ int wholedisk(std::string *s) const {
+ char out[PATH_MAX] = {0};
+ int r = wholedisk(out, sizeof(out));
+ if (r < 0) {
+ return r;
+ }
+ *s = out;
+ return r;
+ }
protected:
int64_t get_int_property(blkdev_prop_t prop) const;