summaryrefslogtreecommitdiff
path: root/ext2fs
diff options
context:
space:
mode:
authorJustus Winter <justus@gnupg.org>2017-06-19 21:20:57 +0200
committerJustus Winter <justus@gnupg.org>2017-08-05 18:42:22 +0200
commit835b293d35a209d38047126443d41fa7090daa4c (patch)
tree5bf956895e6030f91cd618fb191b2151f6d25423 /ext2fs
parentdc0b5a43224999223a246870912b0f292b1980e9 (diff)
Use our own variant of 'assert' and 'assert_perror'.
Our variants print stack traces on failures. This will make locating errors much easier.
Diffstat (limited to 'ext2fs')
-rw-r--r--ext2fs/balloc.c10
-rw-r--r--ext2fs/dir.c58
-rw-r--r--ext2fs/ext2fs.h12
-rw-r--r--ext2fs/getblk.c2
-rw-r--r--ext2fs/hyper.c4
-rw-r--r--ext2fs/ialloc.c8
-rw-r--r--ext2fs/inode.c18
-rw-r--r--ext2fs/pager.c46
-rw-r--r--ext2fs/pokel.c6
-rw-r--r--ext2fs/truncate.c2
-rw-r--r--ext2fs/xattr.c4
11 files changed, 85 insertions, 85 deletions
diff --git a/ext2fs/balloc.c b/ext2fs/balloc.c
index 0b9e5a52..8ebd11cd 100644
--- a/ext2fs/balloc.c
+++ b/ext2fs/balloc.c
@@ -166,7 +166,7 @@ ext2_new_block (block_t goal,
ext2_debug ("goal=%u", goal);
repeat:
- assert (bh == NULL);
+ assert_backtrace (bh == NULL);
/*
* First, test whether the goal block is free.
*/
@@ -272,7 +272,7 @@ repeat:
pthread_spin_unlock (&global_lock);
return 0;
}
- assert (bh == NULL);
+ assert_backtrace (bh == NULL);
bh = disk_cache_block_ref (gdp->bg_block_bitmap);
r = memscan (bh, 0, sblock->s_blocks_per_group >> 3);
j = (r - bh) << 3;
@@ -291,7 +291,7 @@ repeat:
}
search_back:
- assert (bh != NULL);
+ assert_backtrace (bh != NULL);
/*
* We have succeeded in finding a free byte in the block
* bitmap. Now search backwards up to 7 bits to find the
@@ -300,7 +300,7 @@ search_back:
for (k = 0; k < 7 && j > 0 && !test_bit (j - 1, bh); k++, j--);
got_block:
- assert (bh != NULL);
+ assert_backtrace (bh != NULL);
ext2_debug ("using block group %d (%d)", i, gdp->bg_free_blocks_count);
@@ -383,7 +383,7 @@ got_block:
sblock_dirty = 1;
sync_out:
- assert (bh == NULL);
+ assert_backtrace (bh == NULL);
pthread_spin_unlock (&global_lock);
alloc_sync (0);
diff --git a/ext2fs/dir.c b/ext2fs/dir.c
index 87a8a04d..bcf90469 100644
--- a/ext2fs/dir.c
+++ b/ext2fs/dir.c
@@ -153,7 +153,7 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type type,
int looped;
if ((type == REMOVE) || (type == RENAME))
- assert (npp);
+ assert_backtrace (npp);
if (npp)
*npp = 0;
@@ -318,7 +318,7 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type type,
goto out;
}
else
- assert (0);
+ assert_backtrace (0);
}
if ((type == CREATE || type == RENAME) && !inum && ds && ds->stat == LOOKING)
@@ -349,7 +349,7 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type type,
if (np)
{
- assert (npp);
+ assert_backtrace (npp);
if (err)
{
if (!spec_dotdot)
@@ -494,7 +494,7 @@ dirscanblock (vm_address_t blockaddr, struct node *dp, int idx,
diskfs_node_disknode (dp)->dirents[i] = -1;
}
/* Make sure the count is correct if there is one now. */
- assert (diskfs_node_disknode (dp)->dirents[idx] == -1
+ assert_backtrace (diskfs_node_disknode (dp)->dirents[idx] == -1
|| diskfs_node_disknode (dp)->dirents[idx] == nentries);
diskfs_node_disknode (dp)->dirents[idx] = nentries;
@@ -537,9 +537,9 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np,
error_t err;
size_t oldsize = 0;
- assert (ds->type == CREATE);
+ assert_backtrace (ds->type == CREATE);
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
dp->dn_set_mtime = 1;
@@ -551,7 +551,7 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np,
{
case TAKE:
/* We are supposed to consume this slot. */
- assert (ds->entry->inode == 0 && ds->entry->rec_len >= needed);
+ assert_backtrace (ds->entry->inode == 0 && ds->entry->rec_len >= needed);
new = ds->entry;
break;
@@ -560,7 +560,7 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np,
/* We are supposed to take the extra space at the end
of this slot. */
oldneeded = EXT2_DIR_REC_LEN (ds->entry->name_len);
- assert (ds->entry->rec_len - oldneeded >= needed);
+ assert_backtrace (ds->entry->rec_len - oldneeded >= needed);
new = (struct ext2_dir_entry_2 *) ((vm_address_t) ds->entry + oldneeded);
@@ -583,7 +583,7 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np,
if (from->inode != 0)
{
- assert (fromoff >= tooff);
+ assert_backtrace (fromoff >= tooff);
memmove (to, from, fromreclen);
to->rec_len = EXT2_DIR_REC_LEN (to->name_len);
@@ -594,7 +594,7 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np,
}
totfreed = (vm_address_t) ds->entry + DIRBLKSIZ - tooff;
- assert (totfreed >= needed);
+ assert_backtrace (totfreed >= needed);
new = (struct ext2_dir_entry_2 *) tooff;
new->rec_len = totfreed;
@@ -602,7 +602,7 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np,
case EXTEND:
/* Extend the file. */
- assert (needed <= DIRBLKSIZ);
+ assert_backtrace (needed <= DIRBLKSIZ);
oldsize = dp->dn_stat.st_size;
if ((off_t)(oldsize + DIRBLKSIZ) != (dp->dn_stat.st_size + DIRBLKSIZ))
@@ -639,7 +639,7 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np,
default:
new = 0;
- assert (! "impossible: bogus status field in dirstat");
+ assert_backtrace (! "impossible: bogus status field in dirstat");
}
/* NEW points to the directory entry being written, and its
@@ -716,16 +716,16 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np,
error_t
diskfs_dirremove_hard (struct node *dp, struct dirstat *ds)
{
- assert (ds->type == REMOVE);
- assert (ds->stat == HERE_TIS);
+ assert_backtrace (ds->type == REMOVE);
+ assert_backtrace (ds->stat == HERE_TIS);
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
if (ds->preventry == 0)
ds->entry->inode = 0;
else
{
- assert ((vm_address_t) ds->entry - (vm_address_t) ds->preventry
+ assert_backtrace ((vm_address_t) ds->entry - (vm_address_t) ds->preventry
== ds->preventry->rec_len);
ds->preventry->rec_len += ds->entry->rec_len;
}
@@ -756,10 +756,10 @@ diskfs_dirremove_hard (struct node *dp, struct dirstat *ds)
error_t
diskfs_dirrewrite_hard (struct node *dp, struct node *np, struct dirstat *ds)
{
- assert (ds->type == RENAME);
- assert (ds->stat == HERE_TIS);
+ assert_backtrace (ds->type == RENAME);
+ assert_backtrace (ds->stat == HERE_TIS);
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
ds->entry->inode = np->cache_id;
dp->dn_set_mtime = 1;
@@ -790,7 +790,7 @@ diskfs_dirempty (struct node *dp, struct protid *cred)
err = vm_map (mach_task_self (), &buf, dp->dn_stat.st_size, 0,
1, memobj, 0, 0, VM_PROT_READ, VM_PROT_READ, 0);
mach_port_deallocate (mach_task_self (), memobj);
- assert (!err);
+ assert_backtrace (!err);
diskfs_set_node_atime (dp);
@@ -823,7 +823,7 @@ diskfs_drop_dirstat (struct node *dp, struct dirstat *ds)
{
if (ds->type != LOOKUP)
{
- assert (ds->mapbuf);
+ assert_backtrace (ds->mapbuf);
munmap ((caddr_t) ds->mapbuf, ds->mapextent);
ds->type = LOOKUP;
}
@@ -843,13 +843,13 @@ count_dirents (struct node *dp, block_t nb, char *buf)
int count = 0;
error_t err;
- assert (diskfs_node_disknode (dp)->dirents);
- assert ((nb + 1) * DIRBLKSIZ <= dp->dn_stat.st_size);
+ assert_backtrace (diskfs_node_disknode (dp)->dirents);
+ assert_backtrace ((nb + 1) * DIRBLKSIZ <= dp->dn_stat.st_size);
err = diskfs_node_rdwr (dp, buf, nb * DIRBLKSIZ, DIRBLKSIZ, 0, 0, &amt);
if (err)
return err;
- assert (amt == DIRBLKSIZ);
+ assert_backtrace (amt == DIRBLKSIZ);
for (offinblk = buf;
offinblk < buf + DIRBLKSIZ;
@@ -860,7 +860,7 @@ count_dirents (struct node *dp, block_t nb, char *buf)
count++;
}
- assert (diskfs_node_disknode (dp)->dirents[nb] == -1
+ assert_backtrace (diskfs_node_disknode (dp)->dirents[nb] == -1
|| diskfs_node_disknode (dp)->dirents[nb] == count);
diskfs_node_disknode (dp)->dirents[nb] = count;
return 0;
@@ -977,7 +977,7 @@ diskfs_get_directs (struct node *dp,
0, 0, &checklen);
if (err)
return err;
- assert (checklen == DIRBLKSIZ);
+ assert_backtrace (checklen == DIRBLKSIZ);
bufvalid = 1;
}
for (i = 0, bufp = buf;
@@ -985,7 +985,7 @@ diskfs_get_directs (struct node *dp,
bufp += ((struct ext2_dir_entry_2 *)bufp)->rec_len, i++)
;
/* Make sure we didn't run off the end. */
- assert (bufp - buf < DIRBLKSIZ);
+ assert_backtrace (bufp - buf < DIRBLKSIZ);
}
i = 0;
@@ -1002,7 +1002,7 @@ diskfs_get_directs (struct node *dp,
0, 0, &checklen);
if (err)
return err;
- assert (checklen == DIRBLKSIZ);
+ assert_backtrace (checklen == DIRBLKSIZ);
bufvalid = 1;
bufp = buf;
}
@@ -1027,7 +1027,7 @@ diskfs_get_directs (struct node *dp,
/* See if this record would run over the end of the return buffer. */
if (bufsiz == 0)
/* It shouldn't ever, as we calculated the worst case size. */
- assert (datap + rec_len <= *data + allocsize);
+ assert_backtrace (datap + rec_len <= *data + allocsize);
else
/* It's ok if it does, just leave off returning this entry. */
if (datap + rec_len > *data + allocsize)
diff --git a/ext2fs/ext2fs.h b/ext2fs/ext2fs.h
index 2104dba3..08cb510a 100644
--- a/ext2fs/ext2fs.h
+++ b/ext2fs/ext2fs.h
@@ -29,7 +29,7 @@
#include <hurd/store.h>
#include <hurd/diskfs.h>
#include <hurd/ihash.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <pthread.h>
#include <sys/mman.h>
@@ -362,7 +362,7 @@ boffs_ptr (off_t offset)
pthread_mutex_lock (&disk_cache_lock);
char *ptr = hurd_ihash_find (disk_cache_bptr, block);
pthread_mutex_unlock (&disk_cache_lock);
- assert (ptr);
+ assert_backtrace (ptr);
ptr += offset % block_size;
ext2_debug ("(%lld) = %p", offset, ptr);
return ptr;
@@ -374,11 +374,11 @@ bptr_offs (void *ptr)
{
vm_offset_t mem_offset = (char *)ptr - (char *)disk_cache;
off_t offset;
- assert (mem_offset < disk_cache_size);
+ assert_backtrace (mem_offset < disk_cache_size);
pthread_mutex_lock (&disk_cache_lock);
offset = (off_t) disk_cache_info[boffs_block (mem_offset)].block
<< log2_block_size;
- assert (offset || mem_offset < block_size);
+ assert_backtrace (offset || mem_offset < block_size);
offset += mem_offset % block_size;
pthread_mutex_unlock (&disk_cache_lock);
ext2_debug ("(%p) = %lld", ptr, offset);
@@ -481,7 +481,7 @@ record_global_poke (void *ptr)
block_t block = boffs_block (bptr_offs (ptr));
void *block_ptr = bptr (block);
ext2_debug ("(%p = %p)", ptr, block_ptr);
- assert (disk_cache_block_is_ref (block));
+ assert_backtrace (disk_cache_block_is_ref (block));
global_block_modified (block);
pokel_add (&global_pokel, block_ptr, block_size);
}
@@ -507,7 +507,7 @@ record_indir_poke (struct node *node, void *ptr)
block_t block = boffs_block (bptr_offs (ptr));
void *block_ptr = bptr (block);
ext2_debug ("(%llu, %p)", node->cache_id, ptr);
- assert (disk_cache_block_is_ref (block));
+ assert_backtrace (disk_cache_block_is_ref (block));
global_block_modified (block);
pokel_add (&diskfs_node_disknode (node)->indir_pokel, block_ptr, block_size);
}
diff --git a/ext2fs/getblk.c b/ext2fs/getblk.c
index 0d0fab12..43daf6c9 100644
--- a/ext2fs/getblk.c
+++ b/ext2fs/getblk.c
@@ -122,7 +122,7 @@ inode_getblk (struct node *node, int nr, int create, int zero,
block_t hint;
#endif
- assert (0 <= nr && nr < EXT2_N_BLOCKS);
+ assert_backtrace (0 <= nr && nr < EXT2_N_BLOCKS);
*result = diskfs_node_disknode (node)->info.i_data[nr];
if (*result)
diff --git a/ext2fs/hyper.c b/ext2fs/hyper.c
index 91d9d12f..6ef2b8c3 100644
--- a/ext2fs/hyper.c
+++ b/ext2fs/hyper.c
@@ -45,7 +45,7 @@ allocate_mod_map (void)
mod_map_size = sblock->s_blocks_count >> 3;
modified_global_blocks = mmap (0, mod_map_size, PROT_READ|PROT_WRITE,
MAP_ANON, 0, 0);
- assert (modified_global_blocks != (void *) -1);
+ assert_backtrace (modified_global_blocks != (void *) -1);
}
else
modified_global_blocks = 0;
@@ -161,7 +161,7 @@ get_hypermetadata (void)
if (zeroblock == 0)
{
zeroblock = (vm_address_t) mmap (0, block_size, PROT_READ, MAP_ANON, 0, 0);
- assert (zeroblock != (vm_address_t) MAP_FAILED);
+ assert_backtrace (zeroblock != (vm_address_t) MAP_FAILED);
}
}
diff --git a/ext2fs/ialloc.c b/ext2fs/ialloc.c
index 71bfb8cb..b14ddeec 100644
--- a/ext2fs/ialloc.c
+++ b/ext2fs/ialloc.c
@@ -58,7 +58,7 @@ diskfs_free_node (struct node *np, mode_t old_mode)
struct ext2_group_desc *gdp;
ino_t inum = np->cache_id;
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
ext2_debug ("freeing inode %u", inum);
@@ -125,7 +125,7 @@ ext2_alloc_inode (ino_t dir_inum, mode_t mode)
pthread_spin_lock (&global_lock);
repeat:
- assert (bh == NULL);
+ assert_backtrace (bh == NULL);
gdp = NULL;
i = 0;
@@ -267,7 +267,7 @@ repeat:
sblock_dirty = 1;
sync_out:
- assert (bh == NULL);
+ assert_backtrace (bh == NULL);
pthread_spin_unlock (&global_lock);
alloc_sync (0);
@@ -298,7 +298,7 @@ diskfs_alloc_node (struct node *dir, mode_t mode, struct node **node)
struct stat *st;
ino_t inum;
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
inum = ext2_alloc_inode (dir->cache_id, mode);
diff --git a/ext2fs/inode.c b/ext2fs/inode.c
index 17dded6a..472c1b43 100644
--- a/ext2fs/inode.c
+++ b/ext2fs/inode.c
@@ -74,7 +74,7 @@ diskfs_node_norefs (struct node *np)
{
if (diskfs_node_disknode (np)->dirents)
free (diskfs_node_disknode (np)->dirents);
- assert (!diskfs_node_disknode (np)->pager);
+ assert_backtrace (!diskfs_node_disknode (np)->pager);
/* Move any pending writes of indirect blocks. */
pokel_inherit (&global_pokel, &diskfs_node_disknode (np)->indir_pokel);
@@ -362,7 +362,7 @@ write_node (struct node *np)
{
struct ext2_inode_info *info = &diskfs_node_disknode (np)->info;
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
ext2_debug ("writing inode %d to disk", np->cache_id);
@@ -395,10 +395,10 @@ write_node (struct node *np)
else
/* No hurd extensions should be turned on. */
{
- assert ((st->st_uid & ~0xFFFF) == 0);
- assert ((st->st_gid & ~0xFFFF) == 0);
- assert ((st->st_mode & ~0xFFFF) == 0);
- assert (np->author_tracks_uid && st->st_author == st->st_uid);
+ assert_backtrace ((st->st_uid & ~0xFFFF) == 0);
+ assert_backtrace ((st->st_gid & ~0xFFFF) == 0);
+ assert_backtrace ((st->st_mode & ~0xFFFF) == 0);
+ assert_backtrace (np->author_tracks_uid && st->st_author == st->st_uid);
}
di->i_links_count = st->st_nlink;
@@ -551,7 +551,7 @@ diskfs_set_translator (struct node *np, const char *name, unsigned namelen,
{
error_t err;
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
if (sblock->s_creator_os != EXT2_OS_HURD)
return EOPNOTSUPP;
@@ -769,7 +769,7 @@ write_symlink (struct node *node, const char *target)
if (len > MAX_INODE_SYMLINK)
return EINVAL;
- assert (node->dn_stat.st_blocks == 0);
+ assert_backtrace (node->dn_stat.st_blocks == 0);
memcpy (diskfs_node_disknode (node)->info.i_data, target, len);
node->dn_stat.st_size = len - 1;
@@ -786,7 +786,7 @@ read_symlink (struct node *node, char *target)
if (node->dn_stat.st_blocks)
return EINVAL;
- assert (node->dn_stat.st_size < MAX_INODE_SYMLINK);
+ assert_backtrace (node->dn_stat.st_size < MAX_INODE_SYMLINK);
memcpy (target, diskfs_node_disknode (node)->info.i_data,
node->dn_stat.st_size);
diff --git a/ext2fs/pager.c b/ext2fs/pager.c
index fd93dcb8..a47c53ce 100644
--- a/ext2fs/pager.c
+++ b/ext2fs/pager.c
@@ -108,7 +108,7 @@ get_page_buf ()
}
else
{
- assert (free_page_bufs == 0);
+ assert_backtrace (free_page_bufs == 0);
buf = mmap (0, vm_page_size * FREE_PAGE_BUFS,
PROT_READ|PROT_WRITE, MAP_ANON, 0, 0);
if (buf == MAP_FAILED)
@@ -409,7 +409,7 @@ file_pager_write_page (struct node *node, vm_offset_t offset, void *buf)
err = find_block (node, offset, &block, &lock);
if (err)
break;
- assert (block);
+ assert_backtrace (block);
pending_blocks_add (&pb, block);
offset += block_size;
left -= block_size;
@@ -469,13 +469,13 @@ disk_pager_write_page (vm_offset_t page, void *buf)
int index = offset >> log2_block_size;
pthread_mutex_lock (&disk_cache_lock);
- assert (disk_cache_info[index].block != DC_NO_BLOCK);
+ assert_backtrace (disk_cache_info[index].block != DC_NO_BLOCK);
offset = ((store_offset_t) disk_cache_info[index].block << log2_block_size)
+ offset % block_size;
#ifdef DEBUG_DISK_CACHE /* Not strictly needed. */
- assert ((disk_cache_info[index].last_read ^ DISK_CACHE_LAST_READ_XOR)
+ assert_backtrace ((disk_cache_info[index].last_read ^ DISK_CACHE_LAST_READ_XOR)
== disk_cache_info[index].last_read_xor);
- assert (disk_cache_info[index].last_read
+ assert_backtrace (disk_cache_info[index].last_read
== disk_cache_info[index].block);
#endif
pthread_mutex_unlock (&disk_cache_lock);
@@ -657,7 +657,7 @@ error_t
diskfs_grow (struct node *node, off_t size, struct protid *cred)
{
diskfs_check_readonly ();
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
if (size > node->allocsize)
{
@@ -794,7 +794,7 @@ inline error_t
pager_report_extent (struct user_pager_info *pager,
vm_address_t *offset, vm_size_t *size)
{
- assert (pager->type == DISK || pager->type == FILE_DATA);
+ assert_backtrace (pager->type == DISK || pager->type == FILE_DATA);
*offset = 0;
@@ -817,7 +817,7 @@ pager_clear_user_data (struct user_pager_info *upi)
pthread_spin_lock (&node_to_page_lock);
pager = diskfs_node_disknode (upi->node)->pager;
- assert (!pager || pager_get_upi (pager) != upi);
+ assert_backtrace (!pager || pager_get_upi (pager) != upi);
pthread_spin_unlock (&node_to_page_lock);
diskfs_nrele_light (upi->node);
@@ -944,11 +944,11 @@ disk_cache_init (void)
+ (round_block ((sizeof *group_desc_image) * groups_count)
>> log2_block_size);
ext2_debug ("%u-%u\n", fixed_first, fixed_last);
- assert (fixed_last - fixed_first + 1 <= (block_t)disk_cache_blocks + 3);
+ assert_backtrace (fixed_last - fixed_first + 1 <= (block_t)disk_cache_blocks + 3);
for (block_t i = fixed_first; i <= fixed_last; i++)
{
disk_cache_block_ref (i);
- assert (disk_cache_info[i-fixed_first].block == i);
+ assert_backtrace (disk_cache_info[i-fixed_first].block == i);
disk_cache_info[i-fixed_first].flags |= DC_FIXED;
}
}
@@ -1020,7 +1020,7 @@ disk_cache_block_ref (block_t block)
void *bptr;
hurd_ihash_locp_t slot;
- assert (block < store->size >> log2_block_size);
+ assert_backtrace (block < store->size >> log2_block_size);
ext2_debug ("(%u)", block);
@@ -1048,7 +1048,7 @@ retry_ref:
}
/* Just increment reference and return. */
- assert (disk_cache_info[index].ref_count + 1
+ assert_backtrace (disk_cache_info[index].ref_count + 1
> disk_cache_info[index].ref_count);
disk_cache_info[index].ref_count++;
@@ -1113,7 +1113,7 @@ retry_ref:
pthread_mutex_lock (&diskfs_disk_pager->interlock);
int page = (bptr - disk_cache) / vm_page_size;
- assert (page >= 0);
+ assert_backtrace (page >= 0);
int is_incore = (page < diskfs_disk_pager->pagemapsize
&& (diskfs_disk_pager->pagemap[page] & PM_INCORE));
pthread_mutex_unlock (&diskfs_disk_pager->interlock);
@@ -1134,9 +1134,9 @@ retry_ref:
if (disk_cache_info[index].block != DC_NO_BLOCK)
/* Remove old association. */
hurd_ihash_remove (disk_cache_bptr, disk_cache_info[index].block);
- assert (! (disk_cache_info[index].flags & DC_DONT_REUSE & ~DC_UNTOUCHED));
+ assert_backtrace (! (disk_cache_info[index].flags & DC_DONT_REUSE & ~DC_UNTOUCHED));
disk_cache_info[index].block = block;
- assert (! disk_cache_info[index].ref_count);
+ assert_backtrace (! disk_cache_info[index].ref_count);
disk_cache_info[index].ref_count = 1;
/* All data structures are set up. */
@@ -1184,11 +1184,11 @@ disk_cache_block_ref_ptr (void *ptr)
pthread_mutex_lock (&disk_cache_lock);
index = bptr_index (ptr);
- assert (disk_cache_info[index].ref_count >= 1);
- assert (disk_cache_info[index].ref_count + 1
+ assert_backtrace (disk_cache_info[index].ref_count >= 1);
+ assert_backtrace (disk_cache_info[index].ref_count + 1
> disk_cache_info[index].ref_count);
disk_cache_info[index].ref_count++;
- assert (! (disk_cache_info[index].flags & DC_UNTOUCHED));
+ assert_backtrace (! (disk_cache_info[index].flags & DC_UNTOUCHED));
ext2_debug ("(%p) (ref_count = %hu, flags = %#hx)",
ptr,
disk_cache_info[index].ref_count,
@@ -1201,7 +1201,7 @@ _disk_cache_block_deref (void *ptr)
{
int index;
- assert (disk_cache <= ptr && ptr <= disk_cache + disk_cache_size);
+ assert_backtrace (disk_cache <= ptr && ptr <= disk_cache + disk_cache_size);
pthread_mutex_lock (&disk_cache_lock);
index = bptr_index (ptr);
@@ -1209,8 +1209,8 @@ _disk_cache_block_deref (void *ptr)
ptr,
disk_cache_info[index].ref_count - 1,
disk_cache_info[index].flags);
- assert (! (disk_cache_info[index].flags & DC_UNTOUCHED));
- assert (disk_cache_info[index].ref_count >= 1);
+ assert_backtrace (! (disk_cache_info[index].flags & DC_UNTOUCHED));
+ assert_backtrace (disk_cache_info[index].ref_count >= 1);
disk_cache_info[index].ref_count--;
if (disk_cache_info[index].ref_count == 0 &&
!(disk_cache_info[index].flags & DC_DONT_REUSE))
@@ -1298,7 +1298,7 @@ diskfs_get_filemap (struct node *node, vm_prot_t prot)
{
mach_port_t right;
- assert (S_ISDIR (node->dn_stat.st_mode)
+ assert_backtrace (S_ISDIR (node->dn_stat.st_mode)
|| S_ISREG (node->dn_stat.st_mode)
|| (S_ISLNK (node->dn_stat.st_mode)));
@@ -1309,7 +1309,7 @@ diskfs_get_filemap (struct node *node, vm_prot_t prot)
if (pager)
{
right = pager_get_port (pager);
- assert (MACH_PORT_VALID (right));
+ assert_backtrace (MACH_PORT_VALID (right));
pager_get_upi (pager)->max_prot |= prot;
}
else
diff --git a/ext2fs/pokel.c b/ext2fs/pokel.c
index 53dc513a..38209428 100644
--- a/ext2fs/pokel.c
+++ b/ext2fs/pokel.c
@@ -102,7 +102,7 @@ pokel_add (struct pokel *pokel, void *loc, vm_size_t length)
if (pl == NULL)
{
pl = malloc (sizeof (struct poke));
- assert (pl);
+ assert_backtrace (pl);
}
else
pokel->free_pokes = pl->next;
@@ -173,8 +173,8 @@ pokel_inherit (struct pokel *pokel, struct pokel *from)
{
struct poke *pokes, *last;
- assert (pokel->pager == from->pager);
- assert (pokel->image == from->image);
+ assert_backtrace (pokel->pager == from->pager);
+ assert_backtrace (pokel->image == from->image);
/* Take all pokes from FROM... */
pthread_spin_lock (&from->lock);
diff --git a/ext2fs/truncate.c b/ext2fs/truncate.c
index 6941f6b7..265f7f2c 100644
--- a/ext2fs/truncate.c
+++ b/ext2fs/truncate.c
@@ -286,7 +286,7 @@ diskfs_truncate (struct node *node, off_t length)
off_t offset;
diskfs_check_readonly ();
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
if (length >= node->dn_stat.st_size)
return 0;
diff --git a/ext2fs/xattr.c b/ext2fs/xattr.c
index 45969195..bfc34028 100644
--- a/ext2fs/xattr.c
+++ b/ext2fs/xattr.c
@@ -445,7 +445,7 @@ ext2_free_xattr_block (struct node *np)
goto cleanup;
}
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
block = disk_cache_block_ref (blkno);
header = EXT2_XATTR_HEADER (block);
@@ -697,7 +697,7 @@ ext2_set_xattr (struct node *np, const char *name, const char *value,
/* Allocate and initialize new block */
block_t goal;
- assert (!diskfs_readonly);
+ assert_backtrace (!diskfs_readonly);
goal = sblock->s_first_data_block + np->dn->info.i_block_group *
EXT2_BLOCKS_PER_GROUP (sblock);