]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
remove ceph_real_time_t typedef and overrides using it 7915/head
authorMatt Benjamin <mbenjamin@redhat.com>
Thu, 10 Mar 2016 20:47:19 +0000 (15:47 -0500)
committerMatt Benjamin <mbenjamin@redhat.com>
Thu, 10 Mar 2016 21:54:28 +0000 (16:54 -0500)
The two tests exercising stat2() and mtime2() have been collapsed
into one.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/include/rados/librados.hpp
src/librados/IoCtxImpl.cc
src/librados/IoCtxImpl.h
src/librados/librados.cc
src/test/librados/stat.cc

index e4c988596c4e722082a836da60b6aa6d5930b87b..8450f22a033e46f002159bb10e4113ee2922dfe2 100644 (file)
@@ -51,8 +51,6 @@ namespace librados
   typedef void *completion_t;
   typedef void (*callback_t)(completion_t cb, void *arg);
 
-  typedef void *ceph_real_time_t;
-
   class CEPH_RADOS_API ListObject
   {
   public:
@@ -364,7 +362,6 @@ namespace librados
 
     void mtime(time_t *pt);
     void mtime2(struct timespec *pts);
-    void mtime2(ceph_real_time_t *pmtime);
 
     void create(bool exclusive);
     void create(bool exclusive,
@@ -477,7 +474,6 @@ namespace librados
 
     void stat(uint64_t *psize, time_t *pmtime, int *prval);
     void stat2(uint64_t *psize, struct timespec *pts, int *prval);
-    void stat2(uint64_t *psize, ceph_real_time_t *pmtime, int *prval);
     void getxattr(const char *name, bufferlist *pbl, int *prval);
     void getxattrs(std::map<std::string, bufferlist> *pattrs, int *prval);
     void read(size_t off, uint64_t len, bufferlist *pbl, int *prval);
@@ -702,7 +698,6 @@ namespace librados
     int rmxattr(const std::string& oid, const char *name);
     int stat(const std::string& oid, uint64_t *psize, time_t *pmtime);
     int stat2(const std::string& oid, uint64_t *psize, struct timespec *pts);
-    int stat2(const std::string& oid, uint64_t *psize, ceph_real_time_t *pmtime);
     int exec(const std::string& oid, const char *cls, const char *method,
             bufferlist& inbl, bufferlist& outbl);
     /**
@@ -948,7 +943,6 @@ namespace librados
 
     int aio_stat(const std::string& oid, AioCompletion *c, uint64_t *psize, time_t *pmtime);
     int aio_stat2(const std::string& oid, AioCompletion *c, uint64_t *psize, struct timespec *pts);
-    int aio_stat2(const std::string& oid, AioCompletion *c, uint64_t *psize, ceph_real_time_t *pmtime);
 
     /**
      * Cancel aio operation
index e4e496d0402a6b1afa89e070851b3df17e81aca9..549666d9cbbaaad6a52cda077e3f118764782f97 100644 (file)
@@ -924,19 +924,6 @@ int librados::IoCtxImpl::aio_stat2(const object_t& oid, AioCompletionImpl *c,
   return 0;
 }
 
-int librados::IoCtxImpl::aio_stat2(const object_t& oid, AioCompletionImpl *c,
-                                 uint64_t *psize, ceph_real_time_t *pmtime)
-{
-  Context *onack = new C_aio_Ack(c);
-
-  c->io = this;
-  c->tid = objecter->stat(oid, oloc,
-                         snap_seq, psize, (ceph::real_time *)pmtime, 0,
-                         onack, &c->objver);
-
-  return 0;
-}
-
 int librados::IoCtxImpl::aio_cancel(AioCompletionImpl *c)
 {
   return objecter->op_cancel(c->tid, -ECANCELED);
@@ -1207,25 +1194,6 @@ int librados::IoCtxImpl::stat2(const object_t& oid, uint64_t *psize, struct time
   return 0;
 }
 
-int librados::IoCtxImpl::stat2(const object_t& oid, uint64_t *psize, ceph_real_time_t *pmtime)
-{
-  uint64_t size;
-  ceph::real_time mtime;
-
-  if (!psize)
-    psize = &size;
-
-  ::ObjectOperation rd;
-  prepare_assert_ops(&rd);
-  rd.stat(psize, (ceph::real_time *)pmtime, NULL);
-  int r = operate_read(oid, &rd, NULL);
-  if (r < 0) {
-    return r;
-  }
-
-  return 0;
-}
-
 int librados::IoCtxImpl::getxattr(const object_t& oid,
                                    const char *name, bufferlist& bl)
 {
index ea7f1feca30e05426666a5f1535d99348e628ed2..47ed90ab01296376a3a152d80360c7684aedb54e 100644 (file)
@@ -138,7 +138,6 @@ struct librados::IoCtxImpl {
   int remove(const object_t& oid, int flags);
   int stat(const object_t& oid, uint64_t *psize, time_t *pmtime);
   int stat2(const object_t& oid, uint64_t *psize, struct timespec *pts);
-  int stat2(const object_t& oid, uint64_t *psize, ceph_real_time_t *pmtime);
   int trunc(const object_t& oid, uint64_t size);
 
   int tmap_update(const object_t& oid, bufferlist& cmdbl);
@@ -207,7 +206,6 @@ struct librados::IoCtxImpl {
               const char *method, bufferlist& inbl, bufferlist *outbl);
   int aio_stat(const object_t& oid, AioCompletionImpl *c, uint64_t *psize, time_t *pmtime);
   int aio_stat2(const object_t& oid, AioCompletionImpl *c, uint64_t *psize, struct timespec *pts);
-  int aio_stat2(const object_t& oid, AioCompletionImpl *c, uint64_t *psize, ceph_real_time_t *pmtime);
   int aio_cancel(AioCompletionImpl *c);
 
   int pool_change_auid(unsigned long long auid);
index 1784cc838888eb2d7a56aad7d9ccfa8cd5589df4..b669de14934dd446c70fe3a52656d32fc4a6aa7d 100644 (file)
@@ -231,11 +231,6 @@ void librados::ObjectReadOperation::stat2(uint64_t *psize, struct timespec *pts,
   ::ObjectOperation *o = &impl->o;
   o->stat(psize, pts, prval);
 }
-void librados::ObjectReadOperation::stat2(uint64_t *psize, ceph_real_time_t *pmtime, int *prval)
-{
-  ::ObjectOperation *o = &impl->o;
-  o->stat(psize, (ceph::real_time *)pmtime, prval);
-}
 
 void librados::ObjectReadOperation::read(size_t off, uint64_t len, bufferlist *pbl, int *prval)
 {
@@ -378,11 +373,6 @@ void librados::ObjectWriteOperation::mtime2(struct timespec *pts)
   }
 }
 
-void librados::ObjectWriteOperation::mtime2(ceph_real_time_t *pmtime)
-{
-  impl->prt = (ceph::real_time *)pmtime;
-}
-
 void librados::ObjectWriteOperation::create(bool exclusive)
 {
   ::ObjectOperation *o = &impl->o;
@@ -1276,12 +1266,6 @@ int librados::IoCtx::stat2(const std::string& oid, uint64_t *psize, struct times
   return io_ctx_impl->stat2(obj, psize, pts);
 }
 
-int librados::IoCtx::stat2(const std::string& oid, uint64_t *psize, ceph_real_time_t *pmtime)
-{
-  object_t obj(oid);
-  return io_ctx_impl->stat2(obj, psize, pmtime);
-}
-
 int librados::IoCtx::exec(const std::string& oid, const char *cls, const char *method,
                          bufferlist& inbl, bufferlist& outbl)
 {
index e3036ab1d4c92e46edcfcb50f339a439e343f824..9641bb8138d2676d6705bca795825639cc37f138 100644 (file)
@@ -53,42 +53,7 @@ TEST_F(LibRadosStatPP, Stat2Mtime2PP) {
   op.write(0, bl);
   ASSERT_EQ(0, ioctx.operate("foo", &op));
 
-  uint64_t size;
-  time_t mtime;
-  ASSERT_EQ(0, ioctx.stat("foo", &size, &mtime));
-  ASSERT_EQ(sizeof(buf), size);
-  ASSERT_EQ(mtime, ts.tv_sec);
-
-  struct timespec ts2;
-  ASSERT_EQ(0, ioctx.stat2("foo", &size, &ts2));
-  ASSERT_EQ(sizeof(buf), size);
-  ASSERT_EQ(ts2.tv_sec, ts.tv_sec);
-  ASSERT_EQ(ts2.tv_nsec, ts.tv_nsec);
-
-  real_time rt;
-  ASSERT_EQ(0, ioctx.stat2("foo", &size, (ceph_real_time_t *)&rt));
-  ASSERT_EQ(sizeof(buf), size);
-
-  struct timespec ts3 = ceph::real_clock::to_timespec(rt);
-  ASSERT_EQ(ts3.tv_sec, ts.tv_sec);
-  ASSERT_EQ(ts3.tv_nsec, ts.tv_nsec);
-
-  ASSERT_EQ(-ENOENT, ioctx.stat2("nonexistent", &size, (ceph_real_time_t *)&rt));
-}
-
-TEST_F(LibRadosStatPP, Stat2Mtime2RealTimePP) {
-  char buf[128];
-  memset(buf, 0xcc, sizeof(buf));
-  bufferlist bl;
-  bl.append(buf, sizeof(buf));
-  librados::ObjectWriteOperation op;
-  struct timespec ts;
-  ts.tv_sec = 1457129052;
-  ts.tv_nsec = 123456789;
-  real_time rt = real_clock::from_timespec(ts);
-  op.mtime2((ceph_real_time_t *)&rt);
-  op.write(0, bl);
-  ASSERT_EQ(0, ioctx.operate("foo", &op));
+  /* XXX time comparison asserts could spuriously fail */
 
   uint64_t size;
   time_t mtime;
@@ -102,13 +67,7 @@ TEST_F(LibRadosStatPP, Stat2Mtime2RealTimePP) {
   ASSERT_EQ(ts2.tv_sec, ts.tv_sec);
   ASSERT_EQ(ts2.tv_nsec, ts.tv_nsec);
 
-  real_time rt2;
-  ASSERT_EQ(0, ioctx.stat2("foo", &size, (ceph_real_time_t *)&rt2));
-  ASSERT_EQ(sizeof(buf), size);
-
-  ASSERT_EQ(rt, rt2);
-
-  ASSERT_EQ(-ENOENT, ioctx.stat2("nonexistent", &size, (ceph_real_time_t *)&rt));
+  ASSERT_EQ(-ENOENT, ioctx.stat2("nonexistent", &size, &ts2));
 }
 
 TEST_F(LibRadosStat, StatNS) {