summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkj <markj@FreeBSD.org>2017-07-31 00:34:36 +0000
committermarkj <markj@FreeBSD.org>2017-07-31 00:34:36 +0000
commitb213255c4ee52db74d53bc565db2ea34937d0da5 (patch)
treebc2feec2e5d76602ab123ccf31180e8541211fb9
parentacc7e2c36c96e0d4f40fd6b8313b6713e1e58359 (diff)
downloadFreeBSD-src-b213255c4ee52db74d53bc565db2ea34937d0da5.zip
FreeBSD-src-b213255c4ee52db74d53bc565db2ea34937d0da5.tar.gz
MFC r321437:
Fix style and wrap lines to 80 columns in savecore.c.
-rw-r--r--sbin/savecore/savecore.c45
1 files changed, 29 insertions, 16 deletions
diff --git a/sbin/savecore/savecore.c b/sbin/savecore/savecore.c
index 58c493c..cfeb407 100644
--- a/sbin/savecore/savecore.c
+++ b/sbin/savecore/savecore.c
@@ -101,30 +101,39 @@ static sig_atomic_t got_siginfo;
static void infohandler(int);
static void
-printheader(xo_handle_t *xo, const struct kerneldumpheader *h, const char *device,
- int bounds, const int status)
+printheader(xo_handle_t *xo, const struct kerneldumpheader *h,
+ const char *device, int bounds, const int status)
{
uint64_t dumplen;
time_t t;
const char *stat_str;
xo_flush_h(xo);
- xo_emit_h(xo, "{Lwc:Dump header from device}{:dump_device/%s}\n", device);
- xo_emit_h(xo, "{P: }{Lwc:Architecture}{:architecture/%s}\n", h->architecture);
- xo_emit_h(xo, "{P: }{Lwc:Architecture Version}{:architecture_version/%u}\n", dtoh32(h->architectureversion));
+ xo_emit_h(xo, "{Lwc:Dump header from device}{:dump_device/%s}\n",
+ device);
+ xo_emit_h(xo, "{P: }{Lwc:Architecture}{:architecture/%s}\n",
+ h->architecture);
+ xo_emit_h(xo,
+ "{P: }{Lwc:Architecture Version}{:architecture_version/%u}\n",
+ dtoh32(h->architectureversion));
dumplen = dtoh64(h->dumplength);
- xo_emit_h(xo, "{P: }{Lwc:Dump Length}{:dump_length_bytes/%lld}\n", (long long)dumplen);
- xo_emit_h(xo, "{P: }{Lwc:Blocksize}{:blocksize/%d}\n", dtoh32(h->blocksize));
+ xo_emit_h(xo, "{P: }{Lwc:Dump Length}{:dump_length_bytes/%lld}\n",
+ (long long)dumplen);
+ xo_emit_h(xo, "{P: }{Lwc:Blocksize}{:blocksize/%d}\n",
+ dtoh32(h->blocksize));
+
t = dtoh64(h->dumptime);
xo_emit_h(xo, "{P: }{Lwc:Dumptime}{:dumptime/%s}", ctime(&t));
xo_emit_h(xo, "{P: }{Lwc:Hostname}{:hostname/%s}\n", h->hostname);
xo_emit_h(xo, "{P: }{Lwc:Magic}{:magic/%s}\n", h->magic);
- xo_emit_h(xo, "{P: }{Lwc:Version String}{:version_string/%s}", h->versionstring);
- xo_emit_h(xo, "{P: }{Lwc:Panic String}{:panic_string/%s}\n", h->panicstring);
+ xo_emit_h(xo, "{P: }{Lwc:Version String}{:version_string/%s}",
+ h->versionstring);
+ xo_emit_h(xo, "{P: }{Lwc:Panic String}{:panic_string/%s}\n",
+ h->panicstring);
xo_emit_h(xo, "{P: }{Lwc:Dump Parity}{:dump_parity/%u}\n", h->parity);
xo_emit_h(xo, "{P: }{Lwc:Bounds}{:bounds/%d}\n", bounds);
- switch(status) {
+ switch (status) {
case STATUS_BAD:
stat_str = "bad";
break;
@@ -133,13 +142,15 @@ printheader(xo_handle_t *xo, const struct kerneldumpheader *h, const char *devic
break;
default:
stat_str = "unknown";
+ break;
}
xo_emit_h(xo, "{P: }{Lwc:Dump Status}{:dump_status/%s}\n", stat_str);
xo_flush_h(xo);
}
static int
-getbounds(void) {
+getbounds(void)
+{
FILE *fp;
char buf[6];
int ret;
@@ -170,7 +181,8 @@ getbounds(void) {
}
static void
-writebounds(int bounds) {
+writebounds(int bounds)
+{
FILE *fp;
if ((fp = fopen("bounds", "w")) == NULL) {
@@ -372,8 +384,8 @@ DoRegularFile(int fd, off_t dumpsize, char *buf, const char *device,
/*
* At this point, we have a partial ordering:
* nw <= hs <= he <= nr
- * If hs > nw, buf[nw..hs] contains non-zero data.
- * If he > hs, buf[hs..he] is all zeroes.
+ * If hs > nw, buf[nw..hs] contains non-zero
+ * data. If he > hs, buf[hs..he] is all zeroes.
*/
if (hs > nw)
if (fwrite(buf + nw, hs - nw, 1, fp)
@@ -675,7 +687,7 @@ DoFile(const char *savedir, const char *device)
goto closefd;
}
- oumask = umask(S_IRWXG|S_IRWXO); /* Restrict access to the core file.*/
+ oumask = umask(S_IRWXG|S_IRWXO); /* Restrict access to the core file. */
if (compress) {
snprintf(corename, sizeof(corename), "%s.%d.gz",
istextdump ? "textdump.tar" : "vmcore", bounds);
@@ -889,7 +901,8 @@ main(int argc, char **argv)
} else if (nsaved == 0) {
if (nerr != 0) {
if (verbose)
- syslog(LOG_WARNING, "unsaved dumps found but not saved");
+ syslog(LOG_WARNING,
+ "unsaved dumps found but not saved");
exit(1);
} else if (verbose)
syslog(LOG_WARNING, "no unsaved dumps found");
OpenPOWER on IntegriCloud