Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.exe
5 changes: 5 additions & 0 deletions examples/hellofs/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module hellofs

go 1.17

require github.com/billziss-gh/cgofuse v1.5.0
2 changes: 2 additions & 0 deletions examples/hellofs/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/billziss-gh/cgofuse v1.5.0 h1:kH516I/s+Ab4diL/Y/ayFeUjjA8ey+JK12xDfBf4HEs=
github.com/billziss-gh/cgofuse v1.5.0/go.mod h1:LJjoaUojlVjgo5GQoEJTcJNqZJeRU0nCR84CyxKt2YM=
5 changes: 5 additions & 0 deletions examples/memfs/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module memfs

go 1.17

require github.com/billziss-gh/cgofuse v1.5.0
2 changes: 2 additions & 0 deletions examples/memfs/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/billziss-gh/cgofuse v1.5.0 h1:kH516I/s+Ab4diL/Y/ayFeUjjA8ey+JK12xDfBf4HEs=
github.com/billziss-gh/cgofuse v1.5.0/go.mod h1:LJjoaUojlVjgo5GQoEJTcJNqZJeRU0nCR84CyxKt2YM=
51 changes: 46 additions & 5 deletions examples/memfs/memfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
*
* It is licensed under the MIT license. The full license text can be found
* in the License.txt file at the root of this project.
*
*/

package main

import (
Expand Down Expand Up @@ -98,6 +99,33 @@ type Memfs struct {
openmap map[uint64]*node_t
}


func (self *Memfs) Statfs(path string, stat *fuse.Statfs_t) (err int) {
fmt.Printf("STAT FS!!! %s\n", path)
stat.Bsize = 4096
// f_frsize
stat.Frsize = 4096

// 8 EB - 1
vtotal := (8 << 50) / stat.Frsize * 1024 - 1
vavail := (2 << 50) / stat.Frsize * 1024
vfree := (1 << 50) / stat.Frsize * 1024
//used := total - free

// f_blocks
stat.Blocks = vtotal
stat.Bfree = vfree
stat.Bavail = vavail

stat.Files = 2240224
stat.Ffree = 1927486
stat.Favail = 9900000

stat.Namemax = 255
return 0
}


func (self *Memfs) Mknod(path string, mode uint32, dev uint64) (errc int) {
defer trace(path, mode, dev)(&errc)
defer self.synchronize()()
Expand Down Expand Up @@ -582,8 +610,21 @@ var _ fuse.FileSystemSetcrtime = (*Memfs)(nil)
var _ fuse.FileSystemSetchgtime = (*Memfs)(nil)

func main() {
memfs := NewMemfs()
host := fuse.NewFileSystemHost(memfs)
host.SetCapReaddirPlus(true)
host.Mount("", os.Args[1:])
var wg sync.WaitGroup
cpy := 4
wg.Add(cpy)
for i := 0; i < cpy; i++ {
memfs := NewMemfs()
host := fuse.NewFileSystemHost(memfs)
host.SetCapReaddirPlus(true)
go func(i int) {
fmt.Printf("mount %d\n", i)
host.Mount("", append([]string{
"-o", "ExactFileSystemName=NTFS",
"-o", fmt.Sprintf("volname=MyVolume%d", i),
}, os.Args[1:]...))
wg.Done()
}(i)
}
wg.Wait()
}
5 changes: 5 additions & 0 deletions examples/notifyfs/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module notifyfs

go 1.17

require github.com/billziss-gh/cgofuse v1.5.0
2 changes: 2 additions & 0 deletions examples/notifyfs/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/billziss-gh/cgofuse v1.5.0 h1:kH516I/s+Ab4diL/Y/ayFeUjjA8ey+JK12xDfBf4HEs=
github.com/billziss-gh/cgofuse v1.5.0/go.mod h1:LJjoaUojlVjgo5GQoEJTcJNqZJeRU0nCR84CyxKt2YM=
5 changes: 5 additions & 0 deletions examples/passthrough/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module passthrough

go 1.17

require github.com/billziss-gh/cgofuse v1.5.0
2 changes: 2 additions & 0 deletions examples/passthrough/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/billziss-gh/cgofuse v1.5.0 h1:kH516I/s+Ab4diL/Y/ayFeUjjA8ey+JK12xDfBf4HEs=
github.com/billziss-gh/cgofuse v1.5.0/go.mod h1:LJjoaUojlVjgo5GQoEJTcJNqZJeRU0nCR84CyxKt2YM=
3 changes: 3 additions & 0 deletions fuse/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/billziss-gh/cgofuse/fuse

go 1.17
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/billziss-gh/cgofuse

go 1.17