summaryrefslogtreecommitdiff
path: root/sys/dev/ccd.c
diff options
context:
space:
mode:
authorthorpej <thorpej@NetBSD.org>2004-10-26 22:44:45 +0000
committerthorpej <thorpej@NetBSD.org>2004-10-26 22:44:45 +0000
commitf64a29d7088415a38aa4f98efbbcb7ac06157dbc (patch)
tree6cc38100d1508097c63d30e01906d549be403dd1 /sys/dev/ccd.c
parent01d27a59a77f6ddae1dc5f842b0361c53fda5646 (diff)
Implement the DIOCCACHESYNC ioctl; we simply pass it through to each
underlying component.
Diffstat (limited to 'sys/dev/ccd.c')
-rw-r--r--sys/dev/ccd.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/sys/dev/ccd.c b/sys/dev/ccd.c
index 07d03890c9e..41b57d2d19d 100644
--- a/sys/dev/ccd.c
+++ b/sys/dev/ccd.c
@@ -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 @@ ccdioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
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 @@ ccdioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
switch (cmd) {
case CCDIOCCLR:
case DIOCGDINFO:
+ case DIOCCACHESYNC:
case DIOCSDINFO:
case DIOCWDINFO:
case DIOCGPART:
@@ -1214,6 +1216,27 @@ ccdioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
&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