From bcc9a67fc22147f54a27a81ee35f4c081a0e6b73 Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Mon, 20 Apr 2009 12:35:17 -0700 Subject: libglusterfsclient: Add VMP-based mknod Signed-off-by: Anand V. Avati --- libglusterfsclient/src/libglusterfsclient.c | 25 +++++++++++++++++++++++-- libglusterfsclient/src/libglusterfsclient.h | 7 +++++-- 2 files changed, 28 insertions(+), 4 deletions(-) (limited to 'libglusterfsclient/src') diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index 2ab95d1f565..393367e4595 100755 --- a/libglusterfsclient/src/libglusterfsclient.c +++ b/libglusterfsclient/src/libglusterfsclient.c @@ -5006,8 +5006,8 @@ out: } int -glusterfs_mknod(glusterfs_handle_t handle, const char *path, mode_t mode, - dev_t dev) +glusterfs_glh_mknod(glusterfs_handle_t handle, const char *path, mode_t mode, + dev_t dev) { libglusterfs_client_ctx_t *ctx = handle; loc_t loc = {0, }; @@ -5053,6 +5053,27 @@ out: return op_ret; } +int +glusterfs_mknod(const char *pathname, mode_t mode, dev_t dev) +{ + struct vmp_entry *entry = NULL; + char *vpath = NULL; + int op_ret = -1; + + GF_VALIDATE_OR_GOTO (LIBGF_XL_NAME, pathname, out); + + entry = libgf_vmp_search_entry ((char *)pathname); + if (!entry) { + errno = ENODEV; + goto out; + } + + vpath = libgf_vmp_virtual_path (entry, pathname); + op_ret = glusterfs_glh_mknod (entry->handle, vpath, mode, dev); +out: + return op_ret; +} + int glusterfs_mkfifo (glusterfs_handle_t handle, const char *path, mode_t mode) { diff --git a/libglusterfsclient/src/libglusterfsclient.h b/libglusterfsclient/src/libglusterfsclient.h index b4454a37012..90cdc83e206 100755 --- a/libglusterfsclient/src/libglusterfsclient.h +++ b/libglusterfsclient/src/libglusterfsclient.h @@ -252,8 +252,11 @@ glusterfs_getdents (glusterfs_dir_t fd, struct dirent *dirp, unsigned int count); int -glusterfs_mknod(glusterfs_handle_t handle, const char *pathname, mode_t mode, - dev_t dev); +glusterfs_glh_mknod(glusterfs_handle_t handle, const char *pathname, + mode_t mode, dev_t dev); + +int +glusterfs_mknod(const char *pathname, mode_t mode, dev_t dev); char * glusterfs_realpath (glusterfs_handle_t handle, const char *path, -- cgit