Source-Changes-HG archive

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

[src/trunk]: src/sbin/gpt Not all things that write to the disk do something ...



details:   https://anonhg.NetBSD.org/src/rev/71b3921f8ba1
branches:  trunk
changeset: 324421:71b3921f8ba1
user:      jnemeth <jnemeth%NetBSD.org@localhost>
date:      Tue Jul 03 03:41:23 2018 +0000

description:
Not all things that write to the disk do something that dk(4) will
be interested in.  Let individual commands decide if ioctl(DIOCMWEDGES)
should be done.  I was conservative and set the flag on any command
that might create/modify/delete partitions in any way.

diffstat:

 sbin/gpt/add.c     |  4 ++--
 sbin/gpt/gpt.c     |  4 ++--
 sbin/gpt/gpt.h     |  1 +
 sbin/gpt/label.c   |  4 ++--
 sbin/gpt/migrate.c |  4 ++--
 sbin/gpt/recover.c |  4 ++--
 sbin/gpt/remove.c  |  4 ++--
 sbin/gpt/resize.c  |  4 ++--
 sbin/gpt/restore.c |  4 ++--
 sbin/gpt/type.c    |  4 ++--
 10 files changed, 19 insertions(+), 18 deletions(-)

diffs (200 lines):

diff -r 6b6178110b78 -r 71b3921f8ba1 sbin/gpt/add.c
--- a/sbin/gpt/add.c    Tue Jul 03 03:37:03 2018 +0000
+++ b/sbin/gpt/add.c    Tue Jul 03 03:41:23 2018 +0000
@@ -33,7 +33,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/add.c,v 1.14 2006/06/22 22:05:28 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: add.c,v 1.43 2015/12/29 16:45:04 christos Exp $");
+__RCSID("$NetBSD: add.c,v 1.44 2018/07/03 03:41:23 jnemeth Exp $");
 #endif
 
 #include <sys/types.h>
@@ -62,7 +62,7 @@
        "add",
        cmd_add,
        addhelp, __arraycount(addhelp),
-       0,
+       GPT_SYNC,
 };
 
 #define usage() gpt_usage(NULL, &c_add)
diff -r 6b6178110b78 -r 71b3921f8ba1 sbin/gpt/gpt.c
--- a/sbin/gpt/gpt.c    Tue Jul 03 03:37:03 2018 +0000
+++ b/sbin/gpt/gpt.c    Tue Jul 03 03:41:23 2018 +0000
@@ -35,7 +35,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/gpt.c,v 1.16 2006/07/07 02:44:23 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: gpt.c,v 1.74 2018/02/13 00:34:11 sevan Exp $");
+__RCSID("$NetBSD: gpt.c,v 1.75 2018/07/03 03:41:23 jnemeth Exp $");
 #endif
 
 #include <sys/param.h>
@@ -587,7 +587,7 @@
 gpt_close(gpt_t gpt)
 {
 
-       if (!(gpt->flags & GPT_MODIFIED))
+       if (!(gpt->flags & GPT_MODIFIED) || !(gpt->flags & GPT_SYNC))
                goto out;
 
        if (!(gpt->flags & GPT_NOSYNC)) {
diff -r 6b6178110b78 -r 71b3921f8ba1 sbin/gpt/gpt.h
--- a/sbin/gpt/gpt.h    Tue Jul 03 03:37:03 2018 +0000
+++ b/sbin/gpt/gpt.h    Tue Jul 03 03:41:23 2018 +0000
@@ -81,6 +81,7 @@
 #define GPT_NOSYNC     0x08
 #define GPT_FILE       0x10
 #define GPT_TIMESTAMP  0x20
+#define GPT_SYNC       0x40
 #define GPT_OPTDEV      0x8000
 
 void*  gpt_read(gpt_t, off_t, size_t);
diff -r 6b6178110b78 -r 71b3921f8ba1 sbin/gpt/label.c
--- a/sbin/gpt/label.c  Tue Jul 03 03:37:03 2018 +0000
+++ b/sbin/gpt/label.c  Tue Jul 03 03:41:23 2018 +0000
@@ -33,7 +33,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/label.c,v 1.3 2006/10/04 18:20:25 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: label.c,v 1.28 2015/12/04 01:47:48 christos Exp $");
+__RCSID("$NetBSD: label.c,v 1.29 2018/07/03 03:41:24 jnemeth Exp $");
 #endif
 
 #include <sys/types.h>
@@ -62,7 +62,7 @@
        "label",
        cmd_label,
        labelhelp, __arraycount(labelhelp),
-       0,
+       GPT_SYNC,
 };
 
 #define usage() gpt_usage(NULL, &c_label)
diff -r 6b6178110b78 -r 71b3921f8ba1 sbin/gpt/migrate.c
--- a/sbin/gpt/migrate.c        Tue Jul 03 03:37:03 2018 +0000
+++ b/sbin/gpt/migrate.c        Tue Jul 03 03:41:23 2018 +0000
@@ -33,7 +33,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/migrate.c,v 1.16 2005/09/01 02:42:52 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: migrate.c,v 1.32 2016/06/09 19:04:43 christos Exp $");
+__RCSID("$NetBSD: migrate.c,v 1.33 2018/07/03 03:41:24 jnemeth Exp $");
 #endif
 
 #include <sys/types.h>
@@ -88,7 +88,7 @@
        "migrate",
        cmd_migrate,
        migratehelp, __arraycount(migratehelp),
-       0,
+       GPT_SYNC,
 };
 
 #define usage() gpt_usage(NULL, &c_migrate)
diff -r 6b6178110b78 -r 71b3921f8ba1 sbin/gpt/recover.c
--- a/sbin/gpt/recover.c        Tue Jul 03 03:37:03 2018 +0000
+++ b/sbin/gpt/recover.c        Tue Jul 03 03:41:23 2018 +0000
@@ -33,7 +33,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/recover.c,v 1.8 2005/08/31 01:47:19 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: recover.c,v 1.17 2017/03/22 19:59:16 martin Exp $");
+__RCSID("$NetBSD: recover.c,v 1.18 2018/07/03 03:41:24 jnemeth Exp $");
 #endif
 
 #include <sys/types.h>
@@ -59,7 +59,7 @@
        "recover",
        cmd_recover,
        recoverhelp, __arraycount(recoverhelp),
-       0,
+       GPT_SYNC,
 };
 
 #define usage() gpt_usage(NULL, &c_recover)
diff -r 6b6178110b78 -r 71b3921f8ba1 sbin/gpt/remove.c
--- a/sbin/gpt/remove.c Tue Jul 03 03:37:03 2018 +0000
+++ b/sbin/gpt/remove.c Tue Jul 03 03:41:23 2018 +0000
@@ -33,7 +33,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/remove.c,v 1.10 2006/10/04 18:20:25 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: remove.c,v 1.21 2015/12/03 01:07:28 christos Exp $");
+__RCSID("$NetBSD: remove.c,v 1.22 2018/07/03 03:41:24 jnemeth Exp $");
 #endif
 
 #include <sys/types.h>
@@ -60,7 +60,7 @@
        "remove",
        cmd_remove,
        removehelp, __arraycount(removehelp),
-       0,
+       GPT_SYNC,
 };
 
 #define usage() gpt_usage(NULL, &c_remove)
diff -r 6b6178110b78 -r 71b3921f8ba1 sbin/gpt/resize.c
--- a/sbin/gpt/resize.c Tue Jul 03 03:37:03 2018 +0000
+++ b/sbin/gpt/resize.c Tue Jul 03 03:41:23 2018 +0000
@@ -33,7 +33,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/add.c,v 1.14 2006/06/22 22:05:28 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: resize.c,v 1.22 2015/12/04 16:54:28 christos Exp $");
+__RCSID("$NetBSD: resize.c,v 1.23 2018/07/03 03:41:24 jnemeth Exp $");
 #endif
 
 #include <sys/types.h>
@@ -59,7 +59,7 @@
        "resize",
        cmd_resize,
        resizehelp, __arraycount(resizehelp),
-       0,
+       GPT_SYNC,
 };
 
 #define usage() gpt_usage(NULL, &c_resize)
diff -r 6b6178110b78 -r 71b3921f8ba1 sbin/gpt/restore.c
--- a/sbin/gpt/restore.c        Tue Jul 03 03:37:03 2018 +0000
+++ b/sbin/gpt/restore.c        Tue Jul 03 03:41:23 2018 +0000
@@ -33,7 +33,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/create.c,v 1.11 2005/08/31 01:47:19 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: restore.c,v 1.17 2017/09/07 10:23:33 christos Exp $");
+__RCSID("$NetBSD: restore.c,v 1.18 2018/07/03 03:41:24 jnemeth Exp $");
 #endif
 
 #include <sys/types.h>
@@ -62,7 +62,7 @@
        "restore",
        cmd_restore,
        restorehelp, __arraycount(restorehelp),
-       0,
+       GPT_SYNC,
 };
 
 #define usage() gpt_usage(NULL, &c_restore)
diff -r 6b6178110b78 -r 71b3921f8ba1 sbin/gpt/type.c
--- a/sbin/gpt/type.c   Tue Jul 03 03:37:03 2018 +0000
+++ b/sbin/gpt/type.c   Tue Jul 03 03:41:23 2018 +0000
@@ -33,7 +33,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/remove.c,v 1.10 2006/10/04 18:20:25 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: type.c,v 1.14 2018/03/19 09:06:20 mlelstv Exp $");
+__RCSID("$NetBSD: type.c,v 1.15 2018/07/03 03:41:24 jnemeth Exp $");
 #endif
 
 #include <sys/types.h>
@@ -61,7 +61,7 @@
        "type",
        cmd_type,
        typehelp, __arraycount(typehelp),
-       GPT_OPTDEV,
+       GPT_SYNC | GPT_OPTDEV,
 };
 
 #define usage() gpt_usage(NULL, &c_type)



Home | Main Index | Thread Index | Old Index