From owner-svn-src-all@freebsd.org Mon Jul 24 21:51:42 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99FF8DA94C6; Mon, 24 Jul 2017 21:51:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5C9337E2CC; Mon, 24 Jul 2017 21:51:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6OLpfv5013846; Mon, 24 Jul 2017 21:51:41 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6OLpfkR013845; Mon, 24 Jul 2017 21:51:41 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707242151.v6OLpfkR013845@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 24 Jul 2017 21:51:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321437 - head/sbin/savecore X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sbin/savecore X-SVN-Commit-Revision: 321437 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2017 21:51:42 -0000 Author: markj Date: Mon Jul 24 21:51:41 2017 New Revision: 321437 URL: https://svnweb.freebsd.org/changeset/base/321437 Log: Fix style and wrap lines to 80 columns in savecore.c. No functional change intended. MFC after: 3 days Modified: head/sbin/savecore/savecore.c Modified: head/sbin/savecore/savecore.c ============================================================================== --- head/sbin/savecore/savecore.c Mon Jul 24 21:25:49 2017 (r321436) +++ head/sbin/savecore/savecore.c Mon Jul 24 21:51:41 2017 (r321437) @@ -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 kerneldumphe 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) { @@ -397,8 +409,8 @@ DoRegularFile(int fd, bool isencrypted, off_t dumpsize /* * 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) @@ -705,7 +717,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. */ isencrypted = (dumpkeysize > 0); if (compress) { snprintf(corename, sizeof(corename), "%s.%d.gz", @@ -960,7 +972,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");