From: Radoslaw Zarzynski Date: Mon, 12 Oct 2015 16:45:13 +0000 (+0200) Subject: rgw: improve code formatting in Swift's DLO implementation. X-Git-Tag: v10.0.2~36^2~21 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=619e9452aaff14c70c07dc416b44d0baf17cd5ed;p=ceph.git rgw: improve code formatting in Swift's DLO implementation. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index cfaee4e6fce..f5f49848ec8 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -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(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; } diff --git a/src/rgw/rgw_op.h b/src/rgw/rgw_op.h index 29d679677c3..0bd49a87444 100644 --- a/src/rgw/rgw_op.h +++ b/src/rgw/rgw_op.h @@ -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);