Retire the bogus ioctl DIOCGPART in toto.

Once again we can notice that badly thought out hacks ferment and infect
far more code than initially expected.

Sponsored by:	DARPA and NAI Labs.
This commit is contained in:
Poul-Henning Kamp 2002-04-02 11:52:13 +00:00
parent 4e6e5105b0
commit 408ab1b875
15 changed files with 3 additions and 127 deletions

View File

@ -1038,11 +1038,6 @@ acdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td)
error = EBADF;
break;
case DIOCGPART:
((struct partinfo *)addr)->disklab = &cdp->disklabel;
((struct partinfo *)addr)->part = &cdp->disklabel.d_partitions[0];
break;
default:
error = ENOTTY;
}

View File

@ -1505,15 +1505,6 @@ ccdioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
*(struct disklabel *)data = cs->sc_label;
break;
case DIOCGPART:
if (!IS_INITED(cs))
return (ENXIO);
((struct partinfo *)data)->disklab = &cs->sc_label;
((struct partinfo *)data)->part =
&cs->sc_label.d_partitions[ccdpart(dev)];
break;
case DIOCWDINFO:
case DIOCSDINFO:
if (!IS_INITED(cs))

View File

@ -578,12 +578,6 @@ MCD_TRACE("ioctl called 0x%lx\n", cmd);
case DIOCGDINFO:
*(struct disklabel *) addr = cd->dlabel;
return 0;
case DIOCGPART:
((struct partinfo *) addr)->disklab = &cd->dlabel;
((struct partinfo *) addr)->part =
&cd->dlabel.d_partitions[mcd_part(dev)];
return 0;
/*
* a bit silly, but someone might want to test something on a
* section of cdrom.

View File

@ -436,11 +436,6 @@ scdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td)
case DIOCGDINFO:
*(struct disklabel *)addr = cd->dlabel;
return 0;
case DIOCGPART:
((struct partinfo *)addr)->disklab = &cd->dlabel;
((struct partinfo *)addr)->part =
&cd->dlabel.d_partitions[0];
return 0;
case CDIOCPLAYTRACKS:
return scd_playtracks(unit, (struct ioc_play_track *) addr);
case CDIOCPLAYBLOCKS:

View File

@ -387,17 +387,6 @@ vinumioctl(dev_t dev,
get_volume_label(vol->name, vol->plexes, vol->size, (struct disklabel *) data);
break;
/*
* Care! DIOCGPART returns *pointers* to
* the caller, so we need to store this crap
* as well. And yes, we need it.
*/
case DIOCGPART: /* get partition information */
get_volume_label(vol->name, vol->plexes, vol->size, &vol->label);
((struct partinfo *) data)->disklab = &vol->label;
((struct partinfo *) data)->part = &vol->label.d_partitions[0];
break;
/*
* We don't have this stuff on hardware,
* so just pretend to do it so that

View File

@ -305,7 +305,6 @@ struct _volume
*/
int plex[MAXPLEX]; /* index of plexes */
#ifdef _KERNEL
struct disklabel label; /* for DIOCGPART */
dev_t dev; /* associated device */
#endif
};

View File

@ -287,17 +287,6 @@ g_bsd_start(struct bio *bp)
g_io_deliver(bp);
return (1);
}
#ifdef _KERNEL
if (gio->cmd == DIOCGPART) {
struct partinfo pi;
pi.disklab = &ms->inram;
pi.part = &ms->inram.d_partitions[bp->bio_to->index];
bcopy(&pi, gio->data, sizeof pi);
bp->bio_error = 0;
g_io_deliver(bp);
return (1);
}
#endif
return (0);
}

View File

@ -1505,15 +1505,6 @@ ccdioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
*(struct disklabel *)data = cs->sc_label;
break;
case DIOCGPART:
if (!IS_INITED(cs))
return (ENXIO);
((struct partinfo *)data)->disklab = &cs->sc_label;
((struct partinfo *)data)->part =
&cs->sc_label.d_partitions[ccdpart(dev)];
break;
case DIOCWDINFO:
case DIOCSDINFO:
if (!IS_INITED(cs))

View File

