summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-utils.c
diff options
context:
space:
mode:
authorRajesh Joseph <rjoseph@redhat.com>2014-04-03 21:30:06 +0530
committerRajesh Joseph <rjoseph@redhat.com>2014-04-07 00:51:03 -0700
commitdc646153c1a9733b44c78550e4b28ec0c9898b4f (patch)
treeefdb0e040a8f8b5fddac17c87743a564b245abce /xlators/mgmt/glusterd/src/glusterd-utils.c
parent960ce829906292836f2a34f35f4182011cfe5fb2 (diff)
glusterd/snapshot: Addressed upstream review commentsHEADdevelopment
Code cleanup and review comments fixed. Change-Id: Ie51e3a2f995295632cb1db05bab8b38603ab9a0a Signed-off-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-on: http://review.gluster.org/7399 Reviewed-by: Vijaikumar Mallikarjuna <vmallika@redhat.com> Reviewed-by: Avra Sengupta <asengupt@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 905ac6e..e8ae058 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -5013,35 +5013,33 @@ glusterd_get_brick_mount_details (glusterd_brickinfo_t *brickinfo)
char *device = NULL;
FILE *mtab = NULL;
struct mntent *entry = NULL;
+ xlator_t *this = NULL;
- ret = glusterd_get_brick_root (brickinfo->path, &mnt_pt);
- if (ret)
- goto out;
+ this = THIS;
+ GF_ASSERT (this);
+ GF_ASSERT (brickinfo);
- mtab = setmntent (_PATH_MOUNTED, "r");
- if (!mtab) {
- ret = -1;
+ ret = glusterd_get_brick_root (brickinfo->path, &mnt_pt);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to get mount point "
+ "for %s brick", brickinfo->path);
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);
+ entry = glusterd_get_mnt_entry_info (mnt_pt, mtab);
+ if (NULL == entry) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to get mnt entry "
+ "for %s mount path", mnt_pt);
+ goto out;
}
-
/* get the fs_name/device */
device = gf_strdup (entry->mnt_fsname);
out:
+ if (NULL != mtab) {
+ endmntent (mtab);
+ }
return device;
}