* Foundation. See file COPYING.
*
*/
-#ifndef RGW_FILE_H
-#define RGW_FILE_H
+#ifndef RADOS_RGW_FILE_H
+#define RADOS_RGW_FILE_H
#include <sys/types.h>
#include <stdint.h>
}
#endif
-#endif
+#endif /* RADOS_RGW_FILE_H */
RGWLibRequest *req = static_cast<RGWLibRequest*>(base_req);
- io->init(g_ceph_context); // XXXX fix me--we have a local cct
+ io->init(req->cct);
req->log_init();
RGWEnv& rgw_env = io->get_env();
- // XXXX fix me--we have a local cct
- struct req_state rstate(g_ceph_context, &rgw_env);
+ struct req_state rstate(req->cct, &rgw_env);
struct req_state *s = &rstate;
+ req->init_state(s);
+
RGWObjectCtx rados_ctx(store, s);
s->obj_ctx = &rados_ctx;
#include "rgw_user.h"
#include "rgw_bucket.h"
-#include "rgw_lib.h"
-
+#include "rgw_file.h"
#define dout_subsys ceph_subsys_rgw
return 0;
}
-/*
- read directory content
-*/
-class RGWListBucketsRequest : public RGWLibRequest,
- public RGWListBuckets_ObjStore_Lib /* RGWOp */
-{
-public:
- uint64_t offset;
- void* cb_arg;
- rgw_readdir_cb rcb;
-
- RGWListBucketsRequest(uint64_t _req_id,
- rgw_readdir_cb _rcb, void* _cb_arg, uint64_t _offset)
- : RGWLibRequest(_req_id), offset(_offset), cb_arg(_cb_arg), rcb(_rcb) {
- // req->op = op
- op = this;
- }
-
- void operator()(const std::string& name, const std::string& marker) {
- (void) rcb(name.c_str(), cb_arg, offset++);
- }
-
-}; /* RGWListBucketsRequest */
-
int rgw_readdir(struct rgw_fs *rgw_fs,
const struct rgw_file_handle *parent_handle, uint64_t *offset,
rgw_readdir_cb rcb, void *cb_arg, bool *eof)
}
CephContext* cct = static_cast<CephContext*>(rgw_fs->rgw);
- RGWRados* store = librgw.get_store();
#if 1
- /* TODO: get required req_id &c, and put a RGWListBucketsRequest -or-
- * RGWListBucketRequest on the stack */
+ /* TODO:
+ * take actual, um, arguments
+ */
+ RGWListBucketsRequest req(cct, rcb, cb_arg, offset);
#else
/* XXX current open-coded logic should move into librgw (need
--- /dev/null
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#ifndef RGW_FILE_H
+#define RGW_FILE_H
+
+/* internal header */
+
+/*
+ read directory content
+*/
+class RGWListBucketsRequest : public RGWLibRequest,
+ public RGWListBuckets_ObjStore_Lib /* RGWOp */
+{
+public:
+ uint64_t* offset;
+ void* cb_arg;
+ rgw_readdir_cb rcb;
+
+ RGWListBucketsRequest(CephContext* _cct, rgw_readdir_cb _rcb, void* _cb_arg,
+ uint64_t* _offset)
+ : RGWLibRequest(_cct), offset(_offset), cb_arg(_cb_arg), rcb(_rcb) {
+ // req->op = op
+ op = this;
+ }
+
+ virtual bool only_bucket() { return false; }
+
+ int operator()(const std::string& name, const std::string& marker) {
+ (void) rcb(name.c_str(), cb_arg, (*offset)++);
+ }
+
+}; /* RGWListBucketsRequest */
+
+#endif /* RGW_FILE_H */
}; /* RGWLibIO */
class RGWLibRequest : public RGWRequest {
-private:
- struct req_state* s;
-
public:
- RGWLibRequest(uint64_t req_id)
- : RGWRequest(req_id), s(nullptr)
- {}
+ CephContext* cct;
- void set_state(req_state* _s) {
- s = _s;
- }
+ RGWLibRequest(CephContext* _cct)
+ : RGWRequest(0), cct(_cct)
+ {}
virtual bool only_bucket() = 0;