On Mon, Jun 21, 2010 at 02:45:42PM +0000, Christos Zoulas wrote: > > - declare the variables on top to avoid braces in case statements. > - KNF continuation lines (indent-by-four) and lose the ()'s around return
Updated patch below. As an aside, this ss clearly more KNF, but I have to say it's harder to follow (not that this is all that complex) with the variable declaration so far separated from its usage. But I suppose that's another conversation for another day. :) +j -- Index: sys/dev/vnd.c =================================================================== RCS file: /cvsroot/src/sys/dev/vnd.c,v retrieving revision 1.208 diff -p -r1.208 vnd.c *** sys/dev/vnd.c 2 Mar 2010 21:32:29 -0000 1.208 --- sys/dev/vnd.c 21 Jun 2010 18:51:36 -0000 *************** extern struct cfdriver vnd_cd; *** 254,259 **** --- 254,261 ---- static struct vnd_softc *vnd_spawn(int); int vnd_destroy(device_t); + static struct dkdriver vnddkdriver = { vndstrategy, minphys }; + void vndattach(int num) { *************** vnd_attach(device_t parent, device_t sel *** 282,288 **** sc->sc_comp_buff = NULL; sc->sc_comp_decombuf = NULL; bufq_alloc(&sc->sc_tab, "disksort", BUFQ_SORT_RAWBLOCK); ! disk_init(&sc->sc_dkdev, device_xname(self), NULL); if (!pmf_device_register(self, NULL, NULL)) aprint_error_dev(self, "couldn't establish power handler\n"); } --- 284,290 ---- sc->sc_comp_buff = NULL; sc->sc_comp_decombuf = NULL; bufq_alloc(&sc->sc_tab, "disksort", BUFQ_SORT_RAWBLOCK); ! disk_init(&sc->sc_dkdev, device_xname(self), &vnddkdriver); if (!pmf_device_register(self, NULL, NULL)) aprint_error_dev(self, "couldn't establish power handler\n"); } *************** vndioctl(dev_t dev, u_long cmd, void *da *** 1019,1024 **** --- 1021,1028 ---- #ifdef __HAVE_OLD_DISKLABEL struct disklabel newlabel; #endif + struct dkwedge_info *dkw; + struct dkwedge_list *dkwl; #ifdef DEBUG if (vnddebug & VDB_FOLLOW) *************** unlock_and_exit: *** 1501,1506 **** --- 1505,1537 ---- VOP_UNLOCK(vnd->sc_vp, 0); return error; + case DIOCAWEDGE: + dkw = (void *) data; + + if ((flag & FWRITE) == 0) + return EBADF; + + /* If the ioctl happens here, the parent is us. */ + strlcpy(dkw->dkw_parent, device_xname(vnd->sc_dev), + sizeof(dkw->dkw_parent)); + return dkwedge_add(dkw); + + case DIOCDWEDGE: + dkw = (void *) data; + + if ((flag & FWRITE) == 0) + return EBADF; + + /* If the ioctl happens here, the parent is us. */ + strlcpy(dkw->dkw_parent, device_xname(vnd->sc_dev), + sizeof(dkw->dkw_parent)); + return dkwedge_del(dkw); + + case DIOCLWEDGES: + dkwl = (void *) data; + + return dkwedge_list(&vnd->sc_dkdev, dkwl, l); + default: return ENOTTY; }