summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/client/Client.cc2
-rw-r--r--src/client/Client.h2
-rw-r--r--src/cmon.cc3
-rw-r--r--src/common/ClassHandler.cc20
-rw-r--r--src/common/ClassHandler.h18
-rw-r--r--src/cosd.cc2
-rw-r--r--src/dupstore.cc4
-rw-r--r--src/ebofs/Cnode.h4
-rw-r--r--src/ebofs/Ebofs.cc32
-rw-r--r--src/ebofs/Ebofs.h20
-rw-r--r--src/ebofs/Onode.h6
-rw-r--r--src/include/encoding.h54
-rw-r--r--src/include/filepath.h5
-rw-r--r--src/include/object.h9
-rw-r--r--src/librados.cc4
-rw-r--r--src/mds/Anchor.h2
-rw-r--r--src/mds/CDentry.h9
-rw-r--r--src/mds/CDir.cc14
-rw-r--r--src/mds/CDir.h15
-rw-r--r--src/mds/CInode.cc6
-rw-r--r--src/mds/CInode.h2
-rw-r--r--src/mds/Locker.cc2
-rw-r--r--src/mds/Locker.h2
-rw-r--r--src/mds/MDCache.cc12
-rw-r--r--src/mds/Server.cc2
-rw-r--r--src/mds/events/EMetaBlob.h16
-rw-r--r--src/mds/events/ESlaveUpdate.h2
-rw-r--r--src/mds/mdstypes.h16
-rw-r--r--src/messages/MAuthReply.h4
-rw-r--r--src/messages/MCacheExpire.h6
-rw-r--r--src/messages/MClientLease.h4
-rw-r--r--src/messages/MClientRequest.h4
-rw-r--r--src/messages/MDentryLink.h6
-rw-r--r--src/messages/MDentryUnlink.h6
-rw-r--r--src/messages/MMDSCacheRejoin.h6
-rw-r--r--src/messages/MMonSubscribe.h2
-rw-r--r--src/messages/MOSDSubOp.h2
-rw-r--r--src/mon/MDSMonitor.cc2
-rw-r--r--src/mon/MonClient.cc2
-rw-r--r--src/mon/MonClient.h14
-rw-r--r--src/mon/Monitor.cc6
-rw-r--r--src/mon/OSDMonitor.cc2
-rw-r--r--src/mon/Session.h12
-rw-r--r--src/os/Fake.h14
-rw-r--r--src/os/FileStore.cc24
-rw-r--r--src/os/FileStore.h10
-rw-r--r--src/os/ObjectStore.h36
-rw-r--r--src/osd/OSD.cc6
-rw-r--r--src/osd/OSD.h8
-rw-r--r--src/osd/OSDMap.h10
-rw-r--r--src/osd/PG.cc2
-rw-r--r--src/osd/ReplicatedPG.cc36
-rw-r--r--src/osd/osd_types.h9
-rw-r--r--src/osdc/Journaler.h2
-rw-r--r--src/osdc/Objecter.h6
-rw-r--r--src/radosacl.cc2
-rw-r--r--src/rbdtool.cc4
57 files changed, 262 insertions, 270 deletions
diff --git a/src/client/Client.cc b/src/client/Client.cc
index 7d52fa27a0f..cd4e229cbf2 100644
--- a/src/client/Client.cc
+++ b/src/client/Client.cc
@@ -219,7 +219,7 @@ void Client::dump_inode(Inode *in, set<Inode*>& did)
if (in->dir) {
dout(1) << " dir size " << in->dir->dentries.size() << dendl;
//for (hash_map<const char*, Dentry*, hash<const char*>, eqstr>::iterator it = in->dir->dentries.begin();
- for (hash_map<nstring, Dentry*>::iterator it = in->dir->dentries.begin();
+ for (hash_map<string, Dentry*>::iterator it = in->dir->dentries.begin();
it != in->dir->dentries.end();
it++) {
dout(1) << " dn " << it->first << " ref " << it->second->ref << dendl;
diff --git a/src/client/Client.h b/src/client/Client.h
index ff735e2a790..621411634e6 100644
--- a/src/client/Client.h
+++ b/src/client/Client.h
@@ -250,7 +250,7 @@ class Dentry : public LRUObject {
class Dir {
public:
Inode *parent_inode; // my inode
- hash_map<nstring, Dentry*> dentries;
+ hash_map<string, Dentry*> dentries;
__u64 release_count;
Dir(Inode* in) : release_count(0) { parent_inode = in; }
diff --git a/src/cmon.cc b/src/cmon.cc
index 40cf121592d..9bed3f0cf65 100644
--- a/src/cmon.cc
+++ b/src/cmon.cc
@@ -30,7 +30,6 @@ using namespace std;
#include "msg/SimpleMessenger.h"
#include "include/CompatSet.h"
-#include "include/nstring.h"
#include "common/Timer.h"
#include "common/common_init.h"
@@ -97,7 +96,7 @@ int main(int argc, const char **argv)
bufferlist magicbl;
store.get_bl_ss(magicbl, "magic", 0);
- nstring magic(magicbl.length()-1, magicbl.c_str()); // ignore trailing \n
+ string magic(magicbl.c_str(), magicbl.length()-1); // ignore trailing \n
if (strcmp(magic.c_str(), CEPH_MON_ONDISK_MAGIC)) {
cerr << "mon fs magic '" << magic << "' != current '" << CEPH_MON_ONDISK_MAGIC << "'" << std::endl;
exit(1);
diff --git a/src/common/ClassHandler.cc b/src/common/ClassHandler.cc
index f99a6a8bc9e..6e7528c38ac 100644
--- a/src/common/ClassHandler.cc
+++ b/src/common/ClassHandler.cc
@@ -56,7 +56,7 @@ done:
return;
}
-void ClassHandler::load_class(const nstring& cname)
+void ClassHandler::load_class(const string& cname)
{
ClassData& cls = get_obj(cname);
if (&cls == &null_cls_data) {
@@ -68,10 +68,10 @@ void ClassHandler::load_class(const nstring& cname)
cls.mutex->Unlock();
}
-ClassHandler::ClassData& ClassHandler::get_obj(const nstring& cname)
+ClassHandler::ClassData& ClassHandler::get_obj(const string& cname)
{
Mutex::Locker locker(mutex);
- map<nstring, ClassData>::iterator iter = classes.find(cname);
+ map<string, ClassData>::iterator iter = classes.find(cname);
if (iter == classes.end()) {
ClassData& cls = classes[cname];
cls.mutex = new Mutex("ClassData");
@@ -89,7 +89,7 @@ ClassHandler::ClassData& ClassHandler::get_obj(const nstring& cname)
return iter->second;
}
-ClassHandler::ClassData *ClassHandler::get_class(const nstring& cname, ClassVersion& version)
+ClassHandler::ClassData *ClassHandler::get_class(const string& cname, ClassVersion& version)
{
ClassHandler::ClassData *ret = NULL;
ClassData *class_data = &get_obj(cname);
@@ -160,7 +160,7 @@ void ClassHandler::handle_class(MClass *m)
void ClassHandler::resend_class_requests()
{
- for (map<nstring,ClassData>::iterator p = classes.begin(); p != classes.end(); p++) {
+ for (map<string,ClassData>::iterator p = classes.begin(); p != classes.end(); p++) {
dout(20) << "resending class request "<< p->first.c_str() << " v" << p->second.version << dendl;
osd->send_class_request(p->first.c_str(), p->second.version);
}
@@ -237,7 +237,7 @@ bool ClassHandler::ClassData::_add_dependency(cls_deps_t *dep)
dout(0) << "couldn't get class dep object, out of memory?" << dendl;
return false;
}
- map<nstring, ClassData *>::iterator iter = missing_dependencies.find(dep->name);
+ map<string, ClassData *>::iterator iter = missing_dependencies.find(dep->name);
dependencies[dep->name] = &cls_dep;
dout(0) << "adding dependency " << dep->name << dendl;
@@ -264,7 +264,7 @@ bool ClassHandler::ClassData::_add_dependency(cls_deps_t *dep)
void ClassHandler::ClassData::satisfy_dependency(ClassData *cls)
{
Mutex::Locker lock(*mutex);
- map<nstring, ClassData *>::iterator iter = missing_dependencies.find(cls->name);
+ map<string, ClassData *>::iterator iter = missing_dependencies.find(cls->name);
if (iter != missing_dependencies.end()) {
dout(0) << "satisfied dependency name=" << name << " dep=" << cls->name << dendl;
@@ -317,7 +317,7 @@ ClassHandler::ClassMethod *ClassHandler::ClassData::register_cxx_method(const ch
ClassHandler::ClassMethod *ClassHandler::ClassData::get_method(const char *mname)
{
Mutex::Locker lock(*mutex);
- map<nstring, ClassHandler::ClassMethod>::iterator iter = methods_map.find(mname);
+ map<string, ClassHandler::ClassMethod>::iterator iter = methods_map.find(mname);
if (iter == methods_map.end())
return NULL;
@@ -328,7 +328,7 @@ ClassHandler::ClassMethod *ClassHandler::ClassData::get_method(const char *mname
void ClassHandler::ClassData::unregister_method(ClassHandler::ClassMethod *method)
{
/* no need for locking, called under the class_init mutex */
- map<nstring, ClassMethod>::iterator iter;
+ map<string, ClassMethod>::iterator iter;
iter = methods_map.find(method->name);
if (iter == methods_map.end())
@@ -388,7 +388,7 @@ int ClassHandler::ClassMethod::exec(cls_method_context_t ctx, bufferlist& indata
return ret;
}
-int ClassHandler::get_method_flags(const nstring& cname, const nstring& mname)
+int ClassHandler::get_method_flags(const string& cname, const string& mname)
{
ClassData& cls = get_obj(cname);
if (&cls == &null_cls_data)
diff --git a/src/common/ClassHandler.h b/src/common/ClassHandler.h
index 62be92444fd..e9c1e2005ed 100644
--- a/src/common/ClassHandler.h
+++ b/src/common/ClassHandler.h
@@ -52,15 +52,15 @@ public:
ClassVersion version;
time_t timeout;
ClassImpl impl;
- nstring name;
+ string name;
OSD *osd;
ClassHandler *handler;
void *handle;
bool registered;
- map<nstring, ClassMethod> methods_map;
+ map<string, ClassMethod> methods_map;
- map<nstring, ClassData *> dependencies; /* our dependencies */
- map<nstring, ClassData *> missing_dependencies; /* only missing dependencies */
+ map<string, ClassData *> dependencies; /* our dependencies */
+ map<string, ClassData *> missing_dependencies; /* only missing dependencies */
list<ClassData *> dependents; /* classes that depend on us */
bool has_missing_deps() { return (missing_dependencies.size() > 0); }
@@ -81,16 +81,16 @@ public:
bool cache_timed_out();
};
Mutex mutex;
- map<nstring, ClassData> classes;
+ map<string, ClassData> classes;
- ClassData& get_obj(const nstring& cname);
+ ClassData& get_obj(const string& cname);
- void load_class(const nstring& cname);
+ void load_class(const string& cname);
void _load_class(ClassData &data);
ClassHandler(OSD *_osd) : osd(_osd), mutex("ClassHandler") {}
- ClassData *get_class(const nstring& cname, ClassVersion& version);
+ ClassData *get_class(const string& cname, ClassVersion& version);
void resend_class_requests();
void handle_class(MClass *m);
@@ -98,7 +98,7 @@ public:
ClassData *register_class(const char *cname);
void unregister_class(ClassData *cls);
- int get_method_flags(const nstring& cname, const nstring& mname);
+ int get_method_flags(const string& cname, const string& mname);
};
diff --git a/src/cosd.cc b/src/cosd.cc
index 9f9d995da2c..ee72cbc01d0 100644
--- a/src/cosd.cc
+++ b/src/cosd.cc
@@ -111,7 +111,7 @@ int main(int argc, const char **argv)
exit(0);
}
- nstring magic;
+ string magic;
ceph_fsid_t fsid;
int w;
int r = OSD::peek_meta(g_conf.osd_data, magic, fsid, w);
diff --git a/src/dupstore.cc b/src/dupstore.cc
index 0932ddc1573..12be359dd77 100644
--- a/src/dupstore.cc
+++ b/src/dupstore.cc
@@ -42,7 +42,7 @@ int dupstore(ObjectStore* src, ObjectStore* dst)
{
ObjectStore::Transaction t;
t.create_collection(*p);
- map<nstring,bufferptr> attrs;
+ map<string,bufferptr> attrs;
src->collection_getattrs(*p, attrs);
t.collection_setattrs(*p, attrs);
dst->apply_transaction(t);
@@ -61,7 +61,7 @@ int dupstore(ObjectStore* src, ObjectStore* dst)
src->read(*p, *q, 0, 0, bl);
cout << "object " << j++ << "/" << numo << " " << *q << " = " << bl.length() << " bytes" << std::endl;
t.write(*p, *q, 0, bl.length(), bl);
- map<nstring,bufferptr> attrs;
+ map<string,bufferptr> attrs;
src->getattrs(*p, *q, attrs);
t.setattrs(*p, *q, attrs);
did_object[*q] = *p;
diff --git a/src/ebofs/Cnode.h b/src/ebofs/Cnode.h
index 4d7681e466c..810124532cf 100644
--- a/src/ebofs/Cnode.h
+++ b/src/ebofs/Cnode.h
@@ -36,7 +36,7 @@ class Cnode : public LRUObject
extent_t cnode_loc;
epoch_t last_alloc_epoch;
- map<nstring,bufferptr> attr;
+ map<string,bufferptr> attr;
public:
Cnode(coll_t cid) : ref(0), dirty(false), coll_id(cid), last_alloc_epoch(0) {
@@ -75,7 +75,7 @@ class Cnode : public LRUObject
int get_attr_bytes() {
int s = 0;
- for (map<nstring, bufferptr>::iterator i = attr.begin();
+ for (map<string, bufferptr>::iterator i = attr.begin();
i != attr.end();
i++) {
s += i->first.length() + 1;
diff --git a/src/ebofs/Ebofs.cc b/src/ebofs/Ebofs.cc
index 4f8307b9d71..c5ac1d69d7a 100644
--- a/src/ebofs/Ebofs.cc
+++ b/src/ebofs/Ebofs.cc
@@ -830,7 +830,7 @@ csum_t Ebofs::encode_onode(Onode *on, bufferlist& bl, unsigned& off)
}
// attr
- for (map<nstring, bufferptr>::iterator i = on->attr.begin();
+ for (map<string, bufferptr>::iterator i = on->attr.begin();
i != on->attr.end();
i++) {
bl.copy_in(off, i->first.length()+1, i->first.c_str());
@@ -1180,7 +1180,7 @@ csum_t Ebofs::encode_cnode(Cnode *cn, bufferlist& bl, unsigned& off)
off += sizeof(ec);
// attr
- for (map<nstring, bufferptr>::iterator i = cn->attr.begin();
+ for (map<string, bufferptr>::iterator i = cn->attr.begin();
i != cn->attr.end();
i++) {
bl.copy_in(off, i->first.length()+1, i->first.c_str());
@@ -2586,7 +2586,7 @@ unsigned Ebofs::_apply_transaction(Transaction& t)
{
coll_t cid = t.get_cid();
pobject_t oid = t.get_oid();
- map<nstring,bufferptr>& attrset = t.get_attrset();
+ map<string,bufferptr>& attrset = t.get_attrset();
if (_setattrs(oid, attrset) < 0) {
dout(7) << "apply_transaction fail on _setattrs" << dendl;
r &= bit;
@@ -3212,7 +3212,7 @@ int Ebofs::_setattr(pobject_t oid, const char *name, const void *value, size_t s
Onode *on = get_onode(oid);
if (!on) return -ENOENT;
- nstring n(name);
+ string n(name);
on->attr[n] = buffer::copy((char*)value, size);
dirty_onode(on);
put_onode(on);
@@ -3245,7 +3245,7 @@ int Ebofs::setattr(coll_t cid, pobject_t oid, const char *name, const void *valu
return r;
}
-int Ebofs::_setattrs(pobject_t oid, map<nstring,bufferptr>& attrset)
+int Ebofs::_setattrs(pobject_t oid, map<string,bufferptr>& attrset)
{
dout(8) << "setattrs " << oid << dendl;
@@ -3258,7 +3258,7 @@ int Ebofs::_setattrs(pobject_t oid, map<nstring,bufferptr>& attrset)
return 0;
}
-int Ebofs::setattrs(coll_t cid, pobject_t oid, map<nstring,bufferptr>& attrset, Context *onsafe)
+int Ebofs::setattrs(coll_t cid, pobject_t oid, map<string,bufferptr>& attrset, Context *onsafe)
{
ebofs_lock.Lock();
int r = _setattrs(oid, attrset);
@@ -3357,7 +3357,7 @@ int Ebofs::_getattr(pobject_t oid, const char *name, bufferptr& bp)
return r;
}
-int Ebofs::getattrs(coll_t cid, pobject_t oid, map<nstring,bufferptr> &aset)
+int Ebofs::getattrs(coll_t cid, pobject_t oid, map<string,bufferptr> &aset)
{
ebofs_lock.Lock();
int r = _getattrs(oid, aset);
@@ -3365,7 +3365,7 @@ int Ebofs::getattrs(coll_t cid, pobject_t oid, map<nstring,bufferptr> &aset)
return r;
}
-int Ebofs::_getattrs(pobject_t oid, map<nstring,bufferptr> &aset)
+int Ebofs::_getattrs(pobject_t oid, map<string,bufferptr> &aset)
{
dout(8) << "_getattrs " << oid << dendl;
@@ -3416,7 +3416,7 @@ int Ebofs::rmattr(coll_t cid, pobject_t oid, const char *name, Context *onsafe)
return r;
}
-int Ebofs::listattr(coll_t cid, pobject_t oid, vector<nstring>& attrs)
+int Ebofs::listattr(coll_t cid, pobject_t oid, vector<string>& attrs)
{
ebofs_lock.Lock();
dout(8) << "listattr " << oid << dendl;
@@ -3428,7 +3428,7 @@ int Ebofs::listattr(coll_t cid, pobject_t oid, vector<nstring>& attrs)
}
attrs.clear();
- for (map<nstring,bufferptr>::iterator i = on->attr.begin();
+ for (map<string,bufferptr>::iterator i = on->attr.begin();
i != on->attr.end();
i++) {
attrs.push_back(i->first);
@@ -3820,7 +3820,7 @@ int Ebofs::collection_getattr(coll_t cid, const char *name, bufferlist& bl)
return r;
}
-int Ebofs::collection_getattrs(coll_t cid, map<nstring,bufferptr> &aset)
+int Ebofs::collection_getattrs(coll_t cid, map<string,bufferptr> &aset)
{
ebofs_lock.Lock();
int r = _collection_getattrs(cid, aset);
@@ -3828,7 +3828,7 @@ int Ebofs::collection_getattrs(coll_t cid, map<nstring,bufferptr> &aset)
return r;
}
-int Ebofs::_collection_getattrs(coll_t cid, map<nstring,bufferptr> &aset)
+int Ebofs::_collection_getattrs(coll_t cid, map<string,bufferptr> &aset)
{
dout(8) << "_collection_getattrs " << cid << dendl;
@@ -3839,7 +3839,7 @@ int Ebofs::_collection_getattrs(coll_t cid, map<nstring,bufferptr> &aset)
return 0;
}
-int Ebofs::collection_setattrs(coll_t cid, map<nstring,bufferptr> &aset)
+int Ebofs::collection_setattrs(coll_t cid, map<string,bufferptr> &aset)
{
ebofs_lock.Lock();
int r = _collection_setattrs(cid, aset);
@@ -3847,7 +3847,7 @@ int Ebofs::collection_setattrs(coll_t cid, map<nstring,bufferptr> &aset)
return r;
}
-int Ebofs::_collection_setattrs(coll_t cid, map<nstring,bufferptr> &aset)
+int Ebofs::_collection_setattrs(coll_t cid, map<string,bufferptr> &aset)
{
dout(8) << "_collection_setattrs " << cid << dendl;
@@ -3900,7 +3900,7 @@ int Ebofs::collection_rmattr(coll_t cid, const char *name, Context *onsafe)
return 0;
}
-int Ebofs::collection_listattr(coll_t cid, vector<nstring>& attrs)
+int Ebofs::collection_listattr(coll_t cid, vector<string>& attrs)
{
ebofs_lock.Lock();
dout(10) << "collection_listattr " << hex << cid << dec << dendl;
@@ -3912,7 +3912,7 @@ int Ebofs::collection_listattr(coll_t cid, vector<nstring>& attrs)
}
attrs.clear();
- for (map<nstring,bufferptr>::iterator i = cn->attr.begin();
+ for (map<string,bufferptr>::iterator i = cn->attr.begin();
i != cn->attr.end();
i++) {
attrs.push_back(i->first);
diff --git a/src/ebofs/Ebofs.h b/src/ebofs/Ebofs.h
index 13006bf869d..e36b026c8dd 100644
--- a/src/ebofs/Ebofs.h
+++ b/src/ebofs/Ebofs.h
@@ -274,12 +274,12 @@ protected:
// object attr
int setattr(coll_t cid, pobject_t oid, const char *name, const void *value, size_t size, Context *onsafe=0);
- int setattrs(coll_t cid, pobject_t oid, map<nstring,bufferptr>& attrset, Context *onsafe=0);
+ int setattrs(coll_t cid, pobject_t oid, map<string,bufferptr>& attrset, Context *onsafe=0);
int getattr(coll_t cid, pobject_t oid, const char *name, void *value, size_t size);
int getattr(coll_t cid, pobject_t oid, const char *name, bufferptr& bp);
- int getattrs(coll_t cid, pobject_t oid, map<nstring,bufferptr> &aset);
+ int getattrs(coll_t cid, pobject_t oid, map<string,bufferptr> &aset);
int rmattr(coll_t cid, pobject_t oid, const char *name, Context *onsafe=0);
- int listattr(coll_t cid, pobject_t oid, vector<nstring>& attrs);
+ int listattr(coll_t cid, pobject_t oid, vector<string>& attrs);
int get_object_collections(coll_t cid, pobject_t oid, set<coll_t>& ls);
@@ -296,12 +296,12 @@ protected:
int collection_list(coll_t c, vector<pobject_t>& o);
int collection_setattr(coll_t cid, const char *name, const void *value, size_t size, Context *onsafe);
- int collection_setattrs(coll_t cid, map<nstring,bufferptr> &aset);
+ int collection_setattrs(coll_t cid, map<string,bufferptr> &aset);
int collection_getattr(coll_t cid, const char *name, void *value, size_t size);
int collection_getattr(coll_t cid, const char *name, bufferlist& bl);
- int collection_getattrs(coll_t cid, map<nstring,bufferptr> &aset);
+ int collection_getattrs(coll_t cid, map<string,bufferptr> &aset);
int collection_rmattr(coll_t cid, const char *name, Context *onsafe);
- int collection_listattr(coll_t oid, vector<nstring>& attrs);
+ int collection_listattr(coll_t oid, vector<string>& attrs);
// maps
int map_lookup(pobject_t o, bufferlist& key, bufferlist& val);
@@ -330,7 +330,7 @@ private:
int _stat(pobject_t oid, struct stat *st);
int _getattr(pobject_t oid, const char *name, void *value, size_t size);
int _getattr(pobject_t oid, const char *name, bufferptr& bp);
- int _getattrs(pobject_t oid, map<nstring,bufferptr> &aset);
+ int _getattrs(pobject_t oid, map<string,bufferptr> &aset);
int _get_object_collections(pobject_t oid, set<coll_t>& ls);
bool _write_will_block();
@@ -343,7 +343,7 @@ private:
int _clone(coll_t cid, pobject_t from, pobject_t to);
int _clone_range(coll_t cid, pobject_t from, pobject_t to, __u64 off, __u64 len);
int _setattr(pobject_t oid, const char *name, const void *value, size_t size);
- int _setattrs(pobject_t oid, map<nstring,bufferptr>& attrset);
+ int _setattrs(pobject_t oid, map<string,bufferptr>& attrset);
int _rmattr(pobject_t oid, const char *name);
bool _collection_exists(coll_t c);
int _collection_list(coll_t c, vector<pobject_t>& o);
@@ -351,9 +351,9 @@ private:
int _destroy_collection(coll_t c);
int _collection_add(coll_t c, pobject_t o);
int _collection_remove(coll_t c, pobject_t o);
- int _collection_getattrs(coll_t oid, map<nstring,bufferptr> &aset);
+ int _collection_getattrs(coll_t oid, map<string,bufferptr> &aset);
int _collection_setattr(coll_t oid, const char *name, const void *value, size_t size);
- int _collection_setattrs(coll_t oid, map<nstring,bufferptr> &aset);
+ int _collection_setattrs(coll_t oid, map<string,bufferptr> &aset);
int _collection_rmattr(coll_t cid, const char *name);
diff --git a/src/ebofs/Onode.h b/src/ebofs/Onode.h
index c151b512653..3d8754b79fe 100644
--- a/src/ebofs/Onode.h
+++ b/src/ebofs/Onode.h
@@ -23,8 +23,6 @@
#include "include/interval_set.h"
-#include "include/nstring.h"
-
/*
* object node (like an inode)
*
@@ -84,7 +82,7 @@ public:
// onode
set<coll_t> collections;
- map<nstring, bufferptr> attr;
+ map<string, bufferptr> attr;
map<block_t, ExtentCsum> extent_map;
interval_set<__u64> bad_byte_extents;
@@ -508,7 +506,7 @@ public:
}
int get_attr_bytes() {
int s = 0;
- for (map<nstring, bufferptr>::iterator i = attr.begin();
+ for (map<string, bufferptr>::iterator i = attr.begin();
i != attr.end();
i++) {
s += i->first.length() + 1;
diff --git a/src/include/encoding.h b/src/include/encoding.h
index 16d08799c88..60db42a97dc 100644
--- a/src/include/encoding.h
+++ b/src/include/encoding.h
@@ -108,6 +108,16 @@ inline void decode(std::string& s, bufferlist::iterator& p)
p.copy(len, s);
}
+inline void encode_nohead(const std::string& s, bufferlist& bl)
+{
+ bl.append(s.data(), s.length());
+}
+inline void decode_nohead(int len, std::string& s, bufferlist::iterator& p)
+{
+ s.clear();
+ p.copy(len, s);
+}
+
// const char* (encode only, string compatible)
inline void encode(const char *s, bufferlist& bl)
{
@@ -281,28 +291,6 @@ inline void decode(std::list<T>& ls, bufferlist::iterator& p)
}
}
-// deque
-template<class T>
-inline void encode(const std::deque<T>& ls, bufferlist& bl)
-{
- __u32 n = ls.size();
- encode(n, bl);
- for (typename std::deque<T>::const_iterator p = ls.begin(); p != ls.end(); ++p)
- encode(*p, bl);
-}
-template<class T>
-inline void decode(std::deque<T>& ls, bufferlist::iterator& p)
-{
- __u32 n;
- decode(n, p);
- ls.clear();
- while (n--) {
- T v;
- decode(v, p);
- ls.push_back(v);
- }
-}
-
// set
template<class T>
inline void encode(const std::set<T>& s, bufferlist& bl)
@@ -517,5 +505,27 @@ inline void decode(__gnu_cxx::hash_set<T>& m, bufferlist::iterator& p)
}
}
+// deque
+template<class T>
+inline void encode(const std::deque<T>& ls, bufferlist& bl)
+{
+ __u32 n = ls.size();
+ encode(n, bl);
+ for (typename std::deque<T>::const_iterator p = ls.begin(); p != ls.end(); ++p)
+ encode(*p, bl);
+}
+template<class T>
+inline void decode(std::deque<T>& ls, bufferlist::iterator& p)
+{
+ __u32 n;
+ decode(n, p);
+ ls.clear();
+ while (n--) {
+ T v;
+ decode(v, p);
+ ls.push_back(v);
+ }
+}
+
#endif
diff --git a/src/include/filepath.h b/src/include/filepath.h
index 3b209caf91c..4b989e4ec0d 100644
--- a/src/include/filepath.h
+++ b/src/include/filepath.h
@@ -31,7 +31,6 @@ using namespace std;
#include "buffer.h"
#include "encoding.h"
-#include "nstring.h"
class filepath {
inodeno_t ino; // base inode. ino=0 implies pure relative path.
@@ -161,10 +160,6 @@ class filepath {
path += s;
bits.push_back(s);
}
- void push_dentry(const nstring &ns) {
- string s = ns.c_str();
- push_dentry(s);
- }
void push_dentry(const char *cs) {
string s = cs;
push_dentry(s);
diff --git a/src/include/object.h b/src/include/object.h
index 75be694cf69..e3a497f23b9 100644
--- a/src/include/object.h
+++ b/src/include/object.h
@@ -26,13 +26,14 @@ using namespace std;
using namespace __gnu_cxx;
#include "hash.h"
-#include "nstring.h"
#include "encoding.h"
+#include "ceph_hash.h"
struct object_t {
- nstring name;
+ string name;
- object_t(const char *s = 0) : name(s) {}
+ object_t() {}
+ object_t(const char *s) : name(s) {}
object_t(const string& s) : name(s) {}
void swap(object_t& o) {
name.swap(o.name);
@@ -72,7 +73,7 @@ inline ostream& operator<<(ostream& out, const object_t& o) {
namespace __gnu_cxx {
template<> struct hash<object_t> {
size_t operator()(const object_t& r) const {
- //static hash<nstring> H;
+ //static hash<string> H;
//return H(r.name);
return ceph_str_hash_linux(r.name.c_str(), r.name.length());
}
diff --git a/src/librados.cc b/src/librados.cc
index d5b735dc22e..562497866f9 100644
--- a/src/librados.cc
+++ b/src/librados.cc
@@ -1102,14 +1102,14 @@ int RadosClient::getxattrs(PoolCtx& pool, const object_t& oid, map<std::string,
lock.Lock();
ceph_object_layout layout = objecter->osdmap->make_object_layout(oid, pool.poolid);
- map<nstring, bufferlist> aset;
+ map<string, bufferlist> aset;
objecter->getxattrs(oid, layout, pool.snap_seq,
aset,
0, onack);
lock.Unlock();
attrset.clear();
- for (map<nstring,bufferlist>::iterator p = aset.begin(); p != aset.end(); p++)
+ for (map<string,bufferlist>::iterator p = aset.begin(); p != aset.end(); p++)
attrset[p->first.c_str()] = p->second;
mylock.Lock();
diff --git a/src/mds/Anchor.h b/src/mds/Anchor.h
index 16d24140d2d..adbe9612915 100644
--- a/src/mds/Anchor.h
+++ b/src/mds/Anchor.h
@@ -40,7 +40,7 @@ public:
Anchor() : dn_hash(0), nref(0), updated(0) {}
Anchor(inodeno_t i, inodeno_t di, __u32 hash, int nr, version_t u) :
ino(i), dirino(di), dn_hash(hash), nref(nr), updated(u) { }
- Anchor(inodeno_t i, inodeno_t di, const nstring &dname, int nr, version_t u) :
+ Anchor(inodeno_t i, inodeno_t di, const string &dname, int nr, version_t u) :
ino(i), dirino(di),
dn_hash(ceph_str_hash_linux(dname.data(), dname.length())),
nref(nr), updated(u) { }
diff --git a/src/mds/CDentry.h b/src/mds/CDentry.h
index 3ef4b575ff2..8233304fa87 100644
--- a/src/mds/CDentry.h
+++ b/src/mds/CDentry.h
@@ -26,7 +26,6 @@ using namespace std;
#include "include/lru.h"
#include "include/elist.h"
#include "include/filepath.h"
-#include "include/nstring.h"
#include "mdstypes.h"
#include "SimpleLock.h"
@@ -91,7 +90,7 @@ public:
}
public:
- nstring name;
+ string name;
snapid_t first, last;
dentry_key_t key() {
@@ -157,7 +156,7 @@ public:
public:
// cons
- CDentry(const nstring& n,
+ CDentry(const string& n,
snapid_t f, snapid_t l) :
name(n),
first(f), last(l),
@@ -169,7 +168,7 @@ public:
g_num_dn++;
g_num_dna++;
}
- CDentry(const nstring& n, inodeno_t ino, unsigned char dt,
+ CDentry(const string& n, inodeno_t ino, unsigned char dt,
snapid_t f, snapid_t l) :
name(n),
first(f), last(l),
@@ -190,7 +189,7 @@ public:
CDir *get_dir() const { return dir; }
- const nstring& get_name() const { return name; }
+ const string& get_name() const { return name; }
/*
CInode *get_inode() const { return linkage.inode; }
diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc
index 88d6d20571f..e3a52cba92a 100644
--- a/src/mds/CDir.cc
+++ b/src/mds/CDir.cc
@@ -218,7 +218,7 @@ CDentry *CDir::lookup(const char *name, snapid_t snap)
* linking fun
*/
-CDentry* CDir::add_null_dentry(const nstring& dname,
+CDentry* CDir::add_null_dentry(const string& dname,
snapid_t first, snapid_t last)
{
// foreign
@@ -254,7 +254,7 @@ CDentry* CDir::add_null_dentry(const nstring& dname,
}
-CDentry* CDir::add_primary_dentry(const nstring& dname, CInode *in,
+CDentry* CDir::add_primary_dentry(const string& dname, CInode *in,
snapid_t first, snapid_t last)
{
// primary
@@ -289,7 +289,7 @@ CDentry* CDir::add_primary_dentry(const nstring& dname, CInode *in,
return dn;
}
-CDentry* CDir::add_remote_dentry(const nstring& dname, inodeno_t ino, unsigned char d_type,
+CDentry* CDir::add_remote_dentry(const string& dname, inodeno_t ino, unsigned char d_type,
snapid_t first, snapid_t last)
{
// foreign
@@ -777,7 +777,7 @@ void CDir::merge(int bits, list<Context*>& waiters, bool replay)
* WAITING
*/
-void CDir::add_dentry_waiter(const nstring& dname, snapid_t snapid, Context *c)
+void CDir::add_dentry_waiter(const string& dname, snapid_t snapid, Context *c)
{
if (waiting_on_dentry.empty())
get(PIN_DNWAITER);
@@ -787,7 +787,7 @@ void CDir::add_dentry_waiter(const nstring& dname, snapid_t snapid, Context *c)
<< " " << c << " on " << *this << dendl;
}
-void CDir::take_dentry_waiting(const nstring& dname, snapid_t first, snapid_t last,
+void CDir::take_dentry_waiting(const string& dname, snapid_t first, snapid_t last,
list<Context*>& ls)
{
if (waiting_on_dentry.empty())
@@ -886,7 +886,7 @@ void CDir::take_waiting(__u64 mask, list<Context*>& ls)
map<string_snap_t, list<Context*> >::iterator it =
waiting_on_dentry.begin();
while (it != waiting_on_dentry.end()) {
- nstring name = it->first.name;
+ string name = it->first.name;
snapid_t snap = it->first.snapid;
it++;
take_dentry_waiting(name, snap, snap, ls);
@@ -1153,7 +1153,7 @@ void CDir::_fetched(bufferlist &bl)
loff_t dn_offset = p.get_off() - baseoff;
// dname
- nstring dname;
+ string dname;
snapid_t first, last;
dentry_key_t::decode_helper(p, dname, last);
diff --git a/src/mds/CDir.h b/src/mds/CDir.h
index 0cfe2a28f6c..c377c5c0b7e 100644
--- a/src/mds/CDir.h
+++ b/src/mds/CDir.h
@@ -299,7 +299,7 @@ protected:
// -- dentries and inodes --
public:
- CDentry* lookup_exact_snap(const nstring& dname, snapid_t last) {
+ CDentry* lookup_exact_snap(const string& dname, snapid_t last) {
map_t::iterator p = items.find(dentry_key_t(last, dname.c_str()));
if (p == items.end())
return NULL;
@@ -308,16 +308,13 @@ protected:
CDentry* lookup(const string& n, snapid_t snap=CEPH_NOSNAP) {
return lookup(n.c_str(), snap);
}
- CDentry* lookup(const nstring& ns, snapid_t snap=CEPH_NOSNAP) {
- return lookup(ns.c_str(), snap);
- }
CDentry* lookup(const char *n, snapid_t snap=CEPH_NOSNAP);
- CDentry* add_null_dentry(const nstring& dname,
+ CDentry* add_null_dentry(const string& dname,
snapid_t first=2, snapid_t last=CEPH_NOSNAP);
- CDentry* add_primary_dentry(const nstring& dname, CInode *in,
+ CDentry* add_primary_dentry(const string& dname, CInode *in,
snapid_t first=2, snapid_t last=CEPH_NOSNAP);
- CDentry* add_remote_dentry(const nstring& dname, inodeno_t ino, unsigned char d_type,
+ CDentry* add_remote_dentry(const string& dname, inodeno_t ino, unsigned char d_type,
snapid_t first=2, snapid_t last=CEPH_NOSNAP);
void remove_dentry( CDentry *dn ); // delete dentry
void link_remote_inode( CDentry *dn, inodeno_t ino, unsigned char d_type);
@@ -483,8 +480,8 @@ public:
bool is_waiting_for_dentry(const char *dname, snapid_t snap) {
return waiting_on_dentry.count(string_snap_t(dname, snap));
}
- void add_dentry_waiter(const nstring& dentry, snapid_t snap, Context *c);
- void take_dentry_waiting(const nstring& dentry, snapid_t first, snapid_t last, list<Context*>& ls);
+ void add_dentry_waiter(const string& dentry, snapid_t snap, Context *c);
+ void take_dentry_waiting(const string& dentry, snapid_t first, snapid_t last, list<Context*>& ls);
bool is_waiting_for_ino(inodeno_t ino) {
return waiting_on_ino.count(ino);
diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc
index 911a3531be1..d8280632668 100644
--- a/src/mds/CInode.cc
+++ b/src/mds/CInode.cc
@@ -241,7 +241,7 @@ void CInode::pop_and_dirty_projected_inode(LogSegment *ls)
// dirfrags
-frag_t CInode::pick_dirfrag(const nstring& dn)
+frag_t CInode::pick_dirfrag(const string& dn)
{
if (dirfragtree.empty())
return frag_t(); // avoid the string hash if we can.
@@ -689,7 +689,7 @@ void CInode::store(Context *fin)
assert(is_base());
bufferlist bl;
- nstring magic = CEPH_FS_ONDISK_MAGIC;
+ string magic = CEPH_FS_ONDISK_MAGIC;
::encode(magic, bl);
encode_store(bl);
@@ -752,7 +752,7 @@ void CInode::_fetched(bufferlist& bl, Context *fin)
{
dout(10) << "_fetched" << dendl;
bufferlist::iterator p = bl.begin();
- nstring magic;
+ string magic;
::decode(magic, p);
dout(10) << " magic is '" << magic << "' (expecting '" << CEPH_FS_ONDISK_MAGIC << "')" << dendl;
if (magic != CEPH_FS_ONDISK_MAGIC) {
diff --git a/src/mds/CInode.h b/src/mds/CInode.h
index 7b1cb93ebd8..526d1efbe67 100644
--- a/src/mds/CInode.h
+++ b/src/mds/CInode.h
@@ -229,7 +229,7 @@ private:
int stickydir_ref;
public:
- frag_t pick_dirfrag(const nstring &dn);
+ frag_t pick_dirfrag(const string &dn);
bool has_dirfrags() { return !dirfrags.empty(); }
CDir* get_dirfrag(frag_t fg) {
if (dirfrags.count(fg)) {
diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc
index c39968be77c..68e569c314f 100644
--- a/src/mds/Locker.cc
+++ b/src/mds/Locker.cc
@@ -1812,7 +1812,7 @@ void Locker::handle_client_caps(MClientCaps *m)
void Locker::process_cap_update(MDRequest *mdr, client_t client,
inodeno_t ino, __u64 cap_id, int caps, int wanted,
int seq, int issue_seq, int mseq,
- const nstring& dname)
+ const string& dname)
{
CInode *in = mdcache->get_inode(ino);
if (!in)
diff --git a/src/mds/Locker.h b/src/mds/Locker.h
index d77cbf62fbf..149473d6114 100644
--- a/src/mds/Locker.h
+++ b/src/mds/Locker.h
@@ -171,7 +171,7 @@ public:
void process_cap_update(MDRequest *mdr, client_t client,
inodeno_t ino, __u64 cap_id, int caps, int wanted,
int seq, int issue_seq, int mseq,
- const nstring& dname);
+ const string& dname);
void kick_cap_releases(MDRequest *mdr);
protected:
diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc
index 8b72a9d64f5..aa9eba6bacc 100644
--- a/src/mds/MDCache.cc
+++ b/src/mds/MDCache.cc
@@ -329,7 +329,7 @@ void MDCache::create_mydir_hierarchy(C_Gather *gather)
// stray dir
CInode *stray = create_system_inode(MDS_INO_STRAY(mds->whoami), S_IFDIR);
CDir *straydir = stray->get_or_open_dirfrag(this, frag_t());
- nstring name("stray");
+ string name("stray");
mydir->add_primary_dentry(name, stray);
stray->inode.dirstat = straydir->fnode.fragstat;
stray->inode.accounted_rstat = stray->inode.rstat;
@@ -527,7 +527,7 @@ void MDCache::populate_mydir()
}
// open or create stray
- nstring strayname("stray");
+ string strayname("stray");
CDentry *straydn = mydir->lookup(strayname);
if (!straydn || !straydn->get_linkage()->get_inode()) {
_create_system_file(mydir, strayname.c_str(), create_system_inode(MDS_INO_STRAY(mds->whoami), S_IFDIR),
@@ -538,7 +538,7 @@ void MDCache::populate_mydir()
assert(stray);
// open or create journal file
- nstring jname("journal");
+ string jname("journal");
CDentry *jdn = mydir->lookup(jname);
if (!jdn || !jdn->get_linkage()->get_inode()) {
_create_system_file(mydir, jname.c_str(), create_system_inode(MDS_INO_LOG_OFFSET + mds->whoami, S_IFREG),
@@ -5173,7 +5173,7 @@ void MDCache::handle_cache_expire(MCacheExpire *m)
}
// DENTRIES
- for (map<dirfrag_t, map<pair<nstring,snapid_t>,int> >::iterator pd = p->second.dentries.begin();
+ for (map<dirfrag_t, map<pair<string,snapid_t>,int> >::iterator pd = p->second.dentries.begin();
pd != p->second.dentries.end();
++pd) {
dout(10) << " dn expires in dir " << pd->first << dendl;
@@ -5188,7 +5188,7 @@ void MDCache::handle_cache_expire(MCacheExpire *m)
assert(dir->is_auth());
}
- for (map<pair<nstring,snapid_t>,int>::iterator p = pd->second.begin();
+ for (map<pair<string,snapid_t>,int>::iterator p = pd->second.begin();
p != pd->second.end();
++p) {
int nonce = p->second;
@@ -7890,7 +7890,7 @@ CDir *MDCache::forge_replica_dir(CInode *diri, frag_t fg, int from)
CDentry *MDCache::add_replica_dentry(bufferlist::iterator& p, CDir *dir, list<Context*>& finished)
{
- nstring name;
+ string name;
snapid_t last;
::decode(name, p);
::decode(last, p);
diff --git a/src/mds/Server.cc b/src/mds/Server.cc
index bde9d236e12..1e17876decb 100644
--- a/src/mds/Server.cc
+++ b/src/mds/Server.cc
@@ -2357,7 +2357,7 @@ void Server::handle_client_readdir(MDRequest *mdr)
snapid_t snapid = mdr->snapid;
- nstring offset_str = req->get_path2();
+ string offset_str = req->get_path2();
const char *offset = offset_str.length() ? offset_str.c_str() : 0;
dout(10) << "snapid " << snapid << " offset '" << offset_str << "'" << dendl;
diff --git a/src/mds/events/EMetaBlob.h b/src/mds/events/EMetaBlob.h
index 24a8d7b87d1..4a316afc7f8 100644
--- a/src/mds/events/EMetaBlob.h
+++ b/src/mds/events/EMetaBlob.h
@@ -17,8 +17,6 @@
#include <stdlib.h>
-#include "include/nstring.h"
-
#include "../CInode.h"
#include "../CDir.h"
#include "../CDentry.h"
@@ -50,7 +48,7 @@ public:
/* fullbit - a regular dentry + inode
*/
struct fullbit {
- nstring dn; // dentry
+ string dn; // dentry
snapid_t dnfirst, dnlast;
version_t dnv;
inode_t inode; // if it's not
@@ -62,7 +60,7 @@ public:
bufferlist _enc;
- fullbit(const nstring& d, snapid_t df, snapid_t dl,
+ fullbit(const string& d, snapid_t df, snapid_t dl,
version_t v, inode_t& i, fragtree_t &dft,
map<string,bufferptr> &xa, const string& sym, bufferlist &sbl, bool dr) :
//dn(d), dnfirst(df), dnlast(dl), dnv(v),
@@ -135,7 +133,7 @@ public:
/* remotebit - a dentry + remote inode link (i.e. just an ino)
*/
struct remotebit {
- nstring dn;
+ string dn;
snapid_t dnfirst, dnlast;
version_t dnv;
inodeno_t ino;
@@ -144,7 +142,7 @@ public:
bufferlist _enc;
- remotebit(const nstring& d, snapid_t df, snapid_t dl, version_t v, inodeno_t i, unsigned char dt, bool dr) :
+ remotebit(const string& d, snapid_t df, snapid_t dl, version_t v, inodeno_t i, unsigned char dt, bool dr) :
//dn(d), dnfirst(df), dnlast(dl), dnv(v), ino(i), d_type(dt), dirty(dr) { }
_enc(256) {
::encode(d, _enc);
@@ -196,14 +194,14 @@ public:
* nullbit - a null dentry
*/
struct nullbit {
- nstring dn;
+ string dn;
snapid_t dnfirst, dnlast;
version_t dnv;
bool dirty;
bufferlist _enc;
- nullbit(const nstring& d, snapid_t df, snapid_t dl, version_t v, bool dr) :
+ nullbit(const string& d, snapid_t df, snapid_t dl, version_t v, bool dr) :
//dn(d), dnfirst(df), dnlast(dl), dnv(v), dirty(dr) { }
_enc(128) {
::encode(d, _enc);
@@ -600,7 +598,7 @@ private:
else
in->encode_snap_blob(snapbl);
- nstring empty;
+ string empty;
delete root;
root = new fullbit(empty,
in->first, in->last,
diff --git a/src/mds/events/ESlaveUpdate.h b/src/mds/events/ESlaveUpdate.h
index cdfd37330f3..e1ff2812937 100644
--- a/src/mds/events/ESlaveUpdate.h
+++ b/src/mds/events/ESlaveUpdate.h
@@ -60,7 +60,7 @@ struct rename_rollback {
utime_t dirfrag_old_mtime;
utime_t dirfrag_old_rctime;
inodeno_t ino, remote_ino;
- nstring dname;
+ string dname;
char remote_d_type;
utime_t old_ctime;
diff --git a/src/mds/mdstypes.h b/src/mds/mdstypes.h
index b7bfd1d31d5..4f8009a2034 100644
--- a/src/mds/mdstypes.h
+++ b/src/mds/mdstypes.h
@@ -16,7 +16,6 @@ using namespace std;
#include "include/frag.h"
#include "include/xlist.h"
-#include "include/nstring.h"
#include <boost/pool/pool.hpp>
@@ -585,15 +584,15 @@ struct dentry_key_t {
bl.append("_", 1);
bl.append(b);
}
- static void decode_helper(bufferlist::iterator& bl, nstring& nm, snapid_t& sn) {
- nstring foo;
+ static void decode_helper(bufferlist::iterator& bl, string& nm, snapid_t& sn) {
+ string foo;
::decode(foo, bl);
int i = foo.length()-1;
while (foo[i] != '_' && i)
i--;
assert(i);
- if (i+5 == foo.length() &&
+ if (i+5 == (int)foo.length() &&
foo[i+1] == 'h' &&
foo[i+2] == 'e' &&
foo[i+3] == 'a' &&
@@ -606,7 +605,7 @@ struct dentry_key_t {
sscanf(foo.c_str() + i + 1, "%llx", &x);
sn = x;
}
- nm = nstring(i, foo.c_str());
+ nm = string(foo.c_str(), i);
}
};
@@ -627,14 +626,13 @@ inline bool operator<(const dentry_key_t& k1, const dentry_key_t& k2)
/*
- * string_snap_t is a simple (nstring, snapid_t) pair
+ * string_snap_t is a simple (string, snapid_t) pair
*/
struct string_snap_t {
- nstring name;
+ string name;
snapid_t snapid;
string_snap_t() {}
string_snap_t(const string& n, snapid_t s) : name(n), snapid(s) {}
- string_snap_t(const nstring& n, snapid_t s) : name(n), snapid(s) {}
string_snap_t(const char *n, snapid_t s) : name(n), snapid(s) {}
void encode(bufferlist& bl) const {
__u8 struct_v = 1;
@@ -1068,7 +1066,7 @@ class MDSCacheObjectInfo {
public:
inodeno_t ino;
dirfrag_t dirfrag;
- nstring dname;
+ string dname;
snapid_t snapid;
MDSCacheObjectInfo() : ino(0) {}
diff --git a/src/messages/MAuthReply.h b/src/messages/MAuthReply.h
index e900dee7989..3458262bfc2 100644
--- a/src/messages/MAuthReply.h
+++ b/src/messages/MAuthReply.h
@@ -21,11 +21,11 @@ struct MAuthReply : public Message {
__u32 protocol;
__s32 result;
__u64 global_id; // if zero, meaningless
- cstring result_msg;
+ string result_msg;
bufferlist result_bl;
MAuthReply() : Message(CEPH_MSG_AUTH_REPLY), protocol(0), result(0) {}
- MAuthReply(__u32 p, bufferlist *bl = NULL, int r = 0, __u64 gid=0, const char *msg = 0) :
+ MAuthReply(__u32 p, bufferlist *bl = NULL, int r = 0, __u64 gid=0, const char *msg = "") :
Message(CEPH_MSG_AUTH_REPLY),
protocol(p), result(r), global_id(gid),
result_msg(msg) {
diff --git a/src/messages/MCacheExpire.h b/src/messages/MCacheExpire.h
index f19d8da311e..256fad8948d 100644
--- a/src/messages/MCacheExpire.h
+++ b/src/messages/MCacheExpire.h
@@ -26,7 +26,7 @@ public:
struct realm {
map<vinodeno_t, __s32> inodes;
map<dirfrag_t, __s32> dirs;
- map<dirfrag_t, map<pair<nstring,snapid_t>,__s32> > dentries;
+ map<dirfrag_t, map<pair<string,snapid_t>,__s32> > dentries;
void encode(bufferlist &bl) const {
::encode(inodes, bl);
@@ -61,8 +61,8 @@ public:
void add_dir(dirfrag_t r, dirfrag_t df, int nonce) {
realms[r].dirs[df] = nonce;
}
- void add_dentry(dirfrag_t r, dirfrag_t df, const nstring& dn, snapid_t last, int nonce) {
- realms[r].dentries[df][pair<nstring,snapid_t>(dn,last)] = nonce;
+ void add_dentry(dirfrag_t r, dirfrag_t df, const string& dn, snapid_t last, int nonce) {
+ realms[r].dentries[df][pair<string,snapid_t>(dn,last)] = nonce;
}
void add_realm(dirfrag_t df, realm& r) {
diff --git a/src/messages/MClientLease.h b/src/messages/MClientLease.h
index 2d1e454ea83..8d5b9b8e3e5 100644
--- a/src/messages/MClientLease.h
+++ b/src/messages/MClientLease.h
@@ -20,7 +20,7 @@
struct MClientLease : public Message {
struct ceph_mds_lease h;
- nstring dname;
+ string dname;
int get_action() { return h.action; }
ceph_seq_t get_seq() { return h.seq; }
@@ -39,7 +39,7 @@ struct MClientLease : public Message {
h.first = sf;
h.last = sl;
}
- MClientLease(int ac, ceph_seq_t seq, int m, __u64 i, __u64 sf, __u64 sl, const nstring& d) :
+ MClientLease(int ac, ceph_seq_t seq, int m, __u64 i, __u64 sf, __u64 sl, const string& d) :
Message(CEPH_MSG_CLIENT_LEASE),
dname(d) {
h.action = ac;
diff --git a/src/messages/MClientRequest.h b/src/messages/MClientRequest.h
index 19824581517..231cc2faed5 100644
--- a/src/messages/MClientRequest.h
+++ b/src/messages/MClientRequest.h
@@ -52,10 +52,10 @@ public:
struct Release {
mutable ceph_mds_request_release item;
- nstring dname;
+ string dname;
Release() : item(), dname() {}
- Release(const ceph_mds_request_release& rel, nstring name) :
+ Release(const ceph_mds_request_release& rel, string name) :
item(rel), dname(name) {}
void encode(bufferlist& bl) const {
diff --git a/src/messages/MDentryLink.h b/src/messages/MDentryLink.h
index c0f9867340d..223c635ab44 100644
--- a/src/messages/MDentryLink.h
+++ b/src/messages/MDentryLink.h
@@ -18,19 +18,19 @@
class MDentryLink : public Message {
dirfrag_t dirfrag;
- nstring dn;
+ string dn;
bool is_primary;
public:
dirfrag_t get_dirfrag() { return dirfrag; }
- nstring& get_dn() { return dn; }
+ string& get_dn() { return dn; }
bool get_is_primary() { return is_primary; }
bufferlist bl;
MDentryLink() :
Message(MSG_MDS_DENTRYLINK) { }
- MDentryLink(dirfrag_t df, nstring& n, bool p) :
+ MDentryLink(dirfrag_t df, string& n, bool p) :
Message(MSG_MDS_DENTRYLINK),
dirfrag(df),
dn(n),
diff --git a/src/messages/MDentryUnlink.h b/src/messages/MDentryUnlink.h
index b37e1f6a2d6..c857d7bffaf 100644
--- a/src/messages/MDentryUnlink.h
+++ b/src/messages/MDentryUnlink.h
@@ -18,17 +18,17 @@
class MDentryUnlink : public Message {
dirfrag_t dirfrag;
- nstring dn;
+ string dn;
public:
dirfrag_t get_dirfrag() { return dirfrag; }
- nstring& get_dn() { return dn; }
+ string& get_dn() { return dn; }
bufferlist straybl;
MDentryUnlink() :
Message(MSG_MDS_DENTRYUNLINK) { }
- MDentryUnlink(dirfrag_t df, nstring& n) :
+ MDentryUnlink(dirfrag_t df, string& n) :
Message(MSG_MDS_DENTRYUNLINK),
dirfrag(df),
dn(n) {}
diff --git a/src/messages/MMDSCacheRejoin.h b/src/messages/MMDSCacheRejoin.h
index 024788f91b9..d4d30839e5b 100644
--- a/src/messages/MMDSCacheRejoin.h
+++ b/src/messages/MMDSCacheRejoin.h
@@ -245,13 +245,13 @@ public:
void add_weak_primary_dentry(dirfrag_t df, const string& dname, snapid_t first, snapid_t last, inodeno_t ino) {
weak[df][string_snap_t(dname, last)] = dn_weak(first, ino);
}
- void add_strong_dentry(dirfrag_t df, const nstring& dname, snapid_t first, snapid_t last, inodeno_t pi, inodeno_t ri, unsigned char rdt, int n, int ls) {
+ void add_strong_dentry(dirfrag_t df, const string& dname, snapid_t first, snapid_t last, inodeno_t pi, inodeno_t ri, unsigned char rdt, int n, int ls) {
strong_dentries[df][string_snap_t(dname, last)] = dn_strong(first, pi, ri, rdt, n, ls);
}
- void add_dentry_authpin(dirfrag_t df, const nstring& dname, snapid_t last, const metareqid_t& ri) {
+ void add_dentry_authpin(dirfrag_t df, const string& dname, snapid_t last, const metareqid_t& ri) {
authpinned_dentries[df][string_snap_t(dname, last)] = ri;
}
- void add_dentry_xlock(dirfrag_t df, const nstring& dname, snapid_t last, const metareqid_t& ri) {
+ void add_dentry_xlock(dirfrag_t df, const string& dname, snapid_t last, const metareqid_t& ri) {
xlocked_dentries[df][string_snap_t(dname, last)] = ri;
}
diff --git a/src/messages/MMonSubscribe.h b/src/messages/MMonSubscribe.h
index ee7901c2e27..702e17f6b13 100644
--- a/src/messages/MMonSubscribe.h
+++ b/src/messages/MMonSubscribe.h
@@ -18,7 +18,7 @@
#include "msg/Message.h"
struct MMonSubscribe : public Message {
- map<nstring, ceph_mon_subscribe_item> what;
+ map<string, ceph_mon_subscribe_item> what;
MMonSubscribe() : Message(CEPH_MSG_MON_SUBSCRIBE) {}
private:
diff --git a/src/messages/MOSDSubOp.h b/src/messages/MOSDSubOp.h
index 0e1f464baf2..63af1533487 100644
--- a/src/messages/MOSDSubOp.h
+++ b/src/messages/MOSDSubOp.h
@@ -59,7 +59,7 @@ public:
eversion_t pg_trim_to; // primary->replica: trim to here
osd_peer_stat_t peer_stat;
- map<nstring,bufferptr> attrset;
+ map<string,bufferptr> attrset;
interval_set<__u64> data_subset;
map<sobject_t, interval_set<__u64> > clone_subsets;
diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc
index c094648b9cb..f6d57f42721 100644
--- a/src/mon/MDSMonitor.cc
+++ b/src/mon/MDSMonitor.cc
@@ -575,7 +575,7 @@ bool MDSMonitor::prepare_command(MMonCommand *m)
void MDSMonitor::check_subs()
{
- nstring type = "mdsmap";
+ string type = "mdsmap";
xlist<Subscription*>::iterator p = mon->session_map.subs[type].begin();
while (!p.end()) {
Subscription *sub = *p;
diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc
index 0f5e32415e1..da8476dfa64 100644
--- a/src/mon/MonClient.cc
+++ b/src/mon/MonClient.cc
@@ -18,8 +18,6 @@
#include "messages/MAuth.h"
#include "messages/MAuthReply.h"
-#include "include/nstring.h"
-
#include "messages/MMonSubscribe.h"
#include "messages/MMonSubscribeAck.h"
#include "common/ConfUtils.h"
diff --git a/src/mon/MonClient.h b/src/mon/MonClient.h
index a1ee384d8c7..0cbc9f96f5a 100644
--- a/src/mon/MonClient.h
+++ b/src/mon/MonClient.h
@@ -114,17 +114,17 @@ public:
// mon subscriptions
private:
- map<nstring,ceph_mon_subscribe_item> sub_have; // my subs, and current versions
+ map<string,ceph_mon_subscribe_item> sub_have; // my subs, and current versions
utime_t sub_renew_sent, sub_renew_after;
void _renew_subs();
void handle_subscribe_ack(MMonSubscribeAck* m);
- void _sub_want(nstring what, version_t have) {
+ void _sub_want(string what, version_t have) {
sub_have[what].have = have;
sub_have[what].onetime = false;
}
- bool _sub_want_onetime(nstring what, version_t have) {
+ bool _sub_want_onetime(string what, version_t have) {
if (sub_have.count(what) == 0) {
sub_have[what].have = have;
sub_have[what].onetime = true;
@@ -133,7 +133,7 @@ private:
sub_have[what].have = have;
return false;
}
- void _sub_got(nstring what, version_t have) {
+ void _sub_got(string what, version_t have) {
if (sub_have.count(what)) {
if (sub_have[what].onetime)
sub_have.erase(what);
@@ -150,15 +150,15 @@ public:
Mutex::Locker l(monc_lock);
_renew_subs();
}
- void sub_want(nstring what, version_t have) {
+ void sub_want(string what, version_t have) {
Mutex::Locker l(monc_lock);
_sub_want(what, have);
}
- bool sub_want_onetime(nstring what, version_t have) {
+ bool sub_want_onetime(string what, version_t have) {
Mutex::Locker l(monc_lock);
return _sub_want_onetime(what, have);
}
- void sub_got(nstring what, version_t have) {
+ void sub_got(string what, version_t have) {
Mutex::Locker l(monc_lock);
_sub_got(what, have);
}
diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc
index 233e0794f08..b6c264f7e52 100644
--- a/src/mon/Monitor.cc
+++ b/src/mon/Monitor.cc
@@ -126,7 +126,7 @@ Monitor::~Monitor()
for (vector<Paxos*>::iterator p = paxos.begin(); p != paxos.end(); p++)
delete *p;
//clean out MonSessionMap's subscriptions
- for (map<nstring, xlist<Subscription*> >::iterator i
+ for (map<string, xlist<Subscription*> >::iterator i
= session_map.subs.begin();
i != session_map.subs.end();
++i) {
@@ -754,7 +754,7 @@ void Monitor::handle_subscribe(MMonSubscribe *m)
s->until = g_clock.now();
s->until += g_conf.mon_subscribe_interval;
- for (map<nstring,ceph_mon_subscribe_item>::iterator p = m->what.begin();
+ for (map<string,ceph_mon_subscribe_item>::iterator p = m->what.begin();
p != m->what.end();
p++) {
if (!p->second.onetime)
@@ -807,7 +807,7 @@ bool Monitor::ms_handle_reset(Connection *con)
void Monitor::check_subs()
{
- nstring type = "monmap";
+ string type = "monmap";
xlist<Subscription*>::iterator p = session_map.subs[type].begin();
while (!p.end()) {
Subscription *sub = *p;
diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc
index 45b8f385143..828c75707b8 100644
--- a/src/mon/OSDMonitor.cc
+++ b/src/mon/OSDMonitor.cc
@@ -760,7 +760,7 @@ void OSDMonitor::blacklist(entity_addr_t a, utime_t until)
void OSDMonitor::check_subs()
{
- nstring type = "osdmap";
+ string type = "osdmap";
xlist<Subscription*>::iterator p = mon->session_map.subs[type].begin();
while (!p.end()) {
Subscription *sub = *p;
diff --git a/src/mon/Session.h b/src/mon/Session.h
index 0c3ad366683..f6595746a17 100644
--- a/src/mon/Session.h
+++ b/src/mon/Session.h
@@ -26,12 +26,12 @@ struct MonSession;
struct Subscription {
MonSession *session;
- nstring type;
+ string type;
xlist<Subscription*>::item type_item;
version_t last;
bool onetime;
- Subscription(MonSession *s, const nstring& t) : session(s), type(t), type_item(this) {};
+ Subscription(MonSession *s, const string& t) : session(s), type(t), type_item(this) {};
};
struct MonSession : public RefCountedObject {
@@ -44,7 +44,7 @@ struct MonSession : public RefCountedObject {
uint64_t global_id;
uint64_t notified_global_id;
- map<nstring, Subscription*> sub_map;
+ map<string, Subscription*> sub_map;
AuthServiceHandler *auth_handler;
@@ -62,12 +62,12 @@ struct MonSession : public RefCountedObject {
struct MonSessionMap {
xlist<MonSession*> sessions;
- map<nstring, xlist<Subscription*> > subs;
+ map<string, xlist<Subscription*> > subs;
multimap<int, MonSession*> by_osd;
void remove_session(MonSession *s) {
assert(!s->closed);
- for (map<nstring,Subscription*>::iterator p = s->sub_map.begin(); p != s->sub_map.end(); ++p)
+ for (map<string,Subscription*>::iterator p = s->sub_map.begin(); p != s->sub_map.end(); ++p)
p->second->type_item.remove_myself();
s->sub_map.clear();
s->item.remove_myself();
@@ -106,7 +106,7 @@ struct MonSessionMap {
}
- void add_update_sub(MonSession *s, const nstring& what, version_t have, bool onetime) {
+ void add_update_sub(MonSession *s, const string& what, version_t have, bool onetime) {
Subscription *sub = 0;
if (s->sub_map.count(what)) {
sub = s->sub_map[what];
diff --git a/src/os/Fake.h b/src/os/Fake.h
index d47fe226aa6..4643c81942f 100644
--- a/src/os/Fake.h
+++ b/src/os/Fake.h
@@ -124,7 +124,7 @@ class FakeAttrs {
class FakeAttrSet {
public:
- map<nstring, bufferptr> attrs;
+ map<string, bufferptr> attrs;
int getattr(const char *name, void *value, size_t size) {
string n = name;
@@ -153,11 +153,11 @@ class FakeAttrs {
}
return -1;
}
- int getattrs(map<nstring,bufferptr>& aset) {
+ int getattrs(map<string,bufferptr>& aset) {
aset = attrs;
return 0;
}
- int setattrs(map<nstring,bufferptr>& aset) {
+ int setattrs(map<string,bufferptr>& aset) {
attrs = aset;
return 0;
}
@@ -200,7 +200,7 @@ class FakeAttrs {
faker_lock.Unlock();
return r;
}
- int setattrs(coll_t cid, sobject_t oid, map<nstring,bufferptr>& aset) {
+ int setattrs(coll_t cid, sobject_t oid, map<string,bufferptr>& aset) {
faker_lock.Lock();
int r = fakeoattrs[oid].setattrs(aset);
faker_lock.Unlock();
@@ -219,7 +219,7 @@ class FakeAttrs {
faker_lock.Unlock();
return r;
}
- int getattrs(coll_t cid, sobject_t oid, map<nstring,bufferptr>& aset) {
+ int getattrs(coll_t cid, sobject_t oid, map<string,bufferptr>& aset) {
faker_lock.Lock();
int r = fakeoattrs[oid].getattrs(aset);
faker_lock.Unlock();
@@ -250,13 +250,13 @@ class FakeAttrs {
faker_lock.Unlock();
return r;
}
- int collection_setattrs(coll_t cid, map<nstring,bufferptr>& aset) {
+ int collection_setattrs(coll_t cid, map<string,bufferptr>& aset) {
faker_lock.Lock();
int r = fakecattrs[cid].setattrs(aset);
faker_lock.Unlock();
return r;
}
- int collection_getattrs(coll_t cid, map<nstring,bufferptr>& aset) {
+ int collection_getattrs(coll_t cid, map<string,bufferptr>& aset) {
faker_lock.Lock();
int r = fakecattrs[cid].getattrs(aset);
faker_lock.Unlock();
diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc
index 6855d63441d..bde0b212a14 100644
--- a/src/os/FileStore.cc
+++ b/src/os/FileStore.cc
@@ -148,7 +148,7 @@ void FileStore::append_oname(const sobject_t &oid, char *s, int len)
char *t = s + strlen(s);
*t++ = '/';
- char *i = oid.oid.name.c_str();
+ const char *i = oid.oid.name.c_str();
while (*i) {
if (*i == '\\') {
*t++ = '\\';
@@ -198,7 +198,7 @@ bool FileStore::parse_object(char *s, sobject_t& o)
i++;
}
*t = 0;
- o.oid.name = nstring(t-buf, buf);
+ o.oid.name = string(buf, t-buf);
if (strcmp(bar+1, "head") == 0)
o.snap = CEPH_NOSNAP;
else if (strcmp(bar+1, "snapdir") == 0)
@@ -1161,7 +1161,7 @@ unsigned FileStore::_do_transaction(Transaction& t)
{
coll_t cid = t.get_cid();
sobject_t oid = t.get_oid();
- map<nstring, bufferptr> aset;
+ map<string, bufferptr> aset;
t.get_attrset(aset);
_setattrs(cid, oid, aset);
}
@@ -1816,7 +1816,7 @@ int FileStore::_getattr(const char *fn, const char *name, bufferptr& bp)
return l;
}
-int FileStore::_getattrs(const char *fn, map<nstring,bufferptr>& aset, bool user_only)
+int FileStore::_getattrs(const char *fn, map<string,bufferptr>& aset, bool user_only)
{
// get attr list
char names1[100];
@@ -1898,7 +1898,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<nstring,bufferptr>& aset, bool user_only)
+int FileStore::getattrs(coll_t cid, const sobject_t& oid, map<string,bufferptr>& aset, bool user_only)
{
if (fake_attrs) return attrs.getattrs(cid, oid, aset);
@@ -1929,7 +1929,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<nstring,bufferptr>& aset)
+int FileStore::_setattrs(coll_t cid, const sobject_t& oid, map<string,bufferptr>& aset)
{
if (fake_attrs) return attrs.setattrs(cid, oid, aset);
@@ -1937,7 +1937,7 @@ int FileStore::_setattrs(coll_t cid, const sobject_t& oid, map<nstring,bufferptr
get_coname(cid, oid, fn, sizeof(fn));
dout(15) << "setattrs " << fn << dendl;
int r = 0;
- for (map<nstring,bufferptr>::iterator p = aset.begin();
+ for (map<string,bufferptr>::iterator p = aset.begin();
p != aset.end();
++p) {
char n[ATTR_MAX];
@@ -1982,10 +1982,10 @@ int FileStore::_rmattrs(coll_t cid, const sobject_t& oid)
dout(15) << "rmattrs " << fn << dendl;
- map<nstring,bufferptr> aset;
+ map<string,bufferptr> aset;
int r = _getattrs(fn, aset);
if (r >= 0) {
- for (map<nstring,bufferptr>::iterator p = aset.begin(); p != aset.end(); p++) {
+ for (map<string,bufferptr>::iterator p = aset.begin(); p != aset.end(); p++) {
char n[ATTR_MAX];
get_attrname(p->first.c_str(), n, ATTR_MAX);
r = do_removexattr(fn, n);
@@ -2033,7 +2033,7 @@ int FileStore::collection_getattr(coll_t c, const char *name, bufferlist& bl)
return r;
}
-int FileStore::collection_getattrs(coll_t cid, map<nstring,bufferptr>& aset)
+int FileStore::collection_getattrs(coll_t cid, map<string,bufferptr>& aset)
{
if (fake_attrs) return attrs.collection_getattrs(cid, aset);
@@ -2076,7 +2076,7 @@ int FileStore::_collection_rmattr(coll_t c, const char *name)
}
-int FileStore::_collection_setattrs(coll_t cid, map<nstring,bufferptr>& aset)
+int FileStore::_collection_setattrs(coll_t cid, map<string,bufferptr>& aset)
{
if (fake_attrs) return attrs.collection_setattrs(cid, aset);
@@ -2084,7 +2084,7 @@ int FileStore::_collection_setattrs(coll_t cid, map<nstring,bufferptr>& aset)
get_cdir(cid, fn, sizeof(fn));
dout(15) << "collection_setattrs " << fn << dendl;
int r = 0;
- for (map<nstring,bufferptr>::iterator p = aset.begin();
+ for (map<string,bufferptr>::iterator p = aset.begin();
p != aset.end();
++p) {
char n[PATH_MAX];
diff --git a/src/os/FileStore.h b/src/os/FileStore.h
index 88a2980067d..3bc2b8fe78b 100644
--- a/src/os/FileStore.h
+++ b/src/os/FileStore.h
@@ -241,23 +241,23 @@ class FileStore : public JournalingObjectStore {
// 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<nstring,bufferptr>& aset, bool user_only = false);
+ int getattrs(coll_t cid, const sobject_t& oid, map<string,bufferptr>& aset, bool user_only = false);
int _getattr(const char *fn, const char *name, bufferptr& bp);
- int _getattrs(const char *fn, map<nstring,bufferptr>& aset, bool user_only = false);
+ int _getattrs(const char *fn, map<string,bufferptr>& 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<nstring,bufferptr>& aset);
+ int _setattrs(coll_t cid, const sobject_t& oid, map<string,bufferptr>& aset);
int _rmattr(coll_t cid, const sobject_t& oid, const char *name);
int _rmattrs(coll_t cid, const sobject_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);
- int collection_getattrs(coll_t cid, map<nstring,bufferptr> &aset);
+ int collection_getattrs(coll_t cid, map<string,bufferptr> &aset);
int _collection_setattr(coll_t c, const char *name, const void *value, size_t size);
int _collection_rmattr(coll_t c, const char *name);
- int _collection_setattrs(coll_t cid, map<nstring,bufferptr> &aset);
+ int _collection_setattrs(coll_t cid, map<string,bufferptr> &aset);
// collections
int list_collections(vector<coll_t>& ls);
diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h
index 2830380bff9..6b73bc35e17 100644
--- a/src/os/ObjectStore.h
+++ b/src/os/ObjectStore.h
@@ -19,7 +19,6 @@
#include "include/types.h"
#include "include/Context.h"
#include "include/buffer.h"
-#include "include/nstring.h"
#include "include/Distribution.h"
@@ -35,6 +34,7 @@
#include <vector>
using std::vector;
+using std::string;
#ifndef MIN
# define MIN(a,b) ((a) < (b) ? (a):(b))
@@ -129,8 +129,8 @@ public:
// for these guys, just use a pointer.
// but, decode to a full value, and create pointers to that.
//vector<const char*> attrnames;
- vector<nstring> attrnames;
- vector<map<nstring,bufferptr> > attrsets;
+ vector<string> attrnames;
+ deque<map<std::string,bufferptr> > attrsets;
unsigned opp, blp, oidp, cidp, lengthp, attrnamep, attrsetp;
@@ -218,7 +218,7 @@ public:
::decode(s, p);
return s;
}
- void get_attrset(map<nstring,bufferptr>& aset) {
+ void get_attrset(map<string,bufferptr>& aset) {
if (old) {
aset = attrsets[attrsetp++];
return;
@@ -286,16 +286,16 @@ public:
ops++;
}
void setattr(coll_t cid, const sobject_t& oid, const char* name, const void* val, int len) {
- nstring n(name);
+ 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) {
- nstring n(name);
+ string n(name);
setattr(cid, oid, n, val);
}
- void setattr(coll_t cid, const sobject_t& oid, nstring& s, bufferlist& val) {
+ void setattr(coll_t cid, const sobject_t& oid, string& s, bufferlist& val) {
__u32 op = OP_SETATTR;
::encode(op, tbl);
::encode(cid, tbl);
@@ -304,7 +304,7 @@ public:
::encode(val, tbl);
ops++;
}
- void setattrs(coll_t cid, const sobject_t& oid, map<nstring,bufferptr>& attrset) {
+ void setattrs(coll_t cid, const sobject_t& oid, map<string,bufferptr>& attrset) {
__u32 op = OP_SETATTRS;
::encode(op, tbl);
::encode(cid, tbl);
@@ -313,10 +313,10 @@ public:
ops++;
}
void rmattr(coll_t cid, const sobject_t& oid, const char *name) {
- nstring n(name);
+ string n(name);
rmattr(cid, oid, n);
}
- void rmattr(coll_t cid, const sobject_t& oid, nstring& s) {
+ void rmattr(coll_t cid, const sobject_t& oid, string& s) {
__u32 op = OP_RMATTR;
::encode(op, tbl);
::encode(cid, tbl);
@@ -382,10 +382,10 @@ public:
collection_setattr(cid, name, tbl);
}
void collection_setattr(coll_t cid, const char* name, bufferlist& val) {
- nstring n(name);
+ string n(name);
collection_setattr(cid, n, val);
}
- void collection_setattr(coll_t cid, nstring& name, bufferlist& val) {
+ void collection_setattr(coll_t cid, string& name, bufferlist& val) {
__u32 op = OP_COLL_SETATTR;
::encode(op, tbl);
::encode(cid, tbl);
@@ -395,17 +395,17 @@ public:
}
void collection_rmattr(coll_t cid, const char* name) {
- nstring n(name);
+ string n(name);
collection_rmattr(cid, n);
}
- void collection_rmattr(coll_t cid, nstring& name) {
+ void collection_rmattr(coll_t cid, string& name) {
__u32 op = OP_COLL_RMATTR;
::encode(op, tbl);
::encode(cid, tbl);
::encode(name, tbl);
ops++;
}
- void collection_setattrs(coll_t cid, map<nstring,bufferptr>& aset) {
+ void collection_setattrs(coll_t cid, map<string,bufferptr>& aset) {
__u32 op = OP_COLL_SETATTRS;
::encode(op, tbl);
::encode(cid, tbl);
@@ -449,7 +449,7 @@ public:
::decode(cids, bl);
::decode(lengths, bl);
::decode(attrnames, bl);
- /*for (vector<nstring>::iterator p = attrnames2.begin();
+ /*for (vector<string>::iterator p = attrnames2.begin();
p != attrnames2.end();
++p)
attrnames.push_back((*p).c_str());*/
@@ -530,7 +530,7 @@ public:
value.push_back(bp);
return r;
}
- virtual int getattrs(coll_t cid, const sobject_t& oid, map<nstring,bufferptr>& aset, bool user_only = false) {return 0;};
+ virtual int getattrs(coll_t cid, const sobject_t& oid, map<string,bufferptr>& 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;
@@ -550,7 +550,7 @@ public:
virtual int collection_getattr(coll_t cid, const char *name,
void *value, size_t size) = 0;
virtual int collection_getattr(coll_t cid, const char *name, bufferlist& bl) = 0;
- virtual int collection_getattrs(coll_t cid, map<nstring,bufferptr> &aset) = 0;
+ virtual int collection_getattrs(coll_t cid, map<string,bufferptr> &aset) = 0;
virtual bool collection_empty(coll_t c) = 0;
virtual int collection_list_partial(coll_t c, snapid_t seq, vector<sobject_t>& o, int count, collection_list_handle_t *handle) = 0;
virtual int collection_list(coll_t c, vector<sobject_t>& o) = 0;
diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc
index 03c138d9064..7bc21ef580b 100644
--- a/src/osd/OSD.cc
+++ b/src/osd/OSD.cc
@@ -257,7 +257,7 @@ int OSD::write_meta(const char *base, ceph_fsid_t& fsid, int whoami)
return 0;
}
-int OSD::peek_meta(const char *dev, nstring& magic, ceph_fsid_t& fsid, int& whoami)
+int OSD::peek_meta(const char *dev, string& magic, ceph_fsid_t& fsid, int& whoami)
{
char val[80] = { 0 };
@@ -4460,7 +4460,7 @@ void OSD::wait_for_no_ops()
// --------------------------------
-int OSD::get_class(const nstring& cname, ClassVersion& version, pg_t pgid, Message *m, ClassHandler::ClassData **cls)
+int OSD::get_class(const string& cname, ClassVersion& version, pg_t pgid, Message *m, ClassHandler::ClassData **cls)
{
Mutex::Locker l(class_lock);
dout(10) << "wait_for_missing_class '" << cname << "' by " << pgid << dendl;
@@ -4483,7 +4483,7 @@ int OSD::get_class(const nstring& cname, ClassVersion& version, pg_t pgid, Messa
return -EAGAIN;
}
-void OSD::got_class(const nstring& cname)
+void OSD::got_class(const string& cname)
{
// no lock.. this is an upcall from handle_class
dout(10) << "got_class '" << cname << "'" << dendl;
diff --git a/src/osd/OSD.h b/src/osd/OSD.h
index 6f6de45e955..cf8fa2c5d8e 100644
--- a/src/osd/OSD.h
+++ b/src/osd/OSD.h
@@ -444,12 +444,12 @@ private:
protected:
// -- classes --
Mutex class_lock;
- map<nstring, map<pg_t, list<Message*> > > waiting_for_missing_class;
+ map<string, map<pg_t, list<Message*> > > waiting_for_missing_class;
- int get_class(const nstring& cname, ClassVersion& version, pg_t pgid, Message *m, ClassHandler::ClassData **cls);
+ int get_class(const string& cname, ClassVersion& version, pg_t pgid, Message *m, ClassHandler::ClassData **cls);
void handle_class(MClass *m);
public:
- void got_class(const nstring& cname);
+ void got_class(const string& cname);
void send_class_request(const char *n, ClassVersion& version);
protected:
@@ -884,7 +884,7 @@ private:
static int read_meta(const char *base, const char *file, char *val, size_t vallen);
static int write_meta(const char *base, ceph_fsid_t& fsid, int whoami);
public:
- static int peek_meta(const char *dev, nstring& magic, ceph_fsid_t& fsid, int& whoami);
+ static int peek_meta(const char *dev, string& magic, ceph_fsid_t& fsid, int& whoami);
// startup/shutdown
diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h
index 63210762700..9b55a83bc9a 100644
--- a/src/osd/OSDMap.h
+++ b/src/osd/OSDMap.h
@@ -151,7 +151,7 @@ public:
// incremental
int32_t new_max_osd;
map<int32_t,pg_pool_t> new_pools;
- map<int32_t,nstring> new_pool_names;
+ map<int32_t,string> new_pool_names;
set<int32_t> old_pools;
map<int32_t,entity_addr_t> new_up;
map<int32_t,uint8_t> new_down;
@@ -263,8 +263,8 @@ private:
map<pg_t,vector<int> > pg_temp; // temp pg mapping (e.g. while we rebuild)
map<int,pg_pool_t> pools;
- map<int32_t,nstring> pool_name;
- map<nstring,int> name_pool;
+ map<int32_t,string> pool_name;
+ map<string,int> name_pool;
hash_map<entity_addr_t,utime_t> blacklist;
@@ -497,7 +497,7 @@ private:
pools[p->first] = p->second;
pools[p->first].v.last_change = epoch;
}
- for (map<int32_t,nstring>::iterator p = inc.new_pool_names.begin();
+ for (map<int32_t,string>::iterator p = inc.new_pool_names.begin();
p != inc.new_pool_names.end();
p++) {
pool_name[p->first] = p->second;
@@ -659,7 +659,7 @@ private:
// index pool names
name_pool.clear();
- for (map<int,nstring>::iterator i = pool_name.begin(); i != pool_name.end(); i++)
+ for (map<int,string>::iterator i = pool_name.begin(); i != pool_name.end(); i++)
name_pool[i->second] = i->first;
}
diff --git a/src/osd/PG.cc b/src/osd/PG.cc
index 1196b2d5af5..60a177b4c8c 100644
--- a/src/osd/PG.cc
+++ b/src/osd/PG.cc
@@ -2627,7 +2627,7 @@ void PG::scrub()
peerok = ok = false;
num_bad++;
}
- for (map<nstring,bufferptr>::iterator q = po->attrs.begin(); q != po->attrs.end(); q++) {
+ for (map<string,bufferptr>::iterator q = po->attrs.begin(); q != po->attrs.end(); q++) {
if (p[i]->attrs.count(q->first)) {
if (q->second.cmp(p[i]->attrs[q->first])) {
dout(0) << "scrub osd" << acting[i] << " " << po->poid
diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc
index e49ae126608..6a1d9d15a7a 100644
--- a/src/osd/ReplicatedPG.cc
+++ b/src/osd/ReplicatedPG.cc
@@ -1014,9 +1014,9 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops,
case CEPH_OSD_OP_GETXATTR:
{
- nstring name(op.xattr.name_len + 1);
- name[0] = '_';
- bp.copy(op.xattr.name_len, name.data()+1);
+ string aname;
+ bp.copy(op.xattr.name_len, aname);
+ string name = "_" + aname;
int r = osd->store->getattr(coll_t::build_pg_coll(info.pgid), soid, name.c_str(), odata);
if (r >= 0) {
op.xattr.value_len = r;
@@ -1029,10 +1029,10 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops,
case CEPH_OSD_OP_GETXATTRS:
{
- map<nstring,bufferptr> attrset;
+ map<string,bufferptr> attrset;
result = osd->store->getattrs(coll_t::build_pg_coll(info.pgid), soid, attrset, true);
- map<nstring, bufferptr>::iterator iter;
- map<nstring, bufferlist> newattrs;
+ map<string, bufferptr>::iterator iter;
+ map<string, bufferlist> newattrs;
for (iter = attrset.begin(); iter != attrset.end(); ++iter) {
bufferlist bl;
bl.append(iter->second);
@@ -1229,9 +1229,9 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops,
{
if (!ctx->obs->exists)
t.touch(coll_t::build_pg_coll(info.pgid), soid);
- nstring name(op.xattr.name_len + 1);
- name[0] = '_';
- bp.copy(op.xattr.name_len, name.data()+1);
+ string aname;
+ bp.copy(op.xattr.name_len, aname);
+ string name = "_" + aname;
bufferlist bl;
bp.copy(op.xattr.value_len, bl);
if (!ctx->obs->exists) // create object if it doesn't yet exist.
@@ -1244,9 +1244,9 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops,
case CEPH_OSD_OP_RMXATTR:
{
- nstring name(op.xattr.name_len + 1);
- name[0] = '_';
- bp.copy(op.xattr.name_len, name.data()+1);
+ string aname;
+ bp.copy(op.xattr.name_len, aname);
+ string name = "_" + aname;
t.rmattr(coll_t::build_pg_coll(info.pgid), soid, name);
info.stats.num_wr++;
}
@@ -1294,7 +1294,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops,
// verify
if (0) {
bufferlist header;
- map<nstring, bufferlist> m;
+ map<string, bufferlist> m;
::decode(header, bp);
::decode(m, bp);
assert(bp.end());
@@ -1341,7 +1341,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops,
if (0) {
// parse
bufferlist header;
- map<nstring, bufferlist> m;
+ map<string, bufferlist> m;
//ibl.hexdump(*_dout);
if (ibl.length()) {
::decode(header, ip);
@@ -1353,7 +1353,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops,
// do the update(s)
while (!bp.end()) {
__u8 op;
- nstring key;
+ string key;
::decode(op, bp);
switch (op) {
@@ -1413,7 +1413,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops,
// update keys
bufferlist newkeydata;
- nstring nextkey;
+ string nextkey;
bufferlist nextval;
bool have_next = false;
if (!ip.end()) {
@@ -1423,7 +1423,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops,
}
while (!bp.end()) {
__u8 op;
- nstring key;
+ string key;
::decode(op, bp);
::decode(key, bp);
@@ -2831,7 +2831,7 @@ void ReplicatedPG::push(const sobject_t& soid, int peer,
{
// read data+attrs
bufferlist bl;
- map<nstring,bufferptr> attrset;
+ map<string,bufferptr> attrset;
__u64 size;
if (data_subset.size() || clone_subsets.size()) {
diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h
index 599eb2a5dc6..3a085779cad 100644
--- a/src/osd/osd_types.h
+++ b/src/osd/osd_types.h
@@ -21,7 +21,6 @@
#include "include/types.h"
#include "include/CompatSet.h"
#include "include/interval_set.h"
-#include "include/nstring.h"
@@ -526,7 +525,7 @@ static inline std::string pg_state_string(int state) {
struct pool_snap_info_t {
snapid_t snapid;
utime_t stamp;
- nstring name;
+ string name;
void encode(bufferlist& bl) const {
__u8 struct_v = 1;
@@ -1080,7 +1079,7 @@ public:
::decode(v, bl);
if (v < 3) {
- nstring magic;
+ string magic;
::decode(magic, bl);
}
::decode(fsid, bl);
@@ -1250,7 +1249,7 @@ struct ScrubMap {
struct object {
sobject_t poid;
__u64 size;
- map<nstring,bufferptr> attrs;
+ map<string,bufferptr> attrs;
void encode(bufferlist& bl) const {
__u8 struct_v = 1;
@@ -1270,7 +1269,7 @@ struct ScrubMap {
WRITE_CLASS_ENCODER(object)
vector<object> objects;
- map<nstring,bufferptr> attrs;
+ map<string,bufferptr> attrs;
bufferlist logbl;
void encode(bufferlist& bl) const {
diff --git a/src/osdc/Journaler.h b/src/osdc/Journaler.h
index 0152857d647..26a52cfd57c 100644
--- a/src/osdc/Journaler.h
+++ b/src/osdc/Journaler.h
@@ -68,7 +68,7 @@ public:
__s64 expire_pos;
__s64 read_pos;
__s64 write_pos;
- nstring magic;
+ string magic;
ceph_file_layout layout;
Header(const char *m=0) :
diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h
index 1cdbcec9433..1a64629b740 100644
--- a/src/osdc/Objecter.h
+++ b/src/osdc/Objecter.h
@@ -265,9 +265,9 @@ public:
struct C_GetAttrs : public Context {
bufferlist bl;
- map<nstring,bufferlist>& attrset;
+ map<string,bufferlist>& attrset;
Context *fin;
- C_GetAttrs(map<nstring, bufferlist>& set, Context *c) : attrset(set), fin(c) {}
+ C_GetAttrs(map<string, bufferlist>& set, Context *c) : attrset(set), fin(c) {}
void finish(int r) {
if (r >= 0) {
bufferlist::iterator p = bl.begin();
@@ -526,7 +526,7 @@ private:
}
tid_t getxattrs(const object_t& oid, ceph_object_layout ol, snapid_t snap,
- map<nstring,bufferlist>& attrset,
+ map<string,bufferlist>& attrset,
int flags, Context *onfinish) {
vector<OSDOp> ops(1);
ops[0].op.op = CEPH_OSD_OP_GETXATTRS;
diff --git a/src/radosacl.cc b/src/radosacl.cc
index f7e396cdbd1..82979ea89ed 100644
--- a/src/radosacl.cc
+++ b/src/radosacl.cc
@@ -103,7 +103,7 @@ void ObjectACLs::set_acl(ACLID& id, ACLFlags flags)
class ACLEntity
{
- nstring name;
+ string name;
map<ACLID, ACLEntity> groups;
};
diff --git a/src/rbdtool.cc b/src/rbdtool.cc
index bbe223250e5..4e3db775019 100644
--- a/src/rbdtool.cc
+++ b/src/rbdtool.cc
@@ -166,10 +166,10 @@ int main(int argc, const char **argv)
}
bufferlist::iterator p = bl.begin();
bufferlist header;
- map<nstring,bufferlist> m;
+ map<string,bufferlist> m;
::decode(header, p);
::decode(m, p);
- for (map<nstring,bufferlist>::iterator q = m.begin(); q != m.end(); q++)
+ for (map<string,bufferlist>::iterator q = m.begin(); q != m.end(); q++)
cout << q->first << std::endl;
}
else if (opt_create) {