virtual int get_ebd_state(ExtBlkDevState &state) const {
return -ENOENT;
}
+ virtual int get_ebd_id(std::string& id) const {
+ return -ENOENT;
+ }
virtual int collect_metadata(const std::string& prefix, std::map<std::string,std::string> *pm) const = 0;
return -ENOENT;
}
+int KernelDevice::get_ebd_id(std::string& id) const {
+ if (ebd_impl) {
+ return ebd_impl->get_plugin_id(id);
+ }
+ return -ENOENT;
+}
+
int KernelDevice::choose_fd(bool buffered, int write_hint) const
{
#if defined(F_SET_FILE_RW_HINT)
int get_devices(std::set<std::string> *ls) const override;
int get_ebd_state(ExtBlkDevState &state) const override;
+ int get_ebd_id(std::string& id) const override;
int read(uint64_t off, uint64_t len, ceph::buffer::list *pbl,
IOContext *ioc,
* @return 0 on success or a negative errno on error.
*/
virtual int collect_metadata(const std::string& prefix, std::map<std::string,std::string> *pm) = 0;
+
+ /**
+ * Retrieve the identification string of the plugin.
+ * This can be used to verify that proper plugin is loaded.
+ * It is best if id is printable string.
+ *
+ * Return 0 on success or a negative errno on error.
+ *
+ * @param [out] id_str identification of current plugin
+ * @return 0 on success or a negative errno on error.
+ */
+ virtual int get_plugin_id(std::string& id_str) = 0;
};
typedef std::shared_ptr<ExtBlkDevInterface> ExtBlkDevInterfaceRef;
virtual const std::string& get_devname() const {return name;}
virtual int get_state(ceph::ExtBlkDevState& state);
virtual int collect_metadata(const std::string& prefix, std::map<std::string,std::string> *pm);
+ int get_plugin_id(std::string& id_str) override {
+ id_str = "vdo";
+ return 0;
+ };
};
#endif