summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/common-utils.h
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@zresearch.com>2009-04-16 23:52:04 -0700
committerAnand V. Avati <avati@amp.gluster.com>2009-04-17 13:18:12 +0530
commitc1b3deff1186c581cb8d9893a3a0de6bf00d3adc (patch)
tree7646eef549949712725459e1a79f27925879bdbb /libglusterfs/src/common-utils.h
parentb3e3fc79d4e7008a27d935decefcca51ba89dc17 (diff)
libglusterfsclient: Use macros for argument checks
Having those if {} blocks to check for argument validity hurts the eye so this patch replaces those checks with macros. One macro already exists in libglusterfs. The second macro is introduced by this commit for libglusterfsclient-specific check for paths. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'libglusterfs/src/common-utils.h')
-rw-r--r--libglusterfs/src/common-utils.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index b3630d478a7..c90342f7a3d 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -116,6 +116,16 @@ extern char *gf_cbk_list[GF_CBK_MAXVALUE];
} \
} while (0);
+#define GF_VALIDATE_ABSOLUTE_PATH_OR_GOTO(name,arg,label) \
+ do { \
+ GF_VALIDATE_OR_GOTO (name, arg, label); \
+ if ((arg[0]) != '/') { \
+ errno = EINVAL; \
+ gf_log (name, GF_LOG_ERROR, \
+ "invalid argument: " #arg); \
+ goto label; \
+ } \
+ } while (0);
#define GF_FILE_CONTENT_REQUESTED(_xattr_req,_content_limit) \
(dict_get_uint64 (_xattr_req, "glusterfs.content", _content_limit) == 0)