From: Jianpeng Ma Date: Thu, 11 Dec 2014 05:53:52 +0000 (+0800) Subject: librados/ObjectOperation: add new function set_op_flags2 X-Git-Tag: v0.91~55^2~3^2~22 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c5ed33d3f3c136dd0105d9d646c66b80b9c01a76;p=ceph.git librados/ObjectOperation: add new function set_op_flags2 After adding four read/write fadvise flags OP_FADVISE_*, those flags can set multi flags at the same time. For compatibility, add new function. The old func set_op_flags will be deprecated. Signed-off-by: Jianpeng Ma --- diff --git a/src/include/rados/librados.hpp b/src/include/rados/librados.hpp index 93b64b6ba104..e4ab6ff1a69a 100644 --- a/src/include/rados/librados.hpp +++ b/src/include/rados/librados.hpp @@ -241,7 +241,9 @@ namespace librados virtual ~ObjectOperation(); size_t size(); - void set_op_flags(ObjectOperationFlags flags); + void set_op_flags(ObjectOperationFlags flags) __attribute__((deprecated)); + //flag mean ObjectOperationFlags + void set_op_flags2(int flags); void cmpxattr(const char *name, uint8_t op, const bufferlist& val); void cmpxattr(const char *name, uint8_t op, uint64_t v); diff --git a/src/librados/librados.cc b/src/librados/librados.cc index 8200292eb482..cad285e74776 100644 --- a/src/librados/librados.cc +++ b/src/librados/librados.cc @@ -99,12 +99,19 @@ static void set_op_flags(::ObjectOperation *o, int flags) o->set_last_op_flags(rados_flags); } +//deprcated void librados::ObjectOperation::set_op_flags(ObjectOperationFlags flags) { ::ObjectOperation *o = (::ObjectOperation *)impl; ::set_op_flags(o, (int)flags); } +void librados::ObjectOperation::set_op_flags2(int flags) +{ + ::ObjectOperation *o = (::ObjectOperation *)impl; + ::set_op_flags(o, flags); +} + void librados::ObjectOperation::cmpxattr(const char *name, uint8_t op, const bufferlist& v) { ::ObjectOperation *o = (::ObjectOperation *)impl; diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 2c53454389be..52222274001d 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -4508,7 +4508,7 @@ int RGWRados::clone_objs_impl(void *ctx, rgw_obj& dst_obj, ObjectWriteOperation op; if (truncate_dest) { op.remove(); - op.set_op_flags(OP_FAILOK); // don't fail if object didn't exist + op.set_op_flags2((int)OP_FAILOK); // don't fail if object didn't exist } op.create(exclusive);