From 3c68984b6f8dbb772a858fcf829d6c6f81503912 Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Wed, 22 Apr 2009 07:32:53 -0700 Subject: libglusterfsclient: implement glusterfs_umount Signed-off-by: Anand V. Avati --- libglusterfsclient/src/libglusterfsclient.c | 38 +++++++++++++++++++++++++++++ libglusterfsclient/src/libglusterfsclient.h | 3 +++ 2 files changed, 41 insertions(+) diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index 160df1cb337..46208a8ee35 100755 --- a/libglusterfsclient/src/libglusterfsclient.c +++ b/libglusterfsclient/src/libglusterfsclient.c @@ -875,6 +875,13 @@ libgf_init_vmpentry (char *vmp, glusterfs_handle_t *vmphandle) return entry; } +void +libgf_free_vmp_entry (struct vmp_entry *entry) +{ + FREE (entry->vmp); + FREE (entry); +} + int libgf_vmp_map_ghandle (char *vmp, glusterfs_handle_t *vmphandle) { @@ -1005,6 +1012,37 @@ out: return ret; } +int +glusterfs_umount (char *vmp) +{ + struct vmp_entry *entry= NULL; + int ret = -1; + GF_VALIDATE_OR_GOTO (LIBGF_XL_NAME, vmp, out); + + entry = libgf_vmp_search_entry (vmp); + if (entry == NULL) { + gf_log ("libglusterfsclient", GF_LOG_ERROR, + "path (%s) not mounted", vmp); + goto out; + } + + /* FIXME: make this thread safe */ + list_del_init (&entry->list); + + if (entry->handle == NULL) { + gf_log ("libglusterfsclient", GF_LOG_ERROR, + "path (%s) has no corresponding glusterfs handle", + vmp); + goto out; + } + + ret = glusterfs_fini (entry->handle); + libgf_free_vmp_entry (entry); + +out: + return ret; +} + void glusterfs_reset (void) { diff --git a/libglusterfsclient/src/libglusterfsclient.h b/libglusterfsclient/src/libglusterfsclient.h index 93476a6a29f..defbec8786d 100755 --- a/libglusterfsclient/src/libglusterfsclient.h +++ b/libglusterfsclient/src/libglusterfsclient.h @@ -268,6 +268,9 @@ glusterfs_realpath (const char *path, char *resolved_path); int glusterfs_mount (char *vmp, glusterfs_init_params_t *ipars); +int +glusterfs_umount (char *vmp); + int glusterfs_glh_chmod (glusterfs_handle_t handle, const char *path, mode_t mode); -- cgit