RFR: 8293121: (fs) Refactor UnixFileSystem copying into generic Unix, Linux, and BSD implementations [v3]

Alan Bateman alanb at openjdk.org
Thu Sep 1 10:29:11 UTC 2022


On Wed, 31 Aug 2022 16:21:25 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Refactor `UnixFileSystem` and related classes to move implementations specific to Linux and BSD (macOS) into OS-specific classes and native code. Generic Unix implementations remain in existing `Unix*` files.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8293121: Forgot to move UnixCopyFile.c to UnixFileSystem.c

Overall I think the structure looks quite good. A lot of code has moved so it's hard to see what has changed so I focused on the copyFile and supporting methods as that seems to be where the only changes are.

src/java.base/linux/classes/sun/nio/fs/LinuxFileSystem.java line 138:

> 136: 
> 137:     @Override
> 138:     protected void bufferedCopy(int dst, int src, long address,

Everything is in sun.nio.fs and the existing methods aren't protected. I don't mind if we have the protected methods but it's a bit inconsistent to have it on some but not all of the methods that are intended to be used by subclasses.

src/java.base/unix/classes/sun/nio/fs/UnixFileSystem.java line 428:

> 426: 
> 427:     // whether direct copying is supported on this platform
> 428:     private static volatile boolean directCopyNotSupported;

Would it be possible to move MIN_BUFFER_SIZE and directCopyNotSupported to the top so they are declared before the instance fields?

test/jdk/java/nio/file/Files/CopyAndMove.java line 25:

> 23: 
> 24: /* @test
> 25:  * @bug 4313887 6838333 6917021 7006126 6950237 8006645 8201407 8293121 8267820

Did you mean to include this test update in this PR?

-------------

PR: https://git.openjdk.org/jdk/pull/10093


More information about the nio-dev mailing list