]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
replace nstring with std::string
authorSage Weil <sage@newdream.net>
Wed, 28 Apr 2010 20:45:55 +0000 (13:45 -0700)
committerSage Weil <sage@newdream.net>
Wed, 28 Apr 2010 20:45:55 +0000 (13:45 -0700)
57 files changed:
src/client/Client.cc
src/client/Client.h
src/cmon.cc
src/common/ClassHandler.cc
src/common/ClassHandler.h
src/cosd.cc
src/dupstore.cc
src/ebofs/Cnode.h
src/ebofs/Ebofs.cc
src/ebofs/Ebofs.h
src/ebofs/Onode.h
src/include/encoding.h
src/include/filepath.h
src/include/object.h
src/librados.cc
src/mds/Anchor.h
src/mds/CDentry.h
src/mds/CDir.cc
src/mds/CDir.h
src/mds/CInode.cc
src/mds/CInode.h
src/mds/Locker.cc
src/mds/Locker.h
src/mds/MDCache.cc
src/mds/Server.cc
src/mds/events/EMetaBlob.h
src/mds/events/ESlaveUpdate.h
src/mds/mdstypes.h
src/messages/MAuthReply.h
src/messages/MCacheExpire.h
src/messages/MClientLease.h
src/messages/MClientRequest.h
src/messages/MDentryLink.h
src/messages/MDentryUnlink.h
src/messages/MMDSCacheRejoin.h
src/messages/MMonSubscribe.h
src/messages/MOSDSubOp.h
src/mon/MDSMonitor.cc
src/mon/MonClient.cc
src/mon/MonClient.h
src/mon/Monitor.cc
src/mon/OSDMonitor.cc
src/mon/Session.h
src/os/Fake.h
src/os/FileStore.cc
src/os/FileStore.h
src/os/ObjectStore.h
src/osd/OSD.cc
src/osd/OSD.h
src/osd/OSDMap.h
src/osd/PG.cc
src/osd/ReplicatedPG.cc
src/osd/osd_types.h
src/osdc/Journaler.h
src/osdc/Objecter.h
src/radosacl.cc
src/rbdtool.cc

index 7d52fa27a0f88121a453a5df93cf8a2a587a5b6c..cd4e229cbf2722126ab4edb9fd1f51dde278129f 100644 (file)
@@ -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;
index ff735e2a790885236058dd9e3ffd55bfd529787e..621411634e6c82b1ab68979485a7d347eba74e20 100644 (file)
@@ -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; }
index 40cf121592d781730df2f678ae7ce9b9cc56439e..9bed3f0cf652ecea866070a08334c9015cf8bd62 100644 (file)
@@ -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);
index f99a6a8bc9e2718bf891e4bd81bf1aabbb1b8ab7..6e7528c38ac94f1a552d78314f260b62f638f34f 100644 (file)
@@ -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)
index 62be92444fd4397c3f54ccfd98dc2a519fe1f543..e9c1e2005ed300f6f8adef812495459bfe1b2671 100644 (file)
@@ -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);
 };
 
 
index 9f9d995da2c77b433579e7f7de36fe13d007b2ee..ee72cbc01d040d11144f1f1647161da9022b64d4 100644 (file)
@@ -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);
index 0932ddc1573b7678f91db68af39a6ef27cbf6337..12be359dd77c359e42538facf75266e906591c26 100644 (file)
@@ -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;
index 4d7681e466cb5cab5b492529e0d6fc649d540a7d..810124532cf0ba310117b0f5a10598647be0a4b8 100644 (file)
@@ -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;
index 4f8307b9d7187bc864b358a8baee651046ca41bc..c5ac1d69d7a62fae5f8ec20cb5c15c8324ffe083 100644 (file)
@@ -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);
index 13006bf869d4de85f02bf2ffcb6e2225b29df63d..e36b026c8dd574ffd747eb43e8a59482d9f6ce0f 100644 (file)
@@ -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);
 
   
index c151b51265383e28805259a646e08f195f4f6df8..3d8754b79fe99b16c3c16813e67ab8a4d7b932de 100644 (file)
@@ -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;
index 16d08799c88a0812246e0921f01526f5581edc50..60db42a97dcc31f3bf458c8d6598e2659582d518 100644 (file)
@@ -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
index 3b209caf91cd85c8f770f4ee630d94c5a122b638..4b989e4ec0d5e22919bc0b2d8eaa592120af0e30 100644 (file)
@@ -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);
index 75be694cf69fa8f5abe8192b993b123e1594523d..e3a497f23b906dd78c715e8a5616c709aed66cf1 100644 (file)
@@ -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());
     }
