diff options
author | Sage Weil <sage@inktank.com> | 2013-05-17 17:06:36 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-05-17 17:06:36 -0700 |
commit | 8bba266b95b1b6e55134e22df48eb1d1beb07f9d (patch) | |
tree | 90802f73540e4b8ad5c48536d8f648d9e74fa841 /src/libcephfs.cc | |
parent | 863d6d78e4c462abe2e925632c7ebfbf39bcd010 (diff) | |
download | ceph-8bba266b95b1b6e55134e22df48eb1d1beb07f9d.tar.gz |
libcephfs: add ceph_get_pool_name()
Convert an int pool id to a pool name. Useful for making sense of the
output from ceph_get_*_layout()'s poolid output argument.
Signed-off-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'src/libcephfs.cc')
-rw-r--r-- | src/libcephfs.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libcephfs.cc b/src/libcephfs.cc index 6044f7689a9..16b130a435a 100644 --- a/src/libcephfs.cc +++ b/src/libcephfs.cc @@ -838,6 +838,19 @@ extern "C" int ceph_get_file_pool_name(struct ceph_mount_info *cmount, int fh, c return name.length(); } +extern "C" int ceph_get_pool_name(struct ceph_mount_info *cmount, int pool, char *buf, size_t len) +{ + if (!cmount->is_mounted()) + return -ENOTCONN; + string name = cmount->get_client()->get_pool_name(pool); + if (len == 0) + return name.length(); + if (name.length() > len) + return -ERANGE; + strncpy(buf, name.c_str(), len); + return name.length(); +} + extern "C" int ceph_get_path_pool_name(struct ceph_mount_info *cmount, const char *path, char *buf, size_t len) { struct ceph_file_layout l; |