/* /usr/src/mach/utils/rrdl.c Purpose: Read a 512 byte disk label Invocation: ./rddl < /dev/rsd0c Author: unknown. Hacked by: jhs@ 10-92 Tested On: pc532 scsi */ #include #include #include #include "../dl.h" unsigned char sector[512]; char *names[] = { "Root", "Alternate Root", "Whole Disc", "Usr", "Usr1", "Disc Label", "First Kernel", "Second Kernel" } ; main() { struct disklabel *dl; int minor; char **name_p ; if (read (0, sector, 512) != 512) { fprintf (stderr,"couldn't read all bytes\n"); exit (1); } dl = (struct disklabel *)§or [LABELOFFSET]; if (dl->d_magic !=DISKMAGIC) { fprintf(stderr,"bad magic 0x%x should be 0x%x\n", dl->d_magic, DISKMAGIC ); exit (1); } printf("d_type:\t%d\t( DTYPE_SCSI is %d )\n", dl->d_type, DTYPE_SCSI); printf("d_typename:\t%s\n", dl->d_typename); printf("d_secsize:\t%d\n", dl->d_secsize ); printf("d_npartitions:\t%d\n", dl->d_npartitions ); printf("d_nsectors:\t%d\n", dl->d_nsectors ); printf("d_ntracks:\t%d\n", dl->d_ntracks ); printf("d_ncylinders:\t%d\n", dl->d_ncylinders ); printf("d_secpercyl:\t%d\n", dl->d_secpercyl ); printf("d_secperunit:\t%d\n", dl->d_secperunit ); printf("d_sparespertrack:\t%d\n", dl->d_sparespertrack ); printf("d_sparespercyl:\t%d\n", dl->d_sparespercyl ); printf("d_acylinders:\t%d\n", dl->d_acylinders ); printf("d_rpm:\t\t%d\n", dl->d_rpm ); printf("d_interleave:\t%d\n", dl->d_interleave ); printf("d_trackskew:\t%d\n", dl->d_trackskew ); printf("d_cylskew:\t%d\n", dl->d_cylskew ); printf("d_headswitch:\t%d\n", dl->d_headswitch ); printf("d_trkseek:\t%d\n", dl->d_trkseek ); printf("d_npartitions:\t%d\n", dl->d_npartitions); for (minor = 0, name_p = names ; minor < dl->d_npartitions; minor++) printf("[%d=%c]: size %7d, offset %7d, %s\n", minor, 'a'+minor, dl->d_partitions[minor].p_size, dl->d_partitions[minor].p_offset, *name_p++); }