From owner-svn-src-all@FreeBSD.ORG Wed Mar 18 20:54:55 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6ABED213; Wed, 18 Mar 2015 20:54:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 54D199E5; Wed, 18 Mar 2015 20:54:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t2IKstPc085148; Wed, 18 Mar 2015 20:54:55 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t2IKstmx085147; Wed, 18 Mar 2015 20:54:55 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201503182054.t2IKstmx085147@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Wed, 18 Mar 2015 20:54:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r280231 - head/usr.bin/mt X-SVN-Group: head 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.18-1 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: Wed, 18 Mar 2015 20:54:55 -0000 Author: ken Date: Wed Mar 18 20:54:54 2015 New Revision: 280231 URL: https://svnweb.freebsd.org/changeset/base/280231 Log: Improve the mt(1) rblim display. The granularity reported by READ BLOCK LIMITS is an exponent, not a byte value. So a granularity of 0 means 2^0, or 1 byte. A granularity of 1 means 2^1, or 2 bytes. Print out the individual block limits on separate lines to improve readability and avoid exceeding 80 columns. usr.bin/mt/mt.c: Fix and improve the 'mt rblim' output. Add a MT_PLURAL() macro so we can print "byte" or "bytes" as appropriate. Sponsored by: Spectra Logic MFC after: 4 days Modified: head/usr.bin/mt/mt.c Modified: head/usr.bin/mt/mt.c ============================================================================== --- head/usr.bin/mt/mt.c Wed Mar 18 20:52:34 2015 (r280230) +++ head/usr.bin/mt/mt.c Wed Mar 18 20:54:54 2015 (r280231) @@ -119,6 +119,7 @@ __FBSDID("$FreeBSD$"); #ifndef MAX #define MAX(a, b) (a > b) ? a : b #endif +#define MT_PLURAL(a) (a == 1) ? "" : "s" typedef enum { MT_CMD_NONE = MTLOAD + 1, @@ -384,10 +385,16 @@ main(int argc, char *argv[]) if (ioctl(mtfd, MTIOCRBLIM, (caddr_t)&rblim) < 0) err(2, "%s", tape); - (void)printf("%s: min blocksize %u bytes, " - "max blocksize %u bytes, granularity %u bytes\n", + (void)printf("%s:\n" + " min blocksize %u byte%s\n" + " max blocksize %u byte%s\n" + " granularity %u byte%s\n", tape, rblim.min_block_length, - rblim.max_block_length, rblim.granularity); + MT_PLURAL(rblim.min_block_length), + rblim.max_block_length, + MT_PLURAL(rblim.max_block_length), + (1 << rblim.granularity), + MT_PLURAL((1 << rblim.granularity))); exit(0); /* NOTREACHED */ }