Fadvise

Merge #2988  & #2964 into together. And add test case.
 @liewegas , bypass make check & plz review. Thanks!
You're right, it's only the int->enum direction that needs a cast. I'm worried about potential ABI breakage with changing it though, since the type used for the enum may not be int: http://stackoverflow.com/a/159308