D17816: Support for xattrs on kio copy/move

Stefan BrĂ¼ns noreply at phabricator.kde.org
Sun Jan 6 01:16:04 GMT 2019


bruns added inline comments.

INLINE COMMENTS

> copyjob.cpp:2199
> +#if HAVE_SYS_XATTR_H && !defined(__stub_getxattr)
> +    ssize_t listlen = listxattr(xattrsrc, nullptr, 0);
> +#elif defined(Q_OS_MAC)

you can (typically) avoid the double (syscall, i.e. expensive) by preallocating the array and only reallocating if you get `errno == ERANGE`. Dito for getxattr.

> copyjob.cpp:2221
> +    QList<QByteArray> xattrkeys = keylist.split('\0');
> +    xattrkeys.removeLast(); // the last item is alwys empty
> +

`... always ...`

> copyjob.cpp:2225
> +        // get the size of value for key
> +#if HAVE_SYS_XATTR_H && !defined(__stub_getxattr)
> +        ssize_t valuelen = getxattr(xattrsrc, xattrkey.constData(), nullptr, 0);

There should probably be a `if (!xattrkey.startsWith("user.")) continue;` here.

> copyjob.cpp:2226
> +#if HAVE_SYS_XATTR_H && !defined(__stub_getxattr)
> +        ssize_t valuelen = getxattr(xattrsrc, xattrkey.constData(), nullptr, 0);
> +#elif defined(Q_OS_MAC)

getxattr is called on the same file again and again, thus it is much more efficient to use fgetxattr.

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D17816

To: cochise, dfaure
Cc: bruns, phidrho, dhaumann, funkybomber, abika, pino, davidedmundson, ngraham, atha.kane, spoorun, nicolasfella, kde-frameworks-devel, michaelh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190106/295bdb7b/attachment.html>


More information about the Kde-frameworks-devel mailing list