* Copyright (C) 2006, 2007 by Andreas Dilger <adilger@clusterfs.com>
*
* %Begin-Header%
- * This file may be redistributed under the terms of the GNU Public
- * License.
+ * This file may be redistributed under the terms of the GNU Library
+ * General Public License, version 2.
* %End-Header%
*/
+#include "config.h"
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#define STATIC static
#endif
-STATIC __u16 ext2fs_group_desc_csum(ext2_filsys fs, dgrp_t group)
+__u16 ext2fs_group_desc_csum(ext2_filsys fs, dgrp_t group)
{
__u16 crc = 0;
struct ext2_group_desc *desc;
desc = ext2fs_group_desc(fs, fs->group_desc, group);
if (fs->super->s_feature_ro_compat & EXT4_FEATURE_RO_COMPAT_GDT_CSUM) {
- int offset = offsetof(struct ext2_group_desc, bg_checksum);
+ size_t offset = offsetof(struct ext2_group_desc, bg_checksum);
#ifdef WORDS_BIGENDIAN
struct ext4_group_desc swabdesc;
return 0;
for (i = 0; i < fs->group_desc_count; i++) {
- unsigned int old_csum = ext2fs_bg_checksum(fs, i);
- int old_unused = ext2fs_bg_itable_unused(fs, i);
- unsigned int old_flags = ext2fs_bg_flags(fs, i);
- int old_free_inodes_count = ext2fs_bg_free_inodes_count(fs, i);
+ __u32 old_csum = ext2fs_bg_checksum(fs, i);
+ __u32 old_unused = ext2fs_bg_itable_unused(fs, i);
+ __u32 old_flags = ext2fs_bg_flags(fs, i);
+ __u32 old_free_inodes_count = ext2fs_bg_free_inodes_count(fs, i);
if (old_free_inodes_count == sb->s_inodes_per_group) {
ext2fs_bg_flags_set(fs, i, EXT2_BG_INODE_UNINIT);
}
#ifdef DEBUG
+#include "e2p/e2p.h"
+
void print_csum(const char *msg, ext2_filsys fs, dgrp_t group)
{
__u16 crc1, crc2, crc3;
if (offset < size)
crc3 = ext2fs_crc16(crc3, (char *)desc + offset, size - offset);
- printf("%s: UUID %016Lx%016Lx(%04x), grp %u(%04x): %04x=%04x\n",
- msg, *(long long *)&sb->s_uuid, *(long long *)&sb->s_uuid[8],
- crc1, group, crc2, crc3, ext2fs_group_desc_csum(fs, group));
+ printf("%s: UUID %s(%04x), grp %u(%04x): %04x=%04x\n",
+ msg, e2p_uuid2str(sb->s_uuid), crc1, group, crc2, crc3,
+ ext2fs_group_desc_csum(fs, group));
}
unsigned char sb_uuid[16] = { 0x4f, 0x25, 0xe8, 0xcf, 0xe7, 0x97, 0x48, 0x23,