From patchwork Mon Sep 15 15:09:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Sterba X-Patchwork-Id: 4906541 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 89038BEEA5 for ; Mon, 15 Sep 2014 15:10:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 64497201DE for ; Mon, 15 Sep 2014 15:10:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5A0E020160 for ; Mon, 15 Sep 2014 15:10:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753768AbaIOPJ7 (ORCPT ); Mon, 15 Sep 2014 11:09:59 -0400 Received: from cantor2.suse.de ([195.135.220.15]:40719 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752982AbaIOPJ6 (ORCPT ); Mon, 15 Sep 2014 11:09:58 -0400 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id EE4A575020; Mon, 15 Sep 2014 15:09:56 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 43785DAAF9; Mon, 15 Sep 2014 17:09:56 +0200 (CEST) From: David Sterba To: linux-btrfs@vger.kernel.org Cc: David Sterba , Hugo Mills , Nils Steinger , Alexandre Oliva Subject: [UI RFC][PATCH] btrfs-progs: add options to tune units for fi df output Date: Mon, 15 Sep 2014 17:09:52 +0200 Message-Id: <1410793792-17621-1-git-send-email-dsterba@suse.cz> X-Mailer: git-send-email 2.1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The size unit format is a longstanding annoyance. This patch is based on the work of Nils and Alexandre and enhances the options. It's possible to select raw bytes, SI-based or IEC-based compact units (human frientdly) or a fixed base from kilobytes to terabytes. The default is compact human readable IEC-based, no change to current version. CC: Nils Steinger CC: Alexandre Oliva Signed-off-by: David Sterba Reviewed-by: Hugo Mills --- I tried to make the command line UI rich enough to address current and future needs, I'm open to tweaks, rewording etc. The patch is based on current snapshot of integration branch that will be the base of 3.17 release and contains the 'enhanced df' patches, branch dev/units. Documentation/btrfs-filesystem.txt | 25 ++++++++- cmds-filesystem.c | 111 ++++++++++++++++++++++++++++--------- utils.c | 48 ++++++++++++---- utils.h | 30 +++++++--- 4 files changed, 168 insertions(+), 46 deletions(-) diff --git a/Documentation/btrfs-filesystem.txt b/Documentation/btrfs-filesystem.txt index c9c0b006a0b0..7ac105ff350e 100644 --- a/Documentation/btrfs-filesystem.txt +++ b/Documentation/btrfs-filesystem.txt @@ -17,8 +17,31 @@ resizing, defragment. SUBCOMMAND ---------- -*df* [...]:: +*df* [options] :: Show space usage information for a mount point. ++ +`Options` ++ +-b|--raw:::: +raw numbers in bytes, without the 'B' suffix +-h:::: +print human friendly numbers, base 1024, this is the default +-H:::: +print human friendly numbers, base 1000 +--iec:::: +select the 1024 base for the following options, according to the IEC standard +--si:::: +select the 1000 base for the following options, according to the SI standard +-k|--kbytes:::: +show sizes in KiB, or KB with --si +-m|--mbytes:::: +show sizes in MiB, or MB with --si +-g|--gbytes:::: +show sizes in GiB, or GB with --si +-t|--tbytes:::: +show sizes in TiB, or TB with --si + +If conflicting options are passed, the last one takes precedence. *show* [--mounted|--all-devices||||