Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/vnconfig Add an interface to the "force" option, an...



details:   https://anonhg.NetBSD.org/src/rev/233811166cbd
branches:  trunk
changeset: 545601:233811166cbd
user:      drochner <drochner%NetBSD.org@localhost>
date:      Fri Apr 11 16:15:28 2003 +0000

description:
Add an interface to the "force" option, and fix a bug where the
"readonly" flag cleared "hasgeom".

diffstat:

 usr.sbin/vnconfig/vnconfig.8 |   5 ++++-
 usr.sbin/vnconfig/vnconfig.c |  12 +++++++++---
 2 files changed, 13 insertions(+), 4 deletions(-)

diffs (72 lines):

diff -r a87864b6c615 -r 233811166cbd usr.sbin/vnconfig/vnconfig.8
--- a/usr.sbin/vnconfig/vnconfig.8      Fri Apr 11 16:11:49 2003 +0000
+++ b/usr.sbin/vnconfig/vnconfig.8      Fri Apr 11 16:15:28 2003 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: vnconfig.8,v 1.26 2003/03/27 16:00:50 yamt Exp $
+.\"    $NetBSD: vnconfig.8,v 1.27 2003/04/11 16:15:28 drochner Exp $
 .\"
 .\" Copyright (c) 1997 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -89,6 +89,7 @@
 .Op Ar geomspec
 .Nm
 .Fl u
+.Op Fl F
 .Op Fl v
 .Ar vnode_disk
 .Nm
@@ -163,6 +164,8 @@
 argument are mutually exclusive.
 .It Fl u
 Unconfigures the device.
+.It Fl F
+Force unconfiguration if the device is in use.
 .It Fl r
 Configure the device as read-only.
 .It Fl v
diff -r a87864b6c615 -r 233811166cbd usr.sbin/vnconfig/vnconfig.c
--- a/usr.sbin/vnconfig/vnconfig.c      Fri Apr 11 16:11:49 2003 +0000
+++ b/usr.sbin/vnconfig/vnconfig.c      Fri Apr 11 16:15:28 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vnconfig.c,v 1.26 2003/03/27 15:36:02 yamt Exp $       */
+/*     $NetBSD: vnconfig.c,v 1.27 2003/04/11 16:15:28 drochner Exp $   */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -103,6 +103,7 @@
 
 int    verbose = 0;
 int    readonly = 0;
+int    force = 0;
 char   *tabname;
 
 int    config __P((char *, char *, char *, int));
@@ -118,8 +119,11 @@
 {
        int ch, rv, action = VND_CONFIG;
 
-       while ((ch = getopt(argc, argv, "cf:lrt:uv")) != -1) {
+       while ((ch = getopt(argc, argv, "Fcf:lrt:uv")) != -1) {
                switch (ch) {
+               case 'F':
+                       force = 1;
+                       break;
                case 'c':
                        action = VND_CONFIG;
                        break;
@@ -240,12 +244,14 @@
        }
 
        if (readonly)
-               vndio.vnd_flags = VNDIOF_READONLY;
+               vndio.vnd_flags |= VNDIOF_READONLY;
 
        /*
         * Clear (un-configure) the device
         */
        if (action == VND_UNCONFIG) {
+               if (force)
+                       vndio.vnd_flags |= VNDIOF_FORCE;
                rv = ioctl(fd, VNDIOCCLR, &vndio);
                if (rv)
                        warn("%s: VNDIOCCLR", rdev);



Home | Main Index | Thread Index | Old Index