Deleted Added
full compact
34c34
< __FBSDID("$FreeBSD: head/sys/geom/geom_mbr.c 118150 2003-07-29 10:09:13Z phk $");
---
> __FBSDID("$FreeBSD: head/sys/geom/geom_mbr.c 119660 2003-09-01 20:45:32Z phk $");
155,156c155,156
< static void
< g_mbr_ioctl(void *arg, int flag)
---
> static int
> g_mbr_ioctl(struct g_provider *pp, u_long cmd, void *data, struct thread *td)
158d157
< struct bio *bp;
160d158
< struct g_slicer *gsp;
162c160
< struct g_ioctl *gio;
---
> struct g_slicer *gsp;
164d161
< u_char *sec0;
167,172c164
< bp = arg;
< if (flag == EV_CANCEL) {
< g_io_deliver(bp, ENXIO);
< return;
< }
< gp = bp->bio_to->geom;
---
> gp = pp->geom;
175d166
< gio = (struct g_ioctl *)bp->bio_data;
177,183c168,178
< /* The disklabel to set is the ioctl argument. */
< sec0 = gio->data;
<
< error = g_mbr_modify(gp, ms, sec0);
< if (error) {
< g_io_deliver(bp, error);
< return;
---
> switch(cmd) {
> case DIOCSMBR: {
> DROP_GIANT();
> g_topology_lock();
> /* Validate and modify our slicer instance to match. */
> error = g_mbr_modify(gp, ms, data);
> cp = LIST_FIRST(&gp->consumer);
> error = g_write_data(cp, 0, data, 512);
> g_topology_unlock();
> PICKUP_GIANT();
> return(error);
185,187c180,182
< cp = LIST_FIRST(&gp->consumer);
< error = g_write_data(cp, 0, sec0, 512);
< g_io_deliver(bp, error);
---
> default:
> return (ENOIOCTL);
> }
190d184
<
198,199c192
< struct g_ioctl *gio;
< int idx, error;
---
> int idx;
214,240c207
< /* We only handle ioctl(2) requests of the right format. */
< if (strcmp(bp->bio_attribute, "GEOM::ioctl"))
< return (0);
< else if (bp->bio_length != sizeof(*gio))
< return (0);
<
< /* Get hold of the ioctl parameters. */
< gio = (struct g_ioctl *)bp->bio_data;
<
< switch (gio->cmd) {
< case DIOCSMBR:
< /*
< * These we cannot do without the topology lock and some
< * some I/O requests. Ask the event-handler to schedule
< * us in a less restricted environment.
< */
< error = g_post_event(g_mbr_ioctl, bp, M_NOWAIT, gp, NULL);
< if (error)
< g_io_deliver(bp, error);
< /*
< * We must return non-zero to indicate that we will deal
< * with this bio, even though we have not done so yet.
< */
< return (1);
< default:
< return (0);
< }
---
> return (0);
277a245
> gp->ioctl = g_mbr_ioctl;