svn commit: r280231 - head/usr.bin/mt
Kenneth D. Merry
ken at FreeBSD.org
Wed Mar 18 20:54:55 UTC 2015
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 */
}
More information about the svn-src-head
mailing list