tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

wedges on vnd(4) patch



I had occasion to use wedges on a vnd(4), only to be reminded that they're
not currently supported.  Anyone see a problem with this patch? I've
given it light testing, and haven't come across any issues yet...

+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 04:24:56 -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");
  }
*************** unlock_and_exit:
*** 1501,1506 ****
--- 1503,1541 ----
                VOP_UNLOCK(vnd->sc_vp, 0);
                return error;
  
+       case DIOCAWEDGE:
+           {
+               struct dkwedge_info *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:
+           {
+               struct dkwedge_info *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:
+           {
+               struct dkwedge_list *dkwl = (void *) data;
+ 
+               return (dkwedge_list(&vnd->sc_dkdev, dkwl, l));
+           }
+ 
        default:
                return ENOTTY;
        }


Home | Main Index | Thread Index | Old Index