> On Jan. 11, 2016, 12:38 a.m., Joris Van Remoortere wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/ls.hpp, lines 
> > 36-42
> > <https://reviews.apache.org/r/39802/diff/3/?file=1128786#file1128786line36>
> >
> >     If this is the only section that is different between the POSIX and 
> > windows version, does it make sense to factor out this size calculation, 
> > and leave a common `ls` implementation?

It might. Lets look at a couple ways of doing this:

* Since the main problem is `fpathconf` (which doesn't make much sense on 
Windows), we could create a new function, `os::fpathconf` that simply always 
returns `-1`.
* We could create some other function whose job is just to give the size of the 
`dirent` struct on a particular platform. But, I don't know what to call it, or 
where to put it.
* Just keep the forked version.

I'm not sure if any of these really reaches out to you. For me,  I liked the 
last one because I felt it was clearest on both platforms. For example, the 
`os::fpathconf` approach will be a lot less clear because it won't be obvious 
to _anyone_ that we're just returning -1 all the time, or what the consequences 
is for the reported dirent struct size on Windows. The forked 
dirent-size-function is not elegant, and adds API bloat, and still requires a 
forked file, albeit a much smaller one.

I don't know, I'm open to other opinions. I think they all have serious 
downsides. My second choice is the forked dirent-size-function option, because 
it doesn't sacrifice code readability.


- Alex


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/39802/#review113580
-----------------------------------------------------------


On Jan. 4, 2016, 11:20 a.m., Alex Clemmer wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/39802/
> -----------------------------------------------------------
> 
> (Updated Jan. 4, 2016, 11:20 a.m.)
> 
> 
> Review request for mesos, Artem Harutyunyan, Joris Van Remoortere, and Joseph 
> Wu.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Windows: Implemented `stout/os/windows/ls.hpp`.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/os/posix/ls.hpp 
> 7dba79d31559d15a3e84eff506ce7df3e57cf5f3 
>   3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/ls.hpp 
> 5b6fba13ce215af5801fd0867f6e774e100689ca 
> 
> Diff: https://reviews.apache.org/r/39802/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Alex Clemmer
> 
>

Reply via email to