From patchwork Mon Oct 22 20:17:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Goffredo Baroncelli X-Patchwork-Id: 1627771 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 1AD49DFB7A for ; Mon, 22 Oct 2012 20:17:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755782Ab2JVUR0 (ORCPT ); Mon, 22 Oct 2012 16:17:26 -0400 Received: from mail-bk0-f46.google.com ([209.85.214.46]:64974 "EHLO mail-bk0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753331Ab2JVURZ (ORCPT ); Mon, 22 Oct 2012 16:17:25 -0400 Received: by mail-bk0-f46.google.com with SMTP id jk13so1245985bkc.19 for ; Mon, 22 Oct 2012 13:17:24 -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=lRUop3kSEAe8+aG/s990vhr/RAgU8hR+HZDSnKGDhVw=; b=ccfd1Rlfmtg/RwCP+xHiqVsX7r59/NFfEsbCp8z2/Z74hnsULRmeO1XyogyGXjRBrf XlWRb6zAyC6h7jWqk2jINzrB9CkX5X+HnxUu+WMNaWGjkHL7aErGBc6+bREJFEBSWT9m mSOHOZTS0ybljVDC8R0OmbIacsNNdggY5jRJEM/zocB/3pmQ8RpTXISO07iGYeHNCK2L 7CRGhv8/wJhsi4gUwG+KwMLkEygnmme+7Z9Digo+XJL6djr4n9QN+RDjme61rPAkovEm d9/anfhho5J8cZJ2rs5fhz7EsPtla1vK+FMW9eFsYRZf1jzhH/NBR4Hp00tY0k47R1zF l8+g== Received: by 10.204.131.75 with SMTP id w11mr3144971bks.111.1350937044778; Mon, 22 Oct 2012 13:17:24 -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 x13sm4560199bkv.16.2012.10.22.13.17.23 (version=SSLv3 cipher=OTHER); Mon, 22 Oct 2012 13:17:24 -0700 (PDT) From: Goffredo Baroncelli To: linux-btrfs@vger.kernel.org Cc: Stefan Behrens , Wang Sheng-Hui , Goffredo Baroncelli Subject: [PATCH 4/5] parse_size(): add new suffixes Date: Mon, 22 Oct 2012 22:17:47 +0200 Message-Id: <1350937068-10080-5-git-send-email-kreijack@inwind.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1350937068-10080-1-git-send-email-kreijack@inwind.com> References: <1350937068-10080-1-git-send-email-kreijack@inwind.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Goffredo Baroncelli 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 . --- utils.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/utils.c b/utils.c index de75309..a5fabdc 100644 --- a/utils.c +++ b/utils.c @@ -1234,6 +1234,12 @@ u64 parse_size(char *s) if (!isdigit(s[len - 1])) { c = tolower(s[len - 1]); switch (c) { + case 'e': + mult *= 1024; + case 'p': + mult *= 1024; + case 't': + mult *= 1024; case 'g': mult *= 1024; case 'm':