当前位置: 首页>>代码示例>>Golang>>正文


Golang syscall.Statfs_t类代码示例

本文整理汇总了Golang中syscall.Statfs_t的典型用法代码示例。如果您正苦于以下问题:Golang Statfs_t类的具体用法?Golang Statfs_t怎么用?Golang Statfs_t使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Statfs_t类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: TestStatFs

// This test is racy. If an external process consumes space while this
// runs, we may see spurious differences between the two statfs() calls.
func TestStatFs(t *testing.T) {
	ts := NewTestCase(t)
	defer ts.Cleanup()

	empty := syscall.Statfs_t{}
	s1 := empty
	err := syscall.Statfs(ts.orig, &s1)
	if err != 0 {
		t.Fatal("statfs orig", err)
	}

	s2 := syscall.Statfs_t{}
	err = syscall.Statfs(ts.mnt, &s2)

	s1.Type = 0
	s2.Type = 0

	s1.Fsid = empty.Fsid
	s2.Fsid = empty.Fsid

	s1.Spare = empty.Spare
	s2.Spare = empty.Spare

	if err != 0 {
		t.Fatal("statfs mnt", err)
	}

	if fmt.Sprintf("%v", s2) != fmt.Sprintf("%v", s1) {
		t.Error("Mismatch", s1, s2)
	}
}
开发者ID:lht,项目名称:go-fuse,代码行数:33,代码来源:loopback_test.go

示例2: clearStatfs

func clearStatfs(s *syscall.Statfs_t) {
	empty := syscall.Statfs_t{}
	s.Type = 0
	s.Fsid = empty.Fsid
	s.Spare = empty.Spare
	// TODO - figure out what this is for.
	s.Flags = 0
}
开发者ID:niltonkummer,项目名称:go-fuse,代码行数:8,代码来源:loopback_test.go

示例3: clearStatfs

func clearStatfs(s *syscall.Statfs_t) {
	empty := syscall.Statfs_t{}

	// FUSE can only set the following fields.
	empty.Blocks = s.Blocks
	empty.Bfree = s.Bfree
	empty.Bavail = s.Bavail
	empty.Files = s.Files
	empty.Ffree = s.Ffree
	empty.Iosize = s.Iosize
	empty.Bsize = s.Bsize
	// Clear out the rest.
	*s = empty
}
开发者ID:jszwedko,项目名称:ec2-metadatafs,代码行数:14,代码来源:loopback_darwin_test.go


注:本文中的syscall.Statfs_t类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。