[Filesystem] Fix and complete the API

Implement the spec.
Fix and pass the TCT tests.
Fix and complete the example.

BUG=XWALK-1071
BUG=XWALK-1827
prefer `&&` at the end of line, so
```
if (stat(from.c_str(), &from_st) == 0 &&
    stat(to.c_str(), &to_st) == 0 &&
    S_ISREG(from_st.st_mode) &&
    S_ISDIR(to_st.st_mode)) {
```