]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mds: organize Capability class members
authorPatrick Donnelly <pdonnell@redhat.com>
Fri, 11 Nov 2016 23:54:03 +0000 (18:54 -0500)
committerPatrick Donnelly <pdonnell@redhat.com>
Mon, 21 Nov 2016 21:40:55 +0000 (16:40 -0500)
This amends the code to follow our C++ style guidelines with the goal of
increasing header readability.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/mds/Capability.h

index 30b308549a9f19d3c81c72ad49cab31b3e373f9a..b8ea0a1e732b6c6088eaae38d055a317a15e64d7 100644 (file)
@@ -64,18 +64,6 @@ namespace ceph {
 }
 
 class Capability {
-private:
-  static boost::pool<> pool;
-public:
-  static void *operator new(size_t num_bytes) { 
-    void *n = pool.malloc();
-    if (!n)
-      throw std::bad_alloc();
-    return n;
-  }
-  void operator delete(void *p) {
-    pool.free(p);
-  }
 public:
   struct Export {
     int64_t cap_id;
@@ -105,23 +93,6 @@ public:
     void decode(bufferlist::iterator &p);
     void dump(Formatter *f) const;
   };
-
-private:
-  CInode *inode;
-  client_t client;
-
-  uint64_t cap_id;
-
-  __u32 _wanted;     // what the client wants (ideally)
-
-  utime_t last_issue_stamp;
-  utime_t last_revoke_stamp;
-  unsigned num_revoke_warnings;
-
-  // track in-flight caps --------------
-  //  - add new caps to _pending
-  //  - track revocations in _revokes list
-public:
   struct revoke_info {
     __u32 before;
     ceph_seq_t seq, last_issue;
@@ -132,11 +103,47 @@ public:
     void dump(Formatter *f) const;
     static void generate_test_instances(list<revoke_info*>& ls);
   };
-private:
-  __u32 _pending, _issued;
-  list<revoke_info> _revokes;
 
-public:
+
+  const static unsigned STATE_STALE            = (1<<0);
+  const static unsigned STATE_NEW              = (1<<1);
+
+
+  Capability(CInode *i = NULL, uint64_t id = 0, client_t c = 0) :
+    client_follows(0), client_xattr_version(0),
+    client_inline_version(0),
+    last_rbytes(0), last_rsize(0),
+    item_session_caps(this), item_snaprealm_caps(this),
+    item_revoking_caps(this), item_client_revoking_caps(this),
+    inode(i), client(c),
+    cap_id(id),
+    _wanted(0), num_revoke_warnings(0),
+    _pending(0), _issued(0),
+    last_sent(0),
+    last_issue(0),
+    mseq(0),
+    suppress(0), state(0) {
+    g_num_cap++;
+    g_num_capa++;
+  }
+  Capability(const Capability& other);  // no copying
+  ~Capability() {
+    g_num_cap--;
+    g_num_caps++;
+  }
+
+
+  static void *operator new(size_t num_bytes) {
+    void *n = pool.malloc();
+    if (!n)
+      throw std::bad_alloc();
+    return n;
+  }
+  void operator delete(void *p) {
+    pool.free(p);
+  }
+  const Capability& operator=(const Capability& other);  // no copying
+
   int pending() { return _pending; }
   int issued() { return _issued; }
   bool is_null() { return !_pending && _revokes.empty(); }
@@ -217,56 +224,6 @@ public:
       }
     }
   }
-
-
-private:
-  ceph_seq_t last_sent;
-  ceph_seq_t last_issue;
-  ceph_seq_t mseq;
-
-  int suppress;
-  unsigned state;
-
-  const static unsigned STATE_STALE            = (1<<0);
-  const static unsigned STATE_NEW              = (1<<1);
-
-public:
-  snapid_t client_follows;
-  version_t client_xattr_version;
-  version_t client_inline_version;
-  int64_t last_rbytes;
-  int64_t last_rsize;
-
-  xlist<Capability*>::item item_session_caps;
-  xlist<Capability*>::item item_snaprealm_caps;
-  xlist<Capability*>::item item_revoking_caps;
-  xlist<Capability*>::item item_client_revoking_caps;
-
-  Capability(CInode *i = NULL, uint64_t id = 0, client_t c = 0) : 
-    inode(i), client(c),
-    cap_id(id),
-    _wanted(0), num_revoke_warnings(0),
-    _pending(0), _issued(0),
-    last_sent(0),
-    last_issue(0),
-    mseq(0),
-    suppress(0), state(0),
-    client_follows(0), client_xattr_version(0),
-    client_inline_version(0),
-    last_rbytes(0), last_rsize(0),
-    item_session_caps(this), item_snaprealm_caps(this),
-    item_revoking_caps(this), item_client_revoking_caps(this) {
-    g_num_cap++;
-    g_num_capa++;
-  }
-  ~Capability() {
-    g_num_cap--;
-    g_num_caps++;
-  }
-
-  Capability(const Capability& other);  // no copying
-  const Capability& operator=(const Capability& other);  // no copying
-  
   ceph_seq_t get_mseq() { return mseq; }
   void inc_mseq() { mseq++; }
 
@@ -368,6 +325,42 @@ public:
   void dump(Formatter *f) const;
   static void generate_test_instances(list<Capability*>& ls);
   
+  snapid_t client_follows;
+  version_t client_xattr_version;
+  version_t client_inline_version;
+  int64_t last_rbytes;
+  int64_t last_rsize;
+
+  xlist<Capability*>::item item_session_caps;
+  xlist<Capability*>::item item_snaprealm_caps;
+  xlist<Capability*>::item item_revoking_caps;
+  xlist<Capability*>::item item_client_revoking_caps;
+
+private:
+  static boost::pool<> pool;
+  CInode *inode;
+  client_t client;
+
+  uint64_t cap_id;
+
+  __u32 _wanted;     // what the client wants (ideally)
+
+  utime_t last_issue_stamp;
+  utime_t last_revoke_stamp;
+  unsigned num_revoke_warnings;
+
+  // track in-flight caps --------------
+  //  - add new caps to _pending
+  //  - track revocations in _revokes list
+  __u32 _pending, _issued;
+  list<revoke_info> _revokes;
+
+  ceph_seq_t last_sent;
+  ceph_seq_t last_issue;
+  ceph_seq_t mseq;
+
+  int suppress;
+  unsigned state;
 };
 
 WRITE_CLASS_ENCODER(Capability::Export)