cephfs_SOURCES = cephfs.cc
bin_PROGRAMS += cephfs
+librados_config_SOURCES = librados-config.cc
+librados_config_LDADD = librados.la
+bin_PROGRAMS += librados-config
+
# synthetic client
csyn_SOURCES = csyn.cc msg/SimpleMessenger.cc
csyn_LDADD = libclient.a libosdc.a libcrush.a libcommon.a -lpthread -lm $(CRYPTOPP_LIBS)
bin_PROGRAMS += csyn
-core: cmon cosd cmds ceph cephfs cconf monmaptool osdmaptool crushtool csyn
+core: cmon cosd cmds ceph cephfs librados-config cconf monmaptool osdmaptool crushtool csyn
# fuse targets?
tools/gui.h\
tools/gui_resources.h
-all_sources = $(cmon_SOURCES) $(ceph_SOURCES) $(cephfs_SOURCES) $(cauthtool_SOURCES) $(monmaptool_SOURCES) \
+all_sources = $(cmon_SOURCES) $(ceph_SOURCES) $(cephfs_SOURCES) $(librados_config_SOURCES) $(cauthtool_SOURCES) $(monmaptool_SOURCES) \
$(crushtool_SOURCES) $(osdmaptool_SOURCES) $(cconf_SOURCES) $(mount_ceph_SOURCES) $(cmds_SOURCES) \
$(dumpjournal_SOURCES) $(cosd_SOURCES) $(dupstore_SOURCES) $(streamtest_SOURCES) $(csyn_SOURCES) \
$(testmsgr_SOURCES) $(cfuse_SOURCES) $(fakefuse_SOURCES) $(psim_SOURCES) \
#define LIBRADOS_VER_MAJOR 0
#define LIBRADOS_VER_MINOR 25
+#define LIBRADOS_VER_EXTRA 0
-#define LIBRADOS_VERSION(maj, min) ((maj << 16) + min)
+#define LIBRADOS_VERSION(maj, min, extra) ((maj << 16) + (min << 8) + extra)
-#define LIBRADOS_VERSION_CODE LIBRADOS_VERSION(LIBRADOS_VER_MAJOR, LIBRADOS_VER_MINOR)
+#define LIBRADOS_VERSION_CODE LIBRADOS_VERSION(LIBRADOS_VER_MAJOR, LIBRADOS_VER_MINOR, LIBRADOS_VER_EXTRA)
/* initialization */
int rados_initialize(int argc, const char **argv); /* arguments are optional */
void rados_deinitialize();
-void librados_version(int *major, int *minor);
+void librados_version(int *major, int *minor, int *extra);
/* pools */
typedef void *rados_pool_t;
--- /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) 2004-2006 Sage Weil <sage@newdream.net>
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License version 2, as published by the Free Software
+ * Foundation. See file COPYING.
+ *
+ */
+
+#define __STDC_FORMAT_MACROS
+#include "config.h"
+
+#include "common/common_init.h"
+#include "include/librados.h"
+
+void usage()
+{
+ cout << "usage: librados-config [option]\n"
+ << "where options are:\n"
+ << " --version library version\n"
+ << " --vernum library version code\n";
+}
+
+void usage_exit()
+{
+ assert(1);
+ usage();
+ exit(1);
+}
+int main(int argc, const char **argv)
+{
+ vector<const char*> args;
+ DEFINE_CONF_VARS(usage_exit);
+ argv_to_vec(argc, argv, args);
+ env_to_vec(args);
+
+ common_set_defaults(false);
+ // common_init(args, "librados-config", false); /* this overrides --version.. */
+ set_foreground_logging();
+
+ bool opt_version = false;
+ bool opt_vernum = false;
+
+ FOR_EACH_ARG(args) {
+ if (CONF_ARG_EQ("version", '\0')) {
+ CONF_SAFE_SET_ARG_VAL(&opt_version, OPT_BOOL);
+ } else if (CONF_ARG_EQ("vernum", '\0')) {
+ CONF_SAFE_SET_ARG_VAL(&opt_vernum, OPT_BOOL);
+ } else {
+ usage_exit();
+ }
+ }
+ if (!opt_version && !opt_vernum)
+ usage_exit();
+
+ if (opt_version) {
+ int maj, min, ext;
+ librados_version(&maj, &min, &ext);
+ cout << maj << "." << min << "." << ext << std::endl;
+ } else if (opt_vernum) {
+ cout << hex << LIBRADOS_VERSION_CODE << dec << std::endl;
+ }
+
+ return 0;
+}
+
rados_init_mutex.Unlock();
}
-extern "C" void librados_version(int *major, int *minor)
+extern "C" void librados_version(int *major, int *minor, int *extra)
{
if (major)
*major = LIBRADOS_VER_MAJOR;
if (minor)
*minor = LIBRADOS_VER_MINOR;
+ if (extra)
+ *extra = LIBRADOS_VER_EXTRA;
}
extern "C" int rados_lookup_pool(const char *name)