Fixed the documentation to match reality on darwin.
parent
33a476cafc
commit
6565b52bcb
|
@ -51,9 +51,16 @@ type StatFSOp struct {
|
|||
// of f_frsize. On OS X this is surfaced as statfs::f_bsize, which plays the
|
||||
// same roll.
|
||||
//
|
||||
// It appears as though the original intent of statvfs::f_frsize in the posix
|
||||
// standard was to support a smaller addressable unit than statvfs::f_bsize
|
||||
// (cf. The Linux Programming Interface by Michael Kerrisk,
|
||||
// https://goo.gl/5LZMxQ). Therefore users should probably arrange for this
|
||||
// to be no larger than IoSize.
|
||||
//
|
||||
// On Linux this can be any value, and will be faithfully returned to the
|
||||
// caller of statfs(2) (see the code walk above). On OS X it appears it must
|
||||
// be a power of 2 in the range [2^9, 2^17].
|
||||
// caller of statfs(2) (see the code walk above). On OS X it appears that
|
||||
// only powers of 2 in the range [2^9, 2^17] are preserved, and a value of
|
||||
// zero is treated as 4096.
|
||||
//
|
||||
// This interface does not distinguish between blocks and block fragments.
|
||||
BlockSize uint32
|
||||
|
@ -77,8 +84,9 @@ type StatFSOp struct {
|
|||
// statfs::f_iosize. Both are documented in `man 2 statfs` as "optimal
|
||||
// transfer block size".
|
||||
//
|
||||
// On Linux this can be any value. On OS X it appears it must be a power of 2
|
||||
// in the range [2^9, 2^20].
|
||||
// On Linux this can be any value. On OS X it appears that only powers of 2
|
||||
// in the range [2^12, 2^20] are faithfully preserved, and a value of zero is
|
||||
// treated as 65536.
|
||||
IoSize uint32
|
||||
|
||||
// The total number of inodes in the file system, and how many remain free.
|
||||
|
|
|
@ -170,27 +170,23 @@ func (t *StatFSTest) IoSizes() {
|
|||
fsIoSize uint32
|
||||
expectedIosize uint32
|
||||
}{
|
||||
0: {0, 4096},
|
||||
1: {1, 512},
|
||||
2: {3, 512},
|
||||
3: {511, 512},
|
||||
4: {512, 512},
|
||||
5: {513, 1024},
|
||||
6: {1023, 1024},
|
||||
7: {1024, 1024},
|
||||
8: {4095, 4096},
|
||||
9: {1 << 16, 1 << 16},
|
||||
10: {1<<17 - 1, 1 << 17},
|
||||
11: {1 << 17, 1 << 17},
|
||||
12: {1<<17 + 1, 1 << 18},
|
||||
13: {1<<20 - 1, 1 << 20},
|
||||
14: {1 << 20, 1 << 20},
|
||||
15: {1<<20 + 1, 1 << 20},
|
||||
16: {math.MaxInt32 - 1, 1 << 20},
|
||||
17: {math.MaxInt32, 1 << 20},
|
||||
18: {math.MaxInt32 + 1, 512},
|
||||
19: {math.MaxInt32 + 1<<15, 1 << 15},
|
||||
20: {math.MaxUint32, 1 << 20},
|
||||
0: {0, 65536},
|
||||
1: {1, 4096},
|
||||
2: {3, 4096},
|
||||
3: {4095, 4096},
|
||||
4: {4096, 4096},
|
||||
5: {4097, 8192},
|
||||
6: {8191, 8192},
|
||||
7: {8192, 8192},
|
||||
8: {8193, 16384},
|
||||
9: {1<<20 - 1, 1 << 20},
|
||||
10: {1 << 20, 1 << 20},
|
||||
11: {1<<20 + 1, 1 << 20},
|
||||
12: {math.MaxInt32 - 1, 1 << 20},
|
||||
13: {math.MaxInt32, 1 << 20},
|
||||
14: {math.MaxInt32 + 1, 4096},
|
||||
15: {math.MaxInt32 + 1<<15, 1 << 15},
|
||||
16: {math.MaxUint32, 1 << 20},
|
||||
}
|
||||
|
||||
for i, tc := range testCases {
|
||||
|
|
Loading…
Reference in New Issue