Advertisement
Guest User

Untitled

a guest
Aug 5th, 2015
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. package fuse
  2.  
  3. import (
  4. "fmt"
  5. "os"
  6. "unsafe"
  7.  
  8. "bazil.org/fuse/syscallx"
  9. )
  10.  
  11. const fuseBufMaxSize = (1024 * 4096)
  12.  
  13. func mount(dir string, conf *mountConfig, ready chan<- struct{}, errp *error) (*os.File, error) {
  14. defer close(ready)
  15.  
  16. fmt.Printf("mount(%v, %v)\n", dir, conf)
  17. f, err := os.OpenFile("/dev/fuse0", os.O_RDWR, 0000)
  18. if err != nil {
  19. *errp = err
  20. return nil, err
  21. }
  22.  
  23. fuse_args := syscallx.Fusefs_args{
  24. FD: int(f.Fd()),
  25. MaxRead: fuseBufMaxSize,
  26. }
  27.  
  28. err = syscallx.Mount("fuse", dir, 0, uintptr(unsafe.Pointer(&fuse_args)))
  29. return f, err
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement