FreeBSD/sbin/growfs/growfs.c
/*
 * Here we check if all frags of a block are free. For more details again
 * please see the source of newfs(8), as this function is taken over almost
 * unchanged.
 */
Here we check if all frags of a block are free. For more details again
please see the source of newfs(8), as this function is taken over almost
unchanged.
Here we check if all frags of a block are free . For more details again please see the source of newfs ( 8 ) as this function is taken over almost unchanged .
static int
isblock(struct fs *fs, unsigned char *cp, int h)
{
	DBG_FUNC("isblock")
	unsigned char mask;
	DBG_ENTER;
	switch (fs->fs_frag) {
	case 8:
		DBG_LEAVE;
		return (cp[h] == 0xff);
	case 4:
		mask = 0x0f << ((h & 0x1) << 2);
		DBG_LEAVE;
		return ((cp[h >> 1] & mask) == mask);
	case 2:
		mask = 0x03 << ((h & 0x3) << 1);
		DBG_LEAVE;
		return ((cp[h >> 2] & mask) == mask);
	case 1:
		mask = 0x01 << (h & 0x7);
		DBG_LEAVE;
		return ((cp[h >> 3] & mask) == mask);
	default:
		fprintf(stderr, "isblock bad fs_frag %d\n", fs->fs_frag);
		DBG_LEAVE;
		return (0);
	}
}
static int isblock ( struct fs * fs , unsigned char * cp , int h ) { DBG_FUNC ( " " ) unsigned char mask ; DBG_ENTER ; switch ( fs -> fs_frag ) { case 8 : DBG_LEAVE ; return ( cp [ h ] == 0xff ) ; case 4 : mask = 0x0f << ( ( h & 0x1 ) << 2 ) ; DBG_LEAVE ; return ( ( cp [ h >> 1 ] & mask ) == mask ) ; case 2 : mask = 0x03 << ( ( h & 0x3 ) << 1 ) ; DBG_LEAVE ; return ( ( cp [ h >> 2 ] & mask ) == mask ) ; case 1 : mask = 0x01 << ( h & 0x7 ) ; DBG_LEAVE ; return ( ( cp [ h >> 3 ] & mask ) == mask ) ; default : fprintf ( stderr , " \n " , fs -> fs_frag ) ; DBG_LEAVE ; return ( 0 ) ; } }
Here we check if all frags of a block are free.
Here we check if all frags of a block are free .