Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Implement the DIOCCACHESYNC ioctl; we simply pass it...



details:   https://anonhg.NetBSD.org/src/rev/fb14dc2d3134
branches:  trunk
changeset: 570748:fb14dc2d3134
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Oct 26 22:44:45 2004 +0000

description:
Implement the DIOCCACHESYNC ioctl; we simply pass it through to each
underlying component.

diffstat:

 sys/dev/ccd.c |  27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diffs (62 lines):

diff -r 40e3d61275f0 -r fb14dc2d3134 sys/dev/ccd.c
--- a/sys/dev/ccd.c     Tue Oct 26 21:21:59 2004 +0000
+++ b/sys/dev/ccd.c     Tue Oct 26 22:44:45 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ccd.c,v 1.99 2004/09/18 16:40:11 yamt Exp $    */
+/*     $NetBSD: ccd.c,v 1.100 2004/10/26 22:44:45 thorpej Exp $        */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999 The NetBSD Foundation, Inc.
@@ -125,7 +125,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.99 2004/09/18 16:40:11 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.100 2004/10/26 22:44:45 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -986,6 +986,7 @@
        struct buf *bp;
        struct ccd_softc *cs;
        struct ccd_ioctl *ccio = (struct ccd_ioctl *)data;
+       struct ucred *uc;
        char **cpp;
        struct vnode **vpp;
 #ifdef __HAVE_OLD_DISKLABEL
@@ -1019,6 +1020,7 @@
        switch (cmd) {
        case CCDIOCCLR:
        case DIOCGDINFO:
+       case DIOCCACHESYNC:
        case DIOCSDINFO:
        case DIOCWDINFO:
        case DIOCGPART:
@@ -1214,6 +1216,27 @@
                    &cs->sc_dkdev.dk_label->d_partitions[DISKPART(dev)];
                break;
 
+       case DIOCCACHESYNC:
+               /*
+                * XXX Do we really need to care about having a writable
+                * file descriptor here?
+                */
+               if ((flag & FWRITE) == 0)
+                       return (EBADF);
+
+               /*
+                * We pass this call down to all components and report
+                * the first error we encounter.
+                */
+               uc = (p != NULL) ? p->p_ucred : NOCRED;
+               for (error = 0, i = 0; i < cs->sc_nccdisks; i++) {
+                       j = VOP_IOCTL(cs->sc_cinfo[i].ci_vp, cmd, data,
+                                     flag, uc, p);
+                       if (j != 0 && error == 0)
+                               error = j;
+               }
+               break;
+
        case DIOCWDINFO:
        case DIOCSDINFO:
 #ifdef __HAVE_OLD_DISKLABEL



Home | Main Index | Thread Index | Old Index