summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@zresearch.com>2009-04-20 12:30:36 -0700
committerAnand V. Avati <avati@amp.gluster.com>2009-04-21 12:48:32 +0530
commit4074769dd2435ab3521ab39eb2775c3e80fc32b4 (patch)
treeab3e7a3e0da941114cd331b1d586f2eb337faa56 /libglusterfsclient
parentd875df0c5c095488db29a202eac74d10d540aa3b (diff)
libglusterfsclient: Add VMP-based creat
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'libglusterfsclient')
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.c25
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.h5
2 files changed, 26 insertions, 4 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c
index b7e278017d9..b5fa10159c0 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 dabc288c139..d7ce4318e8d 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);