]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: allow ObjectReadOperation::stat() to get time_t mtime
authorSage Weil <sage.weil@dreamhost.com>
Mon, 16 Jan 2012 18:19:19 +0000 (10:19 -0800)
committerSage Weil <sage.weil@dreamhost.com>
Mon, 16 Jan 2012 18:19:19 +0000 (10:19 -0800)
We can't use the internal utime_t type here.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/include/rados/librados.hpp
src/librados.cc
src/osdc/Objecter.h
src/rgw/rgw_rados.cc

index 04f1bc50845df799cb64231954ff914e02c6ef5c..e27f9fc3f78ff1f07f12be9af76a3aa8ad0fef0c 100644 (file)
@@ -187,7 +187,7 @@ namespace librados
     ObjectReadOperation() {}
     ~ObjectReadOperation() {}
 
-    void stat(uint64_t *psize, int *prval);
+    void stat(uint64_t *psize, 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);
index 1e48cabc808ef289b3b88ad946a36a9aa214b317..28c43bf1b4c02e4135f28b303d1f09f0cc864277 100644 (file)
@@ -189,10 +189,10 @@ void librados::ObjectOperation::exec(const char *cls, const char *method, buffer
   o->call(cls, method, inbl);
 }
 
-void librados::ObjectReadOperation::stat(uint64_t *psize, int *prval)
+void librados::ObjectReadOperation::stat(uint64_t *psize, time_t *pmtime, int *prval)
 {
   ::ObjectOperation *o = (::ObjectOperation *)impl;
-  o->stat(psize, NULL, prval);
+  o->stat(psize, pmtime, prval);
 }
 
 void librados::ObjectReadOperation::read(size_t off, uint64_t len, bufferlist *pbl, int *prval)
index 346a347f6d072ccef3cbe6b8b5c7cc4455b01383..94abea0fe1ac99fe72d4f1091760a3c3c879f43e 100644 (file)
@@ -176,7 +176,8 @@ struct ObjectOperation {
     bufferlist bl;
     uint64_t *psize;
     utime_t *pmtime;
-    C_ObjectOperation_stat(uint64_t *ps, utime_t *pm) : psize(ps), pmtime(pm) {}
+    time_t *ptime;
+    C_ObjectOperation_stat(uint64_t *ps, utime_t *pm, time_t *pt) : psize(ps), pmtime(pm), ptime(pt) {}
     void finish(int r) {
       if (r >= 0) {
        bufferlist::iterator p = bl.begin();
@@ -189,6 +190,8 @@ struct ObjectOperation {
            *psize = size;
          if (pmtime)
            *pmtime = mtime;
+         if (ptime)
+           *ptime = mtime.sec();
        }
        catch (buffer::error& e) {
          r = -EIO;
@@ -198,7 +201,14 @@ struct ObjectOperation {
   };
   void stat(uint64_t *psize, utime_t *pmtime, int *prval) {
     unsigned p = ops.size() - 1;
-    C_ObjectOperation_stat *h = new C_ObjectOperation_stat(psize, pmtime);
+    C_ObjectOperation_stat *h = new C_ObjectOperation_stat(psize, pmtime, NULL);
+    out_bl[p] = &h->bl;
+    out_handler[p] = h;
+    out_rval[p] = prval;
+  }
+  void stat(uint64_t *psize, time_t *ptime, int *prval) {
+    unsigned p = ops.size() - 1;
+    C_ObjectOperation_stat *h = new C_ObjectOperation_stat(psize, NULL, ptime);
     out_bl[p] = &h->bl;
     out_handler[p] = h;
     out_rval[p] = prval;
index d11556a833f058e3246da9b47d0fe86957d07aa6..a9b175fb3c417ae838702de0bf48d0490070bb1c 100644 (file)
@@ -1784,7 +1784,7 @@ int RGWRados::obj_stat(void *ctx, rgw_obj& obj, uint64_t *psize, time_t *pmtime,
 
   ObjectReadOperation op;
   op.getxattrs(&attrset, NULL);
-  op.stat(&size, NULL);
+  op.stat(&size, &mtime, NULL);
   if (first_chunk) {
     op.read(0, RGW_MAX_CHUNK_SIZE, first_chunk, NULL);
   }