gitlab.com/apertussolutions/u-root@v7.0.0+incompatible/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:      uint64(sys.Dev),
    21  		Major:    uint64(sys.Dev >> 8),
    22  		Minor:    uint64(sys.Dev & 0xff),
    23  		Rmajor:   uint64(sys.Rdev >> 8),
    24  		Rminor:   uint64(sys.Rdev & 0xff),
    25  		Name:     n,
    26  	}
    27  }