void encode(bufferlist& bl) const {
/* no ENCODE_START/END due to backward compatibility */
- std::string s = to_str_explicit();
+ std::string s = to_str();
ceph::encode(s, bl);
}
size_t pos = s.find("/");
if (pos == std::string::npos) {
name = s;
+ storage_class.clear();
return;
}
name = s.substr(0, pos);
- if (pos < s.size() - 1) {
- storage_class = s.substr(pos + 1);
- }
+ storage_class = s.substr(pos + 1);
}
bool standard_storage_class() const {
return s;
}
+template <typename T>
+int decode_bl(bufferlist& bl, T& t)
+{
+ auto iter = bl.cbegin();
+ try {
+ decode(t, iter);
+ } catch (buffer::error& err) {
+ return -EIO;
+ }
+ return 0;
+}
+
#endif