]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
more header, data type cleanup
authorsageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Mon, 15 Oct 2007 16:14:58 +0000 (16:14 +0000)
committersageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Mon, 15 Oct 2007 16:14:58 +0000 (16:14 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1941 29311d96-e01e-0410-9327-a35deaab8ce9

trunk/ceph/include/ceph_fs.h
trunk/ceph/include/ceph_inttypes.h [deleted file]
trunk/ceph/include/object.h
trunk/ceph/include/types.h
trunk/ceph/msg/ceph_msg_types.h [deleted file]
trunk/ceph/msg/msg_types.h
trunk/ceph/osd/PG.h
trunk/ceph/osd/osd_types.h

index 9c1b1faf4eab9b55f721096dc927a1e91c37a4a5..ffd170999233a82fcce0d5175405fe8573f85b48 100644 (file)
@@ -1,7 +1,3 @@
-/* -*- mode:C++; tab-width:8; c-basic-offset:8; indent-tabs-mode:t -*- 
- * vim: ts=8 sw=8 smarttab
- */
-
 /* ceph_fs.h
  *
  * C data types to share between kernel and userspace
 #ifndef _FS_CEPH_CEPH_FS_H
 #define _FS_CEPH_CEPH_FS_H
 
-typedef u64 ceph_ino_t;
+#include <linux/types.h>
+
+
+typedef __u64 ceph_ino_t;
+
 
 /**
  * object id
  */
 struct ceph_object {
   ceph_ino_t ino;  /* inode "file" identifier */
-  u32 bno;  /* "block" (object) in that "file" */
-  u32 rev;  /* revision.  normally ctime (as epoch). */
+  __u32 bno;  /* "block" (object) in that "file" */
+  __u32 rev;  /* revision.  normally ctime (as epoch). */
 };
 typedef struct ceph_object ceph_object_t;
 
@@ -59,7 +59,6 @@ struct ceph_file_layout {
   /* pg -> disk layout */
   __u32 fl_object_stripe_unit;   /* for per-object raid */
 };
-typedef struct ceph_file_layout ceph_file_layout_t;
 
 #define ceph_file_layout_stripe_width(l) (l.fl_stripe_unit * l.fl_stripe_count)
 
@@ -75,12 +74,12 @@ typedef struct ceph_file_layout ceph_file_layout_t;
 #define CEPH_PG_TYPE_RAID4 2
 
 union ceph_pg {
-  u64 pg64;
+  __u64 pg64;
   struct {
-    s32 preferred; /* preferred primary osd */
-    u16 ps;        /* placement seed */
-    u8 type;
-    u8 size;
+    __s32 preferred; /* preferred primary osd */
+    __u16 ps;        /* placement seed */
+    __u8 type;
+    __u8 size;
   } pg;
 };
 typedef union ceph_pg ceph_pg_t;
@@ -97,7 +96,6 @@ struct ceph_object_layout {
   ceph_pg_t ol_pgid;
   __u32 ol_stripe_unit;  
 };
-typedef struct ceph_object_layout ceph_object_layout_t;
 
 
 
@@ -106,14 +104,61 @@ typedef struct ceph_object_layout ceph_object_layout_t;
  */
 struct ceph_object_extent {
   ceph_object_t oe_oid;
-  u64 oe_start;
-  u64 oe_length;
-  ceph_object_layout_t oe_object_layout;
+  __u64 oe_start;
+  __u64 oe_length;
+  struct ceph_object_layout oe_object_layout;
   
   /* buffer extent reverse mapping? */
 };
-typedef ceph_object_extent ceph_object_extent_t;
 
 
 
+
+
+/*********************************************
+ * message types
+ */
+
+/*
+ * entity_name
+ */
+struct ceph_entity_name {
+       __u32 type;
+       __u32 num;
+};
+
+#define CEPH_ENTITY_TYPE_MON    1
+#define CEPH_ENTITY_TYPE_MDS    2
+#define CEPH_ENTITY_TYPE_OSD    3
+#define CEPH_ENTITY_TYPE_CLIENT 4
+#define CEPH_ENTITY_TYPE_ADMIN  5
+
+
+/*
+ * entity_addr
+ * ipv4 only for now
+ */
+struct ceph_entity_addr {
+       __u64 nonce;
+       __u32 port;
+       __u8  ipq[4];
+};
+
+
+struct ceph_entity_inst {
+       struct ceph_entity_name name;
+       struct ceph_entity_addr addr;
+};
+
+
+/*
+ * message header
+ */
+struct ceph_message_header {
+       __u32 type;
+       struct ceph_entity_inst src, dst;
+       __u32 source_port, dest_port;
+       __u32 nchunks;
+};
+
 #endif
diff --git a/trunk/ceph/include/ceph_inttypes.h b/trunk/ceph/include/ceph_inttypes.h
deleted file mode 100644 (file)
index 3c4679e..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef __CEPH_INTTYPES_H
-#define __CEPH_INTTYPES_H
-
-/* 
- * these are int types defined in the kernel.
- * this header should be included prior to ceph_fs.h when used from userspace.
- * i suspect kernel_compat.h (or whatever) serves a similar purpose?
- */
-
-typedef uint32_t __u64;
-typedef uint32_t __u32;
-typedef uint16_t __u16;
-typedef uint8_t __u8;
-
-typedef int32_t __s64;
-typedef int32_t __s32;
-typedef int16_t __s16;
-typedef int8_t __s8;
-
-typedef uint64_t u64;
-typedef uint32_t u32;
-typedef uint16_t u16;
-typedef uint16_t u8;
-
-typedef int64_t s64;
-typedef int32_t s32;
-typedef int16_t s16;
-typedef int16_t s8;
-
-#endif
index a1382626f7cae5cf754835f16c104eb0817be521..3b8ac05a86b387a755b84e6de74d76defb09dd40 100644 (file)
@@ -85,17 +85,6 @@ inline ostream& operator<<(ostream& out, const object_t o) {
 
 
 namespace __gnu_cxx {
-#ifndef __LP64__
-  template<> struct hash<uint64_t> {
-    size_t operator()(uint64_t __x) const { 
-      static hash<uint32_t> H;
-      return H((__x >> 32) ^ (__x & 0xffffffff)); 
-      //static rjhash<uint64_t> H;
-      //return H(__x);
-    }
-  };
-#endif
-
   template<> struct hash<object_t> {
     size_t operator()(const object_t &r) const { 
       static rjhash<uint64_t> H;
@@ -107,15 +96,4 @@ namespace __gnu_cxx {
   };
 
 }
-
-/*
-  template<> struct rjhash<object_t> {
-    size_t operator()(const object_t &r) const { 
-      static rjhash<uint64_t> H;
-      static rjhash<uint32_t> I;
-      return H(r.ino) ^ I(r.bno) ^ I(r.rev);
-    }
-  };
-*/
-
 #endif
index 39a94c4dfb809a5fb498edb94f25f8f0bb415bbe..bf84575ad31d67f6f3ca430545c9a79b31b322af 100644 (file)
@@ -36,8 +36,6 @@ using namespace std;
 #include <ext/hash_map>
 using namespace __gnu_cxx;
 
-
-#include "ceph_inttypes.h" 
 #include "ceph_fs.h"
 
 
@@ -64,16 +62,6 @@ namespace __gnu_cxx {
       return H(x.c_str());
     }
   };
-
-#ifndef __LP64__
-  template<> struct hash<int64_t> {
-    size_t operator()(int64_t __x) const { 
-      static hash<int32_t> H;
-      return H((__x >> 32) ^ (__x & 0xffffffff)); 
-    }
-  };
-#endif
-
 }
 
 
@@ -109,8 +97,6 @@ typedef uint64_t version_t;
 typedef uint32_t epoch_t;       // map epoch  (32bits -> 13 epochs/second for 10 years)
 
 
-// object and pg layout
-// specified in g_conf.osd_*
 
 #define O_LAZY 01000000
 
@@ -122,7 +108,7 @@ typedef ceph_file_layout FileLayout;
 // --------------------------------------
 // inode
 
-typedef ceph_ino_t _inodeno_t;
+typedef __uint64_t _inodeno_t;
 
 struct inodeno_t {
   _inodeno_t val;
diff --git a/trunk/ceph/msg/ceph_msg_types.h b/trunk/ceph/msg/ceph_msg_types.h
deleted file mode 100644 (file)
index 35e046d..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- mode:C++; tab-width:8; c-basic-offset:8; indent-tabs-mode:t -*- 
- * vim: ts=8 sw=8 smarttab
- */
-#ifndef __CEPH_MSG_TYPES_H
-#define __CEPH_MSG_TYPES_H
-
-/*
- * entity_name
- */
-struct ceph_entity_name {
-       __u32 type;
-       __u32 num;
-};
-
-#define CEPH_ENTITY_TYPE_MON    1
-#define CEPH_ENTITY_TYPE_MDS    2
-#define CEPH_ENTITY_TYPE_OSD    3
-#define CEPH_ENTITY_TYPE_CLIENT 4
-#define CEPH_ENTITY_TYPE_ADMIN  5
-
-
-/*
- * entity_addr
- * ipv4 only for now
- */
-struct ceph_entity_addr {
-       __u64 nonce;
-       __u32 port;
-       __u8  ipq[4];
-};
-
-
-struct ceph_entity_inst {
-       struct ceph_entity_name name;
-       struct ceph_entity_addr addr;
-};
-
-
-/*
- * message header
- */
-struct ceph_message_header {
-       __u32 type;
-       struct ceph_entity_inst src, dst;
-       __u32 source_port, dest_port;
-       __u32 nchunks;
-};
-
-#endif
index 440f7964288fb05b974cfe37092dc756558fc335..52b1e69c8886c865f3cddc1be5a952f68fad7f92 100644 (file)
 #ifndef __MSG_TYPES_H
 #define __MSG_TYPES_H
 
-// raw C structs
-#include "include/ceph_inttypes.h"
-#include "ceph_msg_types.h"
-
 #include "include/types.h"
 #include "include/blobhash.h"
 #include "tcp.h"
@@ -97,11 +93,7 @@ namespace __gnu_cxx {
   };
 }
 
-// get rid of these
-//#define MSG_ADDR_MDS(x)     entity_name_t(entity_name_t::TYPE_MDS,x)
-//#define MSG_ADDR_OSD(x)     entity_name_t(entity_name_t::TYPE_OSD,x)
-//#define MSG_ADDR_MON(x)     entity_name_t(entity_name_t::TYPE_MON,x)
-//#define MSG_ADDR_CLIENT(x)  entity_name_t(entity_name_t::TYPE_CLIENT,x)
+
 
 /*
  * an entity's network address.
index 21de9e8f00b0d743217a577cbcdd58eace6d68bc..7c68ecec2b6e45f25b887e2c9c1c461647c5f314 100644 (file)
@@ -214,7 +214,6 @@ public:
       int        op;   // write, zero, trunc, remove
       object_t   oid;
       eversion_t version;
-      objectrev_t rev;
       
       osdreqid_t reqid;  // caller+tid to uniquely identify request
       
index c46797d950f1033c70754c901b33673c317e0ac7..24dd9eca74234d3d8ec6a2de128251c0022b3a72 100644 (file)
@@ -86,37 +86,29 @@ public:
   static const int TYPE_RAID4 = CEPH_PG_TYPE_RAID4;
 
 private:
-  union {
-    struct {
-      int32_t preferred;
-      uint8_t type;
-      uint8_t size;
-      uint16_t ps;
-    } fields;
-    uint64_t val;          // 64
-  } u;
+  union ceph_pg u;
 
 public:
-  pg_t() { u.val = 0; }
-  pg_t(const pg_t& o) { u.val = o.u.val; }
+  pg_t() { u.pg64 = 0; }
+  pg_t(const pg_t& o) { u.pg64 = o.u.pg64; }
   pg_t(int type, int size, ps_t seed, int pref) {//, pruleset_t r=0) {
-    u.fields.type = type;
-    u.fields.size = size;
-    u.fields.ps = seed;
-    u.fields.preferred = pref;   // hack: avoid negative.
-    //u.fields.ruleset = r;
-    assert(sizeof(u.fields) == sizeof(u.val));
+    u.pg.type = type;
+    u.pg.size = size;
+    u.pg.ps = seed;
+    u.pg.preferred = pref;   // hack: avoid negative.
+    //u.pg.ruleset = r;
+    assert(sizeof(u.pg) == sizeof(u.pg64));
   }
-  pg_t(uint64_t v) { u.val = v; }
+  pg_t(uint64_t v) { u.pg64 = v; }
 
-  int type()      { return u.fields.type; }
+  int type()      { return u.pg.type; }
   bool is_rep()   { return type() == TYPE_REP; }
   bool is_raid4() { return type() == TYPE_RAID4; }
 
-  int size() { return u.fields.size; }
-  ps_t ps() { return u.fields.ps; }
-  //pruleset_t ruleset() { return u.fields.ruleset; }
-  int preferred() { return u.fields.preferred; }   // hack: avoid negative.
+  int size() { return u.pg.size; }
+  ps_t ps() { return u.pg.ps; }
+  //pruleset_t ruleset() { return u.pg.ruleset; }
+  int preferred() { return u.pg.preferred; }   // hack: avoid negative.
   
   /*
   pg_t operator=(uint64_t v) { u.val = v; return *this; }
@@ -125,9 +117,9 @@ public:
   pg_t operator-=(pg_t o) { u.val -= o.val; return *this; }
   pg_t operator++() { ++u.val; return *this; }
   */
-  operator uint64_t() const { return u.val; }
+  operator uint64_t() const { return u.pg64; }
 
-  object_t to_object() const { return object_t(PG_INO, u.val >> 32, u.val & 0xffffffff); }
+  object_t to_object() const { return object_t(PG_INO, u.pg64 >> 32, u.pg64 & 0xffffffff); }
 };
 
 inline ostream& operator<<(ostream& out, pg_t pg)