github.com/whamcloud/lemur@v0.0.0-20190827193804-4655df8a52af/pkg/fsroot/fsid_darwin.go (about)

     1  // Copyright (c) 2018 DDN. All rights reserved.
     2  // Use of this source code is governed by a MIT-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package fsroot
     6  
     7  import "golang.org/x/sys/unix"
     8  
     9  func getFsID(mountPath string) (*FsID, error) {
    10  	statfs := &unix.Statfs_t{}
    11  
    12  	if err := unix.Statfs(mountPath, statfs); err != nil {
    13  		return nil, err
    14  	}
    15  	var id FsID
    16  	id.val[0] = statfs.Fsid.Val[0]
    17  	id.val[1] = statfs.Fsid.Val[1]
    18  	return &id, nil
    19  }