Change to includes. no more ../h
[unix-history] / usr / src / sys / ufs / ffs / ffs_tables.c
index 04d888a..7f739c9 100644 (file)
@@ -1,63 +1,9 @@
-/* Copyright (c) 1981 Regents of the University of California */
+/*     ffs_tables.c    6.2     84/08/29        */
 
 
-/* @(#)ffs_tables.c 1.2 %G% */
-
-#include "../h/param.h"
-
-/*     partab.c        4.2     81/03/08        */
+#include "param.h"
 
 /*
 
 /*
- * Table giving parity for characters and indicating
- * character classes to tty driver.  In particular,
- * if the low 6 bits are 0, then the character needs
- * no special processing on output.
- */
-
-unsigned char partab[] = {
-       0001,0201,0201,0001,0201,0001,0001,0201,
-       0202,0004,0003,0201,0005,0206,0201,0001,
-       0201,0001,0001,0201,0001,0201,0201,0001,
-       0001,0201,0201,0001,0201,0001,0001,0201,
-       0200,0000,0000,0200,0000,0200,0200,0000,
-       0000,0200,0200,0000,0200,0000,0000,0200,
-       0000,0200,0200,0000,0200,0000,0000,0200,
-       0200,0000,0000,0200,0000,0200,0200,0000,
-       0200,0000,0000,0200,0000,0200,0200,0000,
-       0000,0200,0200,0000,0200,0000,0000,0200,
-       0000,0200,0200,0000,0200,0000,0000,0200,
-       0200,0000,0000,0200,0000,0200,0200,0000,
-       0000,0200,0200,0000,0200,0000,0000,0200,
-       0200,0000,0000,0200,0000,0200,0200,0000,
-       0200,0000,0000,0200,0000,0200,0200,0000,
-       0000,0200,0200,0000,0200,0000,0000,0201,
-
-       /*
-        * 7 bit ascii ends with the last character above,
-        * but we contine through all 256 codes for the sake
-        * of the tty output routines which use special vax
-        * instructions which need a 256 character trt table.
-        */
-
-       0007,0007,0007,0007,0007,0007,0007,0007,
-       0007,0007,0007,0007,0007,0007,0007,0007,
-       0007,0007,0007,0007,0007,0007,0007,0007,
-       0007,0007,0007,0007,0007,0007,0007,0007,
-       0007,0007,0007,0007,0007,0007,0007,0007,
-       0007,0007,0007,0007,0007,0007,0007,0007,
-       0007,0007,0007,0007,0007,0007,0007,0007,
-       0007,0007,0007,0007,0007,0007,0007,0007,
-       0007,0007,0007,0007,0007,0007,0007,0007,
-       0007,0007,0007,0007,0007,0007,0007,0007,
-       0007,0007,0007,0007,0007,0007,0007,0007,
-       0007,0007,0007,0007,0007,0007,0007,0007,
-       0007,0007,0007,0007,0007,0007,0007,0007,
-       0007,0007,0007,0007,0007,0007,0007,0007,
-       0007,0007,0007,0007,0007,0007,0007,0007,
-       0007,0007,0007,0007,0007,0007,0007,0007
-};
-
-/*
- * bit patterns for identifying fragments in the block map
+ * Bit patterns for identifying fragments in the block map
  * used as ((map & around) == inside)
  */
 int around[9] = {
  * used as ((map & around) == inside)
  */
 int around[9] = {
@@ -68,54 +14,53 @@ int inside[9] = {
 };
 
 /*
 };
 
 /*
- * given a block map bit pattern, this table tells whether a
+ * Given a block map bit pattern, the frag tables tell whether a
  * particular size fragment is available. 
  * particular size fragment is available. 
+ *
  * used as:
  * used as:
- * if ((1 << (size - 1)) & fragtbl[map]) {
+ * if ((1 << (size - 1)) & fragtbl[fs->fs_frag][map] {
  *     at least one fragment of the indicated size is available
  * }
  *     at least one fragment of the indicated size is available
  * }
- * This table is used by the scanc instruction on the VAX to
+ *
+ * These tables are used by the scanc instruction on the VAX to
  * quickly find an appropriate fragment.
  */
  * quickly find an appropriate fragment.
  */
-#if FRAG == 4
-unsigned char fragtbl[256] = {
-       0x0, 0x1, 0x1, 0x2, 0x1, 0x1, 0x2, 0x4,
-       0x1, 0x1, 0x1, 0x3, 0x2, 0x3, 0x4, 0x8,
-       0x1, 0x1, 0x1, 0x3, 0x1, 0x1, 0x3, 0x5,
-       0x1, 0x1, 0x1, 0x3, 0x3, 0x3, 0x5, 0x9,
-       0x1, 0x1, 0x1, 0x3, 0x1, 0x1, 0x3, 0x5,
-       0x1, 0x1, 0x1, 0x3, 0x3, 0x3, 0x5, 0x9,
-       0x2, 0x3, 0x3, 0x2, 0x3, 0x3, 0x2, 0x6,
-       0x3, 0x3, 0x3, 0x3, 0x2, 0x3, 0x6, 0xa,
-       0x1, 0x1, 0x1, 0x3, 0x1, 0x1, 0x3, 0x5,
-       0x1, 0x1, 0x1, 0x3, 0x3, 0x3, 0x5, 0x9,
-       0x1, 0x1, 0x1, 0x3, 0x1, 0x1, 0x3, 0x5,
-       0x1, 0x1, 0x1, 0x3, 0x3, 0x3, 0x5, 0x9,
-       0x2, 0x3, 0x3, 0x2, 0x3, 0x3, 0x2, 0x6,
-       0x3, 0x3, 0x3, 0x3, 0x2, 0x3, 0x6, 0xa,
-       0x4, 0x5, 0x5, 0x6, 0x5, 0x5, 0x6, 0x4,
-       0x5, 0x5, 0x5, 0x7, 0x6, 0x7, 0x4, 0xc,
-       0x1, 0x1, 0x1, 0x3, 0x1, 0x1, 0x3, 0x5,
-       0x1, 0x1, 0x1, 0x3, 0x3, 0x3, 0x5, 0x9,
-       0x1, 0x1, 0x1, 0x3, 0x1, 0x1, 0x3, 0x5,
-       0x1, 0x1, 0x1, 0x3, 0x3, 0x3, 0x5, 0x9,
-       0x1, 0x1, 0x1, 0x3, 0x1, 0x1, 0x3, 0x5,
-       0x1, 0x1, 0x1, 0x3, 0x3, 0x3, 0x5, 0x9,
-       0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x7,
-       0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x7, 0xb,
-       0x2, 0x3, 0x3, 0x2, 0x3, 0x3, 0x2, 0x6,
-       0x3, 0x3, 0x3, 0x3, 0x2, 0x3, 0x6, 0xa,
-       0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x7,
-       0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x7, 0xb,
-       0x4, 0x5, 0x5, 0x6, 0x5, 0x5, 0x6, 0x4,
-       0x5, 0x5, 0x5, 0x7, 0x6, 0x7, 0x4, 0xc,
-       0x8, 0x9, 0x9, 0xa, 0x9, 0x9, 0xa, 0xc,
-       0x9, 0x9, 0x9, 0xb, 0xa, 0xb, 0xc, 0x8,
+u_char fragtbl124[256] = {
+       0x00, 0x16, 0x16, 0x2a, 0x16, 0x16, 0x26, 0x4e,
+       0x16, 0x16, 0x16, 0x3e, 0x2a, 0x3e, 0x4e, 0x8a,
+       0x16, 0x16, 0x16, 0x3e, 0x16, 0x16, 0x36, 0x5e,
+       0x16, 0x16, 0x16, 0x3e, 0x3e, 0x3e, 0x5e, 0x9e,
+       0x16, 0x16, 0x16, 0x3e, 0x16, 0x16, 0x36, 0x5e,
+       0x16, 0x16, 0x16, 0x3e, 0x3e, 0x3e, 0x5e, 0x9e,
+       0x2a, 0x3e, 0x3e, 0x2a, 0x3e, 0x3e, 0x2e, 0x6e,
+       0x3e, 0x3e, 0x3e, 0x3e, 0x2a, 0x3e, 0x6e, 0xaa,
+       0x16, 0x16, 0x16, 0x3e, 0x16, 0x16, 0x36, 0x5e,
+       0x16, 0x16, 0x16, 0x3e, 0x3e, 0x3e, 0x5e, 0x9e,
+       0x16, 0x16, 0x16, 0x3e, 0x16, 0x16, 0x36, 0x5e,
+       0x16, 0x16, 0x16, 0x3e, 0x3e, 0x3e, 0x5e, 0x9e,
+       0x26, 0x36, 0x36, 0x2e, 0x36, 0x36, 0x26, 0x6e,
+       0x36, 0x36, 0x36, 0x3e, 0x2e, 0x3e, 0x6e, 0xae,
+       0x4e, 0x5e, 0x5e, 0x6e, 0x5e, 0x5e, 0x6e, 0x4e,
+       0x5e, 0x5e, 0x5e, 0x7e, 0x6e, 0x7e, 0x4e, 0xce,
+       0x16, 0x16, 0x16, 0x3e, 0x16, 0x16, 0x36, 0x5e,
+       0x16, 0x16, 0x16, 0x3e, 0x3e, 0x3e, 0x5e, 0x9e,
+       0x16, 0x16, 0x16, 0x3e, 0x16, 0x16, 0x36, 0x5e,
+       0x16, 0x16, 0x16, 0x3e, 0x3e, 0x3e, 0x5e, 0x9e,
+       0x16, 0x16, 0x16, 0x3e, 0x16, 0x16, 0x36, 0x5e,
+       0x16, 0x16, 0x16, 0x3e, 0x3e, 0x3e, 0x5e, 0x9e,
+       0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x7e,
+       0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x7e, 0xbe,
+       0x2a, 0x3e, 0x3e, 0x2a, 0x3e, 0x3e, 0x2e, 0x6e,
+       0x3e, 0x3e, 0x3e, 0x3e, 0x2a, 0x3e, 0x6e, 0xaa,
+       0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x7e,
+       0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x7e, 0xbe,
+       0x4e, 0x5e, 0x5e, 0x6e, 0x5e, 0x5e, 0x6e, 0x4e,
+       0x5e, 0x5e, 0x5e, 0x7e, 0x6e, 0x7e, 0x4e, 0xce,
+       0x8a, 0x9e, 0x9e, 0xaa, 0x9e, 0x9e, 0xae, 0xce,
+       0x9e, 0x9e, 0x9e, 0xbe, 0xaa, 0xbe, 0xce, 0x8a,
 };
 };
-#endif
 
 
-#if FRAG == 8
-unsigned char fragtbl[256] = {
+u_char fragtbl8[256] = {
        0x00, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, 0x04,
        0x01, 0x01, 0x01, 0x03, 0x02, 0x03, 0x04, 0x08,
        0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
        0x00, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, 0x04,
        0x01, 0x01, 0x01, 0x03, 0x02, 0x03, 0x04, 0x08,
        0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x05,
@@ -149,4 +94,10 @@ unsigned char fragtbl[256] = {
        0x08, 0x09, 0x09, 0x0a, 0x09, 0x09, 0x0a, 0x0c,
        0x10, 0x11, 0x11, 0x12, 0x20, 0x21, 0x40, 0x80,
 };
        0x08, 0x09, 0x09, 0x0a, 0x09, 0x09, 0x0a, 0x0c,
        0x10, 0x11, 0x11, 0x12, 0x20, 0x21, 0x40, 0x80,
 };
-#endif
+
+/*
+ * The actual fragtbl array.
+ */
+u_char *fragtbl[MAXFRAG + 1] = {
+       0, fragtbl124, fragtbl124, 0, fragtbl124, 0, 0, 0, fragtbl8,
+};