From: hugo-lkml@carfax.org.uk
To: unlisted-recipients:; (no To-header on input)
Subject: (unknown)
Date: Sun, 17 Oct 2010 19:18:50 +0100 [thread overview]
Message-ID: <E1P7Xoo-0003B9-RH@vlad.carfax.org.uk> (raw)
>From hugo-lkml@carfax.org.uk Sun Oct 17 19:13:47 2010
Message-Id: <20101017181346.872364958@carfax.org.uk>
User-Agent: quilt/0.48-1
Date: Sun, 17 Oct 2010 19:13:25 +0100
From: hugo-lkml@carfax.org.uk
To: linux-btrfs@vger.kernel.org
Cc: Hugo Mills <hugo@carfax.org.uk>
Subject: [patch 4/4] Add an option to show ISO, binary or raw bytes counts using btrfs-show.
References: <20101017181321.592805312@carfax.org.uk>
Content-Disposition: inline; filename=btrfs-show-numbers
Change btrfs-show to allow the user to control the scales used for
sizes in the output.
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
---
btrfs-show.c | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
Index: btrfs-progs-unstable/btrfs-show.c
===================================================================
--- btrfs-progs-unstable.orig/btrfs-show.c 2010-10-17 19:00:34.000000000 +0100
+++ btrfs-progs-unstable/btrfs-show.c 2010-10-17 19:12:50.000000000 +0100
@@ -52,7 +52,7 @@
return 0;
}
-static void print_one_uuid(struct btrfs_fs_devices *fs_devices)
+static void print_one_uuid(struct btrfs_fs_devices *fs_devices, int format)
{
char uuidbuf[37];
struct list_head *cur;
@@ -69,8 +69,7 @@
else
printf("Label: none ");
- super_bytes_used = pretty_sizes(device->super_bytes_used,
- PRETTY_SIZE_BINARY);
+ super_bytes_used = pretty_sizes(device->super_bytes_used, format);
total = device->total_devs;
printf(" uuid: %s\n\tTotal devices %llu FS bytes used %s\n", uuidbuf,
@@ -82,8 +81,8 @@
char *total_bytes;
char *bytes_used;
device = list_entry(cur, struct btrfs_device, dev_list);
- total_bytes = pretty_sizes(device->total_bytes, PRETTY_SIZE_BINARY);
- bytes_used = pretty_sizes(device->bytes_used, PRETTY_SIZE_BINARY);
+ total_bytes = pretty_sizes(device->total_bytes, format);
+ bytes_used = pretty_sizes(device->bytes_used, format);
printf("\tdevid %4llu size %s used %s path %s\n",
(unsigned long long)device->devid,
total_bytes, bytes_used, device->name);
@@ -99,7 +98,8 @@
static void print_usage(void)
{
- fprintf(stderr, "usage: btrfs-show [search label or device]\n");
+ fprintf(stderr, "usage: btrfs-show [-i|-b|-r] [search label or device]\n");
+ fprintf(stderr, "Options:\n -i, -b, -r: Show sizes in ISO, binary or raw form respectively.\n");
fprintf(stderr, "%s\n", BTRFS_BUILD_VERSION);
exit(1);
}
@@ -117,6 +117,7 @@
char *search = NULL;
int ret;
int option_index = 0;
+ int format = PRETTY_SIZE_BINARY;
while(1) {
int c;
@@ -125,6 +126,15 @@
if (c < 0)
break;
switch(c) {
+ case 'i':
+ format = PRETTY_SIZE_ISO;
+ break;
+ case 'b':
+ format = PRETTY_SIZE_BINARY;
+ break;
+ case 'r':
+ format = PRETTY_SIZE_RAW;
+ break;
default:
print_usage();
}
@@ -144,7 +154,7 @@
list);
if (search && uuid_search(fs_devices, search) == 0)
continue;
- print_one_uuid(fs_devices);
+ print_one_uuid(fs_devices, format);
}
printf("%s\n", BTRFS_BUILD_VERSION);
return 0;
next reply other threads:[~2010-10-17 18:18 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-17 18:18 hugo-lkml [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-05-08 0:37 (unknown) Mrs.Dorothy Peters
2012-05-05 18:59 (unknown) Mrs Sabah Halif
[not found] <1330599216.71336.YahooMailNeo@web30703.mail.mud.yahoo.com>
2012-03-01 12:41 ` (unknown) bella tk
2011-10-29 20:38 (unknown) Kai Moonbourn
2011-09-20 15:24 (unknown) Ken D'Ambrosio
2011-09-01 11:50 (unknown) Ivan Piazza
2011-07-01 16:30 (unknown) Edward Goggin
2011-03-19 20:22 (unknown) Kim Leyendecker
2011-02-20 12:22 (unknown) Christian Brunner
2010-11-12 19:33 (unknown) hugo
2010-11-12 19:24 (unknown) hugo
2010-10-17 18:18 (unknown) hugo-lkml
2010-10-17 18:18 (unknown) hugo-lkml
2010-10-17 18:18 (unknown) hugo-lkml
2010-10-17 18:18 (unknown) hugo-lkml
2010-08-30 2:32 (unknown) Bret Palsson
2010-07-17 8:06 (unknown) Grant Mayor
2010-07-10 1:46 (unknown) jck
2010-04-30 20:57 (unknown) Ilya Shestopalov
2010-04-14 20:19 (unknown) Jay Sullivan
2010-03-17 9:36 (unknown) dm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1P7Xoo-0003B9-RH@vlad.carfax.org.uk \
--to=hugo-lkml@carfax.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).