From patchwork Mon Oct 29 17:53:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Goffredo Baroncelli X-Patchwork-Id: 1665071 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id BEE963FCF7 for ; Mon, 29 Oct 2012 17:52:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760133Ab2J2Rwt (ORCPT ); Mon, 29 Oct 2012 13:52:49 -0400 Received: from mail-ea0-f174.google.com ([209.85.215.174]:37204 "EHLO mail-ea0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759689Ab2J2Rwq (ORCPT ); Mon, 29 Oct 2012 13:52:46 -0400 Received: by mail-ea0-f174.google.com with SMTP id c13so1806130eaa.19 for ; Mon, 29 Oct 2012 10:52:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=lyo5tDaMA4jEaPrq0Jo+QzIgy+iXcrIQUmXGUVcPp2Q=; b=0WAIUk92Le333TkpGe+uOwldewpypKUxGzn95JuBvEFwVwMJsLFQBrVY55NhdHnp9U hPPhwOGklkt7982aCnK6h8Fl/kev1VejpE+RcOHSsNXk6XHB4O3kKt195M5eEjMDTAyF mtvYCp0yyeu0ivWmljycGdkZeRi+a/TsdzPkVRqX4nWo3wT3pRfWCZcyJiOo0gAe/95y sfF2U1NlbaiPQMl/xaeIjwHSO2kohWX/PCORoKSQse2IaVgAmBJc3afsoyJ3SC+htjlt CpLmJl/sau7tbZ+9k1MP7w5+Ypx3i0AcITjWwvpnqjH3kqhGns4pqFVejshmorMD8/y6 yWvA== Received: by 10.14.1.69 with SMTP id 45mr63838569eec.23.1351533165766; Mon, 29 Oct 2012 10:52:45 -0700 (PDT) Received: from venice..bhome (host103-133-static.242-95-b.business.telecomitalia.it. [95.242.133.103]) by mx.google.com with ESMTPS id k2sm24096182eep.15.2012.10.29.10.52.44 (version=SSLv3 cipher=OTHER); Mon, 29 Oct 2012 10:52:45 -0700 (PDT) From: Goffredo Baroncelli To: linux-btrfs@vger.kernel.org Cc: Stefan Behrens , Wang Sheng-Hui Subject: [PATCH 3/4] parse_size(): add new suffixes Date: Mon, 29 Oct 2012 18:53:19 +0100 Message-Id: <1351533200-5703-4-git-send-email-kreijack@inwind.it> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1351533200-5703-1-git-send-email-kreijack@inwind.it> References: <1351533200-5703-1-git-send-email-kreijack@inwind.it> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Add new suffixes in parse_size() function. New suffixes are: T as terabyte, P as petabyte, E as exabyte. Note these units are multiply of 2 . Signed-off-by: Goffredo Baroncelli --- utils.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/utils.c b/utils.c index aa2e574..b487be6 100644 --- a/utils.c +++ b/utils.c @@ -1236,6 +1236,12 @@ u64 parse_size(char *s) if (s[i]) { c = tolower(s[i]); switch (c) { + case 'e': + mult *= 1024; + case 'p': + mult *= 1024; + case 't': + mult *= 1024; case 'g': mult *= 1024; case 'm':