summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kuznetsov <Andrey_Kuznetsov@epam.com>2013-07-10 14:25:49 -0700
committerSage Weil <sage@inktank.com>2013-09-04 17:53:30 -0700
commit9e68497ec7f4e51f8b1f6df011a56d5a2236f217 (patch)
treed088c442b2202f718e8e7c87e83eb71dcd09a334
parent8750bc39e2430f862afcd2594ce00647b0300fa6 (diff)
downloadceph-9e68497ec7f4e51f8b1f6df011a56d5a2236f217.tar.gz
libcephfs: add ceph_ll_lookup_root()
Signed-off-by: Andrey Kuznetsov <Andrey_Kuznetsov@epam.com>
-rw-r--r--src/client/Client.cc6
-rw-r--r--src/client/Client.h1
-rw-r--r--src/include/cephfs/libcephfs.h9
-rw-r--r--src/libcephfs.cc9
4 files changed, 25 insertions, 0 deletions
diff --git a/src/client/Client.cc b/src/client/Client.cc
index d6fcb0f51a1..8b9185165f1 100644
--- a/src/client/Client.cc
+++ b/src/client/Client.cc
@@ -256,6 +256,12 @@ inodeno_t Client::get_root_ino()
return root->ino;
}
+Inode *Client::get_root()
+{
+ root->ll_get();
+ return root;
+}
+
// debug crapola
diff --git a/src/client/Client.h b/src/client/Client.h
index b9d83cc2a70..baeb8d5ebdb 100644
--- a/src/client/Client.h
+++ b/src/client/Client.h
@@ -419,6 +419,7 @@ protected:
client_t get_nodeid() { return whoami; }
inodeno_t get_root_ino();
+ Inode *get_root();
int init() WARN_UNUSED_RESULT;
void shutdown();
diff --git a/src/include/cephfs/libcephfs.h b/src/include/cephfs/libcephfs.h
index 824f4be05be..4ba63069064 100644
--- a/src/include/cephfs/libcephfs.h
+++ b/src/include/cephfs/libcephfs.h
@@ -1207,6 +1207,15 @@ int ceph_debug_get_file_caps(class ceph_mount_info *cmount, const char *path);
/* Low Level */
struct Inode *ceph_ll_get_inode(struct ceph_mount_info *cmount,
vinodeno_t vino);
+/**
+ * Get the root inode of FS. Increase counter of references for root Inode. You must call ceph_ll_forget for it!
+ *
+ * @param cmount the ceph mount handle to use.
+ * @param parent pointer to pointer to Inode struct. Pointer to root inode will be returned
+ * @returns 0 if all good
+ */
+int ceph_ll_lookup_root(struct ceph_mount_info *cmount,
+ Inode **parent);
int ceph_ll_lookup(struct ceph_mount_info *cmount, struct Inode *parent,
const char *name, struct stat *attr,
Inode **out, int uid, int gid);
diff --git a/src/libcephfs.cc b/src/libcephfs.cc
index 58ad819dd1a..885ee02a288 100644
--- a/src/libcephfs.cc
+++ b/src/libcephfs.cc
@@ -1154,6 +1154,15 @@ extern "C" int ceph_get_pool_replication(class ceph_mount_info *cmount,
}
/* Low-level exports */
+extern "C" int ceph_ll_lookup_root(struct ceph_mount_info *cmount,
+ Inode **parent)
+{
+ *parent = cmount->get_client()->get_root();
+ if (*parent)
+ return 0;
+ return EFAULT;
+}
+
extern "C" struct Inode *ceph_ll_get_inode(class ceph_mount_info *cmount,
vinodeno_t vino)
{