From patchwork Sun Nov 27 17:35:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhumika Goyal X-Patchwork-Id: 9486521 X-Mozilla-Keys: nonjunk Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on sandeen.net X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 X-Spam-HP: BAYES_00=-1.9,DKIM_ADSP_CUSTOM_MED=0.001,DKIM_SIGNED=0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_DNSWL_HI=-5, RP_MATCHES_RCVD=-0.1, T_DKIM_INVALID=0.01 X-Original-To: sandeen@sandeen.net Delivered-To: sandeen@sandeen.net Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by sandeen.net (Postfix) with ESMTP id 02C4776CB87 for ; Sun, 27 Nov 2016 11:34:49 -0600 (CST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751872AbcK0Rfc (ORCPT ); Sun, 27 Nov 2016 12:35:32 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:36346 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751230AbcK0Rfb (ORCPT ); Sun, 27 Nov 2016 12:35:31 -0500 Received: by mail-pg0-f67.google.com with SMTP id x23so10748802pgx.3; Sun, 27 Nov 2016 09:35:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=TmiF7Z0jbK2zBCt0V2PrXlNK1YIYKj0Lv1CGItpyA9Y=; b=N3s5RwuprsQIrZadaqpyUCkqUSSk5EpLTj4Bw4YTP3RlKXEFmGBcTVI5j0tWjKJGtT ua6w7f4T0dKrzYBXPY8U6j26IuhLOlEX8F8O//wanA+KdUmCd55KCgu72ga85s1ReouO sjbayOzBGhZ2E9a+UrSmi0Wwlj0pX1iB3aoWkcVlZdNy2DoAufNniJYmq24GumWRd5ro SmamgL86bvel6K3JCYjG1sS19IVAM/4DMCVjZ9cDGWv5GkQe+S/XY2mhPwknUAZukZ44 BfNmeF2dVrq6PQvRz4cLvUFnpqZEodLx9qMgJfmXMmzDRtvXvq3Ddi6+4aVCvenawIvs eOPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=TmiF7Z0jbK2zBCt0V2PrXlNK1YIYKj0Lv1CGItpyA9Y=; b=Nkq82UaxZmBNi05mBEUtm3cciYeojuwC3IptSkrzTFsyCkg5jmgfsnGd/3SZ0pf6Is h/0SxkYitxH0x2Aa6zU6nIbZFHsS/sYha/hroxAKNVC0dS2vtzYQz8HhYKC0A8XhsJ6k B2MDQjvYZ/0iT+VBdljttreyveEZtxnl91lFPThaywX2sou5lRT9qK2a64us/1iJ1Rwg Pw6D5ea9QCZRM9r+U+XgJjzUFiBppycHYLMhFzqjOj0W6buIo8wfpMrXmh8Fy0QkxuCy Fxd4lkSdQKDh4xRlT7iO8bEDgrM2s6X3QnDi+BHYK2c5JSnWrGJ3oKYDVi5tltPdkEVB IP9w== X-Gm-Message-State: AKaTC03fnxXf6gvzPQBtyuuCfwzoWQ3yBvwHdpyG7EZYl28tb/MjrLHdcfGMlNnM+D0nTQ== X-Received: by 10.84.209.173 with SMTP id y42mr39565691plh.94.1480268130566; Sun, 27 Nov 2016 09:35:30 -0800 (PST) Received: from gmail.com ([106.215.162.2]) by smtp.gmail.com with ESMTPSA id d197sm78179945pfd.38.2016.11.27.09.35.23 (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 27 Nov 2016 09:35:28 -0800 (PST) Received: by gmail.com (sSMTP sendmail emulation); Sun, 27 Nov 2016 23:05:17 +0530 From: Bhumika Goyal To: julia.lawall@lip6.fr, david@fromorbit.com, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Bhumika Goyal Subject: [PATCH] fs: xfs: libxfs: constify xfs_nameops structures Date: Sun, 27 Nov 2016 23:05:01 +0530 Message-Id: <1480268101-30384-1-git-send-email-bhumirks@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Declare the structure xfs_nameops as const as it is only stored in the m_dirnameops field of a xfs_mount structure. This field is of type const struct xfs_nameops *, so xfs_nameops structures having this property can be declared as const. Done using Coccinelle: @r1 disable optional_qualifier @ identifier i; position p; @@ static struct xfs_nameops i@p = {...}; @ok1@ identifier r1.i; position p; struct xfs_mount mp; @@ mp.m_dirnameops=&i@p @bad@ position p!={r1.p,ok1.p}; identifier r1.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r1.i; @@ static +const struct xfs_nameops i={...}; @depends on !bad disable optional_qualifier@ identifier r1.i; @@ +const struct xfs_nameops i; File size before: text data bss dec hex filename 5302 85 0 5387 150b fs/xfs/libxfs/xfs_dir2.o File size after: text data bss dec hex filename 5318 69 0 5387 150b fs/xfs/libxfs/xfs_dir2.o Signed-off-by: Bhumika Goyal --- fs/xfs/libxfs/xfs_dir2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/xfs/libxfs/xfs_dir2.c b/fs/xfs/libxfs/xfs_dir2.c index 20a96dd..c58d72c 100644 --- a/fs/xfs/libxfs/xfs_dir2.c +++ b/fs/xfs/libxfs/xfs_dir2.c @@ -93,7 +93,7 @@ return result; } -static struct xfs_nameops xfs_ascii_ci_nameops = { +static const struct xfs_nameops xfs_ascii_ci_nameops = { .hashname = xfs_ascii_ci_hashname, .compname = xfs_ascii_ci_compname, };