]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: improve code formatting in Swift's DLO implementation.
authorRadoslaw Zarzynski <rzarzynski@mirantis.com>
Mon, 12 Oct 2015 16:45:13 +0000 (18:45 +0200)
committerRadoslaw Zarzynski <rzarzynski@mirantis.com>
Tue, 8 Dec 2015 16:57:22 +0000 (17:57 +0100)
Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
src/rgw/rgw_op.cc
src/rgw/rgw_op.h

index cfaee4e6fce890d2e8609cb0aea65b37ac45e6ec..f5f49848ec870619804bcee3bc37ef865d9e73d0 100644 (file)
@@ -659,7 +659,11 @@ bool RGWOp::generate_cors_headers(string& origin, string& method, string& header
   return true;
 }
 
-int RGWGetObj::read_user_manifest_part(rgw_bucket& bucket, RGWObjEnt& ent, RGWAccessControlPolicy *bucket_policy, off_t start_ofs, off_t end_ofs)
+int RGWGetObj::read_user_manifest_part(rgw_bucket& bucket,
+                                       const RGWObjEnt& ent,
+                                       RGWAccessControlPolicy * const bucket_policy,
+                                       const off_t start_ofs,
+                                       const off_t end_ofs)
 {
   ldout(s->cct, 20) << "user manifest obj=" << ent.key.name << "[" << ent.key.instance << "]" << dendl;
 
@@ -725,12 +729,22 @@ int RGWGetObj::read_user_manifest_part(rgw_bucket& bucket, RGWObjEnt& ent, RGWAc
   return 0;
 }
 
-static int iterate_user_manifest_parts(CephContext *cct, RGWRados *store, off_t ofs, off_t end,
-                                       rgw_bucket& bucket, string& obj_prefix, RGWAccessControlPolicy *bucket_policy,
-                                       uint64_t *ptotal_len,
-                                       uint64_t *pobj_size,
-                                       int (*cb)(rgw_bucket& bucket, RGWObjEnt& ent, RGWAccessControlPolicy *bucket_policy,
-                                                 off_t start_ofs, off_t end_ofs, void *param), void *cb_param)
+static int iterate_user_manifest_parts(CephContext * const cct,
+                                       RGWRados * const store,
+                                       const off_t ofs,
+                                       const off_t end,
+                                       rgw_bucket& bucket,
+                                       const string& obj_prefix,
+                                       RGWAccessControlPolicy * const bucket_policy,
+                                       uint64_t * const ptotal_len,
+                                       uint64_t * const pobj_size,
+                                       int (*cb)(rgw_bucket& bucket,
+                                                 const RGWObjEnt& ent,
+                                                 RGWAccessControlPolicy * const bucket_policy,
+                                                 off_t start_ofs,
+                                                 off_t end_ofs,
+                                                 void *param),
+                                       void * const cb_param)
 {
   uint64_t obj_ofs = 0, len_count = 0;
   bool found_start = false, found_end = false, handled_end = false;
@@ -779,8 +793,9 @@ static int iterate_user_manifest_parts(CephContext *cct, RGWRados *store, off_t
 
         if (cb) {
           r = cb(bucket, ent, bucket_policy, start_ofs, end_ofs, cb_param);
-          if (r < 0)
+          if (r < 0) {
             return r;
+          }
         }
       }
 
@@ -789,8 +804,9 @@ static int iterate_user_manifest_parts(CephContext *cct, RGWRados *store, off_t
     }
   } while (is_truncated);
 
-  if (ptotal_len)
+  if (ptotal_len) {
     *ptotal_len = len_count;
+  }
   if (pobj_size) {
     *pobj_size = obj_ofs;
   }
@@ -798,8 +814,12 @@ static int iterate_user_manifest_parts(CephContext *cct, RGWRados *store, off_t
   return 0;
 }
 
-static int get_obj_user_manifest_iterate_cb(rgw_bucket& bucket, RGWObjEnt& ent, RGWAccessControlPolicy *bucket_policy, off_t start_ofs, off_t end_ofs,
-                                       void *param)
+static int get_obj_user_manifest_iterate_cb(rgw_bucket& bucket,
+                                            const RGWObjEnt& ent,
+                                            RGWAccessControlPolicy * const bucket_policy,
+                                            const off_t start_ofs,
+                                            const off_t end_ofs,
+                                            void * const param)
 {
   RGWGetObj *op = static_cast<RGWGetObj *>(param);
   return op->read_user_manifest_part(bucket, ent, bucket_policy, start_ofs, end_ofs);
@@ -851,9 +871,12 @@ int RGWGetObj::handle_user_manifest(const char *prefix)
   }
 
   /* dry run to find out total length */
-  int r = iterate_user_manifest_parts(s->cct, store, ofs, end, bucket, obj_prefix, bucket_policy, &total_len, &s->obj_size, NULL, NULL);
-  if (r < 0)
+  int r = iterate_user_manifest_parts(s->cct, store, ofs, end,
+        bucket, obj_prefix, bucket_policy, &total_len, &s->obj_size,
+        NULL, NULL);
+  if (r < 0) {
     return r;
+  }
 
   if (!get_data) {
     bufferlist bl;
@@ -861,9 +884,12 @@ int RGWGetObj::handle_user_manifest(const char *prefix)
     return 0;
   }
 
-  r = iterate_user_manifest_parts(s->cct, store, ofs, end, bucket, obj_prefix, bucket_policy, NULL, NULL, get_obj_user_manifest_iterate_cb, (void *)this);
-  if (r < 0)
+  r = iterate_user_manifest_parts(s->cct, store, ofs, end,
+        bucket, obj_prefix, bucket_policy, NULL, NULL,
+        get_obj_user_manifest_iterate_cb, (void *)this);
+  if (r < 0) {
     return r;
+  }
 
   return 0;
 }
index 29d679677c36d944e6d559516360dd3dd480f17c..0bd49a874449b02bda160d741c23ddf2b32b3382 100644 (file)
@@ -173,7 +173,11 @@ public:
   int verify_permission();
   void pre_exec();
   void execute();
-  int read_user_manifest_part(rgw_bucket& bucket, RGWObjEnt& ent, RGWAccessControlPolicy *bucket_policy, off_t start_ofs, off_t end_ofs);
+  int read_user_manifest_part(rgw_bucket& bucket,
+                              const RGWObjEnt& ent,
+                              RGWAccessControlPolicy *bucket_policy,
+                              off_t start_ofs,
+                              off_t end_ofs);
   int handle_user_manifest(const char *prefix);
 
   int get_data_cb(bufferlist& bl, off_t ofs, off_t len);