summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2009-08-23 22:29:29 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-09-08 01:41:15 -0700
commitb0d3d94b8ca94d1a133f74050d078a4bd6fa5260 (patch)
tree226f37e6a7dfa6c4159d528668be254b5a31284a /libglusterfs
parent2cbc63ca8bbfcb91bce775651e1acc0994a18ac0 (diff)
common-utils: introduce new macro GF_VALIDATE_OR_GOTO_WITH_ERROR
- the existing macro GF_VALIDATE_OR_GOTO sets errno to EINVAL which may not be appropriate in all cases. Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 221 (stat prefetch implementation) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=221
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/common-utils.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index c90342f7a..248efc83c 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -116,6 +116,15 @@ extern char *gf_cbk_list[GF_CBK_MAXVALUE];
} \
} while (0);
+#define GF_VALIDATE_OR_GOTO_WITH_ERROR(name, arg, label, error) do { \
+ if (!arg) { \
+ errno = error; \
+ gf_log (name, GF_LOG_ERROR, \
+ "invalid argument: " #arg); \
+ goto label; \
+ } \
+ }while (0);
+
#define GF_VALIDATE_ABSOLUTE_PATH_OR_GOTO(name,arg,label) \
do { \
GF_VALIDATE_OR_GOTO (name, arg, label); \