summaryrefslogtreecommitdiff
path: root/sys/kern/subr_diskslice.c
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>2000-10-31 07:05:40 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>2000-10-31 07:05:40 +0000
commite7c2b5a51d99ce31aa0e682f216a207e7aaebf5d (patch)
treedc4e9c398777c2a97d5409fb7734949f88a746d5 /sys/kern/subr_diskslice.c
parentcda33ccbd529f4a4fa5bdb0acb454e0b23db6f51 (diff)
Notes
Diffstat (limited to 'sys/kern/subr_diskslice.c')
-rw-r--r--sys/kern/subr_diskslice.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/sys/kern/subr_diskslice.c b/sys/kern/subr_diskslice.c
index c4ecdc54e271..869694111a1a 100644
--- a/sys/kern/subr_diskslice.c
+++ b/sys/kern/subr_diskslice.c
@@ -342,6 +342,7 @@ dsioctl(dev, cmd, data, flags, sspp)
int slice;
struct diskslice *sp;
struct diskslices *ssp;
+ struct partition *pp;
slice = dkslice(dev);
ssp = *sspp;
@@ -349,6 +350,39 @@ dsioctl(dev, cmd, data, flags, sspp)
lp = sp->ds_label;
switch (cmd) {
+ case DIOCGDVIRGIN:
+ lp = (struct disklabel *)data;
+ if (ssp->dss_slices[WHOLE_DISK_SLICE].ds_label) {
+ *lp = *ssp->dss_slices[WHOLE_DISK_SLICE].ds_label;
+ } else {
+ bzero(lp, sizeof(struct disklabel));
+ }
+
+ lp->d_magic = DISKMAGIC;
+ lp->d_magic2 = DISKMAGIC;
+ pp = &lp->d_partitions[RAW_PART];
+ pp->p_offset = 0;
+ pp->p_size = sp->ds_size;
+
+ lp->d_npartitions = MAXPARTITIONS;
+ if (lp->d_interleave == 0)
+ lp->d_interleave = 1;
+ if (lp->d_rpm == 0)
+ lp->d_rpm = 3600;
+ if (lp->d_nsectors == 0)
+ lp->d_nsectors = 32;
+ if (lp->d_ntracks == 0)
+ lp->d_ntracks = 64;
+
+ lp->d_bbsize = BBSIZE;
+ lp->d_sbsize = SBSIZE;
+ lp->d_secpercyl = lp->d_nsectors * lp->d_ntracks;
+ lp->d_ncylinders = sp->ds_size / lp->d_secpercyl;
+ lp->d_secperunit = sp->ds_size;
+ lp->d_checksum = 0;
+ lp->d_checksum = dkcksum(lp);
+ return (0);
+
case DIOCGDINFO:
if (lp == NULL)
return (EINVAL);