CGSIZE macro moves in from mkfs.c (for use by fsck in converting filesystems)
authorMarshall Kirk McKusick <mkm@ucbvax.Berkeley.EDU>
Wed, 2 Feb 1994 15:46:15 +0000 (07:46 -0800)
committerMarshall Kirk McKusick <mkm@ucbvax.Berkeley.EDU>
Wed, 2 Feb 1994 15:46:15 +0000 (07:46 -0800)
SCCS-vsn: sys/ufs/ffs/fs.h 8.4

usr/src/sys/ufs/ffs/fs.h

index 974632a..0c85d2a 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %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)))
 
     ? ((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.
  *
 /*
  * Convert cylinder group to base address of its global summary info.
  *