Fixed setting archive bit on file and alternated data stream creation

This commit is contained in:
Jean-Pierre André 2010-02-24 12:08:56 +01:00
parent 1bdd93e237
commit 1bb7443eb6
3 changed files with 24 additions and 6 deletions

View File

@ -1396,6 +1396,7 @@ static ntfs_inode *__ntfs_create(ntfs_inode *dir_ni, le32 securid,
si->file_attributes = FILE_ATTR_SYSTEM; si->file_attributes = FILE_ATTR_SYSTEM;
ni->flags = FILE_ATTR_SYSTEM; ni->flags = FILE_ATTR_SYSTEM;
} }
ni->flags |= FILE_ATTR_ARCHIVE;
if ((dir_ni->flags & FILE_ATTR_COMPRESSED) if ((dir_ni->flags & FILE_ATTR_COMPRESSED)
&& (S_ISREG(type) || S_ISDIR(type))) && (S_ISREG(type) || S_ISDIR(type)))
ni->flags |= FILE_ATTR_COMPRESSED; ni->flags |= FILE_ATTR_COMPRESSED;
@ -1525,6 +1526,7 @@ static ntfs_inode *__ntfs_create(ntfs_inode *dir_ni, le32 securid,
fn->file_attributes = FILE_ATTR_SYSTEM; fn->file_attributes = FILE_ATTR_SYSTEM;
else else
fn->file_attributes |= ni->flags & FILE_ATTR_COMPRESSED; fn->file_attributes |= ni->flags & FILE_ATTR_COMPRESSED;
fn->file_attributes |= FILE_ATTR_ARCHIVE;
fn->creation_time = ni->creation_time; fn->creation_time = ni->creation_time;
fn->last_data_change_time = ni->last_data_change_time; fn->last_data_change_time = ni->last_data_change_time;
fn->last_mft_change_time = ni->last_mft_change_time; fn->last_mft_change_time = ni->last_mft_change_time;

View File

@ -3244,7 +3244,10 @@ static void ntfs_fuse_setxattr(fuse_req_t req, fuse_ino_t ino, const char *name,
res = -errno; res = -errno;
goto exit; goto exit;
} }
set_archive(ni); if (!(ni->flags & FILE_ATTR_ARCHIVE)) {
set_archive(ni);
NInoFileNameSetDirty(ni);
}
na = ntfs_attr_open(ni, AT_DATA, lename, lename_len); na = ntfs_attr_open(ni, AT_DATA, lename, lename_len);
if (!na) { if (!na) {
res = -errno; res = -errno;
@ -3273,8 +3276,10 @@ static void ntfs_fuse_setxattr(fuse_req_t req, fuse_ino_t ino, const char *name,
&& (ni->flags & FILE_ATTR_ENCRYPTED)) && (ni->flags & FILE_ATTR_ENCRYPTED))
res = ntfs_efs_fixup_attribute(NULL, res = ntfs_efs_fixup_attribute(NULL,
na); na);
if (total) if (total && !(ni->flags & FILE_ATTR_ARCHIVE)) {
set_archive(ni); set_archive(ni);
NInoFileNameSetDirty(ni);
}
} else } else
res = 0; res = 0;
exit: exit:
@ -3451,7 +3456,10 @@ static void ntfs_fuse_removexattr(fuse_req_t req, fuse_ino_t ino, const char *na
errno = ENODATA; errno = ENODATA;
res = -errno; res = -errno;
} }
set_archive(ni); if (!(ni->flags & FILE_ATTR_ARCHIVE)) {
set_archive(ni);
NInoFileNameSetDirty(ni);
}
exit: exit:
free(lename); free(lename);
if (ntfs_inode_close(ni)) if (ntfs_inode_close(ni))

View File

@ -3186,7 +3186,10 @@ static int ntfs_fuse_setxattr(const char *path, const char *name,
res = -errno; res = -errno;
goto exit; goto exit;
} }
set_archive(ni); if (!(ni->flags & FILE_ATTR_ARCHIVE)) {
set_archive(ni);
NInoFileNameSetDirty(ni);
}
na = ntfs_attr_open(ni, AT_DATA, lename, lename_len); na = ntfs_attr_open(ni, AT_DATA, lename, lename_len);
if (!na) { if (!na) {
res = -errno; res = -errno;
@ -3215,8 +3218,10 @@ static int ntfs_fuse_setxattr(const char *path, const char *name,
&& (ni->flags & FILE_ATTR_ENCRYPTED)) && (ni->flags & FILE_ATTR_ENCRYPTED))
res = ntfs_efs_fixup_attribute(NULL, res = ntfs_efs_fixup_attribute(NULL,
na); na);
if (total) if (total && !(ni->flags & FILE_ATTR_ARCHIVE)) {
set_archive(ni); set_archive(ni);
NInoFileNameSetDirty(ni);
}
} else } else
res = 0; res = 0;
exit: exit:
@ -3413,7 +3418,10 @@ static int ntfs_fuse_removexattr(const char *path, const char *name)
errno = ENODATA; errno = ENODATA;
res = -errno; res = -errno;
} }
set_archive(ni); if (!(ni->flags & FILE_ATTR_ARCHIVE)) {
set_archive(ni);
NInoFileNameSetDirty(ni);
}
exit: exit:
free(lename); free(lename);
if (ntfs_inode_close(ni)) if (ntfs_inode_close(ni))