libglusterfsclient: implement glusterfs_umount

Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
This commit is contained in:
Raghavendra G 2009-04-22 07:32:53 -07:00 committed by Anand V. Avati
parent b817670c60
commit 3c68984b6f
2 changed files with 41 additions and 0 deletions

View File

@ -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)
{

View File

@ -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);