/* find or create an RGWFileHandle */
LookupFHResult lookup_fh(RGWFileHandle* parent, const char *name,
const uint32_t cflags = RGWFileHandle::FLAG_NONE) {
-
using std::get;
RGWFileHandle::FHCache::Latch lat;
+ std::string obj_name{name};
std::string key_name{parent->make_key_name(name)};
+
fh_key fhk = parent->make_fhk(key_name);
LookupFHResult fhr { nullptr, RGWFileHandle::FLAG_NONE };
/* LATCHED */
if (! fh) {
if (cflags & RGWFileHandle::FLAG_CREATE) {
- fh = new RGWFileHandle(this, get_inst(), parent, fhk, key_name,
+ fh = new RGWFileHandle(this, get_inst(), parent, fhk, obj_name,
cflags);
intrusive_ptr_add_ref(fh); /* sentinel ref */
fh_cache.insert_latched(fh, lat,
* empty directory */
if (sref=="")
continue;
-
- std::cout << "RGWListBucketRequest "
- << __func__ << " " << "list uri=" << s->relative_uri << " "
- << " prefix=" << prefix << " "
- << " obj path=" << iter.key.name
- << " (" << sref << ")" << ""
- << std::endl;
+
+ lsubdout(cct, rgw, 15) << "RGWListBucketRequest "
+ << __func__ << " "
+ << "list uri=" << s->relative_uri << " "
+ << " prefix=" << prefix << " "
+ << " obj path=" << iter.key.name
+ << " (" << sref << ")" << ""
+ << dendl;
+
/* call me maybe */
this->operator()(sref.data(), sref.data(),
(ix == size-1) ? true : false);
else
sref = boost::string_ref{iter.first};
- std::cout << "RGWListBucketRequest "
- << __func__ << " " << "list uri=" << s->relative_uri << " "
- << " prefix=" << prefix << " "
- << " cpref=" << sref << " (not chomped)"
- << std::endl;
+ lsubdout(cct, rgw, 15) << "RGWListBucketRequest "
+ << __func__ << " "
+ << "list uri=" << s->relative_uri << " "
+ << " prefix=" << prefix << " "
+ << " cpref=" << sref
+ << dendl;
+
this->operator()(sref.data(), sref.data(), (ix == size-1) ? true : false);
++ix;
}
// try objects
for (const auto& iter : objs) {
auto& name = iter.key.name;
- std::cout << "RGWStatLeafRequest "
- << __func__ << " " << "list uri=" << s->relative_uri << " "
- << " prefix=" << prefix << " "
- << " obj path=" << name << ""
- << std::endl;
+ lsubdout(cct, rgw, 15) << "RGWStatLeafRequest "
+ << __func__ << " "
+ << "list uri=" << s->relative_uri << " "
+ << " prefix=" << prefix << " "
+ << " obj path=" << name << ""
+ << dendl;
/* XXX is there a missing match-dir case (trailing '/')? */
matched = true;
return;
// try prefixes
for (auto& iter : common_prefixes) {
auto& name = iter.first;
- std::cout << "RGWStatLeafRequest "
- << __func__ << " " << "list uri=" << s->relative_uri << " "
- << " prefix=" << prefix << " "
- << " pref path=" << name << " (not chomped)"
- << std::endl;
+ lsubdout(cct, rgw, 15) << "RGWStatLeafRequest "
+ << __func__ << " "
+ << "list uri=" << s->relative_uri << " "
+ << " prefix=" << prefix << " "
+ << " pref path=" << name << " (not chomped)"
+ << dendl;
matched = true;
is_dir = true;
break;
#include "common/ceph_argparse.h"
#include "common/debug.h"
#include "global/global_init.h"
+#include "include/assert.h"
#define dout_subsys ceph_subsys_rgw
string access_key("");
string secret_key("");
struct rgw_fs *fs = nullptr;
+ CephContext* cct = nullptr;
string bucket_name = "nfsroot";
if (rgw_fh) {
const char* type = rgw_fh->is_dir() ? "DIR " : "FILE ";
os << rec.rgw_fh->full_object_name()
- << " (" << rec.rgw_fh->object_name() << ", "
- << " " << rec.name << "): "
+ << " (" << rec.rgw_fh->object_name() << "): "
<< type;
}
return os;
secret_key.c_str(), &fs);
ASSERT_EQ(ret, 0);
ASSERT_NE(fs, nullptr);
+
+ cct = static_cast<RGWLibFS*>(fs->fs_private)->get_context();
}
extern "C" {
struct rgw_file_handle* parent_fh
= static_cast<struct rgw_file_handle*>(arg);
RGWFileHandle* rgw_fh = get_rgwfh(parent_fh);
- std::cout << __func__
- << " bucket=" << rgw_fh->bucket_name()
- << " dir=" << rgw_fh->full_object_name()
- << " called back name=" << name
- << std::endl;
+ lsubdout(cct, rgw, 10) << __func__
+ << " bucket=" << rgw_fh->bucket_name()
+ << " dir=" << rgw_fh->full_object_name()
+ << " called back name=" << name
+ << dendl;
obj_stack.push(
obj_rec{name, nullptr, parent_fh, nullptr});
return true; /* XXX */
if (! elt.fh) {
struct rgw_file_handle* parent_fh = elt.parent_fh
? elt.parent_fh : fs->root_fh;
+ RGWFileHandle* pfh = get_rgwfh(parent_fh);
+ rgw::ignore(pfh);
+ lsubdout(cct, rgw, 10)
+ << "rgw_lookup:"
+ << " parent object_name()=" << pfh->object_name()
+ << " parent full_object_name()=" << pfh->full_object_name()
+ << " elt.name=" << elt.name
+ << dendl;
rc = rgw_lookup(fs, parent_fh, elt.name.c_str(), &elt.fh,
RGW_LOOKUP_FLAG_NONE);
ASSERT_EQ(rc, 0);
+ // XXXX
+ RGWFileHandle* efh = get_rgwfh(elt.fh);
+ rgw::ignore(efh);
+ lsubdout(cct, rgw, 10)
+ << "rgw_lookup result:"
+ << " elt object_name()=" << efh->object_name()
+ << " elt full_object_name()=" << efh->full_object_name()
+ << " elt.name=" << elt.name
+ << dendl;
+
ASSERT_NE(elt.fh, nullptr);
elt.rgw_fh = get_rgwfh(elt.fh);
elt.parent_fh = elt.rgw_fh->get_parent()->get_fh();
// descending
uint64_t offset;
bool eof; // XXX
- std::cout << "readdir in"
- << " bucket: " << elt.rgw_fh->bucket_name()
- << " object_name: " << elt.rgw_fh->object_name()
- << " full_name: " << elt.rgw_fh->full_object_name()
- << std::endl;
+ lsubdout(cct, rgw, 10)
+ << "readdir in"
+ << " bucket: " << elt.rgw_fh->bucket_name()
+ << " object_name: " << elt.rgw_fh->object_name()
+ << " full_name: " << elt.rgw_fh->full_object_name()
+ << dendl;
rc = rgw_readdir(fs, elt.fh, &offset, r1_cb, elt.fh, &eof);
elt.state.readdir = true;
ASSERT_EQ(rc, 0);