> On Jan. 19, 2017, 11:31 p.m., James Peach wrote: > > src/linux/fs.cpp, line 96 > > <https://reviews.apache.org/r/55713/diff/1/?file=1608944#file1608944line96> > > > > Why are you truncating the return value? `__fsword_t` can be 8 bytes. > > Maybe it is worth defining a cleaner typedef for the fs type? > > > > ``` > > typedef fstype_t __fsword_t; > > ``` > > Gilbert Song wrote: > Thought about whether or not to use `__fsword_t` as well. Let's keep this > comment open. > > I used `uint32_t` (4 bytes) because `__fsword_t` is not supposed to be > public. Please see: > ``` > The __fsword_t type used for various fields in the statfs structure > definition is a glibc internal type, not intended for public use. > This leaves the programmer in a bit of a conundrum when trying to > copy or compare these fields to local variables in a program. > Using > unsigned int for such variables suffices on most systems. > ``` > from: http://man7.org/linux/man-pages/man2/fstatfs64.2.html > > which means that using `uint32_t` or `unsigned int` should be fine for > most systems.
Since the `f_type` field appears in the 32-bit version of this, it seems like filesystems could not reliably use the upper 4 bytes. So I agree that `uint32_t` should be OK. - James ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/55713/#review162359 ----------------------------------------------------------- On Jan. 20, 2017, 10:11 a.m., Gilbert Song wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/55713/ > ----------------------------------------------------------- > > (Updated Jan. 20, 2017, 10:11 a.m.) > > > Review request for mesos, Avinash sridharan, Jie Yu, James Peach, Timothy > Chen, and Jiang Yan Xu. > > > Bugs: MESOS-6958 > https://issues.apache.org/jira/browse/MESOS-6958 > > > Repository: mesos > > > Description > ------- > > Get filesystem type id by using statfs() from <sys/vfs.h>. > > > Diffs > ----- > > src/linux/fs.hpp da49c9ebfa938d169152ed3b6e4df7378711b013 > src/linux/fs.cpp 913e23317291db164fe6bdf77f3eca146dedec9b > src/tests/containerizer/fs_tests.cpp > ccdd5967d01abfe4fa7746e3588ff93c6e0fe7e4 > > Diff: https://reviews.apache.org/r/55713/diff/ > > > Testing > ------- > > make check > > > Thanks, > > Gilbert Song > >
