From patchwork Thu Aug 14 21:13:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nils Steinger X-Patchwork-Id: 4725431 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 0CA89C0338 for ; Thu, 14 Aug 2014 21:14:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 12CBC201DD for ; Thu, 14 Aug 2014 21:14:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0CF422010E for ; Thu, 14 Aug 2014 21:14:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754681AbaHNVOL (ORCPT ); Thu, 14 Aug 2014 17:14:11 -0400 Received: from ny.voidptr.de ([5.45.110.253]:35437 "EHLO ny.voidptr.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754251AbaHNVOK (ORCPT ); Thu, 14 Aug 2014 17:14:10 -0400 Received: from beta.passau.voidptr.de (188-192-74-226-dynip.superkabel.de [188.192.74.226]) by ny.voidptr.de (Postfix) with ESMTPSA id 0FB67843B3E; Thu, 14 Aug 2014 23:14:09 +0200 (CEST) Received: (nullmailer pid 17274 invoked by uid 1000); Thu, 14 Aug 2014 21:14:08 -0000 From: Nils Steinger To: linux-btrfs@vger.kernel.org Cc: Nils Steinger Subject: [PATCH v2] Add options to use a fixed unit for `filesystem df` instead of determining it automatically. Date: Thu, 14 Aug 2014 23:13:38 +0200 Message-Id: <1408050818-17184-2-git-send-email-nst@voidptr.de> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1408050818-17184-1-git-send-email-nst@voidptr.de> References: <1408044261-11234-1-git-send-email-nst@voidptr.de> <1408050818-17184-1-git-send-email-nst@voidptr.de> 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=ham 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 automatic unit selection makes parsing the output of `filesystem df` unnecessarily difficult. Using the new options -b, -k, -m, and -g, the output unit can be set to bytes, kibi-, mebi-, and gibibytes respectively. Signed-off-by: Nils Steinger --- v2: Add options to btrfs-filesystem man page. Also removed invalid "[...]" placeholder in the process. Documentation/btrfs-filesystem.txt | 14 ++++++++- cmds-filesystem.c | 62 +++++++++++++++++++++++++++++++++----- utils.c | 30 ++++++++++++++++++ utils.h | 8 +++++ 4 files changed, 106 insertions(+), 8 deletions(-) diff --git a/Documentation/btrfs-filesystem.txt b/Documentation/btrfs-filesystem.txt index 0ee79cb..404474d 100644 --- a/Documentation/btrfs-filesystem.txt +++ b/Documentation/btrfs-filesystem.txt @@ -17,8 +17,20 @@ resizing, defragment. SUBCOMMAND ---------- -*df* [...]:: +*df* [-b|-k|-m|-g] :: Show space usage information for a mount point. ++ +By default, all values are scaled to the shortest three digit unit. You can +use the following options to set a fixed unit for all values: ++ +-b:::: +Display all values in bytes. +-k:::: +Display all values in kibibytes. +-m:::: +Display all values in mebibytes. +-g:::: +Display all values in gibibytes. *show* [--mounted|--all-devices||||