@ -1021,12 +1021,6 @@ int matcdioctl(dev_t dev, u_long command, caddr_t addr,
*(struct disklabel *) addr = cd->dlabel;
return(0);
case DIOCGPART:
((struct partinfo *) addr)->disklab=&cd->dlabel;
((struct partinfo *) addr)->part=
&cd->dlabel.d_partitions[matcd_partition(dev)];
return(0);
case DIOCWDINFO:
case DIOCSDINFO:
if ((flags & FWRITE) == 0) {

View File

@ -578,12 +578,6 @@ MCD_TRACE("ioctl called 0x%lx\n", cmd);
case DIOCGDINFO:
*(struct disklabel *) addr = cd->dlabel;
return 0;
case DIOCGPART:
((struct partinfo *) addr)->disklab = &cd->dlabel;
((struct partinfo *) addr)->part =
&cd->dlabel.d_partitions[mcd_part(dev)];
return 0;
/*
* a bit silly, but someone might want to test something on a
* section of cdrom.

View File

@ -436,11 +436,6 @@ scdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td)
case DIOCGDINFO:
*(struct disklabel *)addr = cd->dlabel;
return 0;
case DIOCGPART:
((struct partinfo *)addr)->disklab = &cd->dlabel;
((struct partinfo *)addr)->part =
&cd->dlabel.d_partitions[0];
return 0;
case CDIOCPLAYTRACKS:
return scd_playtracks(unit, (struct ioc_play_track *) addr);
case CDIOCPLAYBLOCKS:

View File

@ -420,14 +420,6 @@ dsioctl(dev, cmd, data, flags, sspp)
lp->d_secsize;
return (0);
case DIOCGPART:
if (lp == NULL)
return (EINVAL);
((struct partinfo *)data)->disklab = lp;
((struct partinfo *)data)->part
= &lp->d_partitions[dkpart(dev)];
return (0);
case DIOCGSLICEINFO:
bcopy(ssp, data, (char *)&ssp->dss_slices[ssp->dss_nslices] -
(char *)ssp);

View File

@ -300,17 +300,6 @@ static char *fstypenames[] = {
#define D_RAMDISK 0x08 /* disk emulator */
#define D_CHAIN 0x10 /* can do back-back transfers */
#ifdef _KERNEL
/*
* Structure used internally to retrieve information about a partition
* on a disk.
*/
struct partinfo {
struct disklabel *disklab;
struct partition *part;
};
#endif
/* DOS partition table -- located in boot block */
#if defined(PC98) && !defined(PC98_ATCOMPAT)
@ -367,13 +356,10 @@ struct dos_partition {
/*
* Disk-specific ioctls.
*/
/* get and set disklabel; DIOCGPART used internally */
/* get and set disklabel */
#define DIOCGDINFO _IOR('d', 101, struct disklabel)/* get */
#define DIOCSDINFO _IOW('d', 102, struct disklabel)/* set */
#define DIOCWDINFO _IOW('d', 103, struct disklabel)/* set, update disk */
#ifdef _KERNEL
#define DIOCGPART _IOW('d', 104, struct partinfo) /* get partition */
#endif
#define DIOCGDVIRGIN _IOR('d', 105, struct disklabel)/* get virgin label */
#define DIOCWLABEL _IOW('d', 109, int) /* write en/disable label */

View File

@ -300,17 +300,6 @@ static char *fstypenames[] = {
#define D_RAMDISK 0x08 /* disk emulator */
#define D_CHAIN 0x10 /* can do back-back transfers */
#ifdef _KERNEL
/*
* Structure used internally to retrieve information about a partition
* on a disk.
*/
struct partinfo {
struct disklabel *disklab;
struct partition *part;
};
#endif
/* DOS partition table -- located in boot block */
#if defined(PC98) && !defined(PC98_ATCOMPAT)
@ -367,13 +356,10 @@ struct dos_partition {
/*
* Disk-specific ioctls.
*/
/* get and set disklabel; DIOCGPART used internally */
/* get and set disklabel */
#define DIOCGDINFO _IOR('d', 101, struct disklabel)/* get */
#define DIOCSDINFO _IOW('d', 102, struct disklabel)/* set */
#define DIOCWDINFO _IOW('d', 103, struct disklabel)/* set, update disk */
#ifdef _KERNEL
#define DIOCGPART _IOW('d', 104, struct partinfo) /* get partition */
#endif
#define DIOCGDVIRGIN _IOR('d', 105, struct disklabel)/* get virgin label */
#define DIOCWLABEL _IOW('d', 109, int) /* write en/disable label */

View File

@ -300,17 +300,6 @@ static char *fstypenames[] = {
#define D_RAMDISK 0x08 /* disk emulator */
#define D_CHAIN 0x10 /* can do back-back transfers */
#ifdef _KERNEL
/*
* Structure used internally to retrieve information about a partition
* on a disk.
*/
struct partinfo {
struct disklabel *disklab;
struct partition *part;
};
#endif
/* DOS partition table -- located in boot block */
#if defined(PC98) && !defined(PC98_ATCOMPAT)
@ -367,13 +356,10 @@ struct dos_partition {
/*
* Disk-specific ioctls.
*/
/* get and set disklabel; DIOCGPART used internally */
/* get and set disklabel */
#define DIOCGDINFO _IOR('d', 101, struct disklabel)/* get */
#define DIOCSDINFO _IOW('d', 102, struct disklabel)/* set */
#define DIOCWDINFO _IOW('d', 103, struct disklabel)/* set, update disk */
#ifdef _KERNEL
#define DIOCGPART _IOW('d', 104, struct partinfo) /* get partition */
#endif
#define DIOCGDVIRGIN _IOR('d', 105, struct disklabel)/* get virgin label */
#define DIOCWLABEL _IOW('d', 109, int) /* write en/disable label */