summaryrefslogtreecommitdiff
path: root/fstests
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1994-09-09 16:06:52 +0000
committerMichael I. Bushnell <mib@gnu.org>1994-09-09 16:06:52 +0000
commit33f5bcf57515a8481fab63f052e7459f30454188 (patch)
treeed0eeb708737521728ef55eec49c1d77e357e235 /fstests
parente57e05ddc091fe85533e39874245874eb23e19fc (diff)
entered into RCS
Diffstat (limited to 'fstests')
-rw-r--r--fstests/opendisk.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/fstests/opendisk.c b/fstests/opendisk.c
index cfe4d8ae..75170b7b 100644
--- a/fstests/opendisk.c
+++ b/fstests/opendisk.c
@@ -24,12 +24,22 @@
#include <hurd.h>
#include <stdio.h>
+/* Boneheaded CMU people decided to gratuitously screw us. */
+#include "/gd/gnu/mach/sys/ioctl.h"
+
+#define DKTYPENAMES
+#include <device/disk_status.h>
+
+int
main (int argc, char **argv)
{
mach_port_t hostpriv, devicemaster;
mach_port_t device;
int sizes[DEV_GET_SIZE_COUNT];
int sizescnt = DEV_GET_SIZE_COUNT;
+ struct disklabel label;
+ int labelcnt = sizeof label / sizeof (int);
+ int i;
errno = get_privileged_ports (&hostpriv, &devicemaster);
@@ -57,6 +67,57 @@ main (int argc, char **argv)
printf ("Record size: %d\nDevice size: %d\n",
sizes[DEV_GET_SIZE_RECORD_SIZE], sizes[DEV_GET_SIZE_DEVICE_SIZE]);
+
+
+ errno = device_get_status (device, DIOCGDINFO, &label, &labelcnt);
+
+ if (errno)
+ {
+ perror ("reading disk label");
+ exit (1);
+ }
+
+ printf ("Magic: %#x", label.d_magic);
+ if (label.d_magic != DISKMAGIC)
+ printf ("Should be %#x\n", DISKMAGIC);
+ else
+ printf ("\n");
+
+ printf ("Type %s\tSubtype %d\nTypename %s\n",
+ dktypenames[label.d_type], label.d_subtype, label.d_typename);
+
+ printf ("Pack name %s\n", label.d_packname);
+
+ printf ("Secsize %d\tnsect %d\tntrack %d\tncyl %d\tspc %d\tspu %d\n",
+ label.d_secsize, label.d_nsectors, label.d_ntracks,
+ label.d_ncylinders, label.d_secpercyl, label.d_secperunit);
+
+ printf ("Spares per track %d\tSpares per cyl %d\tAlternates %d\n",
+ label.d_sparespertrack, label.d_sparespercyl,
+ label.d_acylinders);
+
+ printf ("RPM %d\tileave %d\ttskew %d\tcskew %d\theadsw %d\ttrkseek %d\n",
+ label.d_rpm, label.d_interleave, label.d_trackskew,
+ label.d_cylskew, label.d_headswitch, label.d_trkseek);
+
+ printf ("flags: %d\n", label.d_flags);
+
+ printf ("npartitions: %d\n", label.d_npartitions);
+
+ printf ("bbsize %d\tsbsize %d\n", label.d_bbsize, label.d_sbsize);
+
+ printf ("part\tsize\toff\tfsize\tfstype\tfrag\tcpg\n");
+ for (i = 0; i < label.d_npartitions; i++)
+ {
+ printf ("%c:\t%d\t%d\t%d\t%s\t%d\t%d\n",
+ 'a' + i,
+ label.d_partitions[i].p_size,
+ label.d_partitions[i].p_offset,
+ label.d_partitions[i].p_fsize,
+ fstypenames[label.d_partitions[i].p_fstype],
+ label.d_partitions[i].p_frag,
+ label.d_partitions[i].p_cpg);
+ }
exit (0);
}