Module Name: src
Committed By: christos
Date: Tue Dec 1 02:03:55 UTC 2015
Modified Files:
src/sbin/gpt: add.c gpt.c resize.c
Log Message:
- 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
To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sbin/gpt/add.c
cvs rdiff -u -r1.47 -r1.48 src/sbin/gpt/gpt.c
cvs rdiff -u -r1.13 -r1.14 src/sbin/gpt/resize.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/gpt/add.c
diff -u src/sbin/gpt/add.c:1.29 src/sbin/gpt/add.c:1.30
--- src/sbin/gpt/add.c:1.29 Mon Nov 30 14:59:34 2015
+++ src/sbin/gpt/add.c Mon Nov 30 21:03:55 2015
@@ -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 @@ add(int fd)
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
Index: src/sbin/gpt/gpt.c
diff -u src/sbin/gpt/gpt.c:1.47 src/sbin/gpt/gpt.c:1.48
--- src/sbin/gpt/gpt.c:1.47 Mon Nov 30 20:49:23 2015
+++ src/sbin/gpt/gpt.c Mon Nov 30 21:03:55 2015
@@ -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 @@ void
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 @@ void
gpt_msg(const char *fmt, ...)
{
va_list ap;
+
+ if (quiet)
+ return;
printf("%s: ", device_name);
va_start(ap, fmt);
vprintf(fmt, ap);
Index: src/sbin/gpt/resize.c
diff -u src/sbin/gpt/resize.c:1.13 src/sbin/gpt/resize.c:1.14
--- src/sbin/gpt/resize.c:1.13 Mon Nov 30 14:59:34 2015
+++ src/sbin/gpt/resize.c Mon Nov 30 21:03:55 2015
@@ -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 @@ resize(int fd)
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