Revert revisions 188839 and 188868. Use of the ioctl in geom_dev.c
is invalid because the ioctl happens without prior open. The ioctl got introduced to provide backward compatibility for extended partitions, but it ended up not being used because it didn't work as expected. Since there are no consumers of the ioctl and the implementation is broken, the best fix is to remove the code entirely. Spotted by: phk Approved by: re (kensmith)
This commit is contained in:
parent
347e22a68b
commit
f43b57e32a
@ -219,10 +219,7 @@ acd_geom_ioctl(struct g_provider *pp, u_long cmd, void *addr, int fflag, struct
|
||||
case CDIOCRESET:
|
||||
acd_test_ready(dev);
|
||||
break;
|
||||
|
||||
case DIOCGPROVIDERALIAS:
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
acd_read_toc(dev);
|
||||
acd_prevent_allow(dev, 1);
|
||||
|
@ -113,7 +113,6 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, int insist __unused)
|
||||
{
|
||||
struct g_geom *gp;
|
||||
struct g_consumer *cp;
|
||||
char *alias;
|
||||
int error;
|
||||
struct cdev *dev;
|
||||
|
||||
@ -135,17 +134,6 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, int insist __unused)
|
||||
gp->softc = dev;
|
||||
dev->si_drv1 = gp;
|
||||
dev->si_drv2 = cp;
|
||||
|
||||
g_topology_unlock();
|
||||
|
||||
alias = g_malloc(MAXPATHLEN, M_WAITOK | M_ZERO);
|
||||
error = (pp->geom->ioctl == NULL) ? ENODEV :
|
||||
pp->geom->ioctl(pp, DIOCGPROVIDERALIAS, alias, 0, curthread);
|
||||
if (!error && alias[0] != '\0')
|
||||
make_dev_alias(dev, "%s", alias);
|
||||
g_free(alias);
|
||||
|
||||
g_topology_lock();
|
||||
return (gp);
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,6 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/bio.h>
|
||||
#include <sys/disk.h>
|
||||
#include <sys/diskmbr.h>
|
||||
#include <sys/endian.h>
|
||||
#include <sys/kernel.h>
|
||||
@ -92,7 +91,6 @@ static g_taste_t g_part_taste;
|
||||
|
||||
static g_access_t g_part_access;
|
||||
static g_dumpconf_t g_part_dumpconf;
|
||||
static g_ioctl_t g_part_ioctl;
|
||||
static g_orphan_t g_part_orphan;
|
||||
static g_spoiled_t g_part_spoiled;
|
||||
static g_start_t g_part_start;
|
||||
@ -109,7 +107,6 @@ static struct g_class g_part_class = {
|
||||
/* Geom methods. */
|
||||
.access = g_part_access,
|
||||
.dumpconf = g_part_dumpconf,
|
||||
.ioctl = g_part_ioctl,
|
||||
.orphan = g_part_orphan,
|
||||
.spoiled = g_part_spoiled,
|
||||
.start = g_part_start,
|
||||
@ -1611,31 +1608,6 @@ g_part_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp,
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
g_part_ioctl(struct g_provider *pp, u_long cmd, void *data, int fflag,
|
||||
struct thread *td)
|
||||
{
|
||||
struct g_geom *gp;
|
||||
struct g_part_table *table;
|
||||
struct g_part_entry *entry;
|
||||
int error;
|
||||
|
||||
gp = pp->geom;
|
||||
table = gp->softc;
|
||||
entry = pp->private;
|
||||
|
||||
switch (cmd) {
|
||||
case DIOCGPROVIDERALIAS:
|
||||
error = G_PART_DEVALIAS(table, entry, data, MAXPATHLEN);
|
||||
break;
|
||||
default:
|
||||
error = ENOTTY;
|
||||
break;
|
||||
}
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
static void
|
||||
g_part_orphan(struct g_consumer *cp)
|
||||
{
|
||||
|
@ -85,15 +85,6 @@ METHOD int destroy {
|
||||
struct g_part_parms *gpp;
|
||||
};
|
||||
|
||||
# devalias() - return the name (if any) to be used as an alias for
|
||||
# the device special file created for the partition entry.
|
||||
METHOD int devalias {
|
||||
struct g_part_table *table;
|
||||
struct g_part_entry *entry;
|
||||
char *buf;
|
||||
size_t bufsz;
|
||||
};
|
||||
|
||||
# dumpconf()
|
||||
METHOD void dumpconf {
|
||||
struct g_part_table *table;
|
||||
|
@ -104,10 +104,4 @@ void disk_err(struct bio *bp, const char *what, int blkdone, int nl);
|
||||
* must be at least MAXPATHLEN bytes long.
|
||||
*/
|
||||
|
||||
#define DIOCGPROVIDERALIAS _IOR('d', 139, char[MAXPATHLEN])
|
||||
/*-
|
||||
* Store the provider alias, if present, in a buffer. The buffer must
|
||||
* be at least MAXPATHLEN bytes long.
|
||||
*/
|
||||
|
||||
#endif /* _SYS_DISK_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user