On Tue, Mar 18, 2008 at 01:22:54AM +0800, Andreas Dilger wrote: > On Mar 17, 2008 09:28 -0400, Theodore Ts'o wrote: > > +STATIC __u16 ext2fs_group_desc_csum(ext2_filsys fs, dgrp_t group) .... > > + if (fs->super->s_feature_ro_compat & EXT4_FEATURE_RO_COMPAT_GDT_CSUM) { > > + int offset = offsetof(struct ext2_group_desc, bg_checksum); > > + ... > > + offset += sizeof(desc->bg_checksum); /* skip checksum */ > > + assert(offset == sizeof(*desc)); > > Note that this assertion needs to be removed when the group descriptor > becomes larger, unless ext2_group_desc never changes in the future.. Yeah, I looked at this, and was half tempted to remove it. Indeed ext2_group_desc will never change in the future. Too many things would break if we change it. That's why there is an ext4_group_desc which looks exactly like ext2_group_desc for the first 32 bytes, and adds the high 32-bits for the various fields in the second 32-bytes. But if ext2_group_desc is never going to change, then there's no real good reason to use a run-time check here. Better to turn it into a compile time check, using #error. The tricky part is doing it in a way which is ANSI-C compliant (or maybe we just wrap it in a #ifdef GCC and only do the sanity check if you are compiling with GCC). - Ted -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html