kernels/linux-2.4.0/scripts/cramfs/mkcramfs.c
/*
 * One 4-byte pointer per block and then the actual blocked
 * output. The first block does not need an offset pointer,
 * as it will start immediately after the pointer block;
 * so the i'th pointer points to the end of the i'th block
 * (i.e. the start of the (i+1)'th block or past EOF).
 *
 * Note that size > 0, as a zero-sized file wouldn't ever
 * have gotten here in the first place.
 */
One 4-byte pointer per block and then the actual blocked
output. The first block does not need an offset pointer,
as it will start immediately after the pointer block;
so the i'th pointer points to the end of the i'th block
'th block or past EOF).

Note that size > 0, as a zero-sized file wouldn't ever
have gotten here in the first place.
One 4 - byte pointer per block and then the actual blocked output . The first block does not need an offset pointer as it will start immediately after the pointer block ; so the i ' th pointer points to the end of the i ' th block ' th block or past EOF ) . Note that size > 0 as a zero - sized file wouldn ' t ever have gotten here in the first place .
static unsigned int do_compress(char *base, unsigned int offset, char const *name, char *uncompressed, unsigned int size)
{
	unsigned long original_size = size;
	unsigned long original_offset = offset;
	unsigned long new_size;
	unsigned long blocks = (size - 1) / blksize + 1;
	unsigned long curr = offset + 4 * blocks;
	int change;
	do {
		unsigned long len = 2 * blksize;
		unsigned int input = size;
		if (input > blksize)
			input = blksize;
		size -= input;
		if (!is_zero (uncompressed, input)) {
			compress(base + curr, &len, uncompressed, input);
			curr += len;
		}
		uncompressed += input;
		if (len > blksize*2) {
			printf("AIEEE: block \"compressed\" to > 2*blocklength (%ld)\n", len);
			exit(1);
		}
		*(u32 *) (base + offset) = curr;
		offset += 4;
	} while (size);
	curr = (curr + 3) & ~3;
	new_size = curr - original_offset;
	change = new_size - original_size;
	printf("%6.2f%% (%+d bytes)\t%s\n",
	       (change * 100) / (double) original_size, change, name);
	return curr;
}
static unsigned int do_compress ( char * base , unsigned int offset , char const * name , char * uncompressed , unsigned int size ) { unsigned long original_size = size ; unsigned long original_offset = offset ; unsigned long new_size ; unsigned long blocks = ( size - 1 ) / blksize + 1 ; unsigned long curr = offset + 4 * blocks ; int change ; do { unsigned long len = 2 * blksize ; unsigned int input = size ; if ( input > blksize ) input = blksize ; size -= input ; if ( ! is_zero ( uncompressed , input ) ) { compress ( base + curr , & len , uncompressed , input ) ; curr += len ; } uncompressed += input ; if ( len > blksize * 2 ) { printf ( " \" \" \n " , len ) ; exit ( 1 ) ; } * ( u32 * ) ( base + offset ) = curr ; offset += 4 ; } while ( size ) ; curr = ( curr + 3 ) & ~ 3 ; new_size = curr - original_offset ; change = new_size - original_size ; printf ( " \t \n " , ( change * 100 ) / ( double ) original_size , change , name ) ; return curr ; }
One 4-byte pointer per block and then the actual blocked
 output.
One 4 - byte pointer per block and then the actual blocked output .
/* (I don't think this can happen with zlib.) */ /* TODO: Arguably, original_size in these 2 lines should be
	   st_blocks * 512.  But if you say that then perhaps
	   administrative data should also be included in both. */