Integrated: JDK-8262958 (fs) UnixUserDefinedFileAttributeView cleanup
Sebastian Stenzel
github.com+1204330+overheadhunter at openjdk.java.net
Tue Mar 30 13:16:17 UTC 2021
On Wed, 10 Mar 2021 16:36:06 GMT, Sebastian Stenzel <github.com+1204330+overheadhunter at openjdk.org> wrote:
> `flistxattr` gets called in two places:
> 1. Obviously during `list()`
> 2. When copying xattr from one file to another using `copyExtendedAttributes()`
>
> Commit 7104008 adds a new private method `List<String> list(int fd, int bufSize) throws UnixException` that takes care of the "retry if buffer too small" logic that previously happened inside of two almost identical for-loops.
>
> In order to properly reuse the same code in both places, I move the stripping of the `USER_NAMESPACE` attr prefix from `asList` to `list()`, which I'd consider an undocumented side effect of the former anyway.
>
> This also significantly reduced complexity in both affected methods, but in turn `copyExtendedAttributes` will now deal with Strings instead of bytes for the attr names. While I am convinced that the benefits outweighs this point, I don't want to leave this unmentioned, as this change might slightly affect performance of `Files.copy(src, dst, StandardCopyOption.COPY_ATTRIBUTES)`.
This pull request has now been integrated.
Changeset: daeca3ff
Author: Sebastian Stenzel <sebastian.stenzel at skymatic.de>
Committer: Alan Bateman <alanb at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/daeca3ff
Stats: 95 lines in 1 file changed: 19 ins; 57 del; 19 mod
8262958: (fs) UnixUserDefinedFileAttributeView cleanup
Reviewed-by: alanb
-------------
PR: https://git.openjdk.java.net/jdk/pull/2916
More information about the nio-dev
mailing list