Source-Changes-HG archive

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

[src/trunk]: src/sbin/gpt - use gpt_msg to print informational messages (perh...



details:   https://anonhg.NetBSD.org/src/rev/757edd5f3eb9
branches:  trunk
changeset: 341961:757edd5f3eb9
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Dec 01 02:03:55 2015 +0000

description:
- use gpt_msg to print informational messages (perhaps these should be printed
  only with -v)
- don't print any messages with gpt_msg if quiet
- print a message if we didn't reconfigure the wedges

diffstat:

 sbin/gpt/add.c    |   7 +++----
 sbin/gpt/gpt.c    |  16 +++++++++++++---
 sbin/gpt/resize.c |   6 +++---
 3 files changed, 19 insertions(+), 10 deletions(-)

diffs (94 lines):

diff -r 407595e33e89 -r 757edd5f3eb9 sbin/gpt/add.c
--- a/sbin/gpt/add.c    Tue Dec 01 01:49:23 2015 +0000
+++ b/sbin/gpt/add.c    Tue Dec 01 02:03:55 2015 +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.29 2015/11/30 19:59:34 christos Exp $");
+__RCSID("$NetBSD: add.c,v 1.30 2015/12/01 02:03:55 christos Exp $");
 #endif
 
 #include <sys/types.h>
@@ -180,9 +180,8 @@
        gpt_write(fd, lbt);
        gpt_write(fd, tpg);
 
-       printf("Partition %d added on %s: ", i + 1, device_arg);
-       printf("%s %" PRIu64 " %" PRIu64 "\n", type, map->map_start,
-           map->map_size);
+       gpt_msg("Partition %d added: %s %" PRIu64 " %" PRIu64 "\n", i + 1,
+           type, map->map_start, map->map_size);
 }
 
 int
diff -r 407595e33e89 -r 757edd5f3eb9 sbin/gpt/gpt.c
--- a/sbin/gpt/gpt.c    Tue Dec 01 01:49:23 2015 +0000
+++ b/sbin/gpt/gpt.c    Tue Dec 01 02:03:55 2015 +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.47 2015/12/01 01:49:23 christos Exp $");
+__RCSID("$NetBSD: gpt.c,v 1.48 2015/12/01 02:03:55 christos Exp $");
 #endif
 
 #include <sys/param.h>
@@ -573,15 +573,22 @@
 gpt_close(int fd)
 {
 
-       if (modified && !nosync) {
+       if (!modified)
+               goto out;
+
+       if (!nosync) {
 #ifdef DIOCMWEDGES
                int bits;
                if (ioctl(fd, DIOCMWEDGES, &bits) == -1)
                        warn("Can't update wedge information");
+               else
+                       goto out;
 #endif
        }
+       gpt_msg("You need to run \"dkctl %s makewedges\""
+           " for the changes to take effect\n", device_name);
 
-       /* XXX post processing? */
+out:
        close(fd);
 }
 
@@ -589,6 +596,9 @@
 gpt_msg(const char *fmt, ...)
 {
        va_list ap;
+
+       if (quiet)
+               return;
        printf("%s: ", device_name);
        va_start(ap, fmt);
        vprintf(fmt, ap);
diff -r 407595e33e89 -r 757edd5f3eb9 sbin/gpt/resize.c
--- a/sbin/gpt/resize.c Tue Dec 01 01:49:23 2015 +0000
+++ b/sbin/gpt/resize.c Tue Dec 01 02:03:55 2015 +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.13 2015/11/30 19:59:34 christos Exp $");
+__RCSID("$NetBSD: resize.c,v 1.14 2015/12/01 02:03:55 christos Exp $");
 #endif
 
 #include <sys/types.h>
@@ -166,8 +166,8 @@
        gpt_write(fd, lbt);
        gpt_write(fd, tpg);
 
-       printf("Partition %d resized on %s: ", entry, device_arg);
-       printf("%" PRIu64 " %" PRIu64 "\n", map->map_start, newsize);
+       gpt_msg("Partition %d resized: %" PRIu64 " %" PRIu64 "\n", entry,
+           map->map_start, newsize);
 }
 
 int



Home | Main Index | Thread Index | Old Index