From: John Spray Date: Tue, 22 Jul 2014 01:42:15 +0000 (+0100) Subject: mds: remove some rogue "using namespace std;" X-Git-Tag: v0.84~40^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6bb3aeafcf19bd0678d3c6538c8e23d29ffa4ab5;p=ceph.git mds: remove some rogue "using namespace std;" Signed-off-by: John Spray --- diff --git a/src/mds/CDentry.h b/src/mds/CDentry.h index 7b545b54edcc..ba0c944554ff 100644 --- a/src/mds/CDentry.h +++ b/src/mds/CDentry.h @@ -19,7 +19,6 @@ #include #include -using namespace std; #include "include/types.h" #include "include/buffer.h" @@ -101,7 +100,7 @@ public: } public: - string name; + std::string name; __u32 hash; snapid_t first, last; @@ -169,7 +168,7 @@ public: public: // cons - CDentry(const string& n, __u32 h, + CDentry(const std::string& n, __u32 h, snapid_t f, snapid_t l) : name(n), hash(h), first(f), last(l), @@ -182,7 +181,7 @@ public: g_num_dn++; g_num_dna++; } - CDentry(const string& n, __u32 h, inodeno_t ino, unsigned char dt, + CDentry(const std::string& n, __u32 h, inodeno_t ino, unsigned char dt, snapid_t f, snapid_t l) : name(n), hash(h), first(f), last(l), @@ -204,7 +203,7 @@ public: CDir *get_dir() const { return dir; } - const string& get_name() const { return name; } + const std::string& get_name() const { return name; } __u32 get_hash() const { return hash; } @@ -275,7 +274,7 @@ public: const CDentry& operator= (const CDentry& right); // misc - void make_path_string(string& s); + void make_path_string(std::string& s); void make_path(filepath& fp); // -- version -- diff --git a/src/mds/CDir.h b/src/mds/CDir.h index 22a9d4c4bdef..051a725e7e4d 100644 --- a/src/mds/CDir.h +++ b/src/mds/CDir.h @@ -29,7 +29,6 @@ #include #include #include -using namespace std; #include "CInode.h" @@ -171,7 +170,7 @@ public: fnode_t fnode; snapid_t first; - map dirty_old_rstat; // [value.first,key] + std::map dirty_old_rstat; // [value.first,key] // my inodes with dirty rstat data elist dirty_rstat_inodes; @@ -183,7 +182,7 @@ public: protected: version_t projected_version; - list projected_fnode; + std::list projected_fnode; public: elist::item item_dirty, item_new; @@ -223,7 +222,7 @@ public: void mark_new(LogSegment *ls); public: - typedef map map_t; + typedef std::map map_t; protected: // contents of this directory @@ -250,7 +249,7 @@ protected: // cache control (defined for authority; hints for replicas) __s32 dir_rep; - set<__s32> dir_rep_by; // if dir_rep == REP_LIST + std::set<__s32> dir_rep_by; // if dir_rep == REP_LIST // popularity dirfrag_load_vec_t pop_me; @@ -327,22 +326,22 @@ protected: // -- dentries and inodes -- public: - CDentry* lookup_exact_snap(const string& dname, snapid_t last) { + CDentry* lookup_exact_snap(const std::string& dname, snapid_t last) { map_t::iterator p = items.find(dentry_key_t(last, dname.c_str())); if (p == items.end()) return NULL; return p->second; } - CDentry* lookup(const string& n, snapid_t snap=CEPH_NOSNAP) { + CDentry* lookup(const std::string& n, snapid_t snap=CEPH_NOSNAP) { return lookup(n.c_str(), snap); } CDentry* lookup(const char *n, snapid_t snap=CEPH_NOSNAP); - CDentry* add_null_dentry(const string& dname, + CDentry* add_null_dentry(const std::string& dname, snapid_t first=2, snapid_t last=CEPH_NOSNAP); - CDentry* add_primary_dentry(const string& dname, CInode *in, + CDentry* add_primary_dentry(const std::string& dname, CInode *in, snapid_t first=2, snapid_t last=CEPH_NOSNAP); - CDentry* add_remote_dentry(const string& dname, inodeno_t ino, unsigned char d_type, + CDentry* add_remote_dentry(const std::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); @@ -352,17 +351,17 @@ protected: void try_remove_unlinked_dn(CDentry *dn); void add_to_bloom(CDentry *dn); - bool is_in_bloom(const string& name); + bool is_in_bloom(const std::string& name); bool has_bloom() { return (bloom ? true : false); } void remove_bloom(); private: void link_inode_work( CDentry *dn, CInode *in ); void unlink_inode_work( CDentry *dn ); void remove_null_dentries(); - void purge_stale_snap_data(const set& snaps); + void purge_stale_snap_data(const std::set& snaps); public: void touch_dentries_bottom(); - bool try_trim_snap_dentry(CDentry *dn, const set& snaps); + bool try_trim_snap_dentry(CDentry *dn, const std::set& snaps); public: @@ -416,9 +415,9 @@ private: // for giving to clients - void get_dist_spec(set& ls, int auth) { + void get_dist_spec(std::set& ls, int auth) { if (is_rep()) { - for (map::iterator p = replicas_begin(); + for (std::map::iterator p = replicas_begin(); p != replicas_end(); ++p) ls.insert(p->first); @@ -432,7 +431,7 @@ private: */ frag_t frag = get_frag(); __s32 auth; - set<__s32> dist; + std::set<__s32> dist; auth = dir_auth.first; if (is_auth()) @@ -486,19 +485,19 @@ private: return file_object_t(ino(), frag); } void fetch(Context *c, bool ignore_authpinnability=false); - void fetch(Context *c, const string& want_dn, bool ignore_authpinnability=false); + void fetch(Context *c, const std::string& want_dn, bool ignore_authpinnability=false); protected: - void _omap_fetch(const string& want_dn); - void _omap_fetched(bufferlist& hdrbl, map& omap, - const string& want_dn, int r); - void _tmap_fetch(const string& want_dn); - void _tmap_fetched(bufferlist &bl, const string& want_dn, int r); + void _omap_fetch(const std::string& want_dn); + void _omap_fetched(bufferlist& hdrbl, std::map& omap, + const std::string& want_dn, int r); + void _tmap_fetch(const std::string& want_dn); + void _tmap_fetched(bufferlist &bl, const std::string& want_dn, int r); // -- commit -- - map > waiting_for_commit; + std::map > waiting_for_commit; void _commit(version_t want, int op_prio); void _omap_commit(int op_prio); - void _encode_dentry(CDentry *dn, bufferlist& bl, const set *snaps); + void _encode_dentry(CDentry *dn, bufferlist& bl, const std::set *snaps); void _committed(version_t v); public: void wait_for_commit(Context *c, version_t v=0); @@ -530,18 +529,18 @@ public: // -- waiters -- protected: - map< string_snap_t, list > waiting_on_dentry; + std::map< string_snap_t, std::list > waiting_on_dentry; public: - bool is_waiting_for_dentry(const string& dname, snapid_t snap) { + bool is_waiting_for_dentry(const std::string& dname, snapid_t snap) { return waiting_on_dentry.count(string_snap_t(dname, snap)); } - 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& ls); - void take_sub_waiting(list& ls); // dentry or ino + void add_dentry_waiter(const std::string& dentry, snapid_t snap, Context *c); + void take_dentry_waiting(const std::string& dentry, snapid_t first, snapid_t last, std::list& ls); + void take_sub_waiting(std::list& ls); // dentry or ino void add_waiter(uint64_t mask, Context *c); - void take_waiting(uint64_t mask, list& ls); // may include dentry waiters + void take_waiting(uint64_t mask, std::list& ls); // may include dentry waiters void finish_waiting(uint64_t mask, int result = 0); // ditto diff --git a/src/mds/CInode.h b/src/mds/CInode.h index 77e22c3735da..f33bc02d3a66 100644 --- a/src/mds/CInode.h +++ b/src/mds/CInode.h @@ -33,11 +33,9 @@ #include "SnapRealm.h" #include -#include #include #include -#include -using namespace std; +//#include class Context; class CDentry; @@ -72,10 +70,10 @@ extern int num_cinode_locks; class InodeStore { public: inode_t inode; // the inode itself - string symlink; // symlink dest, if symlink - map xattrs; + std::string symlink; // symlink dest, if symlink + std::map xattrs; fragtree_t dirfragtree; // dir frag tree, if any. always consistent with our dirfrag map. - map old_inodes; // key = last, value.first = first + std::map old_inodes; // key = last, value.first = first bufferlist snap_blob; // Encoded copy of SnapRealm, because we can't // rehydrate it without full MDCache @@ -95,7 +93,7 @@ public: /* For use in debug and ceph-dencoder */ void dump(Formatter *f) const; - static void generate_test_instances(list& ls); + static void generate_test_instances(std::list& ls); }; // cached inode wrapper @@ -214,7 +212,7 @@ public: SnapRealm *snaprealm; SnapRealm *containing_realm; snapid_t first, last; - set dirty_old_rstats; + std::set dirty_old_rstats; bool is_multiversion() { return snaprealm || // other snaprealms will link to me @@ -256,19 +254,19 @@ public: struct projected_inode_t { inode_t *inode; - map *xattrs; + std::map *xattrs; sr_t *snapnode; projected_inode_t() : inode(NULL), xattrs(NULL), snapnode(NULL) {} projected_inode_t(inode_t *in, sr_t *sn) : inode(in), xattrs(NULL), snapnode(sn) {} - projected_inode_t(inode_t *in, map *xp = NULL, sr_t *sn = NULL) + projected_inode_t(inode_t *in, std::map *xp = NULL, sr_t *sn = NULL) : inode(in), xattrs(xp), snapnode(sn) {} }; - list projected_nodes; // projected values (only defined while dirty) + std::list projected_nodes; // projected values (only defined while dirty) - inode_t *project_inode(map *px=0); + inode_t *project_inode(std::map *px=0); void pop_and_dirty_projected_inode(LogSegment *ls); projected_inode_t *get_projected_node() { @@ -296,7 +294,7 @@ public: } inode_t *get_previous_projected_inode() { assert(!projected_nodes.empty()); - list::reverse_iterator p = projected_nodes.rbegin(); + std::list::reverse_iterator p = projected_nodes.rbegin(); ++p; if (p != projected_nodes.rend()) return (*p)->inode; @@ -304,16 +302,16 @@ public: return &inode; } - map *get_projected_xattrs() { - for (list::reverse_iterator p = projected_nodes.rbegin(); + std::map *get_projected_xattrs() { + for (std::list::reverse_iterator p = projected_nodes.rbegin(); p != projected_nodes.rend(); ++p) if ((*p)->xattrs) return (*p)->xattrs; return &xattrs; } - map *get_previous_projected_xattrs() { - list::reverse_iterator p = projected_nodes.rbegin(); + std::map *get_previous_projected_xattrs() { + std::list::reverse_iterator p = projected_nodes.rbegin(); for (p++; // skip the most recent projected value p != projected_nodes.rend(); ++p) @@ -330,7 +328,7 @@ public: else return NULL; } else { - for (list::reverse_iterator p = projected_nodes.rbegin(); + for (std::list::reverse_iterator p = projected_nodes.rbegin(); p != projected_nodes.rend(); ++p) if ((*p)->snapnode) @@ -347,16 +345,16 @@ public: old_inode_t& cow_old_inode(snapid_t follows, bool cow_head); old_inode_t *pick_old_inode(snapid_t last); void pre_cow_old_inode(); - void purge_stale_snap_data(const set& snaps); + void purge_stale_snap_data(const std::set& snaps); // -- cache infrastructure -- private: - map dirfrags; // cached dir fragments under this Inode + std::map dirfrags; // cached dir fragments under this Inode int stickydir_ref; public: - __u32 hash_dentry_name(const string &dn); - frag_t pick_dirfrag(const string &dn); + __u32 hash_dentry_name(const std::string &dn); + frag_t pick_dirfrag(const std::string &dn); bool has_dirfrags() { return !dirfrags.empty(); } CDir* get_dirfrag(frag_t fg) { if (dirfrags.count(fg)) { @@ -365,11 +363,11 @@ public: } else return NULL; } - bool get_dirfrags_under(frag_t fg, list& ls); + bool get_dirfrags_under(frag_t fg, std::list& ls); CDir* get_approx_dirfrag(frag_t fg); - void get_dirfrags(list& ls); - void get_nested_dirfrags(list& ls); - void get_subtree_dirfrags(list& ls); + void get_dirfrags(std::list& ls); + void get_nested_dirfrags(std::list& ls); + void get_subtree_dirfrags(std::list& ls); CDir *get_or_open_dirfrag(MDCache *mdcache, frag_t fg); CDir *add_dirfrag(CDir *dir); void close_dirfrag(frag_t fg); @@ -386,22 +384,22 @@ public: protected: // parent dentries in cache CDentry *parent; // primary link - set remote_parents; // if hard linked + std::set remote_parents; // if hard linked - list projected_parent; // for in-progress rename, (un)link, etc. + std::list projected_parent; // for in-progress rename, (un)link, etc. pair inode_auth; // -- distributed state -- protected: // file capabilities - map client_caps; // client -> caps - map mds_caps_wanted; // [auth] mds -> caps wanted + std::map client_caps; // client -> caps + std::map mds_caps_wanted; // [auth] mds -> caps wanted int replica_caps_wanted; // [replica] what i've requested from auth - map > client_snap_caps; // [auth] [snap] dirty metadata we still need from the head + std::map > client_snap_caps; // [auth] [snap] dirty metadata we still need from the head public: - map > client_need_snapflush; + std::map > client_need_snapflush; void add_need_snapflush(CInode *snapin, snapid_t snapid, client_t client); void remove_need_snapflush(CInode *snapin, snapid_t snapid, client_t client); @@ -506,7 +504,7 @@ public: void set_ambiguous_auth() { state_set(STATE_AMBIGUOUSAUTH); } - void clear_ambiguous_auth(list& finished); + void clear_ambiguous_auth(std::list& finished); void clear_ambiguous_auth(); inodeno_t ino() const { return inode.ino; } @@ -528,10 +526,10 @@ public: // -- misc -- bool is_projected_ancestor_of(CInode *other); - void make_path_string(string& s, bool force=false, CDentry *use_parent=NULL); - void make_path_string_projected(string& s); + void make_path_string(std::string& s, bool force=false, CDentry *use_parent=NULL); + void make_path_string_projected(std::string& s); void make_path(filepath& s); - void name_stray_dentry(string& dname); + void name_stray_dentry(std::string& dname); // -- dirtyness -- version_t get_version() { return inode.version; } @@ -583,15 +581,15 @@ public: // -- waiting -- protected: - map > waiting_on_dir; + std::map > waiting_on_dir; public: void add_dir_waiter(frag_t fg, Context *c); - void take_dir_waiting(frag_t fg, list& ls); + void take_dir_waiting(frag_t fg, std::list& ls); bool is_waiting_for_dir(frag_t fg) { return waiting_on_dir.count(fg); } void add_waiter(uint64_t tag, Context *c); - void take_waiting(uint64_t tag, list& ls); + void take_waiting(uint64_t tag, std::list& ls); // -- encode/decode helpers -- void _encode_base(bufferlist& bl); @@ -601,8 +599,8 @@ public: void _encode_locks_state_for_replica(bufferlist& bl); void _encode_locks_state_for_rejoin(bufferlist& bl, int rep); void _decode_locks_state(bufferlist::iterator& p, bool is_new); - void _decode_locks_rejoin(bufferlist::iterator& p, list& waiters, - list& eval_locks); + void _decode_locks_rejoin(bufferlist::iterator& p, std::list& waiters, + std::list& eval_locks); // -- import/export -- void encode_export(bufferlist& bl); @@ -712,7 +710,7 @@ public: int count_nonstale_caps() { int n = 0; - for (map::iterator it = client_caps.begin(); + for (std::map::iterator it = client_caps.begin(); it != client_caps.end(); ++it) if (!it->second->is_stale()) @@ -721,7 +719,7 @@ public: } bool multiple_nonstale_caps() { int n = 0; - for (map::iterator it = client_caps.begin(); + for (std::map::iterator it = client_caps.begin(); it != client_caps.end(); ++it) if (!it->second->is_stale()) { @@ -735,9 +733,9 @@ public: bool is_any_caps() { return !client_caps.empty(); } bool is_any_nonstale_caps() { return count_nonstale_caps(); } - map& get_mds_caps_wanted() { return mds_caps_wanted; } + std::map& get_mds_caps_wanted() { return mds_caps_wanted; } - map& get_client_caps() { return client_caps; } + std::map& get_client_caps() { return client_caps; } Capability *get_client_cap(client_t client) { if (client_caps.count(client)) return client_caps[client]; @@ -755,7 +753,7 @@ public: Capability *reconnect_cap(client_t client, ceph_mds_cap_reconnect& icr, Session *session); void clear_client_caps_after_export(); - void export_client_caps(map& cl); + void export_client_caps(std::map& cl); // caps allowed int get_caps_liked(); @@ -798,7 +796,7 @@ public: /* Freeze the inode. auth_pin_allowance lets the caller account for any * auth_pins it is itself holding/responsible for. */ bool freeze_inode(int auth_pin_allowance=0); - void unfreeze_inode(list& finished); + void unfreeze_inode(std::list& finished); void unfreeze_inode(); void freeze_auth_pin();