]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/common/blkdev.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / common / blkdev.h
index d471df22dc53e031d830e3bc176dfa6352fd4d51..f8b089b0ca7c08a844396078d2f06d52d82e0112 100644 (file)
@@ -5,27 +5,28 @@
 #define __CEPH_COMMON_BLKDEV_H
 
 #include <set>
+#include <map>
 #include <string>
 #include "json_spirit/json_spirit_value.h"
 
-enum blkdev_prop_t {
-  BLKDEV_PROP_DEV,
-  BLKDEV_PROP_DISCARD_GRANULARITY,
-  BLKDEV_PROP_MODEL,
-  BLKDEV_PROP_ROTATIONAL,
-  BLKDEV_PROP_SERIAL,
-  BLKDEV_PROP_VENDOR,
-  BLKDEV_PROP_NUMA_NODE,
-  BLKDEV_PROP_NUMA_CPUS,
-  BLKDEV_PROP_NUMPROPS,
-};
-
 extern int get_device_by_path(const char *path, char* partition, char* device, size_t max);
 
 extern std::string _decode_model_enc(const std::string& in);  // helper, exported only so we can unit test
 
+// get $vendor_$model_$serial style device id
 extern std::string get_device_id(const std::string& devname,
                                 std::string *err=0);
+
+// get /dev/disk/by-path/... style device id that is stable for a disk slot across reboots etc
+extern std::string get_device_path(const std::string& devname,
+                                  std::string *err=0);
+
+// populate daemon metadata map with device info
+extern void get_device_metadata(
+  const std::set<std::string>& devnames,
+  std::map<std::string,std::string> *pm,
+  std::map<std::string,std::string> *errs);
+
 extern void get_dm_parents(const std::string& dev, std::set<std::string> *ls);
 extern int block_device_get_metrics(const std::string& devname, int timeout,
                                    json_spirit::mValue *result);
@@ -55,7 +56,6 @@ public:
   int partition(char* partition, size_t max) const;
   // from a device (e.g., "sdb")
   bool support_discard() const;
-  bool is_nvme() const;
   bool is_rotational() const;
   int get_numa_node(int *node) const;
   int dev(char *dev, size_t max) const;
@@ -77,8 +77,8 @@ public:
   }
 
 protected:
-  int64_t get_int_property(blkdev_prop_t prop) const;
-  int64_t get_string_property( blkdev_prop_t prop, char *val,
+  int64_t get_int_property(const char* prop) const;
+  int64_t get_string_property(const char* prop, char *val,
     size_t maxlen) const;
 
 private: