*/
/**
- * Get the file striping unit.
+ * Get the file striping unit from an open file descriptor.
*
* @param cmount the ceph mount handle to use.
* @param fh the open file descriptor referring to the file to get the striping unit of.
int ceph_get_file_stripe_unit(struct ceph_mount_info *cmount, int fh);
/**
- * Get the file pool information.
+ * Get the file striping unit.
+ *
+ * @param cmount the ceph mount handle to use.
+ * @param path the path of the file/directory get the striping unit of.
+ * @returns the striping unit of the file or a negative error code on failure.
+ */
+int ceph_get_path_stripe_unit(struct ceph_mount_info *cmount, const char *path);
+
+/**
+ * Get the file striping count from an open file descriptor.
+ *
+ * @param cmount the ceph mount handle to use.
+ * @param fh the open file descriptor referring to the file to get the striping count of.
+ * @returns the striping count of the file or a negative error code on failure.
+ */
+int ceph_get_file_stripe_count(struct ceph_mount_info *cmount, int fh);
+
+/**
+ * Get the file striping count.
+ *
+ * @param cmount the ceph mount handle to use.
+ * @param path the path of the file/directory get the striping count of.
+ * @returns the striping count of the file or a negative error code on failure.
+ */
+int ceph_get_path_stripe_count(struct ceph_mount_info *cmount, const char *path);
+
+/**
+ * Get the file object size from an open file descriptor.
+ *
+ * @param cmount the ceph mount handle to use.
+ * @param fh the open file descriptor referring to the file to get the object size of.
+ * @returns the object size of the file or a negative error code on failure.
+ */
+int ceph_get_file_object_size(struct ceph_mount_info *cmount, int fh);
+
+/**
+ * Get the file object size.
+ *
+ * @param cmount the ceph mount handle to use.
+ * @param path the path of the file/directory get the object size of.
+ * @returns the object size of the file or a negative error code on failure.
+ */
+int ceph_get_path_object_size(struct ceph_mount_info *cmount, const char *path);
+
+/**
+ * Get the file pool information from an open file descriptor.
*
* @param cmount the ceph mount handle to use.
* @param fh the open file descriptor referring to the file to get the pool information of.
*/
int ceph_get_file_pool(struct ceph_mount_info *cmount, int fh);
+/**
+ * Get the file pool information.
+ *
+ * @param cmount the ceph mount handle to use.
+ * @param path the path of the file/directory get the pool information of.
+ * @returns the ceph pool id that the file is in
+ */
+int ceph_get_path_pool(struct ceph_mount_info *cmount, const char *path);
+
/**
* Get the name of the pool a file is stored in,
*
return l.fl_stripe_unit;
}
+extern "C" int ceph_get_path_stripe_unit(struct ceph_mount_info *cmount, const char *path)
+{
+ struct ceph_file_layout l;
+ int r;
+
+ if (!cmount->is_mounted())
+ return -ENOTCONN;
+ r = cmount->get_client()->describe_layout(path, &l);
+ if (r < 0)
+ return r;
+ return l.fl_stripe_unit;
+}
+
+extern "C" int ceph_get_file_stripe_count(struct ceph_mount_info *cmount, int fh)
+{
+ struct ceph_file_layout l;
+ int r;
+
+ if (!cmount->is_mounted())
+ return -ENOTCONN;
+ r = cmount->get_client()->fdescribe_layout(fh, &l);
+ if (r < 0)
+ return r;
+ return l.fl_stripe_count;
+}
+
+extern "C" int ceph_get_path_stripe_count(struct ceph_mount_info *cmount, const char *path)
+{
+ struct ceph_file_layout l;
+ int r;
+
+ if (!cmount->is_mounted())
+ return -ENOTCONN;
+ r = cmount->get_client()->describe_layout(path, &l);
+ if (r < 0)
+ return r;
+ return l.fl_stripe_count;
+}
+
+extern "C" int ceph_get_file_object_size(struct ceph_mount_info *cmount, int fh)
+{
+ struct ceph_file_layout l;
+ int r;
+
+ if (!cmount->is_mounted())
+ return -ENOTCONN;
+ r = cmount->get_client()->fdescribe_layout(fh, &l);
+ if (r < 0)
+ return r;
+ return l.fl_object_size;
+}
+
+extern "C" int ceph_get_path_object_size(struct ceph_mount_info *cmount, const char *path)
+{
+ struct ceph_file_layout l;
+ int r;
+
+ if (!cmount->is_mounted())
+ return -ENOTCONN;
+ r = cmount->get_client()->describe_layout(path, &l);
+ if (r < 0)
+ return r;
+ return l.fl_object_size;
+}
+
extern "C" int ceph_get_file_pool(struct ceph_mount_info *cmount, int fh)
{
struct ceph_file_layout l;
return l.fl_pg_pool;
}
+extern "C" int ceph_get_path_pool(struct ceph_mount_info *cmount, const char *path)
+{
+ struct ceph_file_layout l;
+ int r;
+
+ if (!cmount->is_mounted())
+ return -ENOTCONN;
+ r = cmount->get_client()->describe_layout(path, &l);
+ if (r < 0)
+ return r;
+ return l.fl_pg_pool;
+}
+
extern "C" int ceph_get_file_pool_name(struct ceph_mount_info *cmount, int fh, char *buf, size_t len)
{
struct ceph_file_layout l;