*/
int ceph_create_with_context(struct ceph_mount_info **cmount, struct CephContext *conf);
+
+typedef void *rados_t;
+
+/**
+ * Create a mount handle from a rados_t, for using libcephfs in the
+ * same process as librados.
+ *
+ * @param cmount the mount info handle to initialize
+ * @param cluster reference to already-initialized librados handle
+ * @returns 0 on success, negative error code on failure
+ */
+int ceph_create_from_rados(struct ceph_mount_info **cmount, rados_t cluster);
+
/**
* Initialize the filesystem client (but do not mount the filesystem yet)
*
#include "auth/Crypto.h"
#include "client/Client.h"
-#include "include/cephfs/libcephfs.h"
+#include "librados/RadosClient.h"
#include "common/Mutex.h"
#include "common/ceph_argparse.h"
#include "common/common_init.h"
#include "msg/Messenger.h"
#include "include/assert.h"
+#include "include/cephfs/libcephfs.h"
+
+
struct ceph_mount_info
{
public:
return 0;
}
+extern "C" int ceph_create_from_rados(struct ceph_mount_info **cmount,
+ rados_t cluster)
+{
+ auto rados = (librados::RadosClient *) cluster;
+ auto cct = rados->cct;
+ cct->get();
+ return ceph_create_with_context(cmount, cct);
+}
+
extern "C" int ceph_create(struct ceph_mount_info **cmount, const char * const id)
{
CephInitParameters iparams(CEPH_ENTITY_TYPE_CLIENT);