From 4074769dd2435ab3521ab39eb2775c3e80fc32b4 Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Mon, 20 Apr 2009 12:30:36 -0700 Subject: libglusterfsclient: Add VMP-based creat Signed-off-by: Anand V. Avati --- libglusterfsclient/src/libglusterfsclient.c | 25 ++++++++++++++++++++++--- libglusterfsclient/src/libglusterfsclient.h | 5 ++++- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index b7e278017..b5fa10159 100755 --- a/libglusterfsclient/src/libglusterfsclient.c +++ b/libglusterfsclient/src/libglusterfsclient.c @@ -1944,14 +1944,33 @@ out: } glusterfs_file_t -glusterfs_creat (glusterfs_handle_t handle, - const char *path, - mode_t mode) +glusterfs_glh_creat (glusterfs_handle_t handle, const char *path, mode_t mode) { return glusterfs_glh_open (handle, path, (O_CREAT | O_WRONLY | O_TRUNC), mode); } +glusterfs_file_t +glusterfs_creat (const char *path, mode_t mode) +{ + struct vmp_entry *entry = NULL; + char *vpath = NULL; + glusterfs_file_t fh = NULL; + + GF_VALIDATE_OR_GOTO (LIBGF_XL_NAME, path, out); + + entry = libgf_vmp_search_entry ((char *)path); + if (!entry) { + errno = ENODEV; + goto out; + } + + vpath = libgf_vmp_virtual_path (entry, path); + fh = glusterfs_glh_creat (entry->handle, vpath, mode); + +out: + return fh; +} int32_t libgf_client_flush_cbk (call_frame_t *frame, diff --git a/libglusterfsclient/src/libglusterfsclient.h b/libglusterfsclient/src/libglusterfsclient.h index dabc288c1..d7ce4318e 100755 --- a/libglusterfsclient/src/libglusterfsclient.h +++ b/libglusterfsclient/src/libglusterfsclient.h @@ -109,7 +109,10 @@ glusterfs_file_t glusterfs_open (const char *path, int flags, ...); glusterfs_file_t -glusterfs_creat (glusterfs_handle_t handle, const char *path, mode_t mode); +glusterfs_glh_creat (glusterfs_handle_t handle, const char *path, mode_t mode); + +glusterfs_file_t +glusterfs_creat (const char *path, mode_t mode); int glusterfs_mkdir (glusterfs_handle_t handle, const char *path, mode_t mode); -- cgit