index d5b735dc22e73c1050338214275e0eed970615a6..562497866f9532e708d5c1f4a844aab5069eeb32 100644 (file)
@@ -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();
index 16d24140d2d97be4d05ec2523aa28e64cbfb23ca..adbe9612915d98606fe80bc58edba5dadaac9531 100644 (file)
@@ -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) { }
index 3ef4b575ff2cefb2220751b54fe992a3bdee9561..8233304fa8791f6c5f99437205a9611c9bd8df7a 100644 (file)
@@ -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; }
index 88d6d20571f34b60b67eff82a96afc64b910a748..e3a52cba92aa92430d89b6c2d6e2af64e0c63777 100644 (file)
@@ -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);
     
index 0cfe2a28f6cedccd117d32863d8900c1fbbbbb1e..c377c5c0b7e5e491fea214872ae09d37a3e95369 100644 (file)
@@ -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);
index 911a3531be13ff628ed852ed9234100eb3dcf357..d828063266896fb2df85c38fe3b451f2fbc6a764 100644 (file)
@@ -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) {
index 7b1cb93ebd84080d8ef501b84795719181dfbc07..526d1efbe67ca347bb271c491097523320bdb5bc 100644 (file)
@@ -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)) {
index c39968be77c6960c5f6329a99ce09d31dc2c3b0a..68e569c314f02f7807296cd3c3dfca66d2133b75 100644 (file)
@@ -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)
index d77cbf62fbfcb6046c4e01e777971fd9d8a65c43..149473d6114b225fea7fbb0990501298780026f8 100644 (file)
@@ -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:
index 8b72a9d64f5ad4e7296ea10345609a7a5e17a0d5..aa9eba6bacc2701c26aafbd0dfbab64fe820c921 100644 (file)
@@ -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);
index bde9d236e12a32a8e68c76fa240ccf51d550a9b6..1e17876decb7e3bdb49c9675ccb38ca8aeed1485 100644 (file)
@@ -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;
index 24a8d7b87d13f49d728464fc85ea4991140cb969..4a316afc7f8873bf457ed62edb4efdf0834a6328 100644 (file)
@@ -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,
index cdfd37330f3f761289ee652ec83b9b95d0071144..e1ff28129372450c952e1422b4e247c819e71f03 100644 (file)
@@ -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;
     
index b7bfd1d31d5fc05ca8de19c5b3c5a78e024c6704..4f8009a20344fcd424f488f0221ee65792d1a7e3 100644 (file)
@@ -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) {}
index e900dee7989ee5664b58a82caa12adcc599c0f78..3458262bfc2944cfe6f4ab64a415a36fdd05b3c1 100644 (file)
@@ -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) {
index f19d8da311e46e4cc12701cb08fff624f4e0bd1b..256fad8948d80cdba68f2939cfa44a64e8033c90 100644 (file)
@@ -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) {
index 2d1e454ea8307ccc4eaaa52b414bac48253d0896..8d5b9b8e3e551120e832d7c96121db723af14be2 100644 (file)
@@ -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;
index 1982458151749f475abb6716bf2e4ea6fbd863ce..231cc2faed5649857934cb0fb860f325b6970a74 100644 (file)
@@ -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 {
index c0f9867340d89b1492a4fd6d92b67658e7bb2357..223c635ab44f8149c92540256a9e9c0725eaee7a 100644 (file)
 
 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),
index b37e1f6a2d6e40934a2a752f18742fd9cf85f5dd..c857d7bffafb0f8de6d2c758d6073c06e7e1f95a 100644 (file)
 
 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) {}
index 024788f91b93ea971651fdbdcf62281f52f986b7..d4d30839e5b5167f2791cd54c7afff3421b6a19b 100644 (file)
@@ -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;
   }
 
