github.com/ratrocket/u-root@v0.0.0-20180201221235-1cf9f48ee2cf/pkg/cpio/sysinfo_linux.go (about)

     1  // Copyright 2013-2017 the u-root Authors. All rights reserved
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package cpio
     6  
     7  import (
     8  	"syscall"
     9  )
    10  
    11  func sysInfo(n string, sys *syscall.Stat_t) Info {
    12  	return Info{
    13  		Ino:      sys.Ino,
    14  		Mode:     uint64(sys.Mode),
    15  		UID:      uint64(sys.Uid),
    16  		GID:      uint64(sys.Gid),
    17  		NLink:    uint64(sys.Nlink),
    18  		MTime:    uint64(sys.Mtim.Sec),
    19  		FileSize: uint64(sys.Size),
    20  		Dev:      sys.Dev,
    21  		Major:    sys.Dev >> 8,
    22  		Minor:    sys.Dev & 0xff,
    23  		Rmajor:   sys.Rdev >> 8,
    24  		Rminor:   sys.Rdev & 0xff,
    25  		Name:     n,
    26  	}
    27  }