virtual int collect_metadata(const std::string& prefix, std::map<std::string,std::string> *pm) const = 0;
- virtual int get_devname(std::string *out) {
+ virtual int get_devname(std::string *out) const {
return -ENOENT;
}
- virtual int get_devices(std::set<std::string> *ls) {
+ virtual int get_devices(std::set<std::string> *ls) const {
std::string s;
if (get_devname(&s) == 0) {
ls->insert(s);
return r;
}
-int KernelDevice::get_devices(std::set<std::string> *ls)
+int KernelDevice::get_devices(std::set<std::string> *ls) const
{
if (devname.empty()) {
return 0;
(*pm)[prefix + "vdo_physical_size"] = stringify(total);
}
+ {
+ string res_names;
+ std::set<std::string> devnames;
+ if (get_devices(&devnames) == 0) {
+ for (auto& dev : devnames) {
+ if (!res_names.empty()) {
+ res_names += ",";
+ }
+ res_names += dev;
+ }
+ if (res_names.size()) {
+ (*pm)[prefix + "devices"] = res_names;
+ }
+ }
+ }
+
struct stat st;
int r = ::fstat(fd_buffereds[WRITE_LIFE_NOT_SET], &st);
if (r < 0)
void discard_drain() override;
int collect_metadata(const std::string& prefix, map<std::string,std::string> *pm) const override;
- int get_devname(std::string *s) override {
+ int get_devname(std::string *s) const override {
if (devname.empty()) {
return -ENOENT;
}
*s = devname;
return 0;
}
- int get_devices(std::set<std::string> *ls) override;
+ int get_devices(std::set<std::string> *ls) const override;
bool get_thin_utilization(uint64_t *total, uint64_t *avail) const override;