Source-Changes-HG archive

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

[src/trunk]: src/sys Add a disk ioctl DIOCRMWEDGES to remove all wedges of a ...



details:   https://anonhg.NetBSD.org/src/rev/ba65c5590cba
branches:  trunk
changeset: 449891:ba65c5590cba
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Mar 27 19:13:33 2019 +0000

description:
Add a disk ioctl DIOCRMWEDGES to remove all wedges of a given disk
(if not busy).

diffstat:

 sys/dev/ccd.c        |   5 +++--
 sys/dev/dksubr.c     |   5 +++--
 sys/dev/ofw/ofdisk.c |   5 +++--
 sys/kern/subr_disk.c |  11 +++++++++--
 sys/sys/dkio.h       |   5 ++++-
 5 files changed, 22 insertions(+), 9 deletions(-)

diffs (127 lines):

diff -r 182e3e5b6cb2 -r ba65c5590cba sys/dev/ccd.c
--- a/sys/dev/ccd.c     Wed Mar 27 19:01:44 2019 +0000
+++ b/sys/dev/ccd.c     Wed Mar 27 19:13:33 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ccd.c,v 1.178 2019/03/01 11:06:56 pgoyette Exp $       */
+/*     $NetBSD: ccd.c,v 1.179 2019/03/27 19:13:34 martin Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.178 2019/03/01 11:06:56 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.179 2019/03/27 19:13:34 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1126,6 +1126,7 @@
        case DIOCCACHESYNC:
        case DIOCAWEDGE:
        case DIOCDWEDGE:
+       case DIOCRMWEDGES:
        case DIOCMWEDGES:
 #ifdef __HAVE_OLD_DISKLABEL
        case ODIOCSDINFO:
diff -r 182e3e5b6cb2 -r ba65c5590cba sys/dev/dksubr.c
--- a/sys/dev/dksubr.c  Wed Mar 27 19:01:44 2019 +0000
+++ b/sys/dev/dksubr.c  Wed Mar 27 19:13:33 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.106 2019/01/07 22:35:55 jdolecek Exp $ */
+/* $NetBSD: dksubr.c,v 1.107 2019/03/27 19:13:34 martin Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.106 2019/01/07 22:35:55 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.107 2019/03/27 19:13:34 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -617,6 +617,7 @@
        case DIOCDWEDGE:
        case DIOCLWEDGES:
        case DIOCMWEDGES:
+       case DIOCRMWEDGES:
        case DIOCCACHESYNC:
 #ifdef __HAVE_OLD_DISKLABEL
        case ODIOCGDINFO:
diff -r 182e3e5b6cb2 -r ba65c5590cba sys/dev/ofw/ofdisk.c
--- a/sys/dev/ofw/ofdisk.c      Wed Mar 27 19:01:44 2019 +0000
+++ b/sys/dev/ofw/ofdisk.c      Wed Mar 27 19:13:33 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ofdisk.c,v 1.52 2017/03/25 09:21:21 martin Exp $       */
+/*     $NetBSD: ofdisk.c,v 1.53 2019/03/27 19:13:34 martin Exp $       */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofdisk.c,v 1.52 2017/03/25 09:21:21 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofdisk.c,v 1.53 2019/03/27 19:13:34 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -367,6 +367,7 @@
        case DIOCDWEDGE:
        case DIOCAWEDGE:
        case DIOCLWEDGES:
+       case DIOCRMWEDGES:
        case DIOCMWEDGES:
                if (OFDISK_FLOPPY_P(of))
                        return ENOTTY;
diff -r 182e3e5b6cb2 -r ba65c5590cba sys/kern/subr_disk.c
--- a/sys/kern/subr_disk.c      Wed Mar 27 19:01:44 2019 +0000
+++ b/sys/kern/subr_disk.c      Wed Mar 27 19:13:33 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_disk.c,v 1.122 2018/03/07 21:13:24 kre Exp $      */
+/*     $NetBSD: subr_disk.c,v 1.123 2019/03/27 19:13:33 martin Exp $   */
 
 /*-
  * Copyright (c) 1996, 1997, 1999, 2000, 2009 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.122 2018/03/07 21:13:24 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.123 2019/03/27 19:13:33 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -645,6 +645,13 @@
                dkwedge_discover(dk);
                return 0;
 
+       case DIOCRMWEDGES:
+               if ((flag & FWRITE) == 0)
+                       return EBADF;
+
+               dkwedge_delall(dk);
+               return 0;
+
        default:
                return EPASSTHROUGH;
        }
diff -r 182e3e5b6cb2 -r ba65c5590cba sys/sys/dkio.h
--- a/sys/sys/dkio.h    Wed Mar 27 19:01:44 2019 +0000
+++ b/sys/sys/dkio.h    Wed Mar 27 19:13:33 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dkio.h,v 1.24 2017/04/05 20:15:49 jdolecek Exp $       */
+/*     $NetBSD: dkio.h,v 1.25 2019/03/27 19:13:33 martin Exp $ */
 
 /*
  * Copyright (c) 1987, 1988, 1993
@@ -130,4 +130,7 @@
 #define        DIOCGSECTORSIZE _IOR('d', 133, u_int)   /* sector size in bytes */
 #define        DIOCGMEDIASIZE  _IOR('d', 132, off_t)   /* media size in bytes */
 
+               /* mass removal */
+#define        DIOCRMWEDGES    _IOR('d', 134, int)     /* remove all wedges */
+
 #endif /* _SYS_DKIO_H_ */



Home | Main Index | Thread Index | Old Index