|
|
1.1 ! root 1: /* ! 2: * @(#)chklabel.c 1.1 86/02/03 Copyright (c) 1985 by Sun Microsystems, Inc. ! 3: */ ! 4: ! 5: #include <sys/types.h> ! 6: #include <sun/dklabel.h> ! 7: ! 8: char msg_nolabel[] = "No label found - attempting boot anyway.\n"; ! 9: ! 10: /* ! 11: * Checks a disk label, returns 0 for success, 1 for failure. ! 12: * If the magic number is right but the checksum is wrong, prints ! 13: * "Corrupt label" error message, otherwise is silent. ! 14: */ ! 15: chklabel(label) ! 16: register struct dk_label *label; ! 17: { ! 18: register int count, sum = 0; ! 19: register short *sp; ! 20: ! 21: if (label->dkl_magic != DKL_MAGIC) ! 22: return (1); ! 23: count = sizeof (struct dk_label) / sizeof (short); ! 24: sp = (short *)label; ! 25: while (count--) ! 26: sum ^= *sp++; ! 27: if (sum != 0) { ! 28: printf("Corrupt label\n"); ! 29: return (1); ! 30: } ! 31: return (0); ! 32: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.