]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Revert "librados,librbd: use 64-bit offsets and lengths"
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Mon, 14 Mar 2011 12:10:48 +0000 (05:10 -0700)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Mon, 14 Mar 2011 12:10:48 +0000 (05:10 -0700)
This reverts commit f294b26746a30960971757c42d679208a99995a7.

src/include/rados/librados.h
src/include/rados/librados.hpp
src/include/rbd/librbd.h
src/include/rbd/librbd.hpp
src/librados.cc
src/librbd.cc
src/rados.cc
src/rbd.cc

index 4eadbca870c29fb80ce594e290971d9c17f1587b..00e4e7cc86428aa640c27c7bc2a9af179d1d98eb 100644 (file)
@@ -136,23 +136,23 @@ int rados_ioctx_snap_get_stamp(rados_ioctx_t io, rados_snap_t id, time_t *t);
 /* sync io */
 uint64_t rados_get_last_version(rados_ioctx_t io);
 
-int rados_write(rados_ioctx_t io, const char *oid, const char *buf, uint64_t len, off_t off);
-int rados_append(rados_ioctx_t io, const char *oid, const char *buf, uint64_t len);
-int rados_write_full(rados_ioctx_t io, const char *oid, const char *buf, uint64_t len, off_t off);
-int rados_read(rados_ioctx_t io, const char *oid, char *buf, uint64_t len, off_t off);
+int rados_write(rados_ioctx_t io, const char *oid, const char *buf, size_t len, off_t off);
+int rados_append(rados_ioctx_t io, const char *oid, const char *buf, size_t len);
+int rados_write_full(rados_ioctx_t io, const char *oid, const char *buf, size_t len, off_t off);
+int rados_read(rados_ioctx_t io, const char *oid, char *buf, size_t len, off_t off);
 int rados_remove(rados_ioctx_t io, const char *oid);
-int rados_trunc(rados_ioctx_t io, const char *oid, uint64_t size);
+int rados_trunc(rados_ioctx_t io, const char *oid, size_t size);
 
 /* attrs */
-int rados_getxattr(rados_ioctx_t io, const char *o, const char *name, char *buf, uint64_t len);
-int rados_setxattr(rados_ioctx_t io, const char *o, const char *name, const char *buf, uint64_t len);
+int rados_getxattr(rados_ioctx_t io, const char *o, const char *name, char *buf, size_t len);
+int rados_setxattr(rados_ioctx_t io, const char *o, const char *name, const char *buf, size_t len);
 int rados_rmxattr(rados_ioctx_t io, const char *o, const char *name);
 
 /* misc */
 int rados_stat(rados_ioctx_t io, const char *o, uint64_t *psize, time_t *pmtime);
-int rados_tmap_update(rados_ioctx_t io, const char *o, const char *cmdbuf, uint64_t cmdbuflen);
+int rados_tmap_update(rados_ioctx_t io, const char *o, const char *cmdbuf, size_t cmdbuflen);
 int rados_exec(rados_ioctx_t io, const char *oid, const char *cls, const char *method,
-              const char *in_buf, uint64_t in_len, char *buf, uint64_t out_len);
+              const char *in_buf, size_t in_len, char *buf, size_t out_len);
 
 /* async io */
 typedef void *rados_completion_t;
@@ -169,16 +169,16 @@ uint64_t rados_aio_get_obj_ver(rados_completion_t c);
 void rados_aio_release(rados_completion_t c);
 int rados_aio_write(rados_ioctx_t io, const char *oid,
                    rados_completion_t completion,
-                   const char *buf, uint64_t len, off_t off);
+                   const char *buf, size_t len, off_t off);
 int rados_aio_append(rados_ioctx_t io, const char *oid,
                     rados_completion_t completion,
-                    const char *buf, uint64_t len);
+                    const char *buf, size_t len);
 int rados_aio_write_full(rados_ioctx_t io, const char *oid,
                         rados_completion_t completion,
-                        const char *buf, uint64_t len);
+                        const char *buf, size_t len);
 int rados_aio_read(rados_ioctx_t io, const char *oid,
                   rados_completion_t completion,
-                  char *buf, uint64_t len, off_t off);
+                  char *buf, size_t len, off_t off);
 
 /* watch/notify */
 typedef void (*rados_watchcb_t)(uint8_t opcode, uint64_t ver, void *arg);
index 953f7d085a3c7f077db21ebe164bae4c48582f3a..00aa1ed3217f03408361d7c6311a51234af811a9 100644 (file)
@@ -118,14 +118,14 @@ namespace librados
     // create an object
     int create(const std::string& oid, bool exclusive);
 
-    int write(const std::string& oid, bufferlist& bl, uint64_t len, off_t off);
-    int append(const std::string& oid, bufferlist& bl, uint64_t len);
+    int write(const std::string& oid, bufferlist& bl, size_t len, off_t off);
+    int append(const std::string& oid, bufferlist& bl, size_t len);
     int write_full(const std::string& oid, bufferlist& bl);
-    int read(const std::string& oid, bufferlist& bl, uint64_t len, off_t off);
+    int read(const std::string& oid, bufferlist& bl, size_t len, off_t off);
     int remove(const std::string& oid);
-    int trunc(const std::string& oid, uint64_t size);
-    int mapext(const std::string& o, off_t off, uint64_t len, std::map<off_t, uint64_t>& m);
-    int sparse_read(const std::string& o, std::map<off_t, uint64_t>& m, bufferlist& bl, uint64_t len, off_t off);
+    int trunc(const std::string& oid, size_t size);
+    int mapext(const std::string& o, off_t off, size_t len, std::map<off_t, size_t>& m);
+    int sparse_read(const std::string& o, std::map<off_t, size_t>& m, bufferlist& bl, size_t len, off_t off);
     int getxattr(const std::string& oid, const char *name, bufferlist& bl);
     int getxattrs(const std::string& oid, std::map<std::string, bufferlist>& attrset);
     int setxattr(const std::string& oid, const char *name, bufferlist& bl);
@@ -168,14 +168,14 @@ namespace librados
     uint64_t get_last_version();
 
     int aio_read(const std::string& oid, AioCompletion *c,
-                bufferlist *pbl, uint64_t len, off_t off);
+                bufferlist *pbl, size_t len, off_t off);
     int aio_sparse_read(const std::string& oid, AioCompletion *c,
-                       std::map<off_t,uint64_t> *m, bufferlist *data_bl,
-                       uint64_t len, off_t off);
+                       std::map<off_t,size_t> *m, bufferlist *data_bl,
+                       size_t len, off_t off);
     int aio_write(const std::string& oid, AioCompletion *c, const bufferlist& bl,
-                 uint64_t len, off_t off);
+                 size_t len, off_t off);
     int aio_append(const std::string& oid, AioCompletion *c, const bufferlist& bl,
-                 uint64_t len);
+                 size_t len);
     int aio_write_full(const std::string& oid, AioCompletion *c, const bufferlist& bl);
 
     // watch/notify
index dee7e40848032a9c9c1240c568a2d004cc3cd9da..2206648197402272ccf8676fe8c7fc5a1903eee5 100644 (file)
@@ -59,15 +59,15 @@ typedef struct {
 void rbd_version(int *major, int *minor, int *extra);
 
 /* images */
-int rbd_list(rados_ioctx_t io, char *names, uint64_t *size);
-int rbd_create(rados_ioctx_t io, const char *name, uint64_t size, int *order);
+int rbd_list(rados_ioctx_t io, char *names, size_t *size);
+int rbd_create(rados_ioctx_t io, const char *name, size_t size, int *order);
 int rbd_remove(rados_ioctx_t io, const char *name);
 int rbd_copy(rados_ioctx_t src_io_ctx, const char *srcname, rados_ioctx_t dest_io_ctx, const char *destname);
 int rbd_rename(rados_ioctx_t src_io_ctx, const char *srcname, const char *destname);
 
 int rbd_open(rados_ioctx_t io, const char *name, rbd_image_t *image, const char *snap_name);
 int rbd_close(rbd_image_t image);
-int rbd_resize(rbd_image_t image, uint64_t size);
+int rbd_resize(rbd_image_t image, size_t size);
 int rbd_stat(rbd_image_t image, rbd_image_info_t *info, size_t infosize);
 
 /* snapshots */
@@ -81,12 +81,12 @@ int rbd_snap_set(rbd_image_t image, const char *snapname);
 /* I/O */
 typedef void *rbd_completion_t;
 typedef void (*rbd_callback_t)(rbd_completion_t cb, void *arg);
-int rbd_read(rbd_image_t image, off_t ofs, uint64_t len, char *buf);
-int rbd_read_iterate(rbd_image_t image, off_t ofs, uint64_t len,
-                    int (*cb)(off_t, uint64_t, const char *, void *), void *arg);
-int rbd_write(rbd_image_t image, off_t ofs, uint64_t len, const char *buf);
-int rbd_aio_write(rbd_image_t image, off_t off, uint64_t len, const char *buf, rbd_completion_t c);
-int rbd_aio_read(rbd_image_t image, off_t off, uint64_t len, char *buf, rbd_completion_t c);
+int rbd_read(rbd_image_t image, off_t ofs, size_t len, char *buf);
+int rbd_read_iterate(rbd_image_t image, off_t ofs, size_t len,
+                    int (*cb)(off_t, size_t, const char *, void *), void *arg);
+int rbd_write(rbd_image_t image, off_t ofs, size_t len, const char *buf);
+int rbd_aio_write(rbd_image_t image, off_t off, size_t len, const char *buf, rbd_completion_t c);
+int rbd_aio_read(rbd_image_t image, off_t off, size_t len, char *buf, rbd_completion_t c);
 int rbd_aio_create_completion(void *cb_arg, rbd_callback_t complete_cb, rbd_completion_t *c);
 int rbd_aio_wait_for_complete(rbd_completion_t c);
 int rbd_aio_get_return_value(rbd_completion_t c);
index 6038fb12203eb26c1cc90546fb5cb433c71699c9..66a46a66d59f96c2d37d9ba0a382e973107d36d6 100644 (file)
@@ -60,7 +60,7 @@ public:
   int open(IoCtx& io_ctx, Image& image, const char *name);
   int open(IoCtx& io_ctx, Image& image, const char *name, const char *snapname);
   int list(IoCtx& io_ctx, std::vector<std::string>& names);
-  int create(IoCtx& io_ctx, const char *name, uint64_t size, int *order);
+  int create(IoCtx& io_ctx, const char *name, size_t size, int *order);
   int remove(IoCtx& io_ctx, const char *name);
   int copy(IoCtx& src_io_ctx, const char *srcname, IoCtx& dest_io_ctx, const char *destname);
   int rename(IoCtx& src_io_ctx, const char *srcname, const char *destname);
@@ -77,7 +77,7 @@ public:
   Image();
   ~Image();
 
-  int resize(uint64_t size);
+  int resize(size_t size);
   int stat(image_info_t &info, size_t infosize);
 
   /* snapshots */
@@ -88,13 +88,13 @@ public:
   int snap_set(const char *snap_name);
 
   /* I/O */
-  int read(off_t ofs, uint64_t len, ceph::bufferlist& bl);
-  int read_iterate(off_t ofs, uint64_t len,
-                   int (*cb)(off_t, uint64_t, const char *, void *), void *arg);
-  int write(off_t ofs, uint64_t len, ceph::bufferlist& bl);
+  int read(off_t ofs, size_t len, ceph::bufferlist& bl);
+  int read_iterate(off_t ofs, size_t len,
+                   int (*cb)(off_t, size_t, const char *, void *), void *arg);
+  int write(off_t ofs, size_t len, ceph::bufferlist& bl);
 
-  int aio_write(off_t off, uint64_t len, ceph::bufferlist& bl, RBD::AioCompletion *c);
-  int aio_read(off_t off, uint64_t len, ceph::bufferlist& bl, RBD::AioCompletion *c);
+  int aio_write(off_t off, size_t len, ceph::bufferlist& bl, RBD::AioCompletion *c);
+  int aio_read(off_t off, size_t len, ceph::bufferlist& bl, RBD::AioCompletion *c);
 
 private:
   friend class RBD;
index e1c4057d9808481477e06ebc8c51d3af49b0a401..9f5d68e1dd1986dad0464e67e6a0d175d0e1f7af 100644 (file)
@@ -307,16 +307,16 @@ public:
 
   // io
   int create(IoCtxImpl& io, const object_t& oid, bool exclusive);
-  int write(IoCtxImpl& io, const object_t& oid, bufferlist& bl, uint64_t len, off_t off);
-  int append(IoCtxImpl& io, const object_t& oid, bufferlist& bl, uint64_t len);
+  int write(IoCtxImpl& io, const object_t& oid, bufferlist& bl, size_t len, off_t off);
+  int append(IoCtxImpl& io, const object_t& oid, bufferlist& bl, size_t len);
   int write_full(IoCtxImpl& io, const object_t& oid, bufferlist& bl);
-  int read(IoCtxImpl& io, const object_t& oid, bufferlist& bl, uint64_t len, off_t off);
-  int mapext(IoCtxImpl& io, const object_t& oid, off_t off, uint64_t len, std::map<off_t,uint64_t>& m);
-  int sparse_read(IoCtxImpl& io, const object_t& oid, std::map<off_t,uint64_t>& m, bufferlist& bl,
-                 uint64_t len, off_t off);
+  int read(IoCtxImpl& io, const object_t& oid, bufferlist& bl, size_t len, off_t off);
+  int mapext(IoCtxImpl& io, const object_t& oid, off_t off, size_t len, std::map<off_t,size_t>& m);
+  int sparse_read(IoCtxImpl& io, const object_t& oid, std::map<off_t,size_t>& m, bufferlist& bl,
+                 size_t len, off_t off);
   int remove(IoCtxImpl& io, const object_t& oid);
   int stat(IoCtxImpl& io, const object_t& oid, uint64_t *psize, time_t *pmtime);
-  int trunc(IoCtxImpl& io, const object_t& oid, uint64_t size);
+  int trunc(IoCtxImpl& io, const object_t& oid, size_t size);
 
   int tmap_update(IoCtxImpl& io, const object_t& oid, bufferlist& cmdbl);
   int exec(IoCtxImpl& io, const object_t& oid, const char *cls, const char *method, bufferlist& inbl, bufferlist& outbl);
@@ -371,7 +371,7 @@ public:
   struct C_aio_sparse_read_Ack : public Context {
     AioCompletionImpl *c;
     bufferlist *data_bl;
-    std::map<off_t,uint64_t> *m;
+    std::map<off_t,size_t> *m;
 
     void finish(int r) {
       c->lock.Lock();
@@ -427,16 +427,16 @@ public:
   };
 
   int aio_read(IoCtxImpl& io, const object_t oid, AioCompletionImpl *c,
-                         bufferlist *pbl, uint64_t len, off_t off);
+                         bufferlist *pbl, size_t len, off_t off);
   int aio_read(IoCtxImpl& io, object_t oid, AioCompletionImpl *c,
-              char *buf, uint64_t len, off_t off);
+              char *buf, size_t len, off_t off);
   int aio_sparse_read(IoCtxImpl& io, const object_t oid,
-                   AioCompletionImpl *c, std::map<off_t,uint64_t> *m,
-                   bufferlist *data_bl, uint64_t len, off_t off);
+                   AioCompletionImpl *c, std::map<off_t,size_t> *m,
+                   bufferlist *data_bl, size_t len, off_t off);
   int aio_write(IoCtxImpl& io, const object_t &oid, AioCompletionImpl *c,
-               const bufferlist& bl, uint64_t len, off_t off);
+               const bufferlist& bl, size_t len, off_t off);
   int aio_append(IoCtxImpl& io, const object_t &oid, AioCompletionImpl *c,
-                const bufferlist& bl, uint64_t len);
+                const bufferlist& bl, size_t len);
   int aio_write_full(IoCtxImpl& io, const object_t &oid, AioCompletionImpl *c,
                     const bufferlist& bl);
 
@@ -1065,7 +1065,7 @@ create(IoCtxImpl& io, const object_t& oid, bool exclusive)
 }
 
 int librados::RadosClient::
-write(IoCtxImpl& io, const object_t& oid, bufferlist& bl, uint64_t len, off_t off)
+write(IoCtxImpl& io, const object_t& oid, bufferlist& bl, size_t len, off_t off)
 {
   utime_t ut = g_clock.now();
 
@@ -1108,7 +1108,7 @@ write(IoCtxImpl& io, const object_t& oid, bufferlist& bl, uint64_t len, off_t of
 }
 
 int librados::RadosClient::
-append(IoCtxImpl& io, const object_t& oid, bufferlist& bl, uint64_t len)
+append(IoCtxImpl& io, const object_t& oid, bufferlist& bl, size_t len)
 {
   utime_t ut = g_clock.now();
 
@@ -1192,7 +1192,7 @@ write_full(IoCtxImpl& io, const object_t& oid, bufferlist& bl)
 
 int librados::RadosClient::
 aio_read(IoCtxImpl& io, const object_t oid, AioCompletionImpl *c,
-         bufferlist *pbl, uint64_t len, off_t off)
+         bufferlist *pbl, size_t len, off_t off)
 {
 
   Context *onack = new C_aio_Ack(c);
@@ -1209,7 +1209,7 @@ aio_read(IoCtxImpl& io, const object_t oid, AioCompletionImpl *c,
 
 int librados::RadosClient::
 aio_read(IoCtxImpl& io, const object_t oid, AioCompletionImpl *c,
-         char *buf, uint64_t len, off_t off)
+         char *buf, size_t len, off_t off)
 {
   Context *onack = new C_aio_Ack(c);
 
@@ -1226,8 +1226,8 @@ aio_read(IoCtxImpl& io, const object_t oid, AioCompletionImpl *c,
 
 int librados::RadosClient::
 aio_sparse_read(IoCtxImpl& io, const object_t oid,
-                AioCompletionImpl *c, std::map<off_t,uint64_t> *m,
-                bufferlist *data_bl, uint64_t len, off_t off)
+                AioCompletionImpl *c, std::map<off_t,size_t> *m,
+                bufferlist *data_bl, size_t len, off_t off)
 {
 
   C_aio_sparse_read_Ack *onack = new C_aio_sparse_read_Ack(c);
@@ -1246,7 +1246,7 @@ aio_sparse_read(IoCtxImpl& io, const object_t oid,
 
 int librados::RadosClient::
 aio_write(IoCtxImpl& io, const object_t &oid, AioCompletionImpl *c,
-          const bufferlist& bl, uint64_t len, off_t off)
+          const bufferlist& bl, size_t len, off_t off)
 {
   utime_t ut = g_clock.now();
 
@@ -1263,7 +1263,7 @@ aio_write(IoCtxImpl& io, const object_t &oid, AioCompletionImpl *c,
 
 int librados::RadosClient::
 aio_append(IoCtxImpl& io, const object_t &oid, AioCompletionImpl *c,
-          const bufferlist& bl, uint64_t len)
+          const bufferlist& bl, size_t len)
 {
   utime_t ut = g_clock.now();
 
@@ -1332,7 +1332,7 @@ remove(IoCtxImpl& io, const object_t& oid)
 }
 
 int librados::RadosClient::
-trunc(IoCtxImpl& io, const object_t& oid, uint64_t size)
+trunc(IoCtxImpl& io, const object_t& oid, size_t size)
 {
   utime_t ut = g_clock.now();
 
@@ -1444,7 +1444,7 @@ exec(IoCtxImpl& io, const object_t& oid, const char *cls, const char *method,
 
 int librados::
 RadosClient::read(IoCtxImpl& io, const object_t& oid,
-                  bufferlist& bl, uint64_t len, off_t off)
+                  bufferlist& bl, size_t len, off_t off)
 {
   Mutex mylock("RadosClient::read::mylock");
   Cond cond;
@@ -1485,7 +1485,7 @@ RadosClient::read(IoCtxImpl& io, const object_t& oid,
 }
 
 int librados::RadosClient::
-mapext(IoCtxImpl& io, const object_t& oid, off_t off, uint64_t len, std::map<off_t,uint64_t>& m)
+mapext(IoCtxImpl& io, const object_t& oid, off_t off, size_t len, std::map<off_t,size_t>& m)
 {
   bufferlist bl;
 
@@ -1518,7 +1518,7 @@ mapext(IoCtxImpl& io, const object_t& oid, off_t off, uint64_t len, std::map<off
 
 int librados::RadosClient::
 sparse_read(IoCtxImpl& io, const object_t& oid,
-         std::map<off_t,uint64_t>& m, bufferlist& data_bl, uint64_t len, off_t off)
+         std::map<off_t,size_t>& m, bufferlist& data_bl, size_t len, off_t off)
 {
   bufferlist bl;
 
@@ -2121,14 +2121,14 @@ create(const std::string& oid, bool exclusive)
 }
 
 int librados::IoCtx::
-write(const std::string& oid, bufferlist& bl, uint64_t len, off_t off)
+write(const std::string& oid, bufferlist& bl, size_t len, off_t off)
 {
   object_t obj(oid);
   return io_ctx_impl->client->write(*io_ctx_impl, obj, bl, len, off);
 }
 
 int librados::IoCtx::
-append(const std::string& oid, bufferlist& bl, uint64_t len)
+append(const std::string& oid, bufferlist& bl, size_t len)
 {
   object_t obj(oid);
   return io_ctx_impl->client->append(*io_ctx_impl, obj, bl, len);
@@ -2142,7 +2142,7 @@ write_full(const std::string& oid, bufferlist& bl)
 }
 
 int librados::IoCtx::
-read(const std::string& oid, bufferlist& bl, uint64_t len, off_t off)
+read(const std::string& oid, bufferlist& bl, size_t len, off_t off)
 {
   object_t obj(oid);
   return io_ctx_impl->client->read(*io_ctx_impl, obj, bl, len, off);
@@ -2156,22 +2156,22 @@ remove(const std::string& oid)
 }
 
 int librados::IoCtx::
-trunc(const std::string& oid, uint64_t size)
+trunc(const std::string& oid, size_t size)
 {
   object_t obj(oid);
   return io_ctx_impl->client->trunc(*io_ctx_impl, obj, size);
 }
 
 int librados::IoCtx::
-mapext(const std::string& oid, off_t off, uint64_t len, std::map<off_t, uint64_t>& m)
+mapext(const std::string& oid, off_t off, size_t len, std::map<off_t, size_t>& m)
 {
   object_t obj(oid);
   return io_ctx_impl->client->mapext(*io_ctx_impl, oid, off, len, m);
 }
 
 int librados::IoCtx::
-sparse_read(const std::string& oid, std::map<off_t, uint64_t>& m,
-           bufferlist& bl, uint64_t len, off_t off)
+sparse_read(const std::string& oid, std::map<off_t, size_t>& m,
+           bufferlist& bl, size_t len, off_t off)
 {
   object_t obj(oid);
   return io_ctx_impl->client->sparse_read(*io_ctx_impl, oid, m, bl, len, off);
@@ -2322,15 +2322,15 @@ get_last_version()
 
 int librados::IoCtx::
 aio_read(const std::string& oid, librados::AioCompletion *c,
-        bufferlist *pbl, uint64_t len, off_t off)
+        bufferlist *pbl, size_t len, off_t off)
 {
   return io_ctx_impl->client->aio_read(*io_ctx_impl, oid, c->pc, pbl, len, off);
 }
 
 int librados::IoCtx::
 aio_sparse_read(const std::string& oid, librados::AioCompletion *c,
-               std::map<off_t,uint64_t> *m, bufferlist *data_bl,
-               uint64_t len, off_t off)
+               std::map<off_t,size_t> *m, bufferlist *data_bl,
+               size_t len, off_t off)
 {
   return io_ctx_impl->client->aio_sparse_read(*io_ctx_impl, oid, c->pc,
                                           m, data_bl, len, off);
@@ -2338,14 +2338,14 @@ aio_sparse_read(const std::string& oid, librados::AioCompletion *c,
 
 int librados::IoCtx::
 aio_write(const std::string& oid, librados::AioCompletion *c, const bufferlist& bl,
-         uint64_t len, off_t off)
+         size_t len, off_t off)
 {
   return io_ctx_impl->client->aio_write(*io_ctx_impl, oid, c->pc, bl, len, off);
 }
 
 int librados::IoCtx::
 aio_append(const std::string& oid, librados::AioCompletion *c, const bufferlist& bl,
-         uint64_t len)
+         size_t len)
 {
   return io_ctx_impl->client->aio_append(*io_ctx_impl, oid, c->pc, bl, len);
 }
@@ -2761,7 +2761,7 @@ extern "C" int rados_snap_set_write_context(rados_ioctx_t io, rados_snap_t seq,
   return ctx->set_snap_write_context((snapid_t)seq, snv);
 }
 
-extern "C" int rados_write(rados_ioctx_t io, const char *o, const char *buf, uint64_t len, off_t off)
+extern "C" int rados_write(rados_ioctx_t io, const char *o, const char *buf, size_t len, off_t off)
 {
   librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io;
   object_t oid(o);
@@ -2770,7 +2770,7 @@ extern "C" int rados_write(rados_ioctx_t io, const char *o, const char *buf, uin
   return ctx->client->write(*ctx, oid, bl, len, off);
 }
 
-extern "C" int rados_append(rados_ioctx_t io, const char *o, const char *buf, uint64_t len)
+extern "C" int rados_append(rados_ioctx_t io, const char *o, const char *buf, size_t len)
 {
   librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io;
   object_t oid(o);
@@ -2779,7 +2779,7 @@ extern "C" int rados_append(rados_ioctx_t io, const char *o, const char *buf, ui
   return ctx->client->append(*ctx, oid, bl, len);
 }
 
-extern "C" int rados_write_full(rados_ioctx_t io, const char *o, const char *buf, uint64_t len, off_t off)
+extern "C" int rados_write_full(rados_ioctx_t io, const char *o, const char *buf, size_t len, off_t off)
 {
   librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io;
   object_t oid(o);
@@ -2788,7 +2788,7 @@ extern "C" int rados_write_full(rados_ioctx_t io, const char *o, const char *buf
   return ctx->client->write_full(*ctx, oid, bl);
 }
 
-extern "C" int rados_trunc(rados_ioctx_t io, const char *o, uint64_t size)
+extern "C" int rados_trunc(rados_ioctx_t io, const char *o, size_t size)
 {
   librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io;
   object_t oid(o);
@@ -2802,7 +2802,7 @@ extern "C" int rados_remove(rados_ioctx_t io, const char *o)
   return ctx->client->remove(*ctx, oid);
 }
 
-extern "C" int rados_read(rados_ioctx_t io, const char *o, char *buf, uint64_t len, off_t off)
+extern "C" int rados_read(rados_ioctx_t io, const char *o, char *buf, size_t len, off_t off)
 {
   librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io;
   int ret;
@@ -2961,7 +2961,7 @@ extern "C" int rados_ioctx_snap_get_stamp(rados_ioctx_t io, rados_snap_t id, tim
 }
 
 extern "C" int rados_getxattr(rados_ioctx_t io, const char *o, const char *name,
-                             char *buf, uint64_t len)
+                             char *buf, size_t len)
 {
   librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io;
   int ret;
@@ -2978,7 +2978,7 @@ extern "C" int rados_getxattr(rados_ioctx_t io, const char *o, const char *name,
   return ret;
 }
 
-extern "C" int rados_setxattr(rados_ioctx_t io, const char *o, const char *name, const char *buf, uint64_t len)
+extern "C" int rados_setxattr(rados_ioctx_t io, const char *o, const char *name, const char *buf, size_t len)
 {
   librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io;
   object_t oid(o);
@@ -3001,7 +3001,7 @@ extern "C" int rados_stat(rados_ioctx_t io, const char *o, uint64_t *psize, time
   return ctx->client->stat(*ctx, oid, psize, pmtime);
 }
 
-extern "C" int rados_tmap_update(rados_ioctx_t io, const char *o, const char *cmdbuf, uint64_t cmdbuflen)
+extern "C" int rados_tmap_update(rados_ioctx_t io, const char *o, const char *cmdbuf, size_t cmdbuflen)
 {
   librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io;
   object_t oid(o);
@@ -3011,7 +3011,7 @@ extern "C" int rados_tmap_update(rados_ioctx_t io, const char *o, const char *cm
 }
 
 extern "C" int rados_exec(rados_ioctx_t io, const char *o, const char *cls, const char *method,
-                         const char *inbuf, uint64_t in_len, char *buf, uint64_t out_len)
+                         const char *inbuf, size_t in_len, char *buf, size_t out_len)
 {
   librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io;
   object_t oid(o);
@@ -3118,7 +3118,7 @@ extern "C" void rados_aio_release(rados_completion_t c)
 
 extern "C" int rados_aio_read(rados_ioctx_t io, const char *o,
                               rados_completion_t completion,
-                              char *buf, uint64_t len, off_t off)
+                              char *buf, size_t len, off_t off)
 {
   librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io;
   object_t oid(o);
@@ -3128,7 +3128,7 @@ extern "C" int rados_aio_read(rados_ioctx_t io, const char *o,
 
 extern "C" int rados_aio_write(rados_ioctx_t io, const char *o,
                                rados_completion_t completion,
-                               const char *buf, uint64_t len, off_t off)
+                               const char *buf, size_t len, off_t off)
 {
   librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io;
   object_t oid(o);
@@ -3140,7 +3140,7 @@ extern "C" int rados_aio_write(rados_ioctx_t io, const char *o,
 
 extern "C" int rados_aio_append(rados_ioctx_t io, const char *o,
                                rados_completion_t completion,
-                               const char *buf, uint64_t len)
+                               const char *buf, size_t len)
 {
   librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io;
   object_t oid(o);
@@ -3152,7 +3152,7 @@ extern "C" int rados_aio_append(rados_ioctx_t io, const char *o,
 
 extern "C" int rados_aio_write_full(rados_ioctx_t io, const char *o,
                         rados_completion_t completion,
-                        const char *buf, uint64_t len)
+                        const char *buf, size_t len)
 {
   librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io;
   object_t oid(o);
index d6f2408dfbe04f257b482e55e31158ff6bb07323..7bdda9f433120d83b096a21d053eb31bbc0da3f1 100644 (file)
@@ -114,12 +114,12 @@ namespace librbd {
   struct AioBlockCompletion {
     struct AioCompletion *completion;
     off_t ofs;
-    uint64_t len;
+    size_t len;
     char *buf;
-    map<off_t, uint64_t> m;
+    map<off_t, size_t> m;
     bufferlist data_bl;
 
-    AioBlockCompletion(AioCompletion *aio_completion, off_t _ofs, uint64_t _len, char *_buf) :
+    AioBlockCompletion(AioCompletion *aio_completion, off_t _ofs, size_t _len, char *_buf) :
                                             completion(aio_completion), ofs(_ofs), len(_len), buf(_buf) {}
     void complete(int r);
   };
@@ -241,16 +241,16 @@ namespace librbd {
   uint64_t get_block_ofs(rbd_obj_header_ondisk *header, uint64_t ofs);
   int init_rbd_info(struct rbd_info *info);
   void init_rbd_header(struct rbd_obj_header_ondisk& ondisk,
-                             uint64_t size, int *order, uint64_t bid);
+                             size_t size, int *order, uint64_t bid);
 
-  int read_iterate(ImageCtx *ictx, off_t off, uint64_t len,
-                   int (*cb)(off_t, uint64_t, const char *, void *),
+  int read_iterate(ImageCtx *ictx, off_t off, size_t len,
+                   int (*cb)(off_t, size_t, const char *, void *),
                    void *arg);
-  int read(ImageCtx *ictx, off_t off, uint64_t len, char *buf);
-  int write(ImageCtx *ictx, off_t off, uint64_t len, const char *buf);
-  int aio_write(ImageCtx *ictx, off_t off, uint64_t len, const char *buf,
+  int read(ImageCtx *ictx, off_t off, size_t len, char *buf);
+  int write(ImageCtx *ictx, off_t off, size_t len, const char *buf);
+  int aio_write(ImageCtx *ictx, off_t off, size_t len, const char *buf,
                 AioCompletion *c);
-  int aio_read(ImageCtx *ictx, off_t off, uint64_t len,
+  int aio_read(ImageCtx *ictx, off_t off, size_t len,
                char *buf, AioCompletion *c);
 
   AioCompletion *aio_create_completion() {
@@ -280,7 +280,7 @@ void WatchCtx::notify(uint8_t opcode, uint64_t ver)
 }
 
 void init_rbd_header(struct rbd_obj_header_ondisk& ondisk,
-                                       uint64_t size, int *order, uint64_t bid)
+                                       size_t size, int *order, uint64_t bid)
 {
   uint32_t hi = bid >> 32;
   uint32_t lo = bid & 0xFFFFFFFF;
@@ -933,8 +933,8 @@ int copy(IoCtx& src_md_ctx, const char *srcname, IoCtx& dest_md_ctx, const char
     bufferlist bl;
     string oid = get_block_oid(&header, i);
     string dest_oid = get_block_oid(&dest_header, i);
-    map<off_t, uint64_t> m;
-    map<off_t, uint64_t>::iterator iter;
+    map<off_t, size_t> m;
+    map<off_t, size_t>::iterator iter;
     r = src_data_ctx.sparse_read(oid, m, bl, block_size, 0);
     if (r < 0 && r == -ENOENT)
       r = 0;
@@ -944,7 +944,7 @@ int copy(IoCtx& src_md_ctx, const char *srcname, IoCtx& dest_md_ctx, const char
 
     for (iter = m.begin(); iter != m.end(); ++iter) {
       off_t extent_ofs = iter->first;
-      uint64_t extent_len = iter->second;
+      size_t extent_len = iter->second;
       bufferlist wrbl;
       if (extent_ofs + extent_len > bl.length()) {
        derr << "data error!" << dendl;
@@ -1012,8 +1012,8 @@ void close_image(ImageCtx *ictx)
   ictx = NULL;
 }
 
-int read_iterate(ImageCtx *ictx, off_t off, uint64_t len,
-                int (*cb)(off_t, uint64_t, const char *, void *),
+int read_iterate(ImageCtx *ictx, off_t off, size_t len,
+                int (*cb)(off_t, size_t, const char *, void *),
                 void *arg)
 {
   int r = ictx_check(ictx);
@@ -1033,8 +1033,8 @@ int read_iterate(ImageCtx *ictx, off_t off, uint64_t len,
     uint64_t block_ofs = get_block_ofs(&ictx->header, off + total_read);
     uint64_t read_len = min(block_size - block_ofs, left);
 
-    map<off_t, uint64_t> m;
-    map<off_t, uint64_t>::iterator iter;
+    map<off_t, size_t> m;
+    map<off_t, size_t>::iterator iter;
     off_t bl_ofs = 0, buf_bl_pos = 0;
     r = ictx->data_ctx.sparse_read(oid, m, bl, read_len, block_ofs);
     if (r < 0 && r == -ENOENT)
@@ -1045,7 +1045,7 @@ int read_iterate(ImageCtx *ictx, off_t off, uint64_t len,
     }
     for (iter = m.begin(); iter != m.end(); ++iter) {
       off_t extent_ofs = iter->first;
-      uint64_t extent_len = iter->second;
+      size_t extent_len = iter->second;
       /* a hole? */
       if (extent_ofs - block_ofs) {
         r = cb(total_read + buf_bl_pos, extent_ofs - block_ofs, NULL, arg);
@@ -1080,7 +1080,7 @@ done:
   return ret;
 }
 
-static int simple_read_cb(off_t ofs, uint64_t len, const char *buf, void *arg)
+static int simple_read_cb(off_t ofs, size_t len, const char *buf, void *arg)
 {
   char *dest_buf = (char *)arg;
   if (buf)
@@ -1092,12 +1092,12 @@ static int simple_read_cb(off_t ofs, uint64_t len, const char *buf, void *arg)
 }
 
 
-int read(ImageCtx *ictx, off_t ofs, uint64_t len, char *buf)
+int read(ImageCtx *ictx, off_t ofs, size_t len, char *buf)
 {
   return read_iterate(ictx, ofs, len, simple_read_cb, buf);
 }
 
-int write(ImageCtx *ictx, off_t off, uint64_t len, const char *buf)
+int write(ImageCtx *ictx, off_t off, size_t len, const char *buf)
 {
   if (!len)
     return 0;
@@ -1133,12 +1133,12 @@ void AioBlockCompletion::complete(int r)
 {
   dout(10) << "AioBlockCompletion::complete()" << dendl;
   if ((r >= 0 || r == -ENOENT) && buf) { // this was a sparse_read operation
-    map<off_t, uint64_t>::iterator iter;
+    map<off_t, size_t>::iterator iter;
     off_t bl_ofs = 0, buf_bl_pos = 0;
     dout(10) << "ofs=" << ofs << " len=" << len << dendl;
     for (iter = m.begin(); iter != m.end(); ++iter) {
       off_t extent_ofs = iter->first;
-      uint64_t extent_len = iter->second;
+      size_t extent_len = iter->second;
 
       dout(10) << "extent_ofs=" << extent_ofs << " extent_len=" << extent_len << dendl;
 
@@ -1204,7 +1204,7 @@ void rados_cb(rados_completion_t c, void *arg)
   delete block_completion;
 }
 
-int aio_write(ImageCtx *ictx, off_t off, uint64_t len, const char *buf,
+int aio_write(ImageCtx *ictx, off_t off, size_t len, const char *buf,
                                 AioCompletion *c)
 {
   if (!len)
@@ -1253,7 +1253,7 @@ void rados_aio_sparse_read_cb(rados_completion_t c, void *arg)
   block_completion->complete(rados_aio_get_return_value(c));
 }
 
-int aio_read(ImageCtx *ictx, off_t off, uint64_t len,
+int aio_read(ImageCtx *ictx, off_t off, size_t len,
                                char *buf,
                                 AioCompletion *c)
 {
@@ -1274,8 +1274,8 @@ int aio_read(ImageCtx *ictx, off_t off, uint64_t len,
     uint64_t block_ofs = get_block_ofs(&ictx->header, off + total_read);
     uint64_t read_len = min(block_size - block_ofs, left);
 
-    map<off_t, uint64_t> m;
-    map<off_t, uint64_t>::iterator iter;
+    map<off_t, size_t> m;
+    map<off_t, size_t>::iterator iter;
 
     AioBlockCompletion *block_completion = new AioBlockCompletion(c, block_ofs, read_len, buf + total_read);
     c->add_block_completion(block_completion);
@@ -1335,7 +1335,7 @@ int RBD::open(IoCtx& io_ctx, Image& image, const char *name, const char *snapnam
   return 0;
 }
 
-int RBD::create(IoCtx& io_ctx, const char *name, uint64_t size, int *order)
+int RBD::create(IoCtx& io_ctx, const char *name, size_t size, int *order)
 {
   string md_oid = name;
   md_oid += RBD_SUFFIX;
@@ -1409,7 +1409,7 @@ Image::~Image()
   }
 }
 
-int Image::resize(uint64_t size)
+int Image::resize(size_t size)
 {
   ImageCtx *ictx = (ImageCtx *)ctx;
   int r = librbd::resize(ictx, size);
@@ -1457,7 +1457,7 @@ int Image::snap_set(const char *snap_name)
   return librbd::snap_set(ictx, snap_name);
 }
 
-int Image::read(off_t ofs, uint64_t len, bufferlist& bl)
+int Image::read(off_t ofs, size_t len, bufferlist& bl)
 {
   ImageCtx *ictx = (ImageCtx *)ctx;
   bufferptr ptr(len);
@@ -1465,14 +1465,14 @@ int Image::read(off_t ofs, uint64_t len, bufferlist& bl)
   return librbd::read(ictx, ofs, len, bl.c_str());
 }
 
-int Image::read_iterate(off_t ofs, uint64_t len,
-                   int (*cb)(off_t, uint64_t, const char *, void *), void *arg)
+int Image::read_iterate(off_t ofs, size_t len,
+                   int (*cb)(off_t, size_t, const char *, void *), void *arg)
 {
   ImageCtx *ictx = (ImageCtx *)ctx;
   return librbd::read_iterate(ictx, ofs, len, cb, arg);
 }
 
-int Image::write(off_t ofs, uint64_t len, bufferlist& bl)
+int Image::write(off_t ofs, size_t len, bufferlist& bl)
 {
   ImageCtx *ictx = (ImageCtx *)ctx;
   if (bl.length() < len)
@@ -1480,7 +1480,7 @@ int Image::write(off_t ofs, uint64_t len, bufferlist& bl)
   return librbd::write(ictx, ofs, len, bl.c_str());
 }
 
-int Image::aio_write(off_t off, uint64_t len, bufferlist& bl, RBD::AioCompletion *c)
+int Image::aio_write(off_t off, size_t len, bufferlist& bl, RBD::AioCompletion *c)
 {
   ImageCtx *ictx = (ImageCtx *)ctx;
   if (bl.length() < len)
@@ -1488,7 +1488,7 @@ int Image::aio_write(off_t off, uint64_t len, bufferlist& bl, RBD::AioCompletion
   return librbd::aio_write(ictx, off, len, bl.c_str(), (librbd::AioCompletion *)c->pc);
 }
 
-int Image::aio_read(off_t off, uint64_t len, bufferlist& bl, RBD::AioCompletion *c)
+int Image::aio_read(off_t off, size_t len, bufferlist& bl, RBD::AioCompletion *c)
 {
   ImageCtx *ictx = (ImageCtx *)ctx;
   bufferptr ptr(len);
@@ -1510,7 +1510,7 @@ extern "C" void rbd_version(int *major, int *minor, int *extra)
 }
 
 /* images */
-extern "C" int rbd_list(rados_ioctx_t p, char *names, uint64_t *size)
+extern "C" int rbd_list(rados_ioctx_t p, char *names, size_t *size)
 {
   librados::IoCtx io_ctx;
   librados::IoCtx::from_rados_ioctx_t(p, io_ctx);
@@ -1522,9 +1522,9 @@ extern "C" int rbd_list(rados_ioctx_t p, char *names, uint64_t *size)
   if (r < 0)
     return r;
 
-  uint64_t expected_size = 0;
+  size_t expected_size = 0;
 
-  for (uint64_t i = 0; i < cpp_names.size(); i++) {
+  for (size_t i = 0; i < cpp_names.size(); i++) {
     expected_size += cpp_names[i].size() + 1;
   }
   if (*size < expected_size) {
@@ -1539,7 +1539,7 @@ extern "C" int rbd_list(rados_ioctx_t p, char *names, uint64_t *size)
   return (int)cpp_names.size();
 }
 
-extern "C" int rbd_create(rados_ioctx_t p, const char *name, uint64_t size, int *order)
+extern "C" int rbd_create(rados_ioctx_t p, const char *name, size_t size, int *order)
 {
   librados::IoCtx io_ctx;
   librados::IoCtx::from_rados_ioctx_t(p, io_ctx);
@@ -1589,7 +1589,7 @@ extern "C" int rbd_close(rbd_image_t image)
   return 0; 
 }
 
-extern "C" int rbd_resize(rbd_image_t image, uint64_t size)
+extern "C" int rbd_resize(rbd_image_t image, size_t size)
 {
   librbd::ImageCtx *ictx = (librbd::ImageCtx *)image;
   return librbd::resize(ictx, size);
@@ -1670,20 +1670,20 @@ extern "C" int rbd_snap_set(rbd_image_t image, const char *snapname)
 }
 
 /* I/O */
-extern "C" int rbd_read(rbd_image_t image, off_t ofs, uint64_t len, char *buf)
+extern "C" int rbd_read(rbd_image_t image, off_t ofs, size_t len, char *buf)
 {
   librbd::ImageCtx *ictx = (librbd::ImageCtx *)image;
   return librbd::read(ictx, ofs, len, buf);
 }
 
-extern "C" int rbd_read_iterate(rbd_image_t image, off_t ofs, uint64_t len,
-                               int (*cb)(off_t, uint64_t, const char *, void *), void *arg)
+extern "C" int rbd_read_iterate(rbd_image_t image, off_t ofs, size_t len,
+                               int (*cb)(off_t, size_t, const char *, void *), void *arg)
 {
   librbd::ImageCtx *ictx = (librbd::ImageCtx *)image;
   return librbd::read_iterate(ictx, ofs, len, cb, arg);
 }
 
-extern "C" int rbd_write(rbd_image_t image, off_t ofs, uint64_t len, const char *buf)
+extern "C" int rbd_write(rbd_image_t image, off_t ofs, size_t len, const char *buf)
 {
   librbd::ImageCtx *ictx = (librbd::ImageCtx *)image;
   return librbd::write(ictx, ofs, len, buf);
@@ -1696,14 +1696,14 @@ extern "C" int rbd_aio_create_completion(void *cb_arg, rbd_callback_t complete_c
   return 0;
 }
 
-extern "C" int rbd_aio_write(rbd_image_t image, off_t off, uint64_t len, const char *buf, rbd_completion_t c)
+extern "C" int rbd_aio_write(rbd_image_t image, off_t off, size_t len, const char *buf, rbd_completion_t c)
 {
   librbd::ImageCtx *ictx = (librbd::ImageCtx *)image;
   librbd::RBD::AioCompletion *comp = (librbd::RBD::AioCompletion *)c;
   return librbd::aio_write(ictx, off, len, buf, (librbd::AioCompletion *)comp->pc);
 }
 
-extern "C" int rbd_aio_read(rbd_image_t image, off_t off, uint64_t len, char *buf, rbd_completion_t c)
+extern "C" int rbd_aio_read(rbd_image_t image, off_t off, size_t len, char *buf, rbd_completion_t c)
 {
   librbd::ImageCtx *ictx = (librbd::ImageCtx *)image;
   librbd::RBD::AioCompletion *comp = (librbd::RBD::AioCompletion *)c;
index b870709efb5f1d1c0f1e034da4c4dbbd314d8c8c..f0c4f770faf6f59496a233fec646515b8245ec26 100644 (file)
@@ -264,13 +264,13 @@ int main(int argc, const char **argv)
     if (!pool_name || nargs.size() < 2)
       usage();
     string oid(nargs[1]);
-    std::map<off_t, uint64_t> m;
+    std::map<off_t, size_t> m;
     ret = io_ctx.mapext(oid, 0, -1, m);
     if (ret < 0) {
       cerr << "mapext error on " << pool_name << "/" << oid << ": " << strerror_r(-ret, buf, sizeof(buf)) << std::endl;
       return 1;
     }
-    std::map<off_t, uint64_t>::iterator iter;
+    std::map<off_t, size_t>::iterator iter;
     for (iter = m.begin(); iter != m.end(); ++iter) {
       cout << hex << iter->first << "\t" << iter->second << dec << std::endl;
     }
index 385f89537d1bc8e352350d4781b572b49573fc74..028bd035dffd2385da50f45c57f0bdb69c16db6c 100644 (file)
@@ -112,7 +112,7 @@ static int do_list(librbd::RBD &rbd, librados::IoCtx& io_ctx)
 }
 
 static int do_create(librbd::RBD &rbd, librados::IoCtx& io_ctx,
-                    const char *imgname, uint64_t size, int *order)
+                    const char *imgname, size_t size, int *order)
 {
   int r = rbd.create(io_ctx, imgname, size, order);
   if (r < 0)
@@ -149,7 +149,7 @@ static int do_show_info(const char *imgname, librbd::Image& image)
   return 0;
 }
 
-static int do_resize(librbd::Image& image, uint64_t size)
+static int do_resize(librbd::Image& image, size_t size)
 {
   int r = image.resize(size);
   if (r < 0)
@@ -198,7 +198,7 @@ static int do_rollback_snap(librbd::Image& image, const char *snapname)
   return 0;
 }
 
-static int export_read_cb(off_t ofs, uint64_t len, const char *buf, void *arg)
+static int export_read_cb(off_t ofs, size_t len, const char *buf, void *arg)
 {
   int ret;
   int fd = *(int *)arg;
@@ -377,7 +377,7 @@ static int do_import(librbd::RBD &rbd, librados::IoCtx& io_ctx,
 
   while (extent < fiemap->fm_mapped_extents) {
     off_t file_pos, end_ofs;
-    uint64_t extent_len = 0;
+    size_t extent_len = 0;
 
     file_pos = fiemap->fm_extents[extent].fe_logical; /* position within the file we're reading */
 
@@ -410,7 +410,7 @@ static int do_import(librbd::RBD &rbd, librados::IoCtx& io_ctx,
           cerr << "error reading file: " << cpp_strerror(r) << std::endl;
           goto done;
         }
-       uint64_t len = rval;
+       size_t len = rval;
         if (!len) {
           r = 0;
           goto done;