RFR: 8229872: (fs) Increase buffer size used with getmntent

Alan Bateman Alan.Bateman at oracle.com
Thu Sep 5 08:52:20 UTC 2019


On 04/09/2019 16:56, Vladimir Kempik wrote:
> Hello
> After thinking about it, I think it’s better to leave getlinelen as 
> is, and just increase maxLineSize by one in getMountEntries.
>
> here is webrev: http://cr.openjdk.java.net/~vkempik/8229872/webrev.07/
>
UnixNativeDispatcher.rewind - the comment L413-419 needs cleanup, I 
think should be one line or just removed.

UnixNativeDispatcher.getlinelen - the function description is confusing. 
I think it should be removed or replaced with something simple that 
explains that it returns the line length (without the NUL terminator) or 
-1 when at EOF. I see Florian's mail that -1 can be EOF or an error and 
I agree this needs to be cleaned up.

LinuxNativeDispatcher.getmntent - the parameter to the native method 
should be bufLen to match the libc function that it calls. Also I think 
we should try to keep the formatting/style consistent with the existing 
code, meaning the NULL checks should be "if (bytes == NULL) {" rather 
than putting the open brace on a new line.

LinuxFileSystem.getMountEntries. - maxLineSize++ in the finally block is 
confusing. I think it would be cleaner to have the following after the 
finally block:
   long bufLen = maxLineLen + 1;
and then call getmntent with bugLen. This will avoid misleading further 
maintainers into thinking that maxLineLen is the maxium line length.
At L88 you need a line break to put the statement on the next line (to 
keep it consistent with the existing code).

-Alan.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20190905/95ce749f/attachment-0001.html>


More information about the nio-dev mailing list