|
Kmods SIG |
8b815c |
From 22b05f1ac0332cb47701649206997d8d9a1a7f24 Mon Sep 17 00:00:00 2001
|
|
Kmods SIG |
8b815c |
From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
|
|
Kmods SIG |
8b815c |
Date: Tue, 5 Oct 2021 19:33:26 +0300
|
|
Kmods SIG |
8b815c |
Subject: [Backport 22b05f1ac033] src: Refactor ntfs_read_mft
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
Don't save size of attribute reparse point as size of symlink.
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
|
|
Kmods SIG |
8b815c |
---
|
|
Kmods SIG |
8b815c |
src/inode.c | 22 ++++++++--------------
|
|
Kmods SIG |
8b815c |
1 file changed, 8 insertions(+), 14 deletions(-)
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
diff --git a/src/inode.c b/src/inode.c
|
|
Kmods SIG |
8b815c |
index bdebbbd53e766f7435640e55c1551be0fadccd19..859951d785cb2f4380c85b1d799f66f008da7d45 100644
|
|
Kmods SIG |
8b815c |
--- a/src/inode.c
|
|
Kmods SIG |
8b815c |
+++ b/src/inode.c
|
|
Kmods SIG |
8b815c |
@@ -222,9 +222,6 @@ static struct inode *ntfs_read_mft(struct inode *inode,
|
|
Kmods SIG |
8b815c |
if (!attr->non_res) {
|
|
Kmods SIG |
8b815c |
ni->i_valid = inode->i_size = rsize;
|
|
Kmods SIG |
8b815c |
inode_set_bytes(inode, rsize);
|
|
Kmods SIG |
8b815c |
- t32 = asize;
|
|
Kmods SIG |
8b815c |
- } else {
|
|
Kmods SIG |
8b815c |
- t32 = le16_to_cpu(attr->nres.run_off);
|
|
Kmods SIG |
8b815c |
}
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
mode = S_IFREG | (0777 & sbi->options->fs_fmask_inv);
|
|
Kmods SIG |
8b815c |
@@ -313,17 +310,14 @@ static struct inode *ntfs_read_mft(struct inode *inode,
|
|
Kmods SIG |
8b815c |
rp_fa = ni_parse_reparse(ni, attr, &rp);
|
|
Kmods SIG |
8b815c |
switch (rp_fa) {
|
|
Kmods SIG |
8b815c |
case REPARSE_LINK:
|
|
Kmods SIG |
8b815c |
- if (!attr->non_res) {
|
|
Kmods SIG |
8b815c |
- inode->i_size = rsize;
|
|
Kmods SIG |
8b815c |
- inode_set_bytes(inode, rsize);
|
|
Kmods SIG |
8b815c |
- t32 = asize;
|
|
Kmods SIG |
8b815c |
- } else {
|
|
Kmods SIG |
8b815c |
- inode->i_size =
|
|
Kmods SIG |
8b815c |
- le64_to_cpu(attr->nres.data_size);
|
|
Kmods SIG |
8b815c |
- t32 = le16_to_cpu(attr->nres.run_off);
|
|
Kmods SIG |
8b815c |
- }
|
|
Kmods SIG |
8b815c |
+ /*
|
|
Kmods SIG |
8b815c |
+ * Normal symlink.
|
|
Kmods SIG |
8b815c |
+ * Assume one unicode symbol == one utf8.
|
|
Kmods SIG |
8b815c |
+ */
|
|
Kmods SIG |
8b815c |
+ inode->i_size = le16_to_cpu(rp.SymbolicLinkReparseBuffer
|
|
Kmods SIG |
8b815c |
+ .PrintNameLength) /
|
|
Kmods SIG |
8b815c |
+ sizeof(u16);
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
- /* Looks like normal symlink. */
|
|
Kmods SIG |
8b815c |
ni->i_valid = inode->i_size;
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
/* Clear directory bit. */
|
|
Kmods SIG |
8b815c |
@@ -420,7 +414,7 @@ static struct inode *ntfs_read_mft(struct inode *inode,
|
|
Kmods SIG |
8b815c |
ni->std_fa &= ~FILE_ATTRIBUTE_DIRECTORY;
|
|
Kmods SIG |
8b815c |
inode->i_op = &ntfs_link_inode_operations;
|
|
Kmods SIG |
8b815c |
inode->i_fop = NULL;
|
|
Kmods SIG |
8b815c |
- inode_nohighmem(inode); // ??
|
|
Kmods SIG |
8b815c |
+ inode_nohighmem(inode);
|
|
Kmods SIG |
8b815c |
} else if (S_ISREG(mode)) {
|
|
Kmods SIG |
8b815c |
ni->std_fa &= ~FILE_ATTRIBUTE_DIRECTORY;
|
|
Kmods SIG |
8b815c |
inode->i_op = &ntfs_file_inode_operations;
|
|
Kmods SIG |
8b815c |
--
|
|
Kmods SIG |
8b815c |
2.31.1
|
|
Kmods SIG |
8b815c |
|