From cc0378d39f4082f51d5ef6e02b3007fe9e78cb31 Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Wed, 7 May 2014 20:13:43 +0530 Subject: user servicable snapshots Change-Id: Idbf27dbe088e646a8ab81cedc5818413795895ea Signed-off-by: Raghavendra Bhat Signed-off-by: Anand Subramanian Signed-off-by: Raghavendra Bhat Reviewed-on: http://review.gluster.org/7700 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- .../features/snapview-client/src/snapview-client.h | 110 +++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 xlators/features/snapview-client/src/snapview-client.h (limited to 'xlators/features/snapview-client/src/snapview-client.h') diff --git a/xlators/features/snapview-client/src/snapview-client.h b/xlators/features/snapview-client/src/snapview-client.h new file mode 100644 index 00000000000..000490393c1 --- /dev/null +++ b/xlators/features/snapview-client/src/snapview-client.h @@ -0,0 +1,110 @@ + /* + Copyright (c) 2014 Red Hat, Inc. + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ +#ifndef __SNAP_VIEW_CLIENT_H__ +#define __SNAP_VIEW_CLIENT_H__ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "glusterfs.h" +#include "logging.h" +#include "dict.h" +#include "xlator.h" +#include "defaults.h" +#include "snapview-client-mem-types.h" + +struct __svc_local { + loc_t loc; + xlator_t *subvolume; +}; +typedef struct __svc_local svc_local_t; + +void +svc_local_free (svc_local_t *local); + +#define SVC_STACK_UNWIND(fop, frame, params ...) do { \ + svc_local_t *__local = NULL; \ + if (frame) { \ + __local = frame->local; \ + frame->local = NULL; \ + } \ + STACK_UNWIND_STRICT (fop, frame, params); \ + svc_local_free (__local); \ + } while (0) + +#define SVC_ENTRY_POINT_SET(this, xdata, op_ret, op_errno, new_xdata, \ + priv, ret, label) \ + do { \ + if (!xdata) { \ + xdata = new_xdata = dict_new (); \ + if (!new_xdata) { \ + gf_log (this->name, GF_LOG_ERROR, \ + "failed to allocate new dict"); \ + op_ret = -1; \ + op_errno = ENOMEM; \ + goto label; \ + } \ + } \ + ret = dict_set_str (xdata, "entry-point", "true"); \ + if (ret) { \ + gf_log (this->name, GF_LOG_ERROR, \ + "failed to set dict"); \ + op_ret = -1; \ + op_errno = ENOMEM; \ + goto label; \ + } \ + } while (0); + +#define SVC_GET_SUBVOL_FROM_CTX(this, op_ret, op_errno, inode_type, ret, \ + inode, subvolume, label) \ + do { \ + ret = svc_inode_ctx_get (this, inode, &inode_type); \ + if (ret < 0) { \ + gf_log (this->name, GF_LOG_ERROR, \ + "inode context not found for gfid %s", \ + uuid_utoa (inode->gfid)); \ + op_ret = -1; \ + op_errno = EINVAL; \ + goto label; \ + } \ + \ + subvolume = svc_get_subvolume (this, inode_type); \ + } while (0); + +struct svc_private { + char *path; //might be helpful for samba +}; +typedef struct svc_private svc_private_t; + +typedef enum { + NORMAL_INODE = 1, + VIRTUAL_INODE +} inode_type_t; + +void svc_local_free (svc_local_t *local); + +xlator_t * +svc_get_subvolume (xlator_t *this, int inode_type); + +int +__svc_inode_ctx_get (xlator_t *this, inode_t *inode, int *inode_type); + +int +svc_inode_ctx_get (xlator_t *this, inode_t *inode, int *inode_type); + +int32_t +svc_inode_ctx_set (xlator_t *this, inode_t *inode, int inode_type); + +void +svc_local_free (svc_local_t *local); + +#endif /* __SNAP_VIEW_CLIENT_H__ */ -- cgit