Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Add wedge (dk(4)) support to vnd(4) devices.



details:   https://anonhg.NetBSD.org/src/rev/ed56ba24f8a4
branches:  trunk
changeset: 755846:ed56ba24f8a4
user:      riz <riz%NetBSD.org@localhost>
date:      Thu Jun 24 21:20:23 2010 +0000

description:
Add wedge (dk(4)) support to vnd(4) devices.

diffstat:

 sys/dev/vnd.c |  37 ++++++++++++++++++++++++++++++++++---
 1 files changed, 34 insertions(+), 3 deletions(-)

diffs (79 lines):

diff -r bc768d40e15e -r ed56ba24f8a4 sys/dev/vnd.c
--- a/sys/dev/vnd.c     Thu Jun 24 20:46:11 2010 +0000
+++ b/sys/dev/vnd.c     Thu Jun 24 21:20:23 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vnd.c,v 1.209 2010/06/24 13:03:08 hannken Exp $        */
+/*     $NetBSD: vnd.c,v 1.210 2010/06/24 21:20:23 riz Exp $    */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.209 2010/06/24 13:03:08 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.210 2010/06/24 21:20:23 riz Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -254,6 +254,8 @@
 static struct vnd_softc        *vnd_spawn(int);
 int    vnd_destroy(device_t);
 
+static struct  dkdriver vnddkdriver = { vndstrategy, minphys };
+
 void
 vndattach(int num)
 {
@@ -282,7 +284,7 @@
        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);
+       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");
 }
@@ -1019,6 +1021,8 @@
 #ifdef __HAVE_OLD_DISKLABEL
        struct disklabel newlabel;
 #endif
+       struct dkwedge_info *dkw;
+       struct dkwedge_list *dkwl;
 
 #ifdef DEBUG
        if (vnddebug & VDB_FOLLOW)
@@ -1501,6 +1505,33 @@
                VOP_UNLOCK(vnd->sc_vp);
                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;
        }



Home | Main Index | Thread Index | Old Index