* Update checksum to match expected buffer contents with
* appropriate block number.
*/
- tail->ob_checksum = ext2fs_do_orphan_file_block_csum(fs,
- pd->ino, pd->generation, blk, pd->buf);
+ tail->ob_checksum =
+ ext2fs_cpu_to_le32(ext2fs_do_orphan_file_block_csum(fs,
+ pd->ino, pd->generation, blk, pd->buf));
}
if (!pd->clear) {
pd->errcode = io_channel_read_blk64(fs->io, blk, 1,
crc = ext2fs_crc32c_le(crc, (unsigned char *)buf,
inodes_per_ob * sizeof(__u32));
- return ext2fs_cpu_to_le32(crc);
+ return crc;
}
struct mkorphan_info {
struct ext4_orphan_block_tail *tail;
tail = ext2fs_orphan_block_tail(fs, oi->buf);
- tail->ob_checksum = ext2fs_do_orphan_file_block_csum(fs,
- oi->ino, oi->generation, new_blk, oi->buf);
+ tail->ob_checksum =
+ ext2fs_cpu_to_le32(ext2fs_do_orphan_file_block_csum(fs,
+ oi->ino, oi->generation, new_blk, oi->buf));
}
err = io_channel_write_blk64(fs->io, new_blk, 1, oi->buf);
} else /* zerobuf is used to initialize new indirect blocks... */
blk64_t blk, char *buf)
{
struct ext4_orphan_block_tail *tail;
+ __u32 crc;
if (!ext2fs_has_feature_metadata_csum(fs->super))
return 0;
tail = ext2fs_orphan_block_tail(fs, buf);
- return ext2fs_orphan_file_block_csum(fs, ino, blk, buf,
- &tail->ob_checksum);
+ return ext2fs_orphan_file_block_csum(fs, ino, blk, buf, &crc);
+ tail->ob_checksum = ext2fs_cpu_to_le32(crc);
}
int ext2fs_orphan_file_block_csum_verify(ext2_filsys fs, ext2_ino_t ino,