Diffusion KIO 56c738dc251b

Avoid double fetch and temporary hex encoding for NTFS attributes

Authored by bruns on Mar 22 2020, 2:08 AM.

Description

Avoid double fetch and temporary hex encoding for NTFS attributes

Summary:
The attrib is a DWORD (32 bit unsigned int) in the Windows APIs (see
WIN32_FILE_ATTRIBUTE_DATA), and exported as a 4 byte array by ntfs-3g.
As the size is known, there is no need to query it. As each file has
the "archive" flag set on creation, i.e. the first getxattr call typically
never returns 0, this cuts the number of syscalls by half.

Skip the temporary hex encoding of the value, it is pointless to hex-
encode the value and immediately after parse it again.

Test Plan:

  1. touch foo
  2. getfattr -n system.ntfs_attrib_be -e hex foo
  3. dolphin ./
  4. setfattr -n system.ntfs_attrib_be -v 0x00000022
  5. refresh dolphin

Reviewers: Dolphin, dfaure

Reviewed By: dfaure

Subscribers: kde-frameworks-devel

Tags: Frameworks

Differential Revision: https://phabricator.kde.org/D28195

Details