]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/cls/lock/cls_lock_types.cc
update sources to v12.1.1
[ceph.git] / ceph / src / cls / lock / cls_lock_types.cc
index 1c67bdea5ce419cbac4dd054c791759399bf8137..38a0d93df4689fd4a388c715bf77ab1caceda77a 100644 (file)
@@ -67,3 +67,32 @@ void locker_info_t::generate_test_instances(list<locker_info_t*>& o)
   o.push_back(new locker_info_t);
 }
 
+void lock_info_t::dump(Formatter *f) const
+{
+  f->dump_int("lock_type", lock_type);
+  f->dump_string("tag", tag);
+  f->open_array_section("lockers");
+  for (auto &i : lockers) {
+    f->open_object_section("locker");
+    f->dump_object("id", i.first);
+    f->dump_object("info", i.second);
+    f->close_section();
+  }
+  f->close_section();
+}
+
+void lock_info_t::generate_test_instances(list<lock_info_t *>& o)
+{
+  lock_info_t *i = new lock_info_t;
+  locker_id_t id;
+  locker_info_t info;
+  generate_lock_id(id, 1, "cookie");
+  info.expiration = utime_t(5, 0);
+  generate_test_addr(info.addr, 1, 2);
+  info.description = "description";
+  i->lockers[id] = info;
+  i->lock_type = LOCK_EXCLUSIVE;
+  i->tag = "tag";
+  o.push_back(i);
+  o.push_back(new lock_info_t);
+}