X-Git-Url: https://git.wh0rd.org/?p=dump.git;a=blobdiff_plain;f=dump%2Ftraverse.c;h=41047999c7d921c07237655e50db09f3840136b3;hp=fb868dba4050aec08cc81ae8a961cc5eb6045f19;hb=7d422735f62ce24de9bc9c9d5033745660a85756;hpb=4acaf865a54528c32e3f2650007462c97f86a933 diff --git a/dump/traverse.c b/dump/traverse.c index fb868db..4104799 100644 --- a/dump/traverse.c +++ b/dump/traverse.c @@ -37,7 +37,7 @@ #ifndef lint static const char rcsid[] = - "$Id: traverse.c,v 1.57 2004/03/01 15:38:13 stelian Exp $"; + "$Id: traverse.c,v 1.61 2004/07/01 09:14:49 stelian Exp $"; #endif /* not lint */ #include @@ -208,6 +208,14 @@ blockest(struct dinode const *dp) if (blkest > sizeest) blkest = sizeest; #ifdef __linux__ + if ((dp->di_mode & IFMT) == IFDIR) { + /* + * for directories, assume only half of space is filled + * with entries. + */ + blkest = blkest / 2; + sizeest = sizeest / 2; + } if (i_size > (u_quad_t)fs->blocksize * NDADDR) { /* calculate the number of indirect blocks on the dump tape */ blkest += @@ -763,7 +771,7 @@ dumponeblock(UNUSED(ext2_filsys fs), blk_t *blocknr, e2_blkcnt_t blockcnt, UNUSED(blk_t ref_block), UNUSED(int ref_offset), void * private) { struct block_context *p; - int i; + e2_blkcnt_t i; if (blockcnt < NDADDR) return 0; @@ -1190,9 +1198,9 @@ dmpindir(dump_ino_t ino, daddr_t blk, int ind_level, fsizeT *size) * Collect up the data into tape record sized buffers and output them. */ void -blksout(daddr_t *blkp, int frags, dump_ino_t ino) +blksout(blk_t *blkp, int frags, dump_ino_t ino) { - daddr_t *bp; + blk_t *bp; int i, j, count, blks, tbperdb; blks = howmany(frags * sblock->fs_fsize, TP_BSIZE); @@ -1317,14 +1325,14 @@ getino(dump_ino_t inum) int breaderrors = 0; void -bread(daddr_t blkno, char *buf, int size) +bread(ext2_loff_t blkno, char *buf, int size) { int cnt, i; loop: #ifdef __linux__ - if (ext2fs_llseek(diskfd, (((ext2_loff_t)blkno) << dev_bshift), 0) != - (((ext2_loff_t)blkno) << dev_bshift)) + if (ext2fs_llseek(diskfd, (blkno << dev_bshift), 0) != + (blkno << dev_bshift)) #else if (lseek(diskfd, ((off_t)blkno << dev_bshift), 0) != ((off_t)blkno << dev_bshift)) @@ -1370,8 +1378,8 @@ loop: memset(buf, 0, size); for (i = 0; i < size; i += dev_bsize, buf += dev_bsize, blkno++) { #ifdef __linux__ - if (ext2fs_llseek(diskfd, (((ext2_loff_t)blkno) << dev_bshift), 0) != - (((ext2_loff_t)blkno) << dev_bshift)) + if (ext2fs_llseek(diskfd, (blkno << dev_bshift), 0) != + (blkno << dev_bshift)) #else if (lseek(diskfd, ((off_t)blkno << dev_bshift), 0) != ((off_t)blkno << dev_bshift))