index ee7901c2e27e2618e2406d0c3a2ee0767e641b2a..702e17f6b13beabfb3f1b800e969b35c7e583bda 100644 (file)
@@ -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:
index 0e1f464baf27d2ae6f744b36d4e243bd576e7071..63af1533487310495eda7345a26f505808beeaed 100644 (file)
@@ -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;
index c094648b9cb76cacd86b3cb59664dbd97e3ab613..f6d57f42721dfc4de87ae6e1c8b56d75e1d84ef6 100644 (file)
@@ -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;
index 0f5e32415e101f1fdb5e2e018155556f21c5286a..da8476dfa64a4ee79769411609b030c568722986 100644 (file)
@@ -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"
index a1ee384d8c71818888623eb8bf9746346624a9a9..0cbc9f96f5a2b3e3e4504ea839d98d793d89467d 100644 (file)
@@ -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);
   }
index 233e0794f088df3687997f6cf321e00b0a570295..b6c264f7e52e7b7a186b344a59a67453e788cc52 100644 (file)
@@ -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;
index 45b8f38514330f678a24aca92dbff248abeb8df4..828c75707b8129f4b3ec55d0b9302c66564c8926 100644 (file)
@@ -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;
index 0c3ad3666831e91b6fab8c2ae0d8a82e1cd573c3..f6595746a17a91c731413cec647cd674b9c80cde 100644 (file)
@@ -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];
index d47fe226aa6e1c4e6031d40a3856cb51a7692309..4643c81942f133b9d34f789e293ac207bcdf65af 100644 (file)
@@ -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();
index 6855d63441d1e291ecf7f29f65821eb9ad661aab..bde0b212a147c3baf20a4b6c11d6989dba6a0c7e 100644 (file)
@@ -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];
index 88a2980067df83786043ed8a94dc9183dd1fd5f4..3bc2b8fe78b99164348cd369ac4de23035eb74a1 100644 (file)
@@ -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);
index 2830380bff979c66c7af913c3d3e2f02254ecb27..6b73bc35e1783fe0339de4c5749bd146e89aaf81 100644 (file)
@@ -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;
index 03c138d9064561778ac90890c5b1799647cf36c9..7bc21ef580b9f0ccf53691ff6a1d8d3de9cc1f58 100644 (file)
@@ -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;
index 6f6de45e9558afc8637083e44c299b4375fe979c..cf8fa2c5d8e60a58796a956245140c9541ba6a91 100644 (file)
@@ -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
index 6321076270064ac7ba9c29d18ed5d270a14abc6c..9b55a83bc9a2a5b4d39c89a9e9077917672ad647 100644 (file)
@@ -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;
   }
  
index 1196b2d5af5016875e1c40110a004ab9f4367c89..60a177b4c8c61adfbc9aee7eaf2bd78759df56f1 100644 (file)
@@ -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
index e49ae1266082007759d95696563f57ed67b0d6c7..6a1d9d15a7ae8e58e05ff91b95cad143961d6fe2 100644 (file)
@@ -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()) {
index 599eb2a5dc6c5b3a9ebc5742205c194f98eed4e8..3a085779cadd7c7879bc72cfe9741385b0f1f352 100644 (file)
@@ -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 {
index 0152857d647ccac841c13e31a682e3a6aaf852b5..26a52cfd57c7415ae2dbe32d2bbef4f033399aab 100644 (file)
@@ -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) :
index 1cdbcec9433d062fa8e519071fab52e700d995c5..1a64629b740399c6a4c2cbbcc6a0bcfe0d263026 100644 (file)
@@ -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;
index f7e396cdbd131538e98910d2752226afb839770e..82979ea89ed281c906c5363ee3e446a21e50aeed 100644 (file)
@@ -103,7 +103,7 @@ void ObjectACLs::set_acl(ACLID& id, ACLFlags flags)
 
 class ACLEntity
 {
-  nstring name;
+  string name;
   map<ACLID, ACLEntity> groups;
 };
 
index bbe223250e5ffbf978bb107394bc6cc7a4d1c26b..4e3db77501946b6f22995d8154d04f8702b38e9e 100644 (file)
@@ -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) {