From patchwork Thu Jul 20 09:29:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Tulak X-Patchwork-Id: 9854393 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 31FCA600F5 for ; Thu, 20 Jul 2017 09:29:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A80A28749 for ; Thu, 20 Jul 2017 09:29:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F4A828760; Thu, 20 Jul 2017 09:29:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC7CB2876B for ; Thu, 20 Jul 2017 09:29:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934801AbdGTJ3k (ORCPT ); Thu, 20 Jul 2017 05:29:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57994 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934694AbdGTJ3h (ORCPT ); Thu, 20 Jul 2017 05:29:37 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 94A337CE0D for ; Thu, 20 Jul 2017 09:29:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 94A337CE0D Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jtulak@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 94A337CE0D Received: from honza-mbp.redhat.com (ovpn-204-167.brq.redhat.com [10.40.204.167]) by smtp.corp.redhat.com (Postfix) with ESMTP id D019E7982A; Thu, 20 Jul 2017 09:29:36 +0000 (UTC) From: Jan Tulak To: linux-xfs@vger.kernel.org Cc: Jan Tulak Subject: [PATCH 1/7] mkfs: Save raw user input field to the opts struct Date: Thu, 20 Jul 2017 11:29:26 +0200 Message-Id: <20170720092932.32580-2-jtulak@redhat.com> In-Reply-To: <20170720092932.32580-1-jtulak@redhat.com> References: <20170720092932.32580-1-jtulak@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 20 Jul 2017 09:29:37 +0000 (UTC) Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Save exactly what the user gave us for every option. This way, we will never lose the information if we need it to print back an issue. (Just add the infrastructure now, used in the next patches.) Signed-off-by: Jan Tulak Reviewed-by: Eric Sandeen Reviewed-by: Luis R. Rodriguez --- mkfs/xfs_mkfs.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index a69190b9..4b030101 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -107,6 +107,11 @@ unsigned int sectorsize; * sets what is used with simple specifying the subopt (-d file). * A special SUBOPT_NEEDS_VAL can be used to require a user-given * value in any case. + * + * raw_input INTERNAL + * Filled raw string from the user, so we never lose that information e.g. + * to print it back in case of an issue. + * */ struct opt_params { const char name; @@ -122,6 +127,7 @@ struct opt_params { long long minval; long long maxval; long long defaultval; + const char *raw_input; } subopt_params[MAX_SUBOPTS]; }; @@ -729,6 +735,18 @@ struct opt_params mopts = { */ #define WHACK_SIZE (128 * 1024) +static inline void +set_conf_raw(struct opt_params *opt, int subopt, const char *value) +{ + opt->subopt_params[subopt].raw_input = value; +} + +static inline const char * +get_conf_raw(const struct opt_params *opt, int subopt) +{ + return opt->subopt_params[subopt].raw_input; +} + /* * Convert lsu to lsunit for 512 bytes blocks and check validity of the values. */