} else {
xattr_version = 0;
}
-
+
+ bufferlist optmdbl;
+ {
+ decltype(InodeStat::optmetadata) optmetadata;
+ using kind_t = decltype(optmetadata)::optkind_t;
+
+ auto* csp = get_charmap();
+ if (csp) {
+ dout(25) << *csp << dendl;
+ auto& opt = optmetadata.get_or_create_opt(kind_t::CHARMAP);
+ auto& cs = opt.template get_meta< charmap_md_t >();
+ cs = *csp;
+ dout(25) << "cs now " << cs << dendl;
+ }
+
+ encode(optmetadata, optmdbl);
+ }
+
// do we have room?
if (max_bytes) {
unsigned bytes =
sizeof(struct ceph_dir_layout) // dir_layout
+ 4 + file_i->fscrypt_auth.size() // len + data
+ 4 + file_i->fscrypt_file.size() // len + data
+ + optmdbl.length()
;
if (xattr_version) {
* note: encoding matches MClientReply::InodeStat
*/
if (session->info.has_feature(CEPHFS_FEATURE_REPLY_ENCODING)) {
- ENCODE_START(7, 1, bl);
+ ENCODE_START(8, 1, bl);
encode(std::tuple{
oi->ino,
snapid,
encode(!file_i->fscrypt_auth.empty(), bl);
encode(file_i->fscrypt_auth, bl);
encode(file_i->fscrypt_file, bl);
+ encode_nohead(optmdbl, bl);
+ // encode inodestat
ENCODE_FINISH(bl);
}
else {
};
struct InodeStat {
+ using optmetadata_singleton_client_t = optmetadata_singleton<optmetadata_client_t<std::allocator>,std::allocator>;
+
vinodeno_t vino;
uint32_t rdev = 0;
version_t version = 0;
std::vector<uint8_t> fscrypt_auth;
std::vector<uint8_t> fscrypt_file;
+ optmetadata_multiton<optmetadata_singleton_client_t,std::allocator> optmetadata;
+
public:
InodeStat() {}
InodeStat(ceph::buffer::list::const_iterator& p, const uint64_t features) {
decode(p, features);
}
+ void print(std::ostream& os) const {
+ os << "InodeStat(... " << optmetadata << ")";
+ }
+
void decode(ceph::buffer::list::const_iterator &p, const uint64_t features) {
using ceph::decode;
if (features == (uint64_t)-1) {
decode(fscrypt_auth, p);
decode(fscrypt_file, p);
}
+ if (struct_v >= 8) {
+ decode(optmetadata, p);
+ }
DECODE_FINISH(p);
}
else {