summaryrefslogtreecommitdiffstats
path: root/fs/ntfs3/frecord.c
diff options
context:
space:
mode:
authorDaniel Pinto <danielpinto52@gmail.com>2022-10-10 12:32:12 +0100
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>2022-11-12 20:59:43 +0300
commit66223324cba4290ba45c612fe1e31a265636ad2d (patch)
treeff9a59fd6c104ee135ce247447522670ff80d63c /fs/ntfs3/frecord.c
parent4c9ba192c73f52dc1d549fcfeb109b725fea8950 (diff)
downloadlinux-66223324cba4290ba45c612fe1e31a265636ad2d.tar.bz2
fs/ntfs3: Make hidedotfiles mount option work when renaming files
Currently, the hidedotfiles mount option only has an effect when creating new files. Removing or adding the starting dot when moving or renaming files does not update the hidden attribute. Make hidedotfiles also set or uset the hidden attribute when a file gains or loses its starting dot by being moved or renamed. Signed-off-by: Daniel Pinto <danielpinto52@gmail.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Diffstat (limited to 'fs/ntfs3/frecord.c')
-rw-r--r--fs/ntfs3/frecord.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c
index ce5e8f3b1aca..392efa0270f8 100644
--- a/fs/ntfs3/frecord.c
+++ b/fs/ntfs3/frecord.c
@@ -3023,6 +3023,15 @@ int ni_add_name(struct ntfs_inode *dir_ni, struct ntfs_inode *ni,
!valid_windows_name(sbi, (struct le_str *)&de_name->name_len))
return -EINVAL;
+ /* If option "hidedotfiles" then set hidden attribute for dot files. */
+ if (ni->mi.sbi->options->hide_dot_files) {
+ if (de_name->name_len > 0 &&
+ le16_to_cpu(de_name->name[0]) == '.')
+ ni->std_fa |= FILE_ATTRIBUTE_HIDDEN;
+ else
+ ni->std_fa &= ~FILE_ATTRIBUTE_HIDDEN;
+ }
+
mi_get_ref(&ni->mi, &de->ref);
mi_get_ref(&dir_ni->mi, &de_name->home);