sheep: fix some compile errors

Both MIN/MAX and roundup are provided by glibc and would cause compile error
when we #include <sys/param.h>. Just use GNU version.

Reviewed-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
sheep: introduce NFSv3 transport

We use glibc's RPC to build NFS daemon and rpcgen for NFS marshing and
unmarshing.

Reviewed-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
sheep/nfs: add mount protocol stub

This is a preparation patch

Reviewed-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
dog: add nfs command

We support allocate as many nfs backend storage as you want.

usage:
 dog nfs create $name # create a nfs backend named $name
 dog nfs delete $name # delete a nfs backend named $name

$name is the name for users to mount at client in $IP:$NAME

Reviewed-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
util: add PTR_ERR helpers

Sometimes we need to return ERROR code from pointers

Reviewed-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
sheep/nfs: add basic file system framework

Add basic inode, dentry structures and just support 'ls' /mntpoint operation.

For inode management, we use the hash scheme as in http implementation. This
will save us a lots of code on inode allocation and deallocation and management.

We also make use the simiar concepts found in traditional UNIX systems
- inode, represent files
- dentry, directry entry that map name components to 'inode numbers'
- extents, to manage free space for file data
- directory, a plain file that contains dentries, giving us tree structure

Reviewed-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
sheep: clean up sd_inode btree error code

These error codes are used internally, not for client communication.

Reviewed-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
sheep/nfs: support lookup/create/setattr nfs operation

Now we support 'touch' command.

Reviewed-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
sheep/nfs: implement read/write nfs operation

Now we support more bash command such as cp, mv, echo, cat ...

Reviewed-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
sheep/nfs: add mkdir support

Now we support 'mkdir' command and gain hierarchical structure support.

TODO:
 - make dentry operation operate on top of 'file' operation
 - add hash or btree based dentries management

 Reviewed-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
sheep: make stat_data_objs a generic function

and rename it as sd_inode_stat()

Reviewed-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
sheep/nfs: implement nfs3_fsstat operation

Now we support 'df' command to get file system stats.

Reviewed-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>