message: add metadata fields for nydusify filesystem check
diff: @@ -11,6 +11,7 @@ import (
  "os"
  "path/filepath"
  "reflect"
  + "syscall"
  "github.com/dragonflyoss/image-service/contrib/nydusify/pkg/checker/tool"
  @@ -34,14 +35,20 @@ type Node struct {
  Path string
  Size int64
  Mode os.FileMode
  + Rdev uint64
  + Symlink string
  + UID uint32
  + GID uint32
  + Mtime syscall.Timespec
  Xattrs map[string][]byte
  Hash []byte
  }
  func (node *Node) String() string {
  return fmt.Sprintf(
  - "Path: %s, Size: %d, Mode: %d, Xattrs: %v, Hash: %s",
  - node.Path, node.Size, node.Mode, node.Xattrs, hex.EncodeToString(node.Hash),
  + "Path: %s, Size: %d, Mode: %d, Rdev: %d, Symink: %s, UID: %d, GID: %d, Mtime.Sec: %d, "+
  + "Mtime.Nsec: %d, Xattrs: %v, Hash: %s", node.Path, node.Size, node.Mode, node.Rdev, node.Symlink,
  + node.UID, node.GID, node.Mtime.Sec, node.Mtime.Nsec, node.Xattrs, hex.EncodeToString(node.Hash),
  )
  }
  @@ -114,7 +121,22 @@ func (rule *FilesystemRule) walk(rootfs string) (map[string]Node, error) {
  // Ignore directory size check
  size = info.Size()
  }
  +
  mode := info.Mode()
  + var symlink string
  + if mode&os.ModeSymlink == os.ModeSymlink {
  + if symlink, err = os.Readlink(path); err != nil {
  + return errors.Wrapf(err, "read link %s", path)
  + }
  + } else {
  + symlink = rootfsPath
  + }
  +
  + var stat syscall.Stat_t
  + if err := syscall.Lstat(path, &stat); err != nil {
  + return errors.Wrapf(err, "lstat %s", path)
  + }
  +
  xattrs, err := getXattrs(path)
  if err != nil {
  logrus.Warnf("Failed to get xattr: %s", err)
  @@ -134,6 +156,11 @@ func (rule *FilesystemRule) walk(rootfs string) (map[string]Node, error) {
  Path: rootfsPath,
  Size: size,
  Mode: mode,
  + Rdev: stat.Rdev,
  + Symlink: symlink,
  + UID: stat.Uid,
  + GID: stat.Gid,
  + Mtime: stat.Mtim,
  Xattrs: xattrs,
  Hash: hash,
  }
  