#define MAKE_LE_CLASS(bits) \
- struct __le##bits { \
+ struct ceph_le##bits { \
__u##bits v; \
- __le##bits &operator=(__u##bits nv) { \
+ ceph_le##bits &operator=(__u##bits nv) { \
v = mswab##bits(nv); \
return *this; \
} \
operator __u##bits() const { return mswab##bits(v); } \
} __attribute__ ((packed)); \
- static inline bool operator==(__le##bits a, __le##bits b) { \
+ static inline bool operator==(ceph_le##bits a, ceph_le##bits b) { \
return a.v == b.v; \
}
WRITE_RAW_ENCODER(__u8)
WRITE_RAW_ENCODER(__s8)
WRITE_RAW_ENCODER(char)
-WRITE_RAW_ENCODER(__le64)
-WRITE_RAW_ENCODER(__le32)
-WRITE_RAW_ENCODER(__le16)
+WRITE_RAW_ENCODER(ceph_le64)
+WRITE_RAW_ENCODER(ceph_le32)
+WRITE_RAW_ENCODER(ceph_le16)
// FIXME: we need to choose some portable floating point encoding here
WRITE_RAW_ENCODER(float)
}
};
+template<> struct rjhash<__u64> {
+ inline size_t operator()(const __u64 x) const {
+ return rjhash64(x);
+ }
+};
+
#if defined(__CYGWIN__) || defined(DARWIN)
template<> struct rjhash<size_t> {
inline size_t operator()(const size_t x) const {
#define _CEPH_INTTYPES_H
#include <stdint.h>
-
-typedef uint64_t __u64;
-typedef int64_t __s64;
-typedef uint32_t __u32;
-typedef int32_t __s32;
-typedef uint16_t __u16;
-typedef int16_t __s16;
-typedef uint8_t __u8;
-typedef int8_t __s8;
+#include <linux/types.h>
#endif
#define __CEPH_TYPES_H
// this is needed for ceph_fs to compile in userland
-#include <netinet/in.h>
-#define _LINUX_TYPES_H /* we don't want linux/types.h's __u32, __le32, etc. */
#include "inttypes.h"
#include "byteorder.h"
+
+#include <netinet/in.h>
#include <fcntl.h>
#include <string.h>
+// <macro hackery>
+// temporarily remap __le* to ceph_le* for benefit of shared kernel/userland headers
+#define __le16 ceph_le16
+#define __le32 ceph_le32
+#define __le64 ceph_le64
#include "ceph_fs.h"
#include "ceph_frag.h"
+#include "rbd_types.h"
+#undef __le16
+#undef __le32
+#undef __le64
+// </macro hackery>
+
#define _BACKWARD_BACKWARD_WARNING_H /* make gcc 4.3 shut up about hash_*. */
#ifndef __UTIME_H
#define __UTIME_H
-// this is needed for ceph_fs to compile in userland
-#include <netinet/in.h>
-#define _LINUX_TYPES_H /* we don't want linux/types.h's __u32, __le32, etc. */
-#include "inttypes.h"
-#include "byteorder.h"
-#include <fcntl.h>
-#include <string.h>
-
-#include "ceph_fs.h"
-
#include <math.h>
#include <sys/time.h>
#include <time.h>
-#include "buffer.h"
-#include "encoding.h"
-
// --------
// utime_t
dn->key().encode(bl);
- __le32 plen = init_le32(0);
+ ceph_le32 plen = init_le32(0);
unsigned plen_off = bl.length();
::encode(plen, bl);
plen = bl.length() - plen_off - sizeof(__u32);
- __le32 eplen;
+ ceph_le32 eplen;
eplen = plen;
bl.copy_in(plen_off, sizeof(eplen), (char*)&eplen);
}
// open ...
if (tag == CEPH_MSGR_TAG_ACK) {
dout(20) << "reader got ACK" << dendl;
- __le64 seq;
+ ceph_le64 seq;
int rc = tcp_read( sd, (char*)&seq, sizeof(seq));
pipe_lock.Lock();
if (rc < 0) {
dout(10) << "write_ack " << seq << dendl;
char c = CEPH_MSGR_TAG_ACK;
- __le64 s;
+ ceph_le64 s;
s = seq;
struct msghdr msg;
namespace __gnu_cxx {
template<> struct hash<osd_reqid_t> {
size_t operator()(const osd_reqid_t &r) const {
- static hash<__u64> H;
+ static hash<uint64_t> H;
return H(r.name.num() ^ r.tid ^ r.inc);
}
};