/* 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;
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);
// 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);
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
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 */
/* 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);
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);
Image();
~Image();
- int resize(uint64_t size);
+ int resize(size_t size);
int stat(image_info_t &info, size_t infosize);
/* snapshots */
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;
// 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);
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();
};
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);
}
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();
}
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();
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);
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);
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);
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();
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();
}
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();
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;
}
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;
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;
}
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);
}
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);
}
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);
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);
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);
}
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);
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);
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);
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);
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;
}
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;
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);
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);
}
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);
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);
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);
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);
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);
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);
};
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() {
}
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;
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;
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;
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);
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)
}
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);
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)
}
-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;
{
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;
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)
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)
{
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);
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;
}
}
-int Image::resize(uint64_t size)
+int Image::resize(size_t size)
{
ImageCtx *ictx = (ImageCtx *)ctx;
int r = librbd::resize(ictx, size);
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);
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)
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)
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);
}
/* 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);
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) {
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);
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);
}
/* 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);
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;
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;
}
}
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)
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)
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;
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 */
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;