/* block.c This file implements the low-level routines to read and decompress datablocks and metadata blocks. Read the metadata block length, this is stored in the first two bytes of the metadata block.  */
static struct buffer_head* get_block_length(struct super_block *sb, u64 *cur_index, int *offset, int *length)
/* block.c This file implements the low-level routines to read and decompress datablocks and metadata blocks. Read the metadata block length, this is stored in the first two bytes of the metadata block.  */
static struct buffer_head* get_block_length(struct super_block *sb, u64 *cur_index, int *offset, int *length)
{
	struct squashfs_sb_info *msblk = sb->s_fs_info;
	struct buffer_head *bh;
	bh = sb_bread(sb, *cur_index);
	if (bh == NULL)
		return NULL;
	if (msblk->devblksize - *offset == 1) {
		*length = (unsigned char) bh->b_data[*offset];
		put_bh(bh);
		bh = sb_bread(sb, ++(*cur_index));
		if (bh == NULL)
			return NULL;
		*length |= (unsigned char) bh->b_data[0] << 8;
		*offset = 1;
	} else {
		*length = (unsigned char) bh->b_data[*offset] |
			(unsigned char) bh->b_data[*offset + 1] << 8;
		*offset += 2;
	}
	return bh;
}