sheep: make epoch_log_read() clean

Current epoch_log_read() and the way of treating epoch files are
confusing. Because they heavily depend on the condition:
sizeof(time_t) < sizeof(struct sd_node). The condition is true
currently, but this requirement is implicit and hard to understand.

In addition, epoch_log_read() doesn't handle a rise of EINTR when it
calls read(). This behavior might cause a subtle bug.

This patch eliminates the implicit requirement and adds the handling
of EINTR. For doing it, this patch implements a new function,
epoch_log_read_with_timestamp(). If callers require a timestamp at
tails of epoch files, they should call this one instead of
epoch_log_read().

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
gateway: print oid on error case

This would be helpful when sheep daemon is started without '-d'.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
util: add xmkdir that check EEXIST internally

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
use xmkdir where possible

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheep: comment out store->begin_recover

No users currently, so comment it out for possible use. This will remove
unnecessary if check for now.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheep: use xzalloc in start_recovery()

The caller of start_recovery() don't handle malloc failure, so panic-out is
a better choice than letting non-recoverable sheep daemon keep running.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>