From patchwork Tue Oct 23 17:51:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Goffredo Baroncelli X-Patchwork-Id: 1631721 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 796C5DFB7E for ; Tue, 23 Oct 2012 17:52:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932953Ab2JWRvu (ORCPT ); Tue, 23 Oct 2012 13:51:50 -0400 Received: from mail-ea0-f174.google.com ([209.85.215.174]:52507 "EHLO mail-ea0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757368Ab2JWRvn (ORCPT ); Tue, 23 Oct 2012 13:51:43 -0400 Received: by mail-ea0-f174.google.com with SMTP id c13so1252036eaa.19 for ; Tue, 23 Oct 2012 10:51:43 -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=mpomU0MjJtYDazuBk8XP6SWpm/D8N8r77WlLJ3EAsHU=; b=DQewrz8y9qPmw7SkRVAyP3aHj5YpYjWFXQMOK+RWlU2v7vGTmvyVR20R8BPq/z52uL Uuhq7mF9fsPADb7U/tL2Dd/CdqPOQVaYB39gYLfJT6z/fGoGsoCKSKUBsqeAYtfrD+/v H92ZonbEhhvShGKkl16IMUI7S9LE6dh3g99kcl3LE72kFs48UCCWDY7DJOHGNIJ+t37Y PzlZn1ZZu34l7qtXopcnk2xm/PeEJxRsnkFDvMZFjnL+PwKuhMqwlnvUVow8sUxbvhFR dvmg5uIUweJIGHT+he3amwWr8GBBfmsSjgxVeidLJhR9NMCkH6n8m2SeZaWB9YGqAovd guwQ== Received: by 10.14.221.8 with SMTP id q8mr17907611eep.28.1351014703229; Tue, 23 Oct 2012 10:51:43 -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 o47sm21949351eem.11.2012.10.23.10.51.42 (version=SSLv3 cipher=OTHER); Tue, 23 Oct 2012 10:51:42 -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: Tue, 23 Oct 2012 19:51:54 +0200 Message-Id: <1351014715-5727-5-git-send-email-kreijack@inwind.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1351014715-5727-1-git-send-email-kreijack@inwind.com> References: <1351014715-5727-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 e61cdea..4b16fc9 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':