summaryrefslogtreecommitdiffstats
path: root/api/src/glfs-fops.c
diff options
context:
space:
mode:
authorR.Shyamsundar <srangana@redhat.com>2013-09-16 16:39:24 +0530
committerAnand Avati <avati@redhat.com>2013-10-11 12:16:46 -0700
commitd573f170cf3305c066f8b191f872d2d2f22f2025 (patch)
tree51debc2bc323f4347482c0bfcda919cff5182b1f /api/src/glfs-fops.c
parentd3558ae5c4b1cf6909e27e8fabd6ec44fe6aa971 (diff)
gfapi: object handle based API extensions
There is an ongoing effort to integrate NFS Ganesha ( https://github.com/nfs-ganesha/nfs-ganesha/wiki ) with GlusterFS as one of the file system back ends. Towards this we need extensions to gfapi that can handle object based operations. Meaning, instead of using full paths or relative paths from cwd, it is required that we can work with APIs, like the *at POSIX variants, to be able to create, lookup, open etc. files and directories. Hence the objects are the files or directories themselves and we give out handles to these objects that can be used for further operations. This code drop is an initial implementation of the proposed APIs. The new APIs are implemented as glfs_h_XXX variants in the file glfs-handleops.c to mirror glfs-fops.c style. The code leverages holding onto inode references and doling these out as opaque/cookie type objects to the callers, to enable them to be used as handles in other operations. An fd based approach was considered, but due to the extra footprint that the fd structure and its counterparts would incur, this was dropped to take the approach of holding inode references themselves. Tested by extending glfsxmp.c to invoke and exercise the added APIs, and further tested with a reference integration of the same as an FSAL with NFS Ganesha. Change-Id: I23629c99e905b54070fa2e6565147812e5f3fa5d BUG: 1016000 Signed-off-by: R.Shyamsundar <srangana@redhat.com> Reviewed-on: http://review.gluster.org/5936 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'api/src/glfs-fops.c')
-rw-r--r--api/src/glfs-fops.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c
index 8119cc4f693..9070661b99e 100644
--- a/api/src/glfs-fops.c
+++ b/api/src/glfs-fops.c
@@ -14,20 +14,8 @@
#include "syncop.h"
#include "glfs.h"
-#define DEFAULT_REVAL_COUNT 1
-#define ESTALE_RETRY(ret,errno,reval,loc,label) do { \
- if (ret == -1 && errno == ESTALE) { \
- if (reval < DEFAULT_REVAL_COUNT) { \
- reval++; \
- loc_wipe (loc); \
- goto label; \
- } \
- } \
- } while (0)
-
-
-static int
+int
glfs_loc_link (loc_t *loc, struct iatt *iatt)
{
int ret = -1;
@@ -52,7 +40,7 @@ glfs_loc_link (loc_t *loc, struct iatt *iatt)
}
-static void
+void
glfs_iatt_to_stat (struct glfs *fs, struct iatt *iatt, struct stat *stat)
{
iatt_to_stat (iatt, stat);
@@ -60,7 +48,7 @@ glfs_iatt_to_stat (struct glfs *fs, struct iatt *iatt, struct stat *stat)
}
-static int
+int
glfs_loc_unlink (loc_t *loc)
{
inode_unlink (loc->inode, loc->parent, loc->name);