common/lockdep.cc \
common/DoutStreambuf.cc \
common/debug.cc \
- common/version.cc
+ common/version.cc \
+ common/hex.cc
libcrush_a_SOURCES = \
crush/builder.c \
common/WorkQueue.h\
common/debug.h\
common/version.h\
+ common/hex.h\
common/errno.h\
common/likely.h\
common/lockdep.h\
#include "config.h"
#include "common/armor.h"
#include "common/Clock.h"
+#include "common/hex.h"
#include "common/safe_io.h"
#include <errno.h>
-#include "Mutex.h"
-#include "ceph_ver.h"
#include "common/DoutStreambuf.h"
#include "config.h"
#include "debug.h"
-#include <errno.h>
-#include <fstream>
#include <iostream>
#include <sstream>
assert(_doss);
return _doss->create_rank_symlink(n);
}
-
-void hex2str(const char *s, int len, char *buf, int dest_len)
-{
- int pos = 0;
- for (int i=0; i<len && pos<dest_len; i++) {
- if (i && !(i%8))
- pos += snprintf(&buf[pos], dest_len-pos, " ");
- if (i && !(i%16))
- pos += snprintf(&buf[pos], dest_len-pos, "\n");
- pos += snprintf(&buf[pos], dest_len-pos, "%.2x ", (int)(unsigned char)s[i]);
- }
-}
-
-void hexdump(string msg, const char *s, int len)
-{
- int buf_len = len*4;
- char buf[buf_len];
- hex2str(s, len, buf, buf_len);
- generic_dout(0) << msg << ":\n" << buf << dendl;
-}
#define derr dout(-1)
-extern void hex2str(const char *s, int len, char *buf, int dest_len);
-
-extern void hexdump(std::string msg, const char *s, int len);
-
#endif
--- /dev/null
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2008-2011 New Dream Network
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software
+ * Foundation. See file COPYING.
+ *
+ */
+
+#include "config.h"
+#include "common/debug.h"
+#include "common/hex.h"
+
+#include <stdio.h>
+#include <string>
+
+void hex2str(const char *s, int len, char *buf, int dest_len)
+{
+ int pos = 0;
+ for (int i=0; i<len && pos<dest_len; i++) {
+ if (i && !(i%8))
+ pos += snprintf(&buf[pos], dest_len-pos, " ");
+ if (i && !(i%16))
+ pos += snprintf(&buf[pos], dest_len-pos, "\n");
+ pos += snprintf(&buf[pos], dest_len-pos, "%.2x ", (int)(unsigned char)s[i]);
+ }
+}
+
+void hexdump(std::string msg, const char *s, int len)
+{
+ int buf_len = len*4;
+ char buf[buf_len];
+ hex2str(s, len, buf, buf_len);
+ generic_dout(0) << msg << ":\n" << buf << dendl;
+}
--- /dev/null
+
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2011 New Dream Network
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software
+ * Foundation. See file COPYING.
+ *
+ */
+
+#ifndef CEPH_COMMON_HEX_H
+#define CEPH_COMMON_HEX_H
+
+#include <string>
+
+extern void hex2str(const char *s, int len, char *buf, int dest_len);
+
+extern void hexdump(std::string msg, const char *s, int len);
+
+#endif