Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp2102043ybf; Mon, 2 Mar 2020 01:57:43 -0800 (PST) X-Google-Smtp-Source: ADFU+vv1JTta82pR721vEh1gMx2C2gv4QsRNlIw82asdA3tEbpWzKfe53rtaDET+jq47z8x2iMLl X-Received: by 2002:a05:6808:b29:: with SMTP id t9mr1921441oij.64.1583143063168; Mon, 02 Mar 2020 01:57:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583143063; cv=none; d=google.com; s=arc-20160816; b=JR2zhPh47jVJMut3m9vd4LXBPAzFZuAjm62FaNuKqpFScXfWevgR78upjuelGcGSPX HcBHq6h1k+mjqZVRt/ud8MDB/v55OGo9fmebCVtYRGp/p7bPwCrhogt4kq0xkruNEw6T ZDRegfRiwtQcOhlKVVhyiMtCXZjqvMRm/M/d/iFzsZo9OkT+mBzAaFuNrDOISI4EKQaG Wza8CeGzlBOh3BtIbXCUCHM6xKVb9Bx3D5vKGkBoFsGbpvyDcS6NdQKWqZR+X0jPCLH2 MwPa+UhGS5wgdYLm2LYNCpgAFsZCVmQUPYbJ+a62KunFuMVcx9+9x987tXlw/pFNwhPI WVuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=GhI1fglw/iJiOUr9A6lyKs4V2KRh8pfO8b1kanMrb4Q=; b=wg+lKgAPgPMEcQ2nkPO2J9zpj0tM743+vvz1Y6xkjpwvRLaT/TAswUMv0KdFa2z4d2 kNuaBPvLtn/qPTnC7QUZZy2+53+jaNIRraj6hDmn2MABWNOrUE7u6izZPQGii3yT2Mnm 0zxx2f4HEn0OFhn+kTdXGWmFwoIKCKvkEP0/sTmYekDfUMS3RCuy4r9q6LCjiTwhWogJ SD6+76EaPdKxMim2gLBmb3XH6ODPPA4udktyvhK57jYXAm+imEJegopQT5rTD5UH799w RqVHOpnlDdeCcOgF35fuWu/jK5MGNiwiWGLnRVVLjRkPfRvCzHlsoma47qFZIe8UwidI cGiA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a11si6257006otq.101.2020.03.02.01.57.31; Mon, 02 Mar 2020 01:57:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727573AbgCBJ5U (ORCPT + 99 others); Mon, 2 Mar 2020 04:57:20 -0500 Received: from mx04.melco.co.jp ([192.218.140.144]:56378 "EHLO mx04.melco.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727421AbgCBJ5U (ORCPT ); Mon, 2 Mar 2020 04:57:20 -0500 Received: from mr04.melco.co.jp (mr04 [133.141.98.166]) by mx04.melco.co.jp (Postfix) with ESMTP id 85D453A398E; Mon, 2 Mar 2020 18:57:18 +0900 (JST) Received: from mr04.melco.co.jp (unknown [127.0.0.1]) by mr04.imss (Postfix) with ESMTP id 48WFtQ3R5hzRk9s; Mon, 2 Mar 2020 18:57:18 +0900 (JST) Received: from mf03_second.melco.co.jp (unknown [192.168.20.183]) by mr04.melco.co.jp (Postfix) with ESMTP id 48WFtQ36lTzRk9l; Mon, 2 Mar 2020 18:57:18 +0900 (JST) Received: from mf03.melco.co.jp (unknown [133.141.98.183]) by mf03_second.melco.co.jp (Postfix) with ESMTP id 48WFtQ2js7zRkFV; Mon, 2 Mar 2020 18:57:18 +0900 (JST) Received: from tux532.tad.melco.co.jp (unknown [133.141.243.226]) by mf03.melco.co.jp (Postfix) with ESMTP id 48WFtQ2CcFzRk86; Mon, 2 Mar 2020 18:57:18 +0900 (JST) Received: from tux532.tad.melco.co.jp by tux532.tad.melco.co.jp (unknown) with ESMTP id 0229vINH027655; Mon, 2 Mar 2020 18:57:18 +0900 Received: from tux390.tad.melco.co.jp (tux390.tad.melco.co.jp [127.0.0.1]) by postfix.imss70 (Postfix) with ESMTP id 1D34317E075; Mon, 2 Mar 2020 18:57:18 +0900 (JST) Received: from tux554.tad.melco.co.jp (tadpost1.tad.melco.co.jp [10.168.7.223]) by tux390.tad.melco.co.jp (Postfix) with ESMTP id 07A3617E073; Mon, 2 Mar 2020 18:57:18 +0900 (JST) Received: from tux554.tad.melco.co.jp by tux554.tad.melco.co.jp (unknown) with ESMTP id 0229vH0s007040; Mon, 2 Mar 2020 18:57:17 +0900 From: Tetsuhiro Kohada To: Kohada.Tetsuhiro@dc.MitsubishiElectric.co.jp Cc: Mori.Takahiro@ab.MitsubishiElectric.co.jp, motai.hirotaka@aj.mitsubishielectric.co.jp, Valdis Kletnieks , Greg Kroah-Hartman , linux-fsdevel@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] staging: exfat: clean up d_entry rebuilding. Date: Mon, 2 Mar 2020 18:57:15 +0900 Message-Id: <20200302095716.64155-1-Kohada.Tetsuhiro@dc.MitsubishiElectric.co.jp> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Clean up d_entry rebuilding in exfat_rename_file() and move_file(). -Replace memcpy of d_entry with structure copy. -Change to use the value already stored in fid. Signed-off-by: Tetsuhiro Kohada --- drivers/staging/exfat/exfat_core.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/staging/exfat/exfat_core.c b/drivers/staging/exfat/exfat_core.c index ceaea1ba1a83..374a4fe183f5 100644 --- a/drivers/staging/exfat/exfat_core.c +++ b/drivers/staging/exfat/exfat_core.c @@ -2285,12 +2285,10 @@ s32 exfat_rename_file(struct inode *inode, struct chain_t *p_dir, s32 oldentry, return -ENOENT; } - memcpy((void *)epnew, (void *)epold, DENTRY_SIZE); - if (exfat_get_entry_type(epnew) == TYPE_FILE) { - exfat_set_entry_attr(epnew, - exfat_get_entry_attr(epnew) | - ATTR_ARCHIVE); + *epnew = *epold; + if (fid->type == TYPE_FILE) { fid->attr |= ATTR_ARCHIVE; + exfat_set_entry_attr(epnew, fid->attr); } exfat_buf_modify(sb, sector_new); exfat_buf_unlock(sb, sector_old); @@ -2306,7 +2304,7 @@ s32 exfat_rename_file(struct inode *inode, struct chain_t *p_dir, s32 oldentry, return -ENOENT; } - memcpy((void *)epnew, (void *)epold, DENTRY_SIZE); + *epnew = *epold; exfat_buf_modify(sb, sector_new); exfat_buf_unlock(sb, sector_old); @@ -2319,11 +2317,9 @@ s32 exfat_rename_file(struct inode *inode, struct chain_t *p_dir, s32 oldentry, num_old_entries); fid->entry = newentry; } else { - if (exfat_get_entry_type(epold) == TYPE_FILE) { - exfat_set_entry_attr(epold, - exfat_get_entry_attr(epold) | - ATTR_ARCHIVE); + if (fid->type == TYPE_FILE) { fid->attr |= ATTR_ARCHIVE; + exfat_set_entry_attr(epold, fid->attr); } exfat_buf_modify(sb, sector_old); exfat_buf_unlock(sb, sector_old); @@ -2387,11 +2383,10 @@ s32 move_file(struct inode *inode, struct chain_t *p_olddir, s32 oldentry, return -ENOENT; } - memcpy((void *)epnew, (void *)epmov, DENTRY_SIZE); - if (exfat_get_entry_type(epnew) == TYPE_FILE) { - exfat_set_entry_attr(epnew, exfat_get_entry_attr(epnew) | - ATTR_ARCHIVE); + *epnew = *epmov; + if (fid->type == TYPE_FILE) { fid->attr |= ATTR_ARCHIVE; + exfat_set_entry_attr(epnew, fid->attr); } exfat_buf_modify(sb, sector_new); exfat_buf_unlock(sb, sector_mov); @@ -2406,7 +2401,7 @@ s32 move_file(struct inode *inode, struct chain_t *p_olddir, s32 oldentry, return -ENOENT; } - memcpy((void *)epnew, (void *)epmov, DENTRY_SIZE); + *epnew = *epmov; exfat_buf_modify(sb, sector_new); exfat_buf_unlock(sb, sector_mov); -- 2.25.1