]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/cls/user/cls_user.cc
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / cls / user / cls_user.cc
index f6f7ab0322d15de51688ec64881eecbffcbb81c4..e278ad7fc12834ae2fc355d4cf6232f29a34eddf 100644 (file)
@@ -1,4 +1,4 @@
-// -*- mode:C; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
 // vim: ts=8 sw=2 smarttab
 
 #include <errno.h>
@@ -8,6 +8,13 @@
 
 #include "cls_user_ops.h"
 
+using std::map;
+using std::string;
+
+using ceph::bufferlist;
+using ceph::decode;
+using ceph::encode;
+
 CLS_VER(1,0)
 CLS_NAME(user)
 
@@ -56,7 +63,7 @@ static int get_existing_bucket_entry(cls_method_context_t hctx, const string& bu
   try {
     auto iter = bl.cbegin();
     decode(entry, iter);
-  } catch (buffer::error& err) {
+  } catch (ceph::buffer::error& err) {
     CLS_LOG(0, "ERROR: failed to decode entry %s", key.c_str());
     return -EIO;
   }
@@ -79,7 +86,7 @@ static int read_header(cls_method_context_t hctx, cls_user_header *header)
 
   try {
     decode(*header, bl);
-  } catch (buffer::error& err) {
+  } catch (ceph::buffer::error& err) {
     CLS_LOG(0, "ERROR: failed to decode user header");
     return -EIO;
   }
@@ -115,7 +122,7 @@ static int cls_user_set_buckets_info(cls_method_context_t hctx, bufferlist *in,
   cls_user_set_buckets_op op;
   try {
     decode(op, in_iter);
-  } catch (buffer::error& err) {
+  } catch (ceph::buffer::error& err) {
     CLS_LOG(1, "ERROR: cls_user_add_op(): failed to decode op");
     return -EINVAL;
   }
@@ -127,8 +134,7 @@ static int cls_user_set_buckets_info(cls_method_context_t hctx, bufferlist *in,
     return ret;
   }
 
-  for (list<cls_user_bucket_entry>::iterator iter = op.entries.begin();
-       iter != op.entries.end(); ++iter) {
+  for (auto iter = op.entries.begin(); iter != op.entries.end(); ++iter) {
     cls_user_bucket_entry& update_entry = *iter;
 
     string key;
@@ -200,7 +206,7 @@ static int cls_user_complete_stats_sync(cls_method_context_t hctx, bufferlist *i
   cls_user_complete_stats_sync_op op;
   try {
     decode(op, in_iter);
-  } catch (buffer::error& err) {
+  } catch (ceph::buffer::error& err) {
     CLS_LOG(1, "ERROR: cls_user_add_op(): failed to decode op");
     return -EINVAL;
   }
@@ -233,7 +239,7 @@ static int cls_user_remove_bucket(cls_method_context_t hctx, bufferlist *in, buf
   cls_user_remove_bucket_op op;
   try {
     decode(op, in_iter);
-  } catch (buffer::error& err) {
+  } catch (ceph::buffer::error& err) {
     CLS_LOG(1, "ERROR: cls_user_add_op(): failed to decode op");
     return -EINVAL;
   }
@@ -285,7 +291,7 @@ static int cls_user_list_buckets(cls_method_context_t hctx, bufferlist *in, buff
   cls_user_list_buckets_op op;
   try {
     decode(op, in_iter);
-  } catch (buffer::error& err) {
+  } catch (ceph::buffer::error& err) {
     CLS_LOG(1, "ERROR: cls_user_list_op(): failed to decode op");
     return -EINVAL;
   }
@@ -313,8 +319,8 @@ static int cls_user_list_buckets(cls_method_context_t hctx, bufferlist *in, buff
           to_index.c_str(),
           match_prefix.c_str());
 
-  list<cls_user_bucket_entry>& entries = ret.entries;
-  map<string, bufferlist>::iterator iter = keys.begin();
+  auto& entries = ret.entries;
+  auto iter = keys.begin();
 
   string marker;
 
@@ -333,7 +339,7 @@ static int cls_user_list_buckets(cls_method_context_t hctx, bufferlist *in, buff
       cls_user_bucket_entry e;
       decode(e, biter);
       entries.push_back(e);
-    } catch (buffer::error& err) {
+    } catch (ceph::buffer::error& err) {
       CLS_LOG(0, "ERROR: cls_user_list: could not decode entry, index=%s", index.c_str());
     }
   }
@@ -354,7 +360,7 @@ static int cls_user_get_header(cls_method_context_t hctx, bufferlist *in, buffer
   cls_user_get_header_op op;
   try {
     decode(op, in_iter);
-  } catch (buffer::error& err) {
+  } catch (ceph::buffer::error& err) {
     CLS_LOG(1, "ERROR: cls_user_get_header_op(): failed to decode op");
     return -EINVAL;
   }
@@ -382,7 +388,7 @@ static int cls_user_reset_stats(cls_method_context_t hctx,
   try {
     auto bliter = in->cbegin();
     decode(op, bliter);
-  } catch (buffer::error& err) {
+  } catch (ceph::buffer::error& err) {
     CLS_LOG(0, "ERROR: %s failed to decode op", __func__);
     return -EINVAL;
   }
@@ -407,7 +413,7 @@ static int cls_user_reset_stats(cls_method_context_t hctx,
        auto bl = kv.second;
        auto bliter = bl.cbegin();
        decode(e, bliter);
-      } catch (buffer::error& err) {
+      } catch (ceph::buffer::error& err) {
        CLS_LOG(0, "ERROR: %s failed to decode bucket entry for %s",
                __func__, kv.first.c_str());
        return -EIO;
@@ -523,4 +529,3 @@ CLS_INIT(user)
 
   return;
 }
-