From 1f591c2933a3a6a03eb2a3c93fa5039d4d42bdbc Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Fri, 8 Jul 2011 11:13:49 -0700 Subject: [PATCH] src/os/: s/sobject_t/hobject_t/g Signed-off-by: Samuel Just --- src/os/Fake.h | 28 +++++----- src/os/FileStore.cc | 126 +++++++++++++++++++++---------------------- src/os/FileStore.h | 84 ++++++++++++++--------------- src/os/ObjectStore.h | 84 ++++++++++++++--------------- 4 files changed, 161 insertions(+), 161 deletions(-) diff --git a/src/os/Fake.h b/src/os/Fake.h index ee3ed01efcb40..121def89f0ad7 100644 --- a/src/os/Fake.h +++ b/src/os/Fake.h @@ -28,7 +28,7 @@ class FakeCollections { private: Mutex faker_lock; ObjectStore *store; - hash_map > fakecollections; + hash_map > fakecollections; public: FakeCollections(ObjectStore *s) : faker_lock("FakeCollections::faker_lock"), store(s) {} @@ -37,7 +37,7 @@ class FakeCollections { int list_collections(vector& ls) { faker_lock.Lock(); int r = 0; - for (hash_map< coll_t, set >::iterator p = fakecollections.begin(); + for (hash_map< coll_t, set >::iterator p = fakecollections.begin(); p != fakecollections.end(); p++) { r++; @@ -81,7 +81,7 @@ class FakeCollections { return r; } - int collection_add(coll_t c, sobject_t o, + int collection_add(coll_t c, hobject_t o, Context *onsafe=0) { faker_lock.Lock(); fakecollections[c].insert(o); @@ -90,7 +90,7 @@ class FakeCollections { return 0; } - int collection_remove(coll_t c, sobject_t o, + int collection_remove(coll_t c, hobject_t o, Context *onsafe=0) { faker_lock.Lock(); fakecollections[c].erase(o); @@ -104,10 +104,10 @@ class FakeCollections { return fakecollections[c].empty(); } - int collection_list(coll_t c, vector& o) { + int collection_list(coll_t c, vector& o) { faker_lock.Lock(); int r = 0; - for (set::iterator p = fakecollections[c].begin(); + for (set::iterator p = fakecollections[c].begin(); p != fakecollections[c].end(); p++) { o.push_back(*p); @@ -185,13 +185,13 @@ class FakeAttrs { Mutex faker_lock; ObjectStore *store; - hash_map fakeoattrs; + hash_map fakeoattrs; hash_map fakecattrs; public: FakeAttrs(ObjectStore *s) : faker_lock("FakeAttrs::faker_lock"), store(s) {} - int setattr(coll_t cid, sobject_t oid, const char *name, + int setattr(coll_t cid, hobject_t oid, const char *name, const void *value, size_t size, Context *onsafe=0) { faker_lock.Lock(); @@ -200,32 +200,32 @@ class FakeAttrs { faker_lock.Unlock(); return r; } - int setattrs(coll_t cid, sobject_t oid, map& aset) { + int setattrs(coll_t cid, hobject_t oid, map& aset) { faker_lock.Lock(); int r = fakeoattrs[oid].setattrs(aset); faker_lock.Unlock(); return r; } - int getattr(coll_t cid, sobject_t oid, const char *name, + int getattr(coll_t cid, hobject_t oid, const char *name, void *value, size_t size) { faker_lock.Lock(); int r = fakeoattrs[oid].getattr(name, value, size); faker_lock.Unlock(); return r; } - int getattr(coll_t cid, sobject_t oid, const char *name, bufferptr& bp) { + int getattr(coll_t cid, hobject_t oid, const char *name, bufferptr& bp) { faker_lock.Lock(); int r = fakeoattrs[oid].getattr(name, bp); faker_lock.Unlock(); return r; } - int getattrs(coll_t cid, sobject_t oid, map& aset) { + int getattrs(coll_t cid, hobject_t oid, map& aset) { faker_lock.Lock(); int r = fakeoattrs[oid].getattrs(aset); faker_lock.Unlock(); return r; } - int rmattr(coll_t cid, sobject_t oid, const char *name, + int rmattr(coll_t cid, hobject_t oid, const char *name, Context *onsafe=0) { faker_lock.Lock(); int r = fakeoattrs[oid].rmattr(name); @@ -234,7 +234,7 @@ class FakeAttrs { return r; } - int listattr(coll_t cid, sobject_t oid, char *attrs, size_t size) { + int listattr(coll_t cid, hobject_t oid, char *attrs, size_t size) { faker_lock.Lock(); int r = fakeoattrs[oid].listattr(attrs,size); faker_lock.Unlock(); diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index c5d63a5149b39..bb5c23e3b33fa 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -247,14 +247,14 @@ static void lfn_translate(const char *path, const char *name, char *new_name, in } /* - * sorry, these are sentitive to the sobject_t and coll_t typing. + * sorry, these are sentitive to the hobject_t and coll_t typing. */ // 11111111112222222222333333333344444444445555555555 // 012345678901234567890123456789012345678901234567890123456789 // yyyyyyyyyyyyyyyy.zzzzzzzz.a_s -int FileStore::append_oname(const sobject_t &oid, char *s, int len) +int FileStore::append_oname(const hobject_t &oid, char *s, int len) { //assert(sizeof(oid) == 28); char *end = s + len; @@ -288,7 +288,7 @@ int FileStore::append_oname(const sobject_t &oid, char *s, int len) return size; } -bool FileStore::parse_object(char *s, sobject_t& o) +bool FileStore::parse_object(char *s, hobject_t& o) { char *bar = s + strlen(s) - 1; while (*bar != '_' && @@ -335,7 +335,7 @@ int FileStore::get_cdir(coll_t cid, char *s, int len) return snprintf(s, len, "%s/current/%s", basedir.c_str(), cid_str.c_str()); } -int FileStore::lfn_get(coll_t cid, const sobject_t& oid, char *pathname, int len, char *lfn, int lfn_len, int *exist, int *is_lfn) +int FileStore::lfn_get(coll_t cid, const hobject_t& oid, char *pathname, int len, char *lfn, int lfn_len, int *exist, int *is_lfn) { int i = 0; char *filename; @@ -392,7 +392,7 @@ int FileStore::lfn_get(coll_t cid, const sobject_t& oid, char *pathname, int len return 0; // unreachable anyway } -int FileStore::lfn_find(coll_t cid, const sobject_t& oid, char *pathname, int len) +int FileStore::lfn_find(coll_t cid, const hobject_t& oid, char *pathname, int len) { char long_fn[PATH_MAX]; int r, exist; @@ -405,7 +405,7 @@ int FileStore::lfn_find(coll_t cid, const sobject_t& oid, char *pathname, int le return -ENOENT; return 0; } -int FileStore::lfn_getxattr(coll_t cid, const sobject_t& oid, const char *name, void *val, size_t size) +int FileStore::lfn_getxattr(coll_t cid, const hobject_t& oid, const char *name, void *val, size_t size) { char new_fn[PATH_MAX]; int r; @@ -416,7 +416,7 @@ int FileStore::lfn_getxattr(coll_t cid, const sobject_t& oid, const char *name, return do_getxattr(new_fn, name, val, size); } -int FileStore::lfn_setxattr(coll_t cid, const sobject_t& oid, const char *name, const void *val, size_t size) +int FileStore::lfn_setxattr(coll_t cid, const hobject_t& oid, const char *name, const void *val, size_t size) { char new_fn[PATH_MAX]; int r; @@ -427,7 +427,7 @@ int FileStore::lfn_setxattr(coll_t cid, const sobject_t& oid, const char *name, return do_setxattr(new_fn, name, val, size); } -int FileStore::lfn_removexattr(coll_t cid, const sobject_t& oid, const char *name) +int FileStore::lfn_removexattr(coll_t cid, const hobject_t& oid, const char *name) { char new_fn[PATH_MAX]; int r; @@ -438,7 +438,7 @@ int FileStore::lfn_removexattr(coll_t cid, const sobject_t& oid, const char *nam return do_removexattr(new_fn, name); } -int FileStore::lfn_listxattr(coll_t cid, const sobject_t& oid, char *names, size_t len) +int FileStore::lfn_listxattr(coll_t cid, const hobject_t& oid, char *names, size_t len) { char new_fn[PATH_MAX]; int r; @@ -449,7 +449,7 @@ int FileStore::lfn_listxattr(coll_t cid, const sobject_t& oid, char *names, size return do_listxattr(new_fn, names, len); } -int FileStore::lfn_truncate(coll_t cid, const sobject_t& oid, off_t length) +int FileStore::lfn_truncate(coll_t cid, const hobject_t& oid, off_t length) { char new_fn[PATH_MAX]; int r; @@ -463,7 +463,7 @@ int FileStore::lfn_truncate(coll_t cid, const sobject_t& oid, off_t length) return r; } -int FileStore::lfn_stat(coll_t cid, const sobject_t& oid, struct stat *buf) +int FileStore::lfn_stat(coll_t cid, const hobject_t& oid, struct stat *buf) { char fn[PATH_MAX]; int r; @@ -477,7 +477,7 @@ int FileStore::lfn_stat(coll_t cid, const sobject_t& oid, struct stat *buf) return 0; } -int FileStore::lfn_open(coll_t cid, const sobject_t& oid, int flags, mode_t mode) +int FileStore::lfn_open(coll_t cid, const hobject_t& oid, int flags, mode_t mode) { char long_fn[PATH_MAX]; char short_fn[PATH_MAX]; @@ -507,12 +507,12 @@ int FileStore::lfn_open(coll_t cid, const sobject_t& oid, int flags, mode_t mode return fd; } -int FileStore::lfn_open(coll_t cid, const sobject_t& oid, int flags) +int FileStore::lfn_open(coll_t cid, const hobject_t& oid, int flags) { return lfn_open(cid, oid, flags, 0); } -int FileStore::lfn_link(coll_t c, coll_t cid, const sobject_t& o) +int FileStore::lfn_link(coll_t c, coll_t cid, const hobject_t& o) { char long_fn[PATH_MAX]; char short_fn_old[PATH_MAX]; @@ -545,7 +545,7 @@ int FileStore::lfn_link(coll_t c, coll_t cid, const sobject_t& o) return 0; } -int FileStore::lfn_unlink(coll_t cid, const sobject_t& o) +int FileStore::lfn_unlink(coll_t cid, const hobject_t& o) { char long_fn[PATH_MAX]; char short_fn[PATH_MAX]; @@ -2333,7 +2333,7 @@ unsigned FileStore::_do_transaction(Transaction& t) case Transaction::OP_TOUCH: { coll_t cid = t.get_cid(); - sobject_t oid = t.get_oid(); + hobject_t oid = t.get_oid(); r = _touch(cid, oid); } break; @@ -2341,7 +2341,7 @@ unsigned FileStore::_do_transaction(Transaction& t) case Transaction::OP_WRITE: { coll_t cid = t.get_cid(); - sobject_t oid = t.get_oid(); + hobject_t oid = t.get_oid(); uint64_t off = t.get_length(); uint64_t len = t.get_length(); bufferlist bl; @@ -2353,7 +2353,7 @@ unsigned FileStore::_do_transaction(Transaction& t) case Transaction::OP_ZERO: { coll_t cid = t.get_cid(); - sobject_t oid = t.get_oid(); + hobject_t oid = t.get_oid(); uint64_t off = t.get_length(); uint64_t len = t.get_length(); r = _zero(cid, oid, off, len); @@ -2363,7 +2363,7 @@ unsigned FileStore::_do_transaction(Transaction& t) case Transaction::OP_TRIMCACHE: { coll_t cid = t.get_cid(); - sobject_t oid = t.get_oid(); + hobject_t oid = t.get_oid(); uint64_t off = t.get_length(); uint64_t len = t.get_length(); trim_from_cache(cid, oid, off, len); @@ -2373,7 +2373,7 @@ unsigned FileStore::_do_transaction(Transaction& t) case Transaction::OP_TRUNCATE: { coll_t cid = t.get_cid(); - sobject_t oid = t.get_oid(); + hobject_t oid = t.get_oid(); uint64_t off = t.get_length(); r = _truncate(cid, oid, off); } @@ -2382,7 +2382,7 @@ unsigned FileStore::_do_transaction(Transaction& t) case Transaction::OP_REMOVE: { coll_t cid = t.get_cid(); - sobject_t oid = t.get_oid(); + hobject_t oid = t.get_oid(); r = _remove(cid, oid); } break; @@ -2390,7 +2390,7 @@ unsigned FileStore::_do_transaction(Transaction& t) case Transaction::OP_SETATTR: { coll_t cid = t.get_cid(); - sobject_t oid = t.get_oid(); + hobject_t oid = t.get_oid(); string name = t.get_attrname(); bufferlist bl; t.get_bl(bl); @@ -2404,7 +2404,7 @@ unsigned FileStore::_do_transaction(Transaction& t) case Transaction::OP_SETATTRS: { coll_t cid = t.get_cid(); - sobject_t oid = t.get_oid(); + hobject_t oid = t.get_oid(); map aset; t.get_attrset(aset); r = _setattrs(cid, oid, aset); @@ -2416,7 +2416,7 @@ unsigned FileStore::_do_transaction(Transaction& t) case Transaction::OP_RMATTR: { coll_t cid = t.get_cid(); - sobject_t oid = t.get_oid(); + hobject_t oid = t.get_oid(); string name = t.get_attrname(); r = _rmattr(cid, oid, name.c_str()); } @@ -2425,7 +2425,7 @@ unsigned FileStore::_do_transaction(Transaction& t) case Transaction::OP_RMATTRS: { coll_t cid = t.get_cid(); - sobject_t oid = t.get_oid(); + hobject_t oid = t.get_oid(); r = _rmattrs(cid, oid); } break; @@ -2433,8 +2433,8 @@ unsigned FileStore::_do_transaction(Transaction& t) case Transaction::OP_CLONE: { coll_t cid = t.get_cid(); - sobject_t oid = t.get_oid(); - sobject_t noid = t.get_oid(); + hobject_t oid = t.get_oid(); + hobject_t noid = t.get_oid(); r = _clone(cid, oid, noid); } break; @@ -2442,8 +2442,8 @@ unsigned FileStore::_do_transaction(Transaction& t) case Transaction::OP_CLONERANGE: { coll_t cid = t.get_cid(); - sobject_t oid = t.get_oid(); - sobject_t noid = t.get_oid(); + hobject_t oid = t.get_oid(); + hobject_t noid = t.get_oid(); uint64_t off = t.get_length(); uint64_t len = t.get_length(); r = _clone_range(cid, oid, noid, off, len, off); @@ -2453,8 +2453,8 @@ unsigned FileStore::_do_transaction(Transaction& t) case Transaction::OP_CLONERANGE2: { coll_t cid = t.get_cid(); - sobject_t oid = t.get_oid(); - sobject_t noid = t.get_oid(); + hobject_t oid = t.get_oid(); + hobject_t noid = t.get_oid(); uint64_t srcoff = t.get_length(); uint64_t len = t.get_length(); uint64_t dstoff = t.get_length(); @@ -2480,7 +2480,7 @@ unsigned FileStore::_do_transaction(Transaction& t) { coll_t ocid = t.get_cid(); coll_t ncid = t.get_cid(); - sobject_t oid = t.get_oid(); + hobject_t oid = t.get_oid(); r = _collection_add(ocid, ncid, oid); } break; @@ -2488,7 +2488,7 @@ unsigned FileStore::_do_transaction(Transaction& t) case Transaction::OP_COLL_REMOVE: { coll_t cid = t.get_cid(); - sobject_t oid = t.get_oid(); + hobject_t oid = t.get_oid(); r = _collection_remove(cid, oid); } break; @@ -2565,7 +2565,7 @@ unsigned FileStore::_do_transaction(Transaction& t) // -------------------- // objects -bool FileStore::exists(coll_t cid, const sobject_t& oid) +bool FileStore::exists(coll_t cid, const hobject_t& oid) { struct stat st; if (stat(cid, oid, &st) == 0) @@ -2574,14 +2574,14 @@ bool FileStore::exists(coll_t cid, const sobject_t& oid) return false; } -int FileStore::stat(coll_t cid, const sobject_t& oid, struct stat *st) +int FileStore::stat(coll_t cid, const hobject_t& oid, struct stat *st) { int r = lfn_stat(cid, oid, st); dout(10) << "stat " << cid << "/" << oid << " = " << r << " (size " << st->st_size << ")" << dendl; return r; } -int FileStore::read(coll_t cid, const sobject_t& oid, +int FileStore::read(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len, bufferlist& bl) { int got; @@ -2620,7 +2620,7 @@ int FileStore::read(coll_t cid, const sobject_t& oid, return got; } -int FileStore::fiemap(coll_t cid, const sobject_t& oid, +int FileStore::fiemap(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len, bufferlist& bl) { @@ -2700,7 +2700,7 @@ done: } -int FileStore::_remove(coll_t cid, const sobject_t& oid) +int FileStore::_remove(coll_t cid, const hobject_t& oid) { dout(15) << "remove " << cid << "/" << oid << dendl; int r = lfn_unlink(cid, oid); @@ -2708,7 +2708,7 @@ int FileStore::_remove(coll_t cid, const sobject_t& oid) return r; } -int FileStore::_truncate(coll_t cid, const sobject_t& oid, uint64_t size) +int FileStore::_truncate(coll_t cid, const hobject_t& oid, uint64_t size) { dout(15) << "truncate " << cid << "/" << oid << " size " << size << dendl; int r = lfn_truncate(cid, oid, size); @@ -2717,7 +2717,7 @@ int FileStore::_truncate(coll_t cid, const sobject_t& oid, uint64_t size) } -int FileStore::_touch(coll_t cid, const sobject_t& oid) +int FileStore::_touch(coll_t cid, const hobject_t& oid) { dout(15) << "touch " << cid << "/" << oid << dendl; @@ -2733,7 +2733,7 @@ int FileStore::_touch(coll_t cid, const sobject_t& oid) return r; } -int FileStore::_write(coll_t cid, const sobject_t& oid, +int FileStore::_write(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len, const bufferlist& bl) { @@ -2786,7 +2786,7 @@ int FileStore::_write(coll_t cid, const sobject_t& oid, return r; } -int FileStore::_zero(coll_t cid, const sobject_t& oid, uint64_t offset, size_t len) +int FileStore::_zero(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len) { // write zeros.. yuck! bufferptr bp(len); @@ -2795,7 +2795,7 @@ int FileStore::_zero(coll_t cid, const sobject_t& oid, uint64_t offset, size_t l return _write(cid, oid, offset, len, bl); } -int FileStore::_clone(coll_t cid, const sobject_t& oldoid, const sobject_t& newoid) +int FileStore::_clone(coll_t cid, const hobject_t& oldoid, const hobject_t& newoid) { dout(15) << "clone " << cid << "/" << oldoid << " -> " << cid << "/" << newoid << dendl; @@ -2963,7 +2963,7 @@ int FileStore::_do_copy_range(int from, int to, uint64_t srcoff, uint64_t len, u return r; } -int FileStore::_clone_range(coll_t cid, const sobject_t& oldoid, const sobject_t& newoid, +int FileStore::_clone_range(coll_t cid, const hobject_t& oldoid, const hobject_t& newoid, uint64_t srcoff, uint64_t len, uint64_t dstoff) { dout(15) << "clone_range " << cid << "/" << oldoid << " -> " << cid << "/" << newoid << " " << srcoff << "~" << len << " to " << dstoff << dendl; @@ -3364,7 +3364,7 @@ int FileStore::snapshot(const string& name) // attributes // low-level attr helpers -int FileStore::_getattr(coll_t cid, const sobject_t& oid, const char *name, bufferptr& bp) +int FileStore::_getattr(coll_t cid, const hobject_t& oid, const char *name, bufferptr& bp) { char val[100]; int l = lfn_getxattr(cid, oid, name, val, sizeof(val)); @@ -3399,7 +3399,7 @@ int FileStore::_getattr(const char *fn, const char *name, bufferptr& bp) } // note that this is a clone of the method below.. any change here should be reflected there -int FileStore::_getattrs(coll_t cid, const sobject_t& oid, map& aset, bool user_only) +int FileStore::_getattrs(coll_t cid, const hobject_t& oid, map& aset, bool user_only) { // get attr list char names1[100]; @@ -3505,7 +3505,7 @@ int FileStore::_getattrs(const char *fn, map& aset, bool user_ // objects -int FileStore::getattr(coll_t cid, const sobject_t& oid, const char *name, +int FileStore::getattr(coll_t cid, const hobject_t& oid, const char *name, void *value, size_t size) { if (fake_attrs) return attrs.getattr(cid, oid, name, value, size); @@ -3518,7 +3518,7 @@ int FileStore::getattr(coll_t cid, const sobject_t& oid, const char *name, return r; } -int FileStore::getattr(coll_t cid, const sobject_t& oid, const char *name, bufferptr &bp) +int FileStore::getattr(coll_t cid, const hobject_t& oid, const char *name, bufferptr &bp) { if (fake_attrs) return attrs.getattr(cid, oid, name, bp); @@ -3530,7 +3530,7 @@ int FileStore::getattr(coll_t cid, const sobject_t& oid, const char *name, buffe return r; } -int FileStore::getattrs(coll_t cid, const sobject_t& oid, map& aset, bool user_only) +int FileStore::getattrs(coll_t cid, const hobject_t& oid, map& aset, bool user_only) { if (fake_attrs) return attrs.getattrs(cid, oid, aset); @@ -3540,7 +3540,7 @@ int FileStore::getattrs(coll_t cid, const sobject_t& oid, map& return r; } -int FileStore::_setattr(coll_t cid, const sobject_t& oid, const char *name, +int FileStore::_setattr(coll_t cid, const hobject_t& oid, const char *name, const void *value, size_t size) { if (fake_attrs) return attrs.setattr(cid, oid, name, value, size); @@ -3553,7 +3553,7 @@ int FileStore::_setattr(coll_t cid, const sobject_t& oid, const char *name, return r; } -int FileStore::_setattrs(coll_t cid, const sobject_t& oid, map& aset) +int FileStore::_setattrs(coll_t cid, const hobject_t& oid, map& aset) { if (fake_attrs) return attrs.setattrs(cid, oid, aset); @@ -3581,7 +3581,7 @@ int FileStore::_setattrs(coll_t cid, const sobject_t& oid, map } -int FileStore::_rmattr(coll_t cid, const sobject_t& oid, const char *name) +int FileStore::_rmattr(coll_t cid, const hobject_t& oid, const char *name) { if (fake_attrs) return attrs.rmattr(cid, oid, name); @@ -3593,7 +3593,7 @@ int FileStore::_rmattr(coll_t cid, const sobject_t& oid, const char *name) return r; } -int FileStore::_rmattrs(coll_t cid, const sobject_t& oid) +int FileStore::_rmattrs(coll_t cid, const hobject_t& oid) { //if (fake_attrs) return attrs.rmattrs(cid, oid); @@ -3829,7 +3829,7 @@ bool FileStore::collection_empty(coll_t c) // parse if (de->d_name[0] == '.') continue; //cout << " got object " << de->d_name << std::endl; - sobject_t o; + hobject_t o; if (parse_object(de->d_name, o)) { empty = false; break; @@ -3841,7 +3841,7 @@ bool FileStore::collection_empty(coll_t c) return empty; } -int FileStore::collection_list_partial(coll_t c, snapid_t seq, vector& ls, int max_count, +int FileStore::collection_list_partial(coll_t c, snapid_t seq, vector& ls, int max_count, collection_list_handle_t *handle) { if (fake_collections) return collections.collection_list(c, ls); @@ -3892,7 +3892,7 @@ int FileStore::collection_list_partial(coll_t c, snapid_t seq, vector } //cout << " got object " << de->d_name << std::endl; lfn_translate(dir_name, de->d_name, new_name, sizeof(new_name)); - sobject_t o; + hobject_t o; if (parse_object(new_name, o)) { if (o.snap >= seq) { ls.push_back(o); @@ -3913,7 +3913,7 @@ int FileStore::collection_list_partial(coll_t c, snapid_t seq, vector } -int FileStore::collection_list(coll_t c, vector& ls) +int FileStore::collection_list(coll_t c, vector& ls) { if (fake_collections) return collections.collection_list(c, ls); @@ -3926,7 +3926,7 @@ int FileStore::collection_list(coll_t c, vector& ls) return -errno; // first, build (ino, object) list - vector< pair > inolist; + vector< pair > inolist; struct dirent *de; while (::readdir_r(dir, (struct dirent*)buf, &de) == 0) { @@ -3936,10 +3936,10 @@ int FileStore::collection_list(coll_t c, vector& ls) if (de->d_name[0] == '.') continue; //cout << " got object " << de->d_name << std::endl; - sobject_t o; + hobject_t o; lfn_translate(dir_name, de->d_name, new_name, sizeof(new_name)); if (parse_object(new_name, o)) { - inolist.push_back(pair(de->d_ino, o)); + inolist.push_back(pair(de->d_ino, o)); ls.push_back(o); } } @@ -3951,7 +3951,7 @@ int FileStore::collection_list(coll_t c, vector& ls) // build final list ls.resize(inolist.size()); int i = 0; - for (vector< pair >::iterator p = inolist.begin(); p != inolist.end(); p++) + for (vector< pair >::iterator p = inolist.begin(); p != inolist.end(); p++) ls[i++].swap(p->second); dout(10) << "collection_list " << c << " = 0 (" << ls.size() << " objects)" << dendl; @@ -3987,7 +3987,7 @@ int FileStore::_destroy_collection(coll_t c) } -int FileStore::_collection_add(coll_t c, coll_t cid, const sobject_t& o) +int FileStore::_collection_add(coll_t c, coll_t cid, const hobject_t& o) { if (fake_collections) return collections.collection_add(c, o); @@ -3997,7 +3997,7 @@ int FileStore::_collection_add(coll_t c, coll_t cid, const sobject_t& o) return r; } -int FileStore::_collection_remove(coll_t c, const sobject_t& o) +int FileStore::_collection_remove(coll_t c, const hobject_t& o) { if (fake_collections) return collections.collection_remove(c, o); diff --git a/src/os/FileStore.h b/src/os/FileStore.h index 6d0d71e90f0e9..f215e8fb502b0 100644 --- a/src/os/FileStore.h +++ b/src/os/FileStore.h @@ -67,9 +67,9 @@ class FileStore : public JournalingObjectStore { Finisher ondisk_finisher; // helper fns - int append_oname(const sobject_t &oid, char *s, int len); + int append_oname(const hobject_t &oid, char *s, int len); int get_cdir(coll_t cid, char *s, int len); - bool parse_object(char *s, sobject_t& o); + bool parse_object(char *s, hobject_t& o); int lock_fsid(); @@ -238,18 +238,18 @@ public: void start_logger(int whoami, utime_t tare); void stop_logger(); - int lfn_get(coll_t cid, const sobject_t& oid, char *pathname, int len, char *lfn, int lfn_len, int *exist, int *is_lfn); - int lfn_find(coll_t cid, const sobject_t& oid, char *pathname, int len); - int lfn_getxattr(coll_t cid, const sobject_t& oid, const char *name, void *val, size_t size); - int lfn_setxattr(coll_t cid, const sobject_t& oid, const char *name, const void *val, size_t size); - int lfn_removexattr(coll_t cid, const sobject_t& oid, const char *name); - int lfn_listxattr(coll_t cid, const sobject_t& oid, char *names, size_t len); - int lfn_truncate(coll_t cid, const sobject_t& oid, off_t length); - int lfn_stat(coll_t cid, const sobject_t& oid, struct stat *buf); - int lfn_open(coll_t cid, const sobject_t& oid, int flags, mode_t mode); - int lfn_open(coll_t cid, const sobject_t& oid, int flags); - int lfn_link(coll_t c, coll_t cid, const sobject_t& o) ; - int lfn_unlink(coll_t cid, const sobject_t& o); + int lfn_get(coll_t cid, const hobject_t& oid, char *pathname, int len, char *lfn, int lfn_len, int *exist, int *is_lfn); + int lfn_find(coll_t cid, const hobject_t& oid, char *pathname, int len); + int lfn_getxattr(coll_t cid, const hobject_t& oid, const char *name, void *val, size_t size); + int lfn_setxattr(coll_t cid, const hobject_t& oid, const char *name, const void *val, size_t size); + int lfn_removexattr(coll_t cid, const hobject_t& oid, const char *name); + int lfn_listxattr(coll_t cid, const hobject_t& oid, char *names, size_t len); + int lfn_truncate(coll_t cid, const hobject_t& oid, off_t length); + int lfn_stat(coll_t cid, const hobject_t& oid, struct stat *buf); + int lfn_open(coll_t cid, const hobject_t& oid, int flags, mode_t mode); + int lfn_open(coll_t cid, const hobject_t& oid, int flags); + int lfn_link(coll_t c, coll_t cid, const hobject_t& o) ; + int lfn_unlink(coll_t cid, const hobject_t& o); public: FileStore(const std::string &base, const std::string &jdev); @@ -282,23 +282,23 @@ public: // ------------------ // objects - int pick_object_revision_lt(sobject_t& oid) { + int pick_object_revision_lt(hobject_t& oid) { return 0; } - bool exists(coll_t cid, const sobject_t& oid); - int stat(coll_t cid, const sobject_t& oid, struct stat *st); - int read(coll_t cid, const sobject_t& oid, uint64_t offset, size_t len, bufferlist& bl); - int fiemap(coll_t cid, const sobject_t& oid, uint64_t offset, size_t len, bufferlist& bl); - - int _touch(coll_t cid, const sobject_t& oid); - int _write(coll_t cid, const sobject_t& oid, uint64_t offset, size_t len, const bufferlist& bl); - int _zero(coll_t cid, const sobject_t& oid, uint64_t offset, size_t len); - int _truncate(coll_t cid, const sobject_t& oid, uint64_t size); - int _clone(coll_t cid, const sobject_t& oldoid, const sobject_t& newoid); - int _clone_range(coll_t cid, const sobject_t& oldoid, const sobject_t& newoid, uint64_t srcoff, uint64_t len, uint64_t dstoff); + bool exists(coll_t cid, const hobject_t& oid); + int stat(coll_t cid, const hobject_t& oid, struct stat *st); + int read(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len, bufferlist& bl); + int fiemap(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len, bufferlist& bl); + + int _touch(coll_t cid, const hobject_t& oid); + int _write(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len, const bufferlist& bl); + int _zero(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len); + int _truncate(coll_t cid, const hobject_t& oid, uint64_t size); + int _clone(coll_t cid, const hobject_t& oldoid, const hobject_t& newoid); + int _clone_range(coll_t cid, const hobject_t& oldoid, const hobject_t& newoid, uint64_t srcoff, uint64_t len, uint64_t dstoff); int _do_clone_range(int from, int to, uint64_t srcoff, uint64_t len, uint64_t dstoff); int _do_copy_range(int from, int to, uint64_t srcoff, uint64_t len, uint64_t dstoff); - int _remove(coll_t cid, const sobject_t& oid); + int _remove(coll_t cid, const hobject_t& oid); void _start_sync(); @@ -312,19 +312,19 @@ public: int snapshot(const string& name); // attrs - int getattr(coll_t cid, const sobject_t& oid, const char *name, void *value, size_t size); - int getattr(coll_t cid, const sobject_t& oid, const char *name, bufferptr &bp); - int getattrs(coll_t cid, const sobject_t& oid, map& aset, bool user_only = false); + int getattr(coll_t cid, const hobject_t& oid, const char *name, void *value, size_t size); + int getattr(coll_t cid, const hobject_t& oid, const char *name, bufferptr &bp); + int getattrs(coll_t cid, const hobject_t& oid, map& aset, bool user_only = false); - int _getattr(coll_t cid, const sobject_t& oid, const char *name, bufferptr& bp); - int _getattrs(coll_t cid, const sobject_t& oid, map& aset, bool user_only = false) ; + int _getattr(coll_t cid, const hobject_t& oid, const char *name, bufferptr& bp); + int _getattrs(coll_t cid, const hobject_t& oid, map& aset, bool user_only = false) ; int _getattr(const char *fn, const char *name, bufferptr& bp); int _getattrs(const char *fn, map& aset, bool user_only = false); - int _setattr(coll_t cid, const sobject_t& oid, const char *name, const void *value, size_t size); - int _setattrs(coll_t cid, const sobject_t& oid, map& aset); - int _rmattr(coll_t cid, const sobject_t& oid, const char *name); - int _rmattrs(coll_t cid, const sobject_t& oid); + int _setattr(coll_t cid, const hobject_t& oid, const char *name, const void *value, size_t size); + int _setattrs(coll_t cid, const hobject_t& oid, map& aset); + int _rmattr(coll_t cid, const hobject_t& oid, const char *name); + int _rmattrs(coll_t cid, const hobject_t& oid); int collection_getattr(coll_t c, const char *name, void *value, size_t size); int collection_getattr(coll_t c, const char *name, bufferlist& bl); @@ -340,16 +340,16 @@ public: int collection_stat(coll_t c, struct stat *st); bool collection_exists(coll_t c); bool collection_empty(coll_t c); - int collection_list_partial(coll_t c, snapid_t seq, vector& o, int count, collection_list_handle_t *handle); - int collection_list(coll_t c, vector& o); + int collection_list_partial(coll_t c, snapid_t seq, vector& o, int count, collection_list_handle_t *handle); + int collection_list(coll_t c, vector& o); int _create_collection(coll_t c); int _destroy_collection(coll_t c); - int _collection_add(coll_t c, coll_t ocid, const sobject_t& o); - int _collection_remove(coll_t c, const sobject_t& o); + int _collection_add(coll_t c, coll_t ocid, const hobject_t& o); + int _collection_remove(coll_t c, const hobject_t& o); - void trim_from_cache(coll_t cid, const sobject_t& oid, uint64_t offset, size_t len) {} - int is_cached(coll_t cid, const sobject_t& oid, uint64_t offset, size_t len) { return -1; } + void trim_from_cache(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len) {} + int is_cached(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len) { return -1; } }; #endif diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index 1a0fd3711f8fb..25cc4d7ddfc22 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -228,10 +228,10 @@ public: p = tbl.begin(); ::decode(bl, p); } - sobject_t get_oid() { + hobject_t get_oid() { if (p.get_off() == 0) p = tbl.begin(); - sobject_t soid; + hobject_t soid; ::decode(soid, p); return soid; } @@ -274,14 +274,14 @@ public: ::encode(op, tbl); ops++; } - void touch(coll_t cid, const sobject_t& oid) { + void touch(coll_t cid, const hobject_t& oid) { __u32 op = OP_TOUCH; ::encode(op, tbl); ::encode(cid, tbl); ::encode(oid, tbl); ops++; } - void write(coll_t cid, const sobject_t& oid, uint64_t off, uint64_t len, const bufferlist& data) { + void write(coll_t cid, const hobject_t& oid, uint64_t off, uint64_t len, const bufferlist& data) { __u32 op = OP_WRITE; ::encode(op, tbl); ::encode(cid, tbl); @@ -297,7 +297,7 @@ public: ::encode(data, tbl); ops++; } - void zero(coll_t cid, const sobject_t& oid, uint64_t off, uint64_t len) { + void zero(coll_t cid, const hobject_t& oid, uint64_t off, uint64_t len) { __u32 op = OP_ZERO; ::encode(op, tbl); ::encode(cid, tbl); @@ -306,7 +306,7 @@ public: ::encode(len, tbl); ops++; } - void trim_from_cache(coll_t cid, const sobject_t& oid, uint64_t off, uint64_t len) { + void trim_from_cache(coll_t cid, const hobject_t& oid, uint64_t off, uint64_t len) { __u32 op = OP_TRIMCACHE; ::encode(op, tbl); ::encode(cid, tbl); @@ -315,7 +315,7 @@ public: ::encode(len, tbl); ops++; } - void truncate(coll_t cid, const sobject_t& oid, uint64_t off) { + void truncate(coll_t cid, const hobject_t& oid, uint64_t off) { __u32 op = OP_TRUNCATE; ::encode(op, tbl); ::encode(cid, tbl); @@ -323,24 +323,24 @@ public: ::encode(off, tbl); ops++; } - void remove(coll_t cid, const sobject_t& oid) { + void remove(coll_t cid, const hobject_t& oid) { __u32 op = OP_REMOVE; ::encode(op, tbl); ::encode(cid, tbl); ::encode(oid, tbl); ops++; } - void setattr(coll_t cid, const sobject_t& oid, const char* name, const void* val, int len) { + void setattr(coll_t cid, const hobject_t& oid, const char* name, const void* val, int len) { string n(name); bufferlist bl; bl.append((char*)val, len); setattr(cid, oid, n, tbl); } - void setattr(coll_t cid, const sobject_t& oid, const char* name, bufferlist& val) { + void setattr(coll_t cid, const hobject_t& oid, const char* name, bufferlist& val) { string n(name); setattr(cid, oid, n, val); } - void setattr(coll_t cid, const sobject_t& oid, const string& s, bufferlist& val) { + void setattr(coll_t cid, const hobject_t& oid, const string& s, bufferlist& val) { __u32 op = OP_SETATTR; ::encode(op, tbl); ::encode(cid, tbl); @@ -349,7 +349,7 @@ public: ::encode(val, tbl); ops++; } - void setattrs(coll_t cid, const sobject_t& oid, map& attrset) { + void setattrs(coll_t cid, const hobject_t& oid, map& attrset) { __u32 op = OP_SETATTRS; ::encode(op, tbl); ::encode(cid, tbl); @@ -357,11 +357,11 @@ public: ::encode(attrset, tbl); ops++; } - void rmattr(coll_t cid, const sobject_t& oid, const char *name) { + void rmattr(coll_t cid, const hobject_t& oid, const char *name) { string n(name); rmattr(cid, oid, n); } - void rmattr(coll_t cid, const sobject_t& oid, const string& s) { + void rmattr(coll_t cid, const hobject_t& oid, const string& s) { __u32 op = OP_RMATTR; ::encode(op, tbl); ::encode(cid, tbl); @@ -369,14 +369,14 @@ public: ::encode(s, tbl); ops++; } - void rmattrs(coll_t cid, const sobject_t& oid) { + void rmattrs(coll_t cid, const hobject_t& oid) { __u32 op = OP_RMATTR; ::encode(op, tbl); ::encode(cid, tbl); ::encode(oid, tbl); ops++; } - void clone(coll_t cid, const sobject_t& oid, sobject_t noid) { + void clone(coll_t cid, const hobject_t& oid, hobject_t noid) { __u32 op = OP_CLONE; ::encode(op, tbl); ::encode(cid, tbl); @@ -384,7 +384,7 @@ public: ::encode(noid, tbl); ops++; } - void clone_range(coll_t cid, const sobject_t& oid, sobject_t noid, + void clone_range(coll_t cid, const hobject_t& oid, hobject_t noid, uint64_t srcoff, uint64_t srclen, uint64_t dstoff) { __u32 op = OP_CLONERANGE2; ::encode(op, tbl); @@ -408,7 +408,7 @@ public: ::encode(cid, tbl); ops++; } - void collection_add(coll_t cid, coll_t ocid, const sobject_t& oid) { + void collection_add(coll_t cid, coll_t ocid, const hobject_t& oid) { __u32 op = OP_COLL_ADD; ::encode(op, tbl); ::encode(cid, tbl); @@ -416,7 +416,7 @@ public: ::encode(oid, tbl); ops++; } - void collection_remove(coll_t cid, const sobject_t& oid) { + void collection_remove(coll_t cid, const hobject_t& oid) { __u32 op = OP_COLL_REMOVE; ::encode(op, tbl); ::encode(cid, tbl); @@ -549,16 +549,16 @@ public: virtual int statfs(struct statfs *buf) = 0; // objects - virtual bool exists(coll_t cid, const sobject_t& oid) = 0; // useful? - virtual int stat(coll_t cid, const sobject_t& oid, struct stat *st) = 0; // struct stat? - virtual int read(coll_t cid, const sobject_t& oid, uint64_t offset, size_t len, bufferlist& bl) = 0; - virtual int fiemap(coll_t cid, const sobject_t& oid, uint64_t offset, size_t len, bufferlist& bl) = 0; + virtual bool exists(coll_t cid, const hobject_t& oid) = 0; // useful? + virtual int stat(coll_t cid, const hobject_t& oid, struct stat *st) = 0; // struct stat? + virtual int read(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len, bufferlist& bl) = 0; + virtual int fiemap(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len, bufferlist& bl) = 0; /* - virtual int _remove(coll_t cid, sobject_t oid) = 0; - virtual int _truncate(coll_t cid, sobject_t oid, uint64_t size) = 0; - virtual int _write(coll_t cid, sobject_t oid, uint64_t offset, size_t len, const bufferlist& bl) = 0; - virtual int _zero(coll_t cid, sobject_t oid, uint64_t offset, size_t len) { + virtual int _remove(coll_t cid, hobject_t oid) = 0; + virtual int _truncate(coll_t cid, hobject_t oid, uint64_t size) = 0; + virtual int _write(coll_t cid, hobject_t oid, uint64_t offset, size_t len, const bufferlist& bl) = 0; + virtual int _zero(coll_t cid, hobject_t oid, uint64_t offset, size_t len) { // write zeros.. yuck! bufferptr bp(len); bufferlist bl; @@ -567,28 +567,28 @@ public: } */ - virtual void trim_from_cache(coll_t cid, const sobject_t& oid, uint64_t offset, size_t len) = 0; //{ } - virtual int is_cached(coll_t cid, const sobject_t& oid, uint64_t offset, size_t len) = 0; //{ return -1; } + virtual void trim_from_cache(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len) = 0; //{ } + virtual int is_cached(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len) = 0; //{ return -1; } - virtual int getattr(coll_t cid, const sobject_t& oid, const char *name, void *value, size_t size) = 0; - virtual int getattr(coll_t cid, const sobject_t& oid, const char *name, bufferptr& value) = 0; - int getattr(coll_t cid, const sobject_t& oid, const char *name, bufferlist& value) { + virtual int getattr(coll_t cid, const hobject_t& oid, const char *name, void *value, size_t size) = 0; + virtual int getattr(coll_t cid, const hobject_t& oid, const char *name, bufferptr& value) = 0; + int getattr(coll_t cid, const hobject_t& oid, const char *name, bufferlist& value) { bufferptr bp; int r = getattr(cid, oid, name, bp); if (bp.length()) value.push_back(bp); return r; } - virtual int getattrs(coll_t cid, const sobject_t& oid, map& aset, bool user_only = false) {return 0;}; + virtual int getattrs(coll_t cid, const hobject_t& oid, map& aset, bool user_only = false) {return 0;}; /* - virtual int _setattr(coll_t cid, sobject_t oid, const char *name, const void *value, size_t size) = 0; - virtual int _setattr(coll_t cid, sobject_t oid, const char *name, const bufferptr &bp) { + virtual int _setattr(coll_t cid, hobject_t oid, const char *name, const void *value, size_t size) = 0; + virtual int _setattr(coll_t cid, hobject_t oid, const char *name, const bufferptr &bp) { return _setattr(cid, oid, name, bp.c_str(), bp.length()); } - virtual int _setattrs(coll_t cid, sobject_t oid, map& aset) = 0; - virtual int _rmattr(coll_t cid, sobject_t oid, const char *name) {return 0;} - virtual int _clone(coll_t cid, sobject_t oid, sobject_t noid) { + virtual int _setattrs(coll_t cid, hobject_t oid, map& aset) = 0; + virtual int _rmattr(coll_t cid, hobject_t oid, const char *name) {return 0;} + virtual int _clone(coll_t cid, hobject_t oid, hobject_t noid) { return -1; } */ @@ -601,14 +601,14 @@ public: virtual int collection_getattr(coll_t cid, const char *name, bufferlist& bl) = 0; virtual int collection_getattrs(coll_t cid, map &aset) = 0; virtual bool collection_empty(coll_t c) = 0; - virtual int collection_list_partial(coll_t c, snapid_t seq, vector& o, int count, collection_list_handle_t *handle) = 0; - virtual int collection_list(coll_t c, vector& o) = 0; + virtual int collection_list_partial(coll_t c, snapid_t seq, vector& o, int count, collection_list_handle_t *handle) = 0; + virtual int collection_list(coll_t c, vector& o) = 0; /* virtual int _create_collection(coll_t c) = 0; virtual int _destroy_collection(coll_t c) = 0; - virtual int _collection_add(coll_t c, coll_t ocid, sobject_t o) = 0; - virtual int _collection_remove(coll_t c, sobject_t o) = 0; + virtual int _collection_add(coll_t c, coll_t ocid, hobject_t o) = 0; + virtual int _collection_remove(coll_t c, hobject_t o) = 0; virtual int _collection_setattr(coll_t cid, const char *name, const void *value, size_t size) = 0; virtual int _collection_rmattr(coll_t cid, const char *name) = 0; -- 2.39.5