RFR: JDK-8262958 (fs) UnixUserDefinedFileAttributeView cleanup
Sebastian Stenzel
sebastian.stenzel at gmail.com
Mon Mar 29 16:22:47 UTC 2021
> On 26. Mar 2021, at 16:05, Sebastian Stenzel <github.com+1204330+overheadhunter at openjdk.java.net> 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)`.
>
> -------------
>
> Commit messages:
> - Merge branch 'master' into JDK-8262958
> - renamed variable
> - Stream.toList() is already unmodifiable
> - deduplicated flistxattr-related code
>
> Changes: https://git.openjdk.java.net/jdk/pull/2916/files
> Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2916&range=00
> Issue: https://bugs.openjdk.java.net/browse/JDK-8262958
> Stats: 95 lines in 1 file changed: 19 ins; 57 del; 19 mod
> Patch: https://git.openjdk.java.net/jdk/pull/2916.diff
> Fetch: git fetch https://git.openjdk.java.net/jdk pull/2916/head:pull/2916
>
> PR: https://git.openjdk.java.net/jdk/pull/2916
Alan, may I ask you to review this PR? As discussed earlier this month, I split up the scope into multiple small issues and changed the description of JDK-8262958. I didn't change the issue title yet (which might be confusing) because I'm not sure if bridgekeeper will understand what is happening. Let me know if I should adjust the title as well.
Thank you!
More information about the nio-dev
mailing list