From patchwork Thu Nov 24 06:40:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuezhang.Mo@sony.com" X-Patchwork-Id: 25333 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3227899wrr; Wed, 23 Nov 2022 22:49:43 -0800 (PST) X-Google-Smtp-Source: AA0mqf5H5x9tUt4s2AlzqJbr1FzmE6F8WKc+D15rAMhhzvJ9rmohPDsWbZluQc0E/22Jt41/H1g3 X-Received: by 2002:a17:906:eb17:b0:7ae:87ef:d9a6 with SMTP id mb23-20020a170906eb1700b007ae87efd9a6mr10817982ejb.397.1669272583178; Wed, 23 Nov 2022 22:49:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669272583; cv=pass; d=google.com; s=arc-20160816; b=ismycw239EYm71CppHuMvctGrUhvr1auxkHRQTMr0BwM/JPCtmRUWHfJwkiGtdwgcc Hkc9XYgsf49KN+ZcwN/EHPJrqvtj4yv+Ir/hgWIW+ioIsHrc1nKqOK9a3wdzH0NKcE7c wErr+sBLxswcSYCYEo7hUrj5Y/nSBiXTCfAg1m59QYAC9LE7tYOHkL04hvPlxiofyTYF cdzrlh5KWwK5XOrDVN/Fj+RUysnZm73Jkm8gUE1fKuhMFc7ctvaoKoDJpA8bET+jz8ti F7RhQLEGZUHi2qE+wGuwj/t4ASLuX91RZ1RX5TOVh3SA4rNLF2G+U4MFlRjdIpOEvOXE pE5A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=qwkyQki8XUKo4GmkKpTwouFfBIBxxOz+7oReYTJNuJg=; b=UvcD5LbGvHpojVe7ifoozXWF6ls46p5wOSCf7A/F6woEtaa9JHnGOTl1OZngb5X80w sinvfJSHyDzKEJ90hZIp12ABoWoP1EmDT3zsqImOGMpSsT3+idffegDLucCDUOB8blG0 FPIE+fcQk4R0RTEiuGDhUBLxhECCIcAJVnmrTVA3iFIGBaSu44gU52CFCoyZd//esBCe jLi7d+tSYwyAQzzaOceRlCOWPHli9P5MHiglUErxa21P8/6K+DqCSoMdUBr2FJ/HhibT vVg6pORvKwWp3jEp1b+oo7it0YJmz6eTYE4qlrLx3kVVqOmbKjVCDBxnUwcmWxL/u+aK QIkQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sony.com header.s=S1 header.b=mbU0HVAF; arc=pass (i=1 spf=pass spfdomain=sony.com dkim=pass dkdomain=sony.com dmarc=pass fromdomain=sony.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sony.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w10-20020a05640234ca00b004627d582888si352900edc.24.2022.11.23.22.49.18; Wed, 23 Nov 2022 22:49:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sony.com header.s=S1 header.b=mbU0HVAF; arc=pass (i=1 spf=pass spfdomain=sony.com dkim=pass dkdomain=sony.com dmarc=pass fromdomain=sony.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sony.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229754AbiKXGlI (ORCPT + 99 others); Thu, 24 Nov 2022 01:41:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229704AbiKXGkw (ORCPT ); Thu, 24 Nov 2022 01:40:52 -0500 Received: from mx08-001d1705.pphosted.com (mx08-001d1705.pphosted.com [185.183.30.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10DFFDAD3F; Wed, 23 Nov 2022 22:40:50 -0800 (PST) Received: from pps.filterd (m0209321.ppops.net [127.0.0.1]) by mx08-001d1705.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AO6OH5s001748; Thu, 24 Nov 2022 06:40:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; h=from : to : cc : subject : date : message-id : content-type : content-transfer-encoding : mime-version; s=S1; bh=qwkyQki8XUKo4GmkKpTwouFfBIBxxOz+7oReYTJNuJg=; b=mbU0HVAFA3ALZTmPyjxowi9O5adSmcR6ehEkofBoEfNWRGH3oiCNvnh+yTOXbrdBf39a /xAcuV5sE/6HlzjnmCbn9sWhdpPNwuaAStXI4TwYTqTZ+m1+k/+S+I9udShsV9wGdeHn Lv+T2xRUTDSmMvvUZNwO744YE2X74pP2NkvMuFOW5EiJm8XBmTJsQKQxG1imu/3eRCM+ UC+4POEVGnDzfKfA0AwWZfZvOnec236Mi1ePZ4DgwhcVd0nfLU8xsMpOIMSPRWpecjBM Z/1ZQ2XWgVv49XCoxN8KsAJfnxhrKFHuF9VHWoh6hOyxr10nWrL4mVLFJMNT3KTKHX+G NA== Received: from apc01-tyz-obe.outbound.protection.outlook.com (mail-tyzapc01lp2047.outbound.protection.outlook.com [104.47.110.47]) by mx08-001d1705.pphosted.com (PPS) with ESMTPS id 3kxrb94t31-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 24 Nov 2022 06:40:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l0U2acbBoizVOlPIqiuTn5BGjtJEU8uywgqUUcf6Km8W+1Y2ohWv0WwS95rDHnCTkNfPApUUh8L1OHpC97snIvr3wInBFd1bWMSCGleXxoh+FsoM4FFnWPEWEz/aiQ/NyYotMTzgC/JKKgrsJC2aaNHsUT3BfLN0Swq5I5HJKQxKmj/yVZ3ZZblU2CiyR5X9HhTLAWJaVYwyltmf5Hg92QlKj85Mieak/34XyFE1BWWQUO0eKUIq5iaNdXp/B3Z0myCa+MTH/Dw3T2XRRiVp8K1gxZBT+SvQlF4yILM2OK3Mbm6aiThNhog4IHQ4TuHzutSsqpIRf6WdDr57uTSRMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qwkyQki8XUKo4GmkKpTwouFfBIBxxOz+7oReYTJNuJg=; b=aJHQ+R5VHUaDyVDbz5/uIkauN3eapyGCvPccXOJr351RAfjqHul5CQKpsTj9D3RlhFWxfQ+9aFH49x7p0ZtDDWrQE3SWIzep3+SLOQJYgBAwyX2ee8Hyn7+2KH9ht7P2MaQfI7k4sToLqWJDOVaZVoyX4lNe3Xkdoyk8vJ1jPrH3C1jhNW/FspksDZKWpkjfknde7bHvjGxnFEt7VFBS2H9iqlfcu6ywQX2HZgJ1mNuCv9TJ+xNcrozENpDc/53p0CcZoTX/9mt8EeUvjK4h8u6xC6+YCDuZHqIxSURN2AWDwdKSKNiPpGSTk7EZNd5dXKswQUQs4s5ujS+faHD/zA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=sony.com; dmarc=pass action=none header.from=sony.com; dkim=pass header.d=sony.com; arc=none Received: from PUZPR04MB6316.apcprd04.prod.outlook.com (2603:1096:301:fc::7) by SI2PR04MB4425.apcprd04.prod.outlook.com (2603:1096:4:e8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.17; Thu, 24 Nov 2022 06:40:26 +0000 Received: from PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::708b:1447:3c12:c222]) by PUZPR04MB6316.apcprd04.prod.outlook.com ([fe80::708b:1447:3c12:c222%8]) with mapi id 15.20.5857.008; Thu, 24 Nov 2022 06:40:26 +0000 From: "Yuezhang.Mo@sony.com" To: "linkinjeon@kernel.org" , "sj1557.seo@samsung.com" CC: "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Andy.Wu@sony.com" , "Wataru.Aoyama@sony.com" Subject: [PATCH v2 5/5] exfat: replace magic numbers with Macros Thread-Topic: [PATCH v2 5/5] exfat: replace magic numbers with Macros Thread-Index: Adj/zvsgGNVBvInHQtSPjlm/TwV6nA== Date: Thu, 24 Nov 2022 06:40:26 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PUZPR04MB6316:EE_|SI2PR04MB4425:EE_ x-ms-office365-filtering-correlation-id: 85537ed8-ff4b-45df-0031-08dacde6c59f x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: i9M+w3FY8mKXeKSCMUm/VIib2nGZRbqnUrA8WhKUKfcB+rx8xgz5fzFkvnxg3ZKsagdu1M9daOAtWaVSCbq13MugJpv4PfLXfcoMozxdCYawzXmJrOYktudMIKMFobw4/V61H2YilQa+xHt1WOiI5kC3evG2RmIeXU/j+4O3bpYt6shUt2jWa+Ax3Jz1qwMF7soLtwe21E4iz3QkT/1uVoViM+YGTQrgMBLN27OMsXMfkTMBaMphbglqqXW5AdmbyKfViSF5mZS6O173q1Auq71eFMg1EhL6fIbPg7BLLCBiplVWSKT2DUDk2+edKoBDGOC/pC3kdTSRZhV6cliTozUWT9jvQYmkLwCqZBVQmgn8RZY0FZpMUhP80iB7ygmX1Lpo1x0FxfHj93laLgJGfpspQRZz91T1ErHdXvxkSsyFBVC8HedK2ifexJcoahbppeXyOK7LhxAqKkiRgRnLwM2uwCya2Ov2rDiX8wxwX3l1TXZot8GeKJh48vbXWKvcT7dt5alyhf9AtUQOhLYhJlLjIiyFZcBi536H+JlZEIW7pBvpfV/VhpJxTCRbUmnjbOjlFRZLvg4LFX0NTYty2B05N5tpPIe0U2AOfo+2m/K+QVrrvBjMWcGao3NFXnwJHUFQcKmR9zQqTlbDZdphMBi/1prnmUrNTa855S6OVF9BiBnsFYSwabV4dY62Phd24uIOF+eGiBoXOL9LKNMWOw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR04MB6316.apcprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(396003)(366004)(376002)(136003)(346002)(451199015)(41300700001)(8936002)(478600001)(54906003)(4326008)(5660300002)(316002)(66556008)(66476007)(66946007)(76116006)(52536014)(66446008)(64756008)(8676002)(71200400001)(107886003)(2906002)(7696005)(6506007)(9686003)(186003)(110136005)(122000001)(26005)(38070700005)(38100700002)(82960400001)(86362001)(83380400001)(33656002)(55016003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?mgWzRj2f5CoHOJnGGk3BgWNFSssg?= =?utf-8?q?4fe0fAcwlIVp4pUOEx2cD1H1q6/Pbl7jDeqUuSecf4Mec7mRhv96noQHWkrl5gqwa?= =?utf-8?q?7Vmcdu3ZnCojPWQZ5IhypqA770S3mkV3Zznplcx1vl2RTFgTmGAs94gE4+BeUptGu?= =?utf-8?q?AF2OIcZ0wT987QIvh5xnExbT0e6zFxAU+clsM6vBeIl2HHLdyVyczdyp5tHp0hTCH?= =?utf-8?q?xHbeDeKPBCGqxwMVf15dCOFtdFsqV7qy+bUyN27Yn9PENQBouvEjcENsvYa+eceU6?= =?utf-8?q?EpCR7rxw9rnfWCMsm68ceBdEtmn7IlWWB5tqu/JGr3LubqlE8b1NkplpmVdNr7mkj?= =?utf-8?q?OG0+SemLVfuVJ9YBER6+jFE3eujDyCrtgr/BEfEA2/ityddmvHFe0uUAk0NIeOLi9?= =?utf-8?q?i2CZSPM45gDX2JorYQ0B2QTvZGa1oB1vGboNr8Yh79EkKwfFWhA0hL8ULwZOXJHNj?= =?utf-8?q?lc7VDrF9Xo4DZCJK2zVgBg9nssS8V2LWvg0OQjVKhC28EEFgT25GjxOWT8f7FKzPY?= =?utf-8?q?xDIQ13hjnd6AAUrY0ynKWcf/ARFbBKb1LrtwLMypseMCtF9WOi0+Ovnr9qNoOWuBl?= =?utf-8?q?cIeqkmWP/QguefeAE355P0xwHMTEYzyGiT4bRrSCjvQOYWp0+Zy0H0GizmKEPS1ZR?= =?utf-8?q?7lt5Anppv6wR4RxCXK2oiRC9gLxWaYTNqV5dztHnDqVPw5M7NqQFhcIAAd0kokvX5?= =?utf-8?q?ECa+/qioPVe71LEcCRnhPI8PPVPydVa5Fv6LNJ2ug0T1It7G5yBBju3MWTqdUpwZb?= =?utf-8?q?jAFioMiCK/G8dcZ8buXKNSLNdkpm+zMqW+ytlRJbgX1eTaa+ycDIjZQXnDMMcZz8g?= =?utf-8?q?l15dkMAEpfosTziXT1kpl6I+aYEeR0aWoZ0ueNKp4efHFgPIK9NGwfvLM6EURM8XD?= =?utf-8?q?izPysvDOLbz48zY2wBneOD56X8MjO4bCMZF/WX87eLgosD8ToaBeA692It29kRL8v?= =?utf-8?q?1xedOSb87Gaov5FIhjSrTJCqVQ5sbpsZ9RFtuOMTWVixahXaW3zPVB0JJq+v6f6eL?= =?utf-8?q?OGX6vg+RkYseT5ZUWuhOlaT39NEtPTuZs13rVD5dd7T89PeI2DmUQ/o8kilI4iCRX?= =?utf-8?q?RS9kOMaRDRXAcHbzV1HY+tVu5MNWhBXxVDBoxwY0DwXjO/9smn/Dhu8WrEmGigu7r?= =?utf-8?q?trAUg40rWIS4HtNkE11wq4/rrGAY32aafIrChHOOCJbpRLHHSiWZtc+thgtomuNGx?= =?utf-8?q?216GM0AQjPJDKs8myoNlGf3BiNChzZF3eMh5WEAAkDLYVR7cUJYJUhMscA4DNhZEz?= =?utf-8?q?mJh5+a5MZI20WspfrZAMZnurnYN4mV0Di4xa/o2Q4Xe9oUSvj1E+DBnfcKc1by8P2?= =?utf-8?q?RO0T3pt6vPCFZwUqPsNHjrBmLTSJLBXK+CGeV13/RWdosiJA+h8yWDGDt+DKdlD5f?= =?utf-8?q?k02aCNtGjCqXI69IkNS1N8DN0cRu/91nJIqYbRT2dg/0OvOh+/o3TP8C7HI6Aijq+?= =?utf-8?q?C0fzB2tEZzbMIN9q+iyeT5BaZk/pSLrIERnlYEl6sKMn/ThzPmwDh9xwYMK4RkeKH?= =?utf-8?q?/rovIbuSlQt6?= MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: raLTJpJXAy3Zc+8QQ8SEWYPnUcqTGImkSV0E3V8b//z+go3WVXllt400+4SFzKXAfTtPq8mdZBij4PdWeNZW9QQ7bgTWh+oplMUbRLeKfpwBhgxaW1woDH25iQ8c7uQQapYhxyNLnlN6o1SJ38cyXiANU962hcCeRoh1cX3W4bMzsEaLL38Utq/yXxR2UrNDFLn3/xs7ZV295OyS/Vs2bbWccv6IQhg0ITRJpOWb1bawGrB8lQNKrEWIY0/hcSRgjksNbyDhQqd+VI6ZQ3DEGrk0PGRBx+rPRmkCnPezdD0CDkV6BmWliUmddvbeOzbv6lXM97uhP1rRZwDJO/d5HVJxNwUcFvBgluwWiKHWZHA5m6FROerk2Lu04UsfVm44Qv/7K99rhJxpK7aVph9+tvzp8K0UCqmnYEz7cNPjHM5JFLMkeNBZJd73/Xedn04YXhxmp0uzDFHkOypNPQKSunbRK1eJuVn3b0y6nrdTSffL51cbqpA/iLgjoaR998Erqryb+FsMkQVqeS817eUDGgloIhndZ25ouPM2fWNdLXfIQ8tFEw8s4oMmaQiS4SZbTttbwk3C1zBKPIDURFHOXZbuSI659GdQ0fK9o9dJLSQrR9hJFhdtMKIiZVAFhYhDCLE3T+fcppct08p348TX7aoXZz96tokwxvIoTKgT6Wfz371N5fEmHVoPQmyOgEAsxw+oyE308ItS4j3hii7RmCasrnPzqnswuBzGvVe80l1hpUotLAauz2734fu3zGVq6gRyk2kUk8/Xg3+a1x4sgf7/Ti1ISaFvrWSzkls8ltn2OdA3tiSvYnM01Aifou2zu34cb9EgcmmzwBUg06HdOLYoE8dQ1X/08WC2YjOCrn4cfyP0Vm45/wNKAOomsrGP X-OriginatorOrg: sony.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PUZPR04MB6316.apcprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 85537ed8-ff4b-45df-0031-08dacde6c59f X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Nov 2022 06:40:26.7737 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 66c65d8a-9158-4521-a2d8-664963db48e4 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: CD5q98V1hrYtWI1Hh7LTOadc/QhZFnIEEsqzOanZQAIkEs5Yls88ALrpiAL7MluGqYk0h4fC9FDCwoxSkN53nw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR04MB4425 X-Proofpoint-GUID: DH00IPFq01qaAT2-gQM6k_ledK9q3ztH X-Proofpoint-ORIG-GUID: DH00IPFq01qaAT2-gQM6k_ledK9q3ztH X-Sony-Outbound-GUID: DH00IPFq01qaAT2-gQM6k_ledK9q3ztH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-24_04,2022-11-23_01,2022-06-22_01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750359167764535884?= X-GMAIL-MSGID: =?utf-8?q?1750359167764535884?= Code refinement, no functional changes. Signed-off-by: Yuezhang Mo Reviewed-by: Andy Wu Reviewed-by: Aoyama Wataru --- fs/exfat/dir.c | 12 ++++++------ fs/exfat/inode.c | 4 ++-- fs/exfat/namei.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) -- 2.25.1 diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c index a9a0b3e46af2..c05493fc9124 100644 --- a/fs/exfat/dir.c +++ b/fs/exfat/dir.c @@ -44,7 +44,7 @@ static void exfat_get_uniname_from_ext_entry(struct super_block *sb, * Third entry : first file-name entry * So, the index of first file-name dentry should start from 2. */ - for (i = 2; i < es.num_entries; i++) { + for (i = ES_IDX_FIRST_FILENAME; i < es.num_entries; i++) { struct exfat_dentry *ep = exfat_get_dentry_cached(&es, i); /* end of name entry */ @@ -336,7 +336,7 @@ int exfat_calc_num_entries(struct exfat_uni_name *p_uniname) return -EINVAL; /* 1 file entry + 1 stream entry + name entries */ - return ((len - 1) / EXFAT_FILE_NAME_LEN + 3); + return ES_ENTRY_NUM(len); } unsigned int exfat_get_entry_type(struct exfat_dentry *ep) @@ -591,13 +591,13 @@ void exfat_update_dir_chksum_with_entry_set(struct exfat_entry_set_cache *es) unsigned short chksum = 0; struct exfat_dentry *ep; - for (i = 0; i < es->num_entries; i++) { + for (i = ES_IDX_FILE; i < es->num_entries; i++) { ep = exfat_get_dentry_cached(es, i); chksum = exfat_calc_chksum16(ep, DENTRY_SIZE, chksum, chksum_type); chksum_type = CS_DEFAULT; } - ep = exfat_get_dentry_cached(es, 0); + ep = exfat_get_dentry_cached(es, ES_IDX_FILE); ep->dentry.file.checksum = cpu_to_le16(chksum); es->modified = true; } @@ -858,7 +858,7 @@ int exfat_get_dentry_set(struct exfat_entry_set_cache *es, return -EIO; es->bh[es->num_bh++] = bh; - ep = exfat_get_dentry_cached(es, 0); + ep = exfat_get_dentry_cached(es, ES_IDX_FILE); if (!exfat_validate_entry(exfat_get_entry_type(ep), &mode)) goto put_es; @@ -895,7 +895,7 @@ int exfat_get_dentry_set(struct exfat_entry_set_cache *es, } /* validate cached dentries */ - for (i = 1; i < num_entries; i++) { + for (i = ES_IDX_STREAM; i < num_entries; i++) { ep = exfat_get_dentry_cached(es, i); if (!exfat_validate_entry(exfat_get_entry_type(ep), &mode)) goto put_es; diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c index a84eae72556d..dac5001bae9e 100644 --- a/fs/exfat/inode.c +++ b/fs/exfat/inode.c @@ -44,8 +44,8 @@ int __exfat_write_inode(struct inode *inode, int sync) /* get the directory entry of given file or directory */ if (exfat_get_dentry_set(&es, sb, &(ei->dir), ei->entry, ES_ALL_ENTRIES)) return -EIO; - ep = exfat_get_dentry_cached(&es, 0); - ep2 = exfat_get_dentry_cached(&es, 1); + ep = exfat_get_dentry_cached(&es, ES_IDX_FILE); + ep2 = exfat_get_dentry_cached(&es, ES_IDX_STREAM); ep->dentry.file.attr = cpu_to_le16(exfat_make_attr(inode)); diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index 57510d7f58cf..01e4e8c60bbe 100644 --- a/fs/exfat/namei.c +++ b/fs/exfat/namei.c @@ -646,8 +646,8 @@ static int exfat_find(struct inode *dir, struct qstr *qname, dentry = hint_opt.eidx; if (exfat_get_dentry_set(&es, sb, &cdir, dentry, ES_2_ENTRIES)) return -EIO; - ep = exfat_get_dentry_cached(&es, 0); - ep2 = exfat_get_dentry_cached(&es, 1); + ep = exfat_get_dentry_cached(&es, ES_IDX_FILE); + ep2 = exfat_get_dentry_cached(&es, ES_IDX_STREAM); info->type = exfat_get_entry_type(ep); info->attr = le16_to_cpu(ep->dentry.file.attr);