RFR: JDK-8030048: (fs) Support UserDefinedFileAttributeView/extended attributes on OS X / HFS+ [v2]
Sebastian Stenzel
github.com+1204330+overheadhunter at openjdk.java.net
Wed Jan 13 12:35:24 UTC 2021
> This adds support for UserDefinedFileAttributeView on macOS 10.4 and newer.
>
> While the main audience for this will probably be macOS users, the relevant changes take place in (mostly existing) classes carrying BSD in their names as none of this is really macOS-specific.
>
> Code is mostly copied from the Linux implementation except for three differences:
> 1. max length for attribute names is 127 bytes
> 2. we know for sure that APFS and HFS+ support extended attributes, therefore we [simply return `true`](https://github.com/skymatic/jdk/blob/7a3619df12853bd3a44e4f49c98f35e15bceb652/src/java.base/macosx/classes/sun/nio/fs/BsdFileStore.java#L114-L118) from `supportsFileAttributeView(UserDefinedFileAttributeView.class)` for these two FS types, while for all other types support is determined experimentally in [`isExtendedAttributesEnabled(...)`](https://github.com/skymatic/jdk/blob/7a3619df12853bd3a44e4f49c98f35e15bceb652/src/java.base/macosx/classes/sun/nio/fs/BsdFileStore.java#L83-L100)
> 3. For the aforementioned check the new `UnixConstants.ENOATTR` is added, which [seems to be macOS and BSD-specific](https://mail-index.netbsd.org/tech-kern/2012/04/30/msg013090.html).
>
> As discussed in the mailing list, for ease of tracking changes it is not a goal of this patch to modernize the existing Linux implementation, nor to deduplicate anything.
Sebastian Stenzel has updated the pull request incrementally with one additional commit since the last revision:
fixed comment that was copy-pasted from LinuxFileStore
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/2017/files
- new: https://git.openjdk.java.net/jdk/pull/2017/files/7a3619df..5d00aa62
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2017&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2017&range=00-01
Stats: 2 lines in 1 file changed: 0 ins; 1 del; 1 mod
Patch: https://git.openjdk.java.net/jdk/pull/2017.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/2017/head:pull/2017
PR: https://git.openjdk.java.net/jdk/pull/2017
More information about the nio-dev
mailing list