Ejemplo n.º 1
0
Archivo: fs.go Proyecto: funkygao/gafka
func (this *KafkaFS) Statfs(ctx context.Context, req *fuse.StatfsRequest,
	res *fuse.StatfsResponse) error {
	s := syscall.Statfs_t{}
	res.Blocks = s.Blocks
	res.Bfree = s.Bfree
	res.Bavail = s.Bavail
	res.Ffree = s.Ffree
	res.Bsize = uint32(s.Bsize)
	return nil
}
Ejemplo n.º 2
0
func (fs FS) Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse.StatfsResponse) error {
	resp.Blocks = 18446744073709551615
	resp.Bfree = 18446744073709551615  // Free blocks in file system.
	resp.Bavail = 18446744073709551615 // Free blocks in file system if you're not root.
	resp.Files = 0                     // Total files in file system.
	resp.Ffree = 18446744073709551615  // Free files in file system.
	resp.Bsize = uint32(fs.blockSize)  // Block size
	resp.Namelen = 4294967295          // Maximum file name length?
	resp.Frsize = 1                    // Fragment size, smallest addressable data size in the file system.
	return nil
}
Ejemplo n.º 3
0
func (fs *CamliFileSystem) Statfs(ctx context.Context, req *fuse.StatfsRequest, res *fuse.StatfsResponse) error {
	// Make some stuff up, just to see if it makes "lsof" happy.
	res.Blocks = 1 << 35
	res.Bfree = 1 << 34
	res.Bavail = 1 << 34
	res.Files = 1 << 29
	res.Ffree = 1 << 28
	res.Namelen = 2048
	res.Bsize = 1024
	return nil
}
Ejemplo n.º 4
0
Archivo: fs.go Proyecto: ncw/rclone
// Statfs is called to obtain file system metadata.
// It should write that data to resp.
func (f *FS) Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse.StatfsResponse) error {
	const blockSize = 4096
	const fsBlocks = (1 << 50) / blockSize
	resp.Blocks = fsBlocks  // Total data blocks in file system.
	resp.Bfree = fsBlocks   // Free blocks in file system.
	resp.Bavail = fsBlocks  // Free blocks in file system if you're not root.
	resp.Files = 1E9        // Total files in file system.
	resp.Ffree = 1E9        // Free files in file system.
	resp.Bsize = blockSize  // Block size
	resp.Namelen = 255      // Maximum file name length?
	resp.Frsize = blockSize // Fragment size, smallest addressable data size in the file system.
	return nil
}
Ejemplo n.º 5
0
func (fs FS) Statfs(req *fuse.StatfsRequest, res *fuse.StatfsResponse, intr fs.Intr) fuse.Error {
	// Make some stuff up, just to see if it makes "lsof" happy.
	res.Blocks = 1 << 35
	res.Bfree = 1 << 34
	res.Bavail = 1 << 34
	res.Files = 1 << 29
	res.Ffree = 1 << 28
	res.Namelen = 2048
	// res.Bsize = 1024
	// res.Bsize = 32768
	// res.Bsize = 49152
	res.Bsize = 4096 * 1024
	return nil
}
Ejemplo n.º 6
0
func statfsToFuse(path string, resp *fuse.StatfsResponse) error {
	var buf syscall.Statfs_t
	if err := syscall.Statfs(path, &buf); err != nil {
		return fuse.ENOTSUP
	}
	resp.Blocks = uint64(buf.Blocks) // Total data blocks in file system.
	resp.Bfree = uint64(buf.Bfree)   // Free blocks in file system.
	resp.Bavail = uint64(buf.Bavail) // Free blocks in file system if you're not root.
	resp.Files = uint64(buf.Files)   // Total files in file system.
	resp.Ffree = uint64(buf.Ffree)   // Free files in file system.
	resp.Bsize = uint32(buf.Bsize)   // Block size
	// resp.Namelen = ????  // Does not exist on Mac OS X
	// resp.Frsize = // Does not exist on Mac OS X
	return nil
}
Ejemplo n.º 7
0
func (f *MirrorFS) Statfs(ctx context.Context, req *fuse.StatfsRequest, res *fuse.StatfsResponse) error {
	s := syscall.Statfs_t{}
	err := syscall.Statfs(f.path, &s)
	if err != nil {
		log.Println("DRIVE | Statfs syscall failed; ", err)
		return err
	}

	res.Blocks = s.Blocks
	res.Bfree = s.Bfree
	res.Bavail = s.Bavail
	res.Ffree = s.Ffree
	res.Bsize = s.Bsize
	// log.Println(res)
	return nil
}
Ejemplo n.º 8
0
Archivo: fs.go Proyecto: ligadous/logfs
func (f *LogFS) Statfs(ctx context.Context, req *fuse.StatfsRequest, res *fuse.StatfsResponse) error {
	log.Println("** Statfs")

	s := syscall.Statfs_t{}
	err := syscall.Statfs(f.path, &s)
	if err != nil {
		log.Println("DRIVE) Statfs falha no syscall; ", err)
		return err
	}

	res.Blocks = s.Blocks
	res.Bfree = s.Bfree
	res.Bavail = s.Bavail
	res.Ffree = s.Ffree
	res.Bsize = s.Bsize
	return nil
}