From nobody Wed Feb 11 16:10:14 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 68A9EC77B7F for ; Mon, 8 May 2023 12:39:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234252AbjEHMjD (ORCPT ); Mon, 8 May 2023 08:39:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234633AbjEHMi5 (ORCPT ); Mon, 8 May 2023 08:38:57 -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 3C93539196; Mon, 8 May 2023 05:38:49 -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 7713221C3; Mon, 8 May 2023 12:34:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1683549240; bh=d84Ds9/cfWxjNs2/jfAkCt+5qkUgSqpdu5xT/2Jr3EI=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=baKqxaTL8KClyo2ZLOJzvkpx/AItLISWL6uH91JodSZwMNMyE5ulsY3OFgJAvIxlG gFZQLSyDcq4tthScvZirvZ3XkcBeP5vSSTFRnD8EIgwpMZVnSsp8bW+2GgfcXswEZe O9219w2ELaLMb297vuqHSbDNdGnQQxRo06UBqXsw= Received: from [192.168.211.146] (192.168.211.146) 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, 8 May 2023 15:38:46 +0300 Message-ID: <4356fa5f-db35-4e2a-35bb-8f727a08dd63@paragon-software.com> Date: Mon, 8 May 2023 16:38:46 +0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: [PATCH 07/10] fs/ntfs3: Code refactoring 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.146] X-ClientProxiedBy: vobn-exch-01.paragon-software.com (172.30.72.13) To vdlg-exch-02.paragon-software.com (172.30.1.105) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Check functions arguments. Use u8 instead of size_t for ntfs names, more=20 consts and other. Signed-off-by: Konstantin Komarov --- =C2=A0fs/ntfs3/attrlist.c |=C2=A0=C2=A0 3 +- =C2=A0fs/ntfs3/frecord.c=C2=A0 |=C2=A0=C2=A0 2 +- =C2=A0fs/ntfs3/fsntfs.c=C2=A0=C2=A0 |=C2=A0 37 +++++++-------- =C2=A0fs/ntfs3/inode.c=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0 5 +- =C2=A0fs/ntfs3/ntfs.h=C2=A0=C2=A0=C2=A0=C2=A0 | 108 ++++++++++++++++++++++= ++-------------------- =C2=A0fs/ntfs3/ntfs_fs.h=C2=A0 |=C2=A0 12 ++--- =C2=A0fs/ntfs3/record.c=C2=A0=C2=A0 |=C2=A0=C2=A0 2 +- =C2=A07 files changed, 88 insertions(+), 81 deletions(-) diff --git a/fs/ntfs3/attrlist.c b/fs/ntfs3/attrlist.c index 81c22df27c72..42631b31adf1 100644 --- a/fs/ntfs3/attrlist.c +++ b/fs/ntfs3/attrlist.c @@ -375,8 +375,7 @@ bool al_remove_le(struct ntfs_inode *ni, struct=20 ATTR_LIST_ENTRY *le) =C2=A0 * al_delete_le - Delete first le from the list which matches its=20 parameters. =C2=A0 */ =C2=A0bool al_delete_le(struct ntfs_inode *ni, enum ATTR_TYPE type, CLST v= cn, -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 const __le16 *name, size_t na= me_len, -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 const struct MFT_REF *ref) +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 const __le16 *name, u8 name_l= en, const struct MFT_REF *ref) =C2=A0{ =C2=A0=C2=A0=C2=A0 =C2=A0u16 size; =C2=A0=C2=A0=C2=A0 =C2=A0struct ATTR_LIST_ENTRY *le; diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c index 4227e3f590a5..be59bd399fd1 100644 --- a/fs/ntfs3/frecord.c +++ b/fs/ntfs3/frecord.c @@ -384,7 +384,7 @@ bool ni_add_subrecord(struct ntfs_inode *ni, CLST=20 rno, struct mft_inode **mi) =C2=A0 * ni_remove_attr - Remove all attributes for the given type/name/id. =C2=A0 */ =C2=A0int ni_remove_attr(struct ntfs_inode *ni, enum ATTR_TYPE type, -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 const __le16 *name, siz= e_t name_len, bool base_only, +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 const __le16 *name, u8 = name_len, bool base_only, =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 const __le16 *id) =C2=A0{ =C2=A0=C2=A0=C2=A0 =C2=A0int err; diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c index 1a0527e81ebb..1c05c088d1c6 100644 --- a/fs/ntfs3/fsntfs.c +++ b/fs/ntfs3/fsntfs.c @@ -1661,7 +1661,8 @@ int ntfs_vbo_to_lbo(struct ntfs_sb_info *sbi,=20 const struct runs_tree *run, =C2=A0=C2=A0=C2=A0 =C2=A0return 0; =C2=A0} -struct ntfs_inode *ntfs_new_inode(struct ntfs_sb_info *sbi, CLST rno,=20 bool dir) +struct ntfs_inode *ntfs_new_inode(struct ntfs_sb_info *sbi, CLST rno, +=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 enum RECORD_FLAG flag) =C2=A0{ =C2=A0=C2=A0=C2=A0 =C2=A0int err =3D 0; =C2=A0=C2=A0=C2=A0 =C2=A0struct super_block *sb =3D sbi->sb; @@ -1673,8 +1674,7 @@ struct ntfs_inode *ntfs_new_inode(struct=20 ntfs_sb_info *sbi, CLST rno, bool dir) =C2=A0=C2=A0=C2=A0 =C2=A0ni =3D ntfs_i(inode); -=C2=A0=C2=A0 =C2=A0err =3D mi_format_new(&ni->mi, sbi, rno, dir ? RECORD_F= LAG_DIR : 0, -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2= =A0 false); +=C2=A0=C2=A0 =C2=A0err =3D mi_format_new(&ni->mi, sbi, rno, flag, false); =C2=A0=C2=A0=C2=A0 =C2=A0if (err) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0goto out; @@ -1937,7 +1937,7 @@ int ntfs_security_init(struct ntfs_sb_info *sbi) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0break; =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0sii_e =3D (struct NTFS_DE_SII = *)ne; -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (le16_to_cpu(ne->view.data_size) = < SIZEOF_SECURITY_HDR) +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (le16_to_cpu(ne->view.data_size) = < sizeof(sii_e->sec_hdr)) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0continue; =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0next_id =3D le32_to_cpu(sii_e-= >sec_id) + 1; @@ -1998,18 +1998,18 @@ int ntfs_get_security_by_id(struct ntfs_sb_info=20 *sbi, __le32 security_id, =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0goto out; =C2=A0=C2=A0=C2=A0 =C2=A0t32 =3D le32_to_cpu(sii_e->sec_hdr.size); -=C2=A0=C2=A0 =C2=A0if (t32 < SIZEOF_SECURITY_HDR) { +=C2=A0=C2=A0 =C2=A0if (t32 < sizeof(struct SECURITY_HDR)) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0err =3D -EINVAL; =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0goto out; =C2=A0=C2=A0=C2=A0 =C2=A0} -=C2=A0=C2=A0 =C2=A0if (t32 > SIZEOF_SECURITY_HDR + 0x10000) { +=C2=A0=C2=A0 =C2=A0if (t32 > sizeof(struct SECURITY_HDR) + 0x10000) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0/* Looks like too big security= . 0x10000 - is arbitrary big=20 number. */ =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0err =3D -EFBIG; =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0goto out; =C2=A0=C2=A0=C2=A0 =C2=A0} -=C2=A0=C2=A0 =C2=A0*size =3D t32 - SIZEOF_SECURITY_HDR; +=C2=A0=C2=A0 =C2=A0*size =3D t32 - sizeof(struct SECURITY_HDR); =C2=A0=C2=A0=C2=A0 =C2=A0p =3D kmalloc(*size, GFP_NOFS); =C2=A0=C2=A0=C2=A0 =C2=A0if (!p) { @@ -2023,14 +2023,14 @@ int ntfs_get_security_by_id(struct ntfs_sb_info=20 *sbi, __le32 security_id, =C2=A0=C2=A0=C2=A0 =C2=A0if (err) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0goto out; -=C2=A0=C2=A0 =C2=A0if (memcmp(&d_security, &sii_e->sec_hdr, SIZEOF_SECURIT= Y_HDR)) { +=C2=A0=C2=A0 =C2=A0if (memcmp(&d_security, &sii_e->sec_hdr, sizeof(d_secur= ity))) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0err =3D -EINVAL; =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0goto out; =C2=A0=C2=A0=C2=A0 =C2=A0} =C2=A0=C2=A0=C2=A0 =C2=A0err =3D ntfs_read_run_nb(sbi, &ni->file.run, =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 le64_to_cpu(sii_e->sec_hdr.off) + -=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 SIZEOF_SECURITY_HDR, +=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 sizeof(struct SECURITY_HDR), =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 p, *size, NULL); =C2=A0=C2=A0=C2=A0 =C2=A0if (err) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0goto out; @@ -2069,7 +2069,7 @@ int ntfs_insert_security(struct ntfs_sb_info *sbi, =C2=A0=C2=A0=C2=A0 =C2=A0struct NTFS_DE_SDH sdh_e; =C2=A0=C2=A0=C2=A0 =C2=A0struct NTFS_DE_SII sii_e; =C2=A0=C2=A0=C2=A0 =C2=A0struct SECURITY_HDR *d_security; -=C2=A0=C2=A0 =C2=A0u32 new_sec_size =3D size_sd + SIZEOF_SECURITY_HDR; +=C2=A0=C2=A0 =C2=A0u32 new_sec_size =3D size_sd + sizeof(struct SECURITY_H= DR); =C2=A0=C2=A0=C2=A0 =C2=A0u32 aligned_sec_size =3D ALIGN(new_sec_size, 16); =C2=A0=C2=A0=C2=A0 =C2=A0struct SECURITY_KEY hash_key; =C2=A0=C2=A0=C2=A0 =C2=A0struct ntfs_fnd *fnd_sdh =3D NULL; @@ -2207,14 +2207,14 @@ int ntfs_insert_security(struct ntfs_sb_info *sbi, =C2=A0=C2=A0=C2=A0 =C2=A0/* Fill SII entry. */ =C2=A0=C2=A0=C2=A0 =C2=A0sii_e.de.view.data_off =3D =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0cpu_to_le16(offsetof(struct NT= FS_DE_SII, sec_hdr)); -=C2=A0=C2=A0 =C2=A0sii_e.de.view.data_size =3D cpu_to_le16(SIZEOF_SECURITY= _HDR); +=C2=A0=C2=A0 =C2=A0sii_e.de.view.data_size =3D cpu_to_le16(sizeof(struct S= ECURITY_HDR)); =C2=A0=C2=A0=C2=A0 =C2=A0sii_e.de.view.res =3D 0; -=C2=A0=C2=A0 =C2=A0sii_e.de.size =3D cpu_to_le16(SIZEOF_SII_DIRENTRY); +=C2=A0=C2=A0 =C2=A0sii_e.de.size =3D cpu_to_le16(sizeof(struct NTFS_DE_SII= )); =C2=A0=C2=A0=C2=A0 =C2=A0sii_e.de.key_size =3D cpu_to_le16(sizeof(d_securi= ty->key.sec_id)); =C2=A0=C2=A0=C2=A0 =C2=A0sii_e.de.flags =3D 0; =C2=A0=C2=A0=C2=A0 =C2=A0sii_e.de.res =3D 0; =C2=A0=C2=A0=C2=A0 =C2=A0sii_e.sec_id =3D d_security->key.sec_id; -=C2=A0=C2=A0 =C2=A0memcpy(&sii_e.sec_hdr, d_security, SIZEOF_SECURITY_HDR); +=C2=A0=C2=A0 =C2=A0memcpy(&sii_e.sec_hdr, d_security, sizeof(struct SECURI= TY_HDR)); =C2=A0=C2=A0=C2=A0 =C2=A0err =3D indx_insert_entry(indx_sii, ni, &sii_e.de= , NULL, NULL, 0); =C2=A0=C2=A0=C2=A0 =C2=A0if (err) @@ -2223,7 +2223,7 @@ int ntfs_insert_security(struct ntfs_sb_info *sbi, =C2=A0=C2=A0=C2=A0 =C2=A0/* Fill SDH entry. */ =C2=A0=C2=A0=C2=A0 =C2=A0sdh_e.de.view.data_off =3D =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0cpu_to_le16(offsetof(struct NT= FS_DE_SDH, sec_hdr)); -=C2=A0=C2=A0 =C2=A0sdh_e.de.view.data_size =3D cpu_to_le16(SIZEOF_SECURITY= _HDR); +=C2=A0=C2=A0 =C2=A0sdh_e.de.view.data_size =3D cpu_to_le16(sizeof(struct S= ECURITY_HDR)); =C2=A0=C2=A0=C2=A0 =C2=A0sdh_e.de.view.res =3D 0; =C2=A0=C2=A0=C2=A0 =C2=A0sdh_e.de.size =3D cpu_to_le16(SIZEOF_SDH_DIRENTRY= ); =C2=A0=C2=A0=C2=A0 =C2=A0sdh_e.de.key_size =3D cpu_to_le16(sizeof(sdh_e.ke= y)); @@ -2231,7 +2231,7 @@ int ntfs_insert_security(struct ntfs_sb_info *sbi, =C2=A0=C2=A0=C2=A0 =C2=A0sdh_e.de.res =3D 0; =C2=A0=C2=A0=C2=A0 =C2=A0sdh_e.key.hash =3D d_security->key.hash; =C2=A0=C2=A0=C2=A0 =C2=A0sdh_e.key.sec_id =3D d_security->key.sec_id; -=C2=A0=C2=A0 =C2=A0memcpy(&sdh_e.sec_hdr, d_security, SIZEOF_SECURITY_HDR); +=C2=A0=C2=A0 =C2=A0memcpy(&sdh_e.sec_hdr, d_security, sizeof(struct SECURI= TY_HDR)); =C2=A0=C2=A0=C2=A0 =C2=A0sdh_e.magic[0] =3D cpu_to_le16('I'); =C2=A0=C2=A0=C2=A0 =C2=A0sdh_e.magic[1] =3D cpu_to_le16('I'); @@ -2522,7 +2522,8 @@ void mark_as_free_ex(struct ntfs_sb_info *sbi,=20 CLST lcn, CLST len, bool trim) =C2=A0/* =C2=A0 * run_deallocate - Deallocate clusters. =C2=A0 */ -int run_deallocate(struct ntfs_sb_info *sbi, struct runs_tree *run,=20 bool trim) +int run_deallocate(struct ntfs_sb_info *sbi, const struct runs_tree *run, +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 bool trim) =C2=A0{ =C2=A0=C2=A0=C2=A0 =C2=A0CLST lcn, len; =C2=A0=C2=A0=C2=A0 =C2=A0size_t idx =3D 0; @@ -2578,13 +2579,13 @@ static inline bool=20 name_has_forbidden_chars(const struct le_str *fname) =C2=A0=C2=A0=C2=A0 =C2=A0return false; =C2=A0} -static inline bool is_reserved_name(struct ntfs_sb_info *sbi, +static inline bool is_reserved_name(const struct ntfs_sb_info *sbi, =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 const struct le_str *fname) =C2=A0{ =C2=A0=C2=A0=C2=A0 =C2=A0int port_digit; =C2=A0=C2=A0=C2=A0 =C2=A0const __le16 *name =3D fname->name; =C2=A0=C2=A0=C2=A0 =C2=A0int len =3D fname->len; -=C2=A0=C2=A0 =C2=A0u16 *upcase =3D sbi->upcase; +=C2=A0=C2=A0 =C2=A0const u16 *upcase =3D sbi->upcase; =C2=A0=C2=A0=C2=A0 =C2=A0/* check for 3 chars reserved names (device names= ) */ =C2=A0=C2=A0=C2=A0 =C2=A0/* name by itself or with any extension is forbid= den */ diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index f699cc053655..dc7e7ab701c6 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -1309,7 +1309,7 @@ struct inode *ntfs_create_inode(struct mnt_idmap=20 *idmap, struct inode *dir, =C2=A0=C2=A0=C2=A0 =C2=A0if (err) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0goto out2; -=C2=A0=C2=A0 =C2=A0ni =3D ntfs_new_inode(sbi, ino, fa & FILE_ATTRIBUTE_DIR= ECTORY); +=C2=A0=C2=A0 =C2=A0ni =3D ntfs_new_inode(sbi, ino, S_ISDIR(mode) ? RECORD_= FLAG_DIR : 0); =C2=A0=C2=A0=C2=A0 =C2=A0if (IS_ERR(ni)) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0err =3D PTR_ERR(ni); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0ni =3D NULL; @@ -1437,8 +1437,7 @@ struct inode *ntfs_create_inode(struct mnt_idmap=20 *idmap, struct inode *dir, =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0root =3D Add2Ptr(attr, sizeof(= I30_NAME) + SIZEOF_RESIDENT); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0memcpy(root, dir_root, offseto= f(struct INDEX_ROOT, ihdr)); -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0root->ihdr.de_off =3D -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0cpu_to_le32(sizeo= f(struct INDEX_HDR)); // 0x10 +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0root->ihdr.de_off =3D cpu_to_le32(si= zeof(struct INDEX_HDR)); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0root->ihdr.used =3D cpu_to_le3= 2(sizeof(struct INDEX_HDR) + =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=C2=A0=C2=A0 sizeof(struct N= TFS_DE)); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0root->ihdr.total =3D root->ihd= r.used; diff --git a/fs/ntfs3/ntfs.h b/fs/ntfs3/ntfs.h index 90151e56c122..3ec2eaf31996 100644 --- a/fs/ntfs3/ntfs.h +++ b/fs/ntfs3/ntfs.h @@ -95,11 +95,10 @@ enum RECORD_NUM { =C2=A0=C2=A0=C2=A0 =C2=A0MFT_REC_BITMAP=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=3D 6, =C2=A0=C2=A0=C2=A0 =C2=A0MFT_REC_BOOT=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=3D 7, =C2=A0=C2=A0=C2=A0 =C2=A0MFT_REC_BADCLUST=C2=A0=C2=A0 =C2=A0=3D 8, -=C2=A0=C2=A0 =C2=A0//MFT_REC_QUOTA=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =3D 9, -=C2=A0=C2=A0 =C2=A0MFT_REC_SECURE=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=3D= 9, // NTFS 3.0 +=C2=A0=C2=A0 =C2=A0MFT_REC_SECURE=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=3D= 9, =C2=A0=C2=A0=C2=A0 =C2=A0MFT_REC_UPCASE=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=3D 10, -=C2=A0=C2=A0 =C2=A0MFT_REC_EXTEND=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=3D= 11, // NTFS 3.0 -=C2=A0=C2=A0 =C2=A0MFT_REC_RESERVED=C2=A0=C2=A0 =C2=A0=3D 11, +=C2=A0=C2=A0 =C2=A0MFT_REC_EXTEND=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=3D= 11, +=C2=A0=C2=A0 =C2=A0MFT_REC_RESERVED=C2=A0=C2=A0 =C2=A0=3D 12, =C2=A0=C2=A0=C2=A0 =C2=A0MFT_REC_FREE=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=3D 16, =C2=A0=C2=A0=C2=A0 =C2=A0MFT_REC_USER=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=3D 24, =C2=A0}; @@ -109,7 +108,6 @@ enum ATTR_TYPE { =C2=A0=C2=A0=C2=A0 =C2=A0ATTR_STD=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=3D= cpu_to_le32(0x10), =C2=A0=C2=A0=C2=A0 =C2=A0ATTR_LIST=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =3D cpu_to_le32(0x20), =C2=A0=C2=A0=C2=A0 =C2=A0ATTR_NAME=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =3D cpu_to_le32(0x30), -=C2=A0=C2=A0 =C2=A0// ATTR_VOLUME_VERSION on Nt4 =C2=A0=C2=A0=C2=A0 =C2=A0ATTR_ID=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 =C2=A0=3D cpu_to_le32(0x40), =C2=A0=C2=A0=C2=A0 =C2=A0ATTR_SECURE=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =3D cpu_to_le32(0x50), =C2=A0=C2=A0=C2=A0 =C2=A0ATTR_LABEL=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =3D cpu_to_le32(0x60), @@ -118,7 +116,6 @@ enum ATTR_TYPE { =C2=A0=C2=A0=C2=A0 =C2=A0ATTR_ROOT=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =3D cpu_to_le32(0x90), =C2=A0=C2=A0=C2=A0 =C2=A0ATTR_ALLOC=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =3D cpu_to_le32(0xA0), =C2=A0=C2=A0=C2=A0 =C2=A0ATTR_BITMAP=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =3D cpu_to_le32(0xB0), -=C2=A0=C2=A0 =C2=A0// ATTR_SYMLINK on Nt4 =C2=A0=C2=A0=C2=A0 =C2=A0ATTR_REPARSE=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=3D cpu_to_le32(0xC0), =C2=A0=C2=A0=C2=A0 =C2=A0ATTR_EA_INFO=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=3D cpu_to_le32(0xD0), =C2=A0=C2=A0=C2=A0 =C2=A0ATTR_EA=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 =C2=A0=3D cpu_to_le32(0xE0), @@ -144,6 +141,7 @@ enum FILE_ATTRIBUTE { =C2=A0=C2=A0=C2=A0 =C2=A0FILE_ATTRIBUTE_ENCRYPTED=C2=A0=C2=A0 =C2=A0=3D cp= u_to_le32(0x00004000), =C2=A0=C2=A0=C2=A0 =C2=A0FILE_ATTRIBUTE_VALID_FLAGS=C2=A0=C2=A0 =C2=A0=3D = cpu_to_le32(0x00007fb7), =C2=A0=C2=A0=C2=A0 =C2=A0FILE_ATTRIBUTE_DIRECTORY=C2=A0=C2=A0 =C2=A0=3D cp= u_to_le32(0x10000000), +=C2=A0=C2=A0 =C2=A0FILE_ATTRIBUTE_INDEX=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=3D cpu_to_le32(0x20000000) =C2=A0}; =C2=A0static_assert(sizeof(enum FILE_ATTRIBUTE) =3D=3D 4); @@ -266,7 +264,7 @@ enum RECORD_FLAG { =C2=A0=C2=A0=C2=A0 =C2=A0RECORD_FLAG_IN_USE=C2=A0=C2=A0 =C2=A0=3D cpu_to_l= e16(0x0001), =C2=A0=C2=A0=C2=A0 =C2=A0RECORD_FLAG_DIR=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=3D cpu_to_le16(0x0002), =C2=A0=C2=A0=C2=A0 =C2=A0RECORD_FLAG_SYSTEM=C2=A0=C2=A0 =C2=A0=3D cpu_to_l= e16(0x0004), -=C2=A0=C2=A0 =C2=A0RECORD_FLAG_UNKNOWN=C2=A0=C2=A0 =C2=A0=3D cpu_to_le16(0= x0008), +=C2=A0=C2=A0 =C2=A0RECORD_FLAG_INDEX=C2=A0=C2=A0 =C2=A0=3D cpu_to_le16(0x0= 008), =C2=A0}; =C2=A0/* MFT Record structure. */ @@ -331,18 +329,18 @@ struct ATTR_NONRESIDENT { =C2=A0=C2=A0=C2=A0 =C2=A0__le64 svcn;=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0// 0x10: Starting VCN of this segment. =C2=A0=C2=A0=C2=A0 =C2=A0__le64 evcn;=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0// 0x18: End VCN of this segment. =C2=A0=C2=A0=C2=A0 =C2=A0__le16 run_off;=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0// 0x20: Offset to packed runs. -=C2=A0=C2=A0 =C2=A0//=C2=A0 Unit of Compression size for this stream, expr= essed -=C2=A0=C2=A0 =C2=A0//=C2=A0 as a log of the cluster size. +=C2=A0=C2=A0 =C2=A0// Unit of Compression size for this stream, expressed +=C2=A0=C2=A0 =C2=A0// as a log of the cluster size. =C2=A0=C2=A0=C2=A0 =C2=A0// -=C2=A0=C2=A0 =C2=A0//=C2=A0=C2=A0 =C2=A00 means file is not compressed -=C2=A0=C2=A0 =C2=A0//=C2=A0=C2=A0 =C2=A01, 2, 3, and 4 are potentially leg= al values if the -=C2=A0=C2=A0 =C2=A0//=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0 stream is compr= essed, however the implementation -=C2=A0=C2=A0 =C2=A0//=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0 may only choose= to use 4, or possibly 3.=C2=A0 Note -=C2=A0=C2=A0 =C2=A0//=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0 that 4 means cl= uster size time 16.=C2=A0=C2=A0 =C2=A0If convenient -=C2=A0=C2=A0 =C2=A0//=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0 the implementat= ion may wish to accept a -=C2=A0=C2=A0 =C2=A0//=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0 reasonable rang= e of legal values here (1-5?), -=C2=A0=C2=A0 =C2=A0//=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0 even if the imp= lementation only generates -=C2=A0=C2=A0 =C2=A0//=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0 a smaller set o= f values itself. +=C2=A0=C2=A0 =C2=A0// 0 means file is not compressed +=C2=A0=C2=A0 =C2=A0// 1, 2, 3, and 4 are potentially legal values if the +=C2=A0=C2=A0 =C2=A0// stream is compressed, however the implementation +=C2=A0=C2=A0 =C2=A0// may only choose to use 4, or possibly 3. +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 // Note that 4 means cluster si= ze time 16. +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 // If convenient the implementa= tion may wish to accept a +=C2=A0=C2=A0 =C2=A0// reasonable range of legal values here (1-5?), +=C2=A0=C2=A0 =C2=A0// even if the implementation only generates +=C2=A0=C2=A0 =C2=A0// a smaller set of values itself. =C2=A0=C2=A0=C2=A0 =C2=A0u8 c_unit;=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0/= / 0x22: =C2=A0=C2=A0=C2=A0 =C2=A0u8 res1[5];=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= // 0x23: =C2=A0=C2=A0=C2=A0 =C2=A0__le64 alloc_size;=C2=A0=C2=A0 =C2=A0// 0x28: The= allocated size of attribute in=20 bytes. @@ -836,16 +834,22 @@ static_assert(sizeof(struct ATTR_DEF_ENTRY) =3D=3D 0x= a0); =C2=A0/* Object ID (0x40) */ =C2=A0struct OBJECT_ID { =C2=A0=C2=A0=C2=A0 =C2=A0struct GUID ObjId;=C2=A0=C2=A0 =C2=A0// 0x00: Uni= que Id assigned to file. -=C2=A0=C2=A0 =C2=A0struct GUID BirthVolumeId; // 0x10: Birth Volume Id is = the Object=20 Id of the Volume on. -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0// which the Object Id was allocated. It never changes. -=C2=A0=C2=A0 =C2=A0struct GUID BirthObjectId; // 0x20: Birth Object Id is = the first=20 Object Id that was -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =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=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0// is changed for some reason, this field will reflect the -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0// original value of the Object Id. -=C2=A0=C2=A0 =C2=A0struct GUID DomainId;=C2=A0=C2=A0 =C2=A0// 0x30: Domain= Id is currently unused but=20 it is intended to be -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0// used in a network environment where the local machine is -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0// part of a Windows 2000 Domain. This may be used in a=20 Windows -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0// 2000 Advanced Server managed domain. + +=C2=A0=C2=A0 =C2=A0// Birth Volume Id is the Object Id of the Volume on. +=C2=A0=C2=A0 =C2=A0// which the Object Id was allocated. It never changes. +=C2=A0=C2=A0 =C2=A0struct GUID BirthVolumeId; //0x10: + +=C2=A0=C2=A0 =C2=A0// Birth Object Id is the first Object Id that was +=C2=A0=C2=A0 =C2=A0// ever assigned to this MFT Record. I.e. If the Object= Id +=C2=A0=C2=A0 =C2=A0// is changed for some reason, this field will reflect = the +=C2=A0=C2=A0 =C2=A0// original value of the Object Id. +=C2=A0=C2=A0 =C2=A0struct GUID BirthObjectId; // 0x20: + +=C2=A0=C2=A0 =C2=A0// Domain Id is currently unused but it is intended to = be +=C2=A0=C2=A0 =C2=A0// used in a network environment where the local machin= e is +=C2=A0=C2=A0 =C2=A0// part of a Windows 2000 Domain. This may be used in a= Windows +=C2=A0=C2=A0 =C2=A0// 2000 Advanced Server managed domain. +=C2=A0=C2=A0 =C2=A0struct GUID DomainId;=C2=A0=C2=A0 =C2=A0// 0x30: =C2=A0}; =C2=A0static_assert(sizeof(struct OBJECT_ID) =3D=3D 0x40); @@ -855,32 +859,35 @@ struct NTFS_DE_O { =C2=A0=C2=A0=C2=A0 =C2=A0struct NTFS_DE de; =C2=A0=C2=A0=C2=A0 =C2=A0struct GUID ObjId;=C2=A0=C2=A0 =C2=A0// 0x10: Uni= que Id assigned to file. =C2=A0=C2=A0=C2=A0 =C2=A0struct MFT_REF ref;=C2=A0=C2=A0 =C2=A0// 0x20: MF= T record number with this file. -=C2=A0=C2=A0 =C2=A0struct GUID BirthVolumeId; // 0x28: Birth Volume Id is = the Object=20 Id of the Volume on -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0// which the Object Id was allocated. It never changes. -=C2=A0=C2=A0 =C2=A0struct GUID BirthObjectId; // 0x38: Birth Object Id is = the first=20 Object Id that was -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =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=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0// is changed for some reason, this field will reflect the -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0// original value of the Object Id. -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0// This field is valid if data_size =3D=3D 0x48. -=C2=A0=C2=A0 =C2=A0struct GUID BirthDomainId; // 0x48: Domain Id is curren= tly unused=20 but it is intended -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0// to be used in a network environment where the local -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0// machine is part of a Windows 2000 Domain. This may be -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0// used in a Windows 2000 Advanced Server managed domain. + +=C2=A0=C2=A0 =C2=A0// Birth Volume Id is the Object Id of the Volume on +=C2=A0=C2=A0 =C2=A0// which the Object Id was allocated. It never changes. +=C2=A0=C2=A0 =C2=A0struct GUID BirthVolumeId; // 0x28: + +=C2=A0=C2=A0 =C2=A0// Birth Object Id is the first Object Id that was +=C2=A0=C2=A0 =C2=A0// ever assigned to this MFT Record. I.e. If the Object= Id +=C2=A0=C2=A0 =C2=A0// is changed for some reason, this field will reflect = the +=C2=A0=C2=A0 =C2=A0// original value of the Object Id. +=C2=A0=C2=A0 =C2=A0// This field is valid if data_size =3D=3D 0x48. +=C2=A0=C2=A0 =C2=A0struct GUID BirthObjectId; // 0x38: + +=C2=A0=C2=A0 =C2=A0// Domain Id is currently unused but it is intended +=C2=A0=C2=A0 =C2=A0// to be used in a network environment where the local +=C2=A0=C2=A0 =C2=A0// machine is part of a Windows 2000 Domain. This may be +=C2=A0=C2=A0 =C2=A0// used in a Windows 2000 Advanced Server managed domai= n. +=C2=A0=C2=A0 =C2=A0struct GUID BirthDomainId; // 0x48: =C2=A0}; =C2=A0static_assert(sizeof(struct NTFS_DE_O) =3D=3D 0x58); -#define NTFS_OBJECT_ENTRY_DATA_SIZE1=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=C2=A0=C2=A0 \ -=C2=A0=C2=A0 =C2=A00x38 // struct NTFS_DE_O.BirthDomainId is not used -#define NTFS_OBJECT_ENTRY_DATA_SIZE2=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=C2=A0=C2=A0 \ -=C2=A0=C2=A0 =C2=A00x48 // struct NTFS_DE_O.BirthDomainId is used - =C2=A0/* Q Directory entry structure ( rule =3D 0x11 ) */ =C2=A0struct NTFS_DE_Q { =C2=A0=C2=A0=C2=A0 =C2=A0struct NTFS_DE de; =C2=A0=C2=A0=C2=A0 =C2=A0__le32 owner_id;=C2=A0=C2=A0 =C2=A0// 0x10: Uniqu= e Id assigned to file + +=C2=A0=C2=A0 =C2=A0/* here is 0x30 bytes of user quota. NOTE: 4 byte align= ed! */ =C2=A0=C2=A0=C2=A0 =C2=A0__le32 Version;=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0// 0x14: 0x02 -=C2=A0=C2=A0 =C2=A0__le32 flags2;=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0// = 0x18: Quota flags, see above +=C2=A0=C2=A0 =C2=A0__le32 Flags;=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0// 0= x18: Quota flags, see above =C2=A0=C2=A0=C2=A0 =C2=A0__le64 BytesUsed;=C2=A0=C2=A0 =C2=A0// 0x1C: =C2=A0=C2=A0=C2=A0 =C2=A0__le64 ChangeTime;=C2=A0=C2=A0 =C2=A0// 0x24: =C2=A0=C2=A0=C2=A0 =C2=A0__le64 WarningLimit;=C2=A0=C2=A0 =C2=A0// 0x28: @@ -888,9 +895,9 @@ struct NTFS_DE_Q { =C2=A0=C2=A0=C2=A0 =C2=A0__le64 ExceededTime;=C2=A0=C2=A0 =C2=A0// 0x3C: =C2=A0=C2=A0=C2=A0 =C2=A0// SID is placed here -}; // sizeof() =3D 0x44 +}__packed; // sizeof() =3D 0x44 -#define SIZEOF_NTFS_DE_Q 0x44 +static_assert(sizeof(struct NTFS_DE_Q) =3D=3D 0x44); =C2=A0#define SecurityDescriptorsBlockSize 0x40000 // 256K =C2=A0#define SecurityDescriptorMaxSize=C2=A0=C2=A0=C2=A0 0x20000 // 128K @@ -912,7 +919,7 @@ struct SECURITY_HDR { =C2=A0=C2=A0=C2=A0 =C2=A0 */ =C2=A0} __packed; -#define SIZEOF_SECURITY_HDR 0x14 +static_assert(sizeof(struct SECURITY_HDR) =3D=3D 0x14); =C2=A0/* SII Directory entry structure */ =C2=A0struct NTFS_DE_SII { @@ -921,7 +928,8 @@ struct NTFS_DE_SII { =C2=A0=C2=A0=C2=A0 =C2=A0struct SECURITY_HDR sec_hdr;=C2=A0=C2=A0 =C2=A0//= 0x14: =C2=A0} __packed; -#define SIZEOF_SII_DIRENTRY 0x28 +static_assert(offsetof(struct NTFS_DE_SII, sec_hdr) =3D=3D 0x14); +static_assert(sizeof(struct NTFS_DE_SII) =3D=3D 0x28); =C2=A0/* SDH Directory entry structure */ =C2=A0struct NTFS_DE_SDH { @@ -1155,7 +1163,7 @@ struct REPARSE_DATA_BUFFER { =C2=A0#define FILE_NEED_EA 0x80 // See ntifs.h =C2=A0/* - *FILE_NEED_EA, indicates that the file to which the EA belongs cannot be + * FILE_NEED_EA, indicates that the file to which the EA belongs cannot be =C2=A0 * interpreted without understanding the associated extended attribu= tes. =C2=A0 */ =C2=A0struct EA_INFO { diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h index 6667a75411fc..98b61e4b3215 100644 --- a/fs/ntfs3/ntfs_fs.h +++ b/fs/ntfs3/ntfs_fs.h @@ -467,8 +467,7 @@ int al_add_le(struct ntfs_inode *ni, enum ATTR_TYPE=20 type, const __le16 *name, =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct ATTR_LIST_E= NTRY **new_le); =C2=A0bool al_remove_le(struct ntfs_inode *ni, struct ATTR_LIST_ENTRY *le); =C2=A0bool al_delete_le(struct ntfs_inode *ni, enum ATTR_TYPE type, CLST v= cn, -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 const __le16 *name, size_t na= me_len, -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 const struct MFT_REF *ref); +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 const __le16 *name, u8 name_l= en, const struct MFT_REF *ref); =C2=A0int al_update(struct ntfs_inode *ni, int sync); =C2=A0static inline size_t al_aligned(size_t size) =C2=A0{ @@ -527,7 +526,7 @@ struct ATTRIB *ni_load_attr(struct ntfs_inode *ni,=20 enum ATTR_TYPE type, =C2=A0int ni_load_all_mi(struct ntfs_inode *ni); =C2=A0bool ni_add_subrecord(struct ntfs_inode *ni, CLST rno, struct=20 mft_inode **mi); =C2=A0int ni_remove_attr(struct ntfs_inode *ni, enum ATTR_TYPE type, -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 const __le16 *name, siz= e_t name_len, bool base_only, +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 const __le16 *name, u8 = name_len, bool base_only, =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 const __le16 *id); =C2=A0int ni_create_attr_list(struct ntfs_inode *ni); =C2=A0int ni_expand_list(struct ntfs_inode *ni); @@ -631,7 +630,7 @@ int ntfs_bio_fill_1(struct ntfs_sb_info *sbi, const=20 struct runs_tree *run); =C2=A0int ntfs_vbo_to_lbo(struct ntfs_sb_info *sbi, const struct runs_tree= *run, =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0 u64 vbo, u6= 4 *lbo, u64 *bytes); =C2=A0struct ntfs_inode *ntfs_new_inode(struct ntfs_sb_info *sbi, CLST nRe= c, -=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 bool 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 enum RECORD_FLAG flag); =C2=A0extern const u8 s_default_security[0x50]; =C2=A0bool is_sd_valid(const struct SECURITY_DESCRIPTOR_RELATIVE *sd, u32 = len); =C2=A0int ntfs_security_init(struct ntfs_sb_info *sbi); @@ -649,7 +648,8 @@ int ntfs_insert_reparse(struct ntfs_sb_info *sbi,=20 __le32 rtag, =C2=A0int ntfs_remove_reparse(struct ntfs_sb_info *sbi, __le32 rtag, =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0const struc= t MFT_REF *ref); =C2=A0void mark_as_free_ex(struct ntfs_sb_info *sbi, CLST lcn, CLST len,=20 bool trim); -int run_deallocate(struct ntfs_sb_info *sbi, struct runs_tree *run,=20 bool trim); +int run_deallocate(struct ntfs_sb_info *sbi, const struct runs_tree *run, +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 bool trim); =C2=A0bool valid_windows_name(struct ntfs_sb_info *sbi, const struct le_st= r=20 *name); =C2=A0/* Globals from index.c */ @@ -738,7 +738,7 @@ struct ATTRIB *mi_enum_attr(struct mft_inode *mi,=20 struct ATTRIB *attr); =C2=A0// TODO: id? =C2=A0struct ATTRIB *mi_find_attr(struct mft_inode *mi, struct ATTRIB *att= r, =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 enum ATTR_TYPE type, const __le16 *name, -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2= =A0 size_t name_len, const __le16 *id); +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2= =A0 u8 name_len, const __le16 *id); =C2=A0static inline struct ATTRIB *rec_find_attr_le(struct mft_inode *rec, =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=C2=A0=C2=A0 struct ATTR_LIS= T_ENTRY *le) =C2=A0{ diff --git a/fs/ntfs3/record.c b/fs/ntfs3/record.c index 7974ca35a15c..e73ca2df42eb 100644 --- a/fs/ntfs3/record.c +++ b/fs/ntfs3/record.c @@ -302,7 +302,7 @@ struct ATTRIB *mi_enum_attr(struct mft_inode *mi,=20 struct ATTRIB *attr) =C2=A0 */ =C2=A0struct ATTRIB *mi_find_attr(struct mft_inode *mi, struct ATTRIB *att= r, =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 enum ATTR_TYPE type, const __le16 *name, -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2= =A0 size_t name_len, const __le16 *id) +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2= =A0 u8 name_len, const __le16 *id) =C2=A0{ =C2=A0=C2=A0=C2=A0 =C2=A0u32 type_in =3D le32_to_cpu(type); =C2=A0=C2=A0=C2=A0 =C2=A0u32 atype; --=20 2.34.1