summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshishir gowda <sgowda@redhat.com>2013-10-08 01:23:15 -0700
committerGerrit Code Review <review@dev.gluster.org>2013-10-08 01:23:15 -0700
commitcd87a145ef57a166f1463629b457c0ad90f1ba5e (patch)
treed0f5ee84498d87bd9dd437661ee5eefcb1b2d728
parentbac48c2e98afa8e7f309927cc00d8601063faf1d (diff)
parente978d8f69b06890815cccd58682a13e365dbec79 (diff)
Merge "glusterd/utils: Get brick mount's device name" into devel
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c41
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.h5
2 files changed, 46 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index e6ff573..7ad6cc8 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -4413,6 +4413,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 89888b4..e85e0eb 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.h
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.h
@@ -565,4 +565,9 @@ glusterd_check_gsync_running_local (char *master, char *slave,
char *conf_path,
gf_boolean_t *is_run);
+#ifdef GF_LINUX_HOST_OS
+char*
+glusterd_get_brick_mount_details (glusterd_brickinfo_t *brickinfo);
+#endif //LINUX_HOST
+
#endif