|
Kmods SIG |
d83023 |
From cd4c76ff807c1afeed89f1b7e311760c0e296349 Mon Sep 17 00:00:00 2001
|
|
Kmods SIG |
d83023 |
From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
|
|
Kmods SIG |
d83023 |
Date: Tue, 5 Oct 2021 19:08:08 +0300
|
|
Kmods SIG |
d83023 |
Subject: [Backport cd4c76ff807c] src: Refactor ni_parse_reparse
|
|
Kmods SIG |
d83023 |
|
|
Kmods SIG |
d83023 |
Change argument from void* to struct REPARSE_DATA_BUFFER*
|
|
Kmods SIG |
d83023 |
We copy data to buffer, so we can read it later in ntfs_read_mft.
|
|
Kmods SIG |
d83023 |
|
|
Kmods SIG |
d83023 |
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
|
|
Kmods SIG |
d83023 |
---
|
|
Kmods SIG |
d83023 |
src/frecord.c | 9 +++++----
|
|
Kmods SIG |
d83023 |
src/ntfs_fs.h | 2 +-
|
|
Kmods SIG |
d83023 |
2 files changed, 6 insertions(+), 5 deletions(-)
|
|
Kmods SIG |
d83023 |
|
|
Kmods SIG |
d83023 |
diff --git a/src/frecord.c b/src/frecord.c
|
|
Kmods SIG |
d83023 |
index 007602badd9000ce190dd5a0ad13e0618aa27e83..ecb965e4afd075e2e38be7dfda7ad71f3ff1e150 100644
|
|
Kmods SIG |
d83023 |
--- a/src/frecord.c
|
|
Kmods SIG |
d83023 |
+++ b/src/frecord.c
|
|
Kmods SIG |
d83023 |
@@ -1710,18 +1710,16 @@ int ni_new_attr_flags(struct ntfs_inode *ni, enum FILE_ATTRIBUTE new_fa)
|
|
Kmods SIG |
d83023 |
/*
|
|
Kmods SIG |
d83023 |
* ni_parse_reparse
|
|
Kmods SIG |
d83023 |
*
|
|
Kmods SIG |
d83023 |
- * Buffer is at least 24 bytes.
|
|
Kmods SIG |
d83023 |
+ * buffer - memory for reparse buffer header
|
|
Kmods SIG |
d83023 |
*/
|
|
Kmods SIG |
d83023 |
enum REPARSE_SIGN ni_parse_reparse(struct ntfs_inode *ni, struct ATTRIB *attr,
|
|
Kmods SIG |
d83023 |
- void *buffer)
|
|
Kmods SIG |
d83023 |
+ struct REPARSE_DATA_BUFFER *buffer)
|
|
Kmods SIG |
d83023 |
{
|
|
Kmods SIG |
d83023 |
const struct REPARSE_DATA_BUFFER *rp = NULL;
|
|
Kmods SIG |
d83023 |
u8 bits;
|
|
Kmods SIG |
d83023 |
u16 len;
|
|
Kmods SIG |
d83023 |
typeof(rp->CompressReparseBuffer) *cmpr;
|
|
Kmods SIG |
d83023 |
|
|
Kmods SIG |
d83023 |
- static_assert(sizeof(struct REPARSE_DATA_BUFFER) <= 24);
|
|
Kmods SIG |
d83023 |
-
|
|
Kmods SIG |
d83023 |
/* Try to estimate reparse point. */
|
|
Kmods SIG |
d83023 |
if (!attr->non_res) {
|
|
Kmods SIG |
d83023 |
rp = resident_data_ex(attr, sizeof(struct REPARSE_DATA_BUFFER));
|
|
Kmods SIG |
d83023 |
@@ -1807,6 +1805,9 @@ enum REPARSE_SIGN ni_parse_reparse(struct ntfs_inode *ni, struct ATTRIB *attr,
|
|
Kmods SIG |
d83023 |
return REPARSE_NONE;
|
|
Kmods SIG |
d83023 |
}
|
|
Kmods SIG |
d83023 |
|
|
Kmods SIG |
d83023 |
+ if (buffer != rp)
|
|
Kmods SIG |
d83023 |
+ memcpy(buffer, rp, sizeof(struct REPARSE_DATA_BUFFER));
|
|
Kmods SIG |
d83023 |
+
|
|
Kmods SIG |
d83023 |
/* Looks like normal symlink. */
|
|
Kmods SIG |
d83023 |
return REPARSE_LINK;
|
|
Kmods SIG |
d83023 |
}
|
|
Kmods SIG |
d83023 |
diff --git a/src/ntfs_fs.h b/src/ntfs_fs.h
|
|
Kmods SIG |
d83023 |
index 9277b552f2578ee8e94784afe9772614b02748a0..e95d93c683ed9852a1b941c3ac8585af0b925f7f 100644
|
|
Kmods SIG |
d83023 |
--- a/src/ntfs_fs.h
|
|
Kmods SIG |
d83023 |
+++ b/src/ntfs_fs.h
|
|
Kmods SIG |
d83023 |
@@ -547,7 +547,7 @@ struct ATTR_FILE_NAME *ni_fname_type(struct ntfs_inode *ni, u8 name_type,
|
|
Kmods SIG |
d83023 |
struct ATTR_LIST_ENTRY **entry);
|
|
Kmods SIG |
d83023 |
int ni_new_attr_flags(struct ntfs_inode *ni, enum FILE_ATTRIBUTE new_fa);
|
|
Kmods SIG |
d83023 |
enum REPARSE_SIGN ni_parse_reparse(struct ntfs_inode *ni, struct ATTRIB *attr,
|
|
Kmods SIG |
d83023 |
- void *buffer);
|
|
Kmods SIG |
d83023 |
+ struct REPARSE_DATA_BUFFER *buffer);
|
|
Kmods SIG |
d83023 |
int ni_write_inode(struct inode *inode, int sync, const char *hint);
|
|
Kmods SIG |
d83023 |
#define _ni_write_inode(i, w) ni_write_inode(i, w, __func__)
|
|
Kmods SIG |
d83023 |
int ni_fiemap(struct ntfs_inode *ni, struct fiemap_extent_info *fieinfo,
|
|
Kmods SIG |
d83023 |
--
|
|
Kmods SIG |
d83023 |
2.31.1
|
|
Kmods SIG |
d83023 |
|