From nobody Sun Feb 8 18:28:30 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25FBAEB64DD for ; Mon, 3 Jul 2023 07:25:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229958AbjGCHZ5 (ORCPT ); Mon, 3 Jul 2023 03:25:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230114AbjGCHZs (ORCPT ); Mon, 3 Jul 2023 03:25:48 -0400 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5FEAE6C; Mon, 3 Jul 2023 00:25:34 -0700 (PDT) Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 1F2C31D74; Mon, 3 Jul 2023 07:20:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1688368821; bh=idQe/8I4/xtf47MoCwShCKiDMRqvp0LjVacaYr6AkWU=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=jqwwrq8B8R664q9ffRJjmOoR2X8CkRNU4rlXglrlwAsRvgRunVJuYY9Nzd/Serb3x wZNXxN6TabamoZsxq4gvnA44ipNC5KLs/YzKRjXVD6bnZ+qF++zZ+TN646VFIW2Hp8 g+7ng2XewnogU8vU+K6qNydqFDKkhcl9brgaeiik= Received: from [192.168.211.138] (192.168.211.138) by vdlg-exch-02.paragon-software.com (172.30.1.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Mon, 3 Jul 2023 10:25:32 +0300 Message-ID: Date: Mon, 3 Jul 2023 11:25:31 +0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: [PATCH 3/8] fs/ntfs3: Minor code refactoring and formatting Content-Language: en-US From: Konstantin Komarov To: CC: Linux Kernel Mailing List , References: In-Reply-To: Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [192.168.211.138] X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Trim spaces and clang-format. Add comment for mi_enum_attr. Signed-off-by: Konstantin Komarov --- =C2=A0fs/ntfs3/namei.c=C2=A0 | 2 +- =C2=A0fs/ntfs3/ntfs.h=C2=A0=C2=A0 | 2 +- =C2=A0fs/ntfs3/record.c | 6 ++++++ =C2=A0fs/ntfs3/super.c=C2=A0 | 3 +-- =C2=A0fs/ntfs3/xattr.c=C2=A0 | 3 ++- =C2=A05 files changed, 11 insertions(+), 5 deletions(-) diff --git a/fs/ntfs3/namei.c b/fs/ntfs3/namei.c index 70f8c859e0ad..dd38dbf30add 100644 --- a/fs/ntfs3/namei.c +++ b/fs/ntfs3/namei.c @@ -376,7 +376,7 @@ static int ntfs_atomic_open(struct inode *dir,=20 struct dentry *dentry, =C2=A0#ifdef CONFIG_NTFS3_FS_POSIX_ACL =C2=A0=C2=A0=C2=A0 =C2=A0if (IS_POSIXACL(dir)) { -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0/* +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0/* =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0 * Load in cache current acl t= o avoid ni_lock(dir): =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0 * ntfs_create_inode -> ntfs_i= nit_acl -> posix_acl_create -> =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0 * ntfs_get_acl -> ntfs_get_ac= l_ex -> ni_lock diff --git a/fs/ntfs3/ntfs.h b/fs/ntfs3/ntfs.h index 98b76d1b09e7..86aecbb01a92 100644 --- a/fs/ntfs3/ntfs.h +++ b/fs/ntfs3/ntfs.h @@ -847,7 +847,7 @@ struct OBJECT_ID { =C2=A0=C2=A0=C2=A0 =C2=A0// Birth Volume Id is the Object Id of the Volume= on. =C2=A0=C2=A0=C2=A0 =C2=A0// which the Object Id was allocated. It never ch= anges. =C2=A0=C2=A0=C2=A0 =C2=A0struct GUID BirthVolumeId; //0x10: - + =C2=A0=C2=A0=C2=A0 =C2=A0// Birth Object Id is the first Object Id that was =C2=A0=C2=A0=C2=A0 =C2=A0// ever assigned to this MFT Record. I.e. If the = Object Id =C2=A0=C2=A0=C2=A0 =C2=A0// is changed for some reason, this field will re= flect the diff --git a/fs/ntfs3/record.c b/fs/ntfs3/record.c index c12ebffc94da..cae939cb42cf 100644 --- a/fs/ntfs3/record.c +++ b/fs/ntfs3/record.c @@ -189,6 +189,12 @@ int mi_read(struct mft_inode *mi, bool is_mft) =C2=A0=C2=A0=C2=A0 =C2=A0return err; =C2=A0} +/* + * mi_enum_attr - start/continue attributes enumeration in record. + * + * NOTE: mi->mrec - memory of size sbi->record_size + * here we sure that mi->mrec->total =3D=3D sbi->record_size (see mi_read) + */ =C2=A0struct ATTRIB *mi_enum_attr(struct mft_inode *mi, struct ATTRIB *att= r) =C2=A0{ =C2=A0=C2=A0=C2=A0 =C2=A0const struct MFT_REC *rec =3D mi->mrec; diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index 1a02072b6b0e..d24f2da36bb2 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -488,7 +488,6 @@ static ssize_t ntfs3_label_write(struct file *file,=20 const char __user *buffer, =C2=A0{ =C2=A0=C2=A0=C2=A0 =C2=A0int err; =C2=A0=C2=A0=C2=A0 =C2=A0struct super_block *sb =3D pde_data(file_inode(fi= le)); -=C2=A0=C2=A0 =C2=A0struct ntfs_sb_info *sbi =3D sb->s_fs_info; =C2=A0=C2=A0=C2=A0 =C2=A0ssize_t ret =3D count; =C2=A0=C2=A0=C2=A0 =C2=A0u8 *label =3D kmalloc(count, GFP_NOFS); @@ -502,7 +501,7 @@ static ssize_t ntfs3_label_write(struct file *file,=20 const char __user *buffer, =C2=A0=C2=A0=C2=A0 =C2=A0while (ret > 0 && label[ret - 1] =3D=3D '\n') =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0ret -=3D 1; -=C2=A0=C2=A0 =C2=A0err =3D ntfs_set_label(sbi, label, ret); +=C2=A0=C2=A0 =C2=A0err =3D ntfs_set_label(sb->s_fs_info, label, ret); =C2=A0=C2=A0=C2=A0 =C2=A0if (err < 0) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0ntfs_err(sb, "failed (%d) to w= rite label", err); diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c index 1a518550c317..c59d6f5a725a 100644 --- a/fs/ntfs3/xattr.c +++ b/fs/ntfs3/xattr.c @@ -211,7 +211,8 @@ static ssize_t ntfs_list_ea(struct ntfs_inode *ni,=20 char *buffer, =C2=A0=C2=A0=C2=A0 =C2=A0size =3D le32_to_cpu(info->size); =C2=A0=C2=A0=C2=A0 =C2=A0/* Enumerate all xattrs. */ -=C2=A0=C2=A0 =C2=A0for (ret =3D 0, off =3D 0; off + sizeof(struct EA_FULL)= < size; off +=3D=20 ea_size) { +=C2=A0=C2=A0 =C2=A0ret =3D 0; +=C2=A0=C2=A0 =C2=A0for (off =3D 0; off + sizeof(struct EA_FULL) < size; of= f +=3D ea_size) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0ea =3D Add2Ptr(ea_all, off); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0ea_size =3D unpacked_ea_size(e= a); --=20 2.34.1