From: Marshall Kirk McKusick Date: Wed, 2 Feb 1994 15:46:15 +0000 (-0800) Subject: CGSIZE macro moves in from mkfs.c (for use by fsck in converting filesystems) X-Git-Tag: BSD-4_4_Lite1-Snapshot-Development~592 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/21f4a0120a439f55882ac2bd16572652e5a3a7bc CGSIZE macro moves in from mkfs.c (for use by fsck in converting filesystems) SCCS-vsn: sys/ufs/ffs/fs.h 8.4 --- diff --git a/usr/src/sys/ufs/ffs/fs.h b/usr/src/sys/ufs/ffs/fs.h index 974632a6a9..0c85d2a0bf 100644 --- a/usr/src/sys/ufs/ffs/fs.h +++ b/usr/src/sys/ufs/ffs/fs.h @@ -4,7 +4,7 @@ * * %sccs.include.redist.c% * - * @(#)fs.h 8.3 (Berkeley) %G% + * @(#)fs.h 8.4 (Berkeley) %G% */ /* @@ -231,6 +231,21 @@ struct fs { ? ((fs)->fs_space) \ : ((u_char *)((char *)(fs) + (fs)->fs_rotbloff))) +/* + * The size of a cylinder group is calculated by CGSIZE. The maximum size + * is limited by the fact that cylinder groups are at most one block. + * Its size is derived from the size of the maps maintained in the + * cylinder group and the (struct cg) size. + */ +#define CGSIZE(fs) \ + /* base cg */ (sizeof(struct cg) + sizeof(long) + \ + /* blktot size */ (fs)->fs_cpg * sizeof(long) + \ + /* blks size */ (fs)->fs_cpg * (fs)->fs_nrpos * sizeof(short) + \ + /* inode map */ howmany((fs)->fs_ipg, NBBY) + \ + /* block map */ howmany((fs)->fs_cpg * (fs)->fs_spc / NSPF(fs), NBBY) +\ + /* cluster sum */ (fs)->fs_contigsumsize * sizeof(long) + \ + /* cluster map */ howmany((fs)->fs_cpg * (fs)->fs_spc / NSPB(fs), NBBY)) + /* * Convert cylinder group to base address of its global summary info. *