summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshishir gowda <sgowda@redhat.com>2013-10-08 10:33:08 +0530
committershishir gowda <sgowda@redhat.com>2013-11-15 12:30:00 +0530
commite3d266deb09ed5ff8825db681c1d82552ffacdcb (patch)
tree5b97a740b25e4f8b69762747f1310511863951c5
parent82c14c1d4a1b26b52d9b0fb6f68db6abafa04fe0 (diff)
glusterd/utils: Get brick mount's device name
Change-Id: I03ff9e8094e7e36b28b521380949c7e9044c2e4e Signed-off-by: shishir gowda <sgowda@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c41
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.h6
2 files changed, 47 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 00521a1..15924cc 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -4525,6 +4525,47 @@ glusterd_add_brick_mount_details (glusterd_brickinfo_t *brickinfo,
return ret;
}
+
+char*
+glusterd_get_brick_mount_details (glusterd_brickinfo_t *brickinfo)
+{
+ int ret = -1;
+ char *mnt_pt = NULL;
+ char *device = NULL;
+ FILE *mtab = NULL;
+ struct mntent *entry = NULL;
+
+ ret = glusterd_get_brick_root (brickinfo->path, &mnt_pt);
+ if (ret)
+ goto out;
+
+ mtab = setmntent (_PATH_MOUNTED, "r");
+ if (!mtab) {
+ ret = -1;
+ goto out;
+ }
+
+ entry = getmntent (mtab);
+
+ while (1) {
+ if (!entry) {
+ ret = -1;
+ goto out;
+ }
+ if (!strcmp (entry->mnt_dir, mnt_pt) &&
+ strcmp (entry->mnt_type, "rootfs"))
+ break;
+ entry = getmntent (mtab);
+ }
+
+
+ /* get the fs_name/device */
+ device = gf_strdup (entry->mnt_fsname);
+
+out:
+
+ return device;
+}
#endif
int
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h
index 4603ff4..bdd2eef 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.h
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.h
@@ -573,4 +573,10 @@ glusterd_check_gsync_running_local (char *master, char *slave,
gf_boolean_t
glusterd_is_status_tasks_op (glusterd_op_t op, dict_t *dict);
+
+#ifdef GF_LINUX_HOST_OS
+char*
+glusterd_get_brick_mount_details (glusterd_brickinfo_t *brickinfo);
+#endif //LINUX_HOST
+
#endif