diff options
author | Vijay Bellur <vijay@gluster.com> | 2010-10-12 03:06:30 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-10-12 02:39:01 -0700 |
commit | 9bad9d59f0f19fe20f90c6ed80e25c7db08b3371 (patch) | |
tree | 05dc2622a1ab6e00930f3846bd79cf560e8a939e /libglusterfs/src | |
parent | f637330995eab92a1d0b9f4ad9c43acfaad35037 (diff) |
Change assert to GF_ASSERT
Signed-off-by: Vijay Bellur <vijay@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 971 (dynamic volume management)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971
Diffstat (limited to 'libglusterfs/src')
-rw-r--r-- | libglusterfs/src/common-utils.h | 8 | ||||
-rw-r--r-- | libglusterfs/src/fd.c | 6 | ||||
-rw-r--r-- | libglusterfs/src/inode.c | 4 | ||||
-rw-r--r-- | libglusterfs/src/iobuf.c | 2 | ||||
-rw-r--r-- | libglusterfs/src/mem-pool.c | 14 | ||||
-rw-r--r-- | libglusterfs/src/stack.c | 4 |
6 files changed, 22 insertions, 16 deletions
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index b883653bf70..4371888d034 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -131,7 +131,13 @@ extern char *gf_mgmt_list[GF_MGMT_MAXVALUE]; #define GF_FILE_CONTENT_REQUESTED(_xattr_req,_content_limit) \ (dict_get_uint64 (_xattr_req, "glusterfs.content", _content_limit) == 0) -#define GF_ASSERT(x) assert (x); +#define GF_ASSERT(x) \ + do { \ + if (!(x)) { \ + gf_log_callingfn ("", GF_LOG_ERROR, \ + "Assertion failed: " #x); \ + } \ + } while (0); static inline void iov_free (struct iovec *vector, int count) diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c index 58790f4e69b..e4e75d8040f 100644 --- a/libglusterfs/src/fd.c +++ b/libglusterfs/src/fd.c @@ -384,7 +384,7 @@ fd_ref (fd_t *fd) fd_t * _fd_unref (fd_t *fd) { - assert (fd->refcount); + GF_ASSERT (fd->refcount); --fd->refcount; @@ -503,7 +503,7 @@ fd_bind (fd_t *fd) void fd_unref_unbind (fd_t *fd) { - assert (fd->refcount); + GF_ASSERT (fd->refcount); LOCK (&fd->inode->lock); { @@ -514,7 +514,7 @@ fd_unref_unbind (fd_t *fd) * Make sure you only call this when you know there are * pending refs on the fd. */ - assert (fd->refcount); + GF_ASSERT (fd->refcount); list_del_init (&fd->inode_list); } UNLOCK (&fd->inode->lock); diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c index bdc2c6e4889..04e4560ed8f 100644 --- a/libglusterfs/src/inode.c +++ b/libglusterfs/src/inode.c @@ -306,7 +306,7 @@ __inode_unref (inode_t *inode) if (inode->ino == 1) return inode; - assert (inode->ref); + GF_ASSERT (inode->ref); --inode->ref; @@ -501,7 +501,7 @@ __inode_forget (inode_t *inode, uint64_t nlookup) if (!inode) return NULL; - assert (inode->nlookup >= nlookup); + GF_ASSERT (inode->nlookup >= nlookup); inode->nlookup -= nlookup; diff --git a/libglusterfs/src/iobuf.c b/libglusterfs/src/iobuf.c index d1afc4d36bd..a8bd192cf88 100644 --- a/libglusterfs/src/iobuf.c +++ b/libglusterfs/src/iobuf.c @@ -82,7 +82,7 @@ __iobuf_arena_destroy_iobufs (struct iobuf_arena *iobuf_arena) iobuf = iobuf_arena->iobufs; for (i = 0; i < iobuf_cnt; i++) { - assert (iobuf->ref == 0); + GF_ASSERT (iobuf->ref == 0); list_del_init (&iobuf->list); iobuf++; diff --git a/libglusterfs/src/mem-pool.c b/libglusterfs/src/mem-pool.c index 8f62ac3cf89..17d2e0dd2f1 100644 --- a/libglusterfs/src/mem-pool.c +++ b/libglusterfs/src/mem-pool.c @@ -78,15 +78,15 @@ gf_mem_set_acct_info (xlator_t *xl, char **alloc_ptr, ptr = (char *) (*alloc_ptr); if (!xl) { - assert (0); + GF_ASSERT (0); } if (!(xl->mem_acct.rec)) { - assert (0); + GF_ASSERT (0); } if (type > xl->mem_acct.num_types) { - assert (0); + GF_ASSERT (0); } LOCK(&xl->mem_acct.rec[type].lock); @@ -179,7 +179,7 @@ __gf_realloc (void *ptr, size_t size) orig_ptr = (char *)ptr - 4; - assert (*(uint32_t *)orig_ptr == GF_MEM_HEADER_MAGIC); + GF_ASSERT (*(uint32_t *)orig_ptr == GF_MEM_HEADER_MAGIC); orig_ptr = orig_ptr - sizeof(xlator_t *); xl = *((xlator_t **)orig_ptr); @@ -261,7 +261,7 @@ __gf_free (void *free_ptr) if (GF_MEM_HEADER_MAGIC != *(uint32_t *)ptr) { //Possible corruption, assert here - assert (0); + GF_ASSERT (0); } *(uint32_t *)ptr = 0; @@ -271,7 +271,7 @@ __gf_free (void *free_ptr) if (!xl) { //gf_free expects xl to be available - assert (0); + GF_ASSERT (0); } if (!xl->mem_acct.rec) { @@ -288,7 +288,7 @@ __gf_free (void *free_ptr) if (GF_MEM_TRAILER_MAGIC != *(uint32_t *) ((char *)free_ptr + req_size)) { // This points to a memory overrun - assert (0); + GF_ASSERT (0); } *(uint32_t *) ((char *)free_ptr + req_size) = 0; diff --git a/libglusterfs/src/stack.c b/libglusterfs/src/stack.c index 30a86f2e461..b2659c57fe3 100644 --- a/libglusterfs/src/stack.c +++ b/libglusterfs/src/stack.c @@ -48,7 +48,7 @@ gf_proc_dump_call_frame (call_frame_t *call_frame, const char *key_buf,...) if (!call_frame) return; - assert(key_buf); + GF_ASSERT (key_buf); memset(prefix, 0, sizeof(prefix)); memset(&my_frame, 0, sizeof(my_frame)); @@ -91,7 +91,7 @@ gf_proc_dump_call_stack (call_stack_t *call_stack, const char *key_buf,...) if (!call_stack) return; - assert(key_buf); + GF_ASSERT (key_buf); cnt = call_frames_count(&call_stack->frames); |