Commit 49cf5940 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Polish.

parent d87cbd06
...@@ -75,7 +75,7 @@ KNOWN PROBLEMS ...@@ -75,7 +75,7 @@ KNOWN PROBLEMS
Grep source code for TODO. Major topics: Grep source code for TODO. Major topics:
* Missing support for file locking: FUSE_GETLK, FUSE_SETLK, FUSE_SETLKW * Missing support for file locking: FUSE_GETLK, FUSE_SETLK, FUSE_SETLKW, STATFS
* Missing support for FUSE_INTERRUPT, FUSE_NOTIFY, CUSE, BMAP, POLL, IOCTL * Missing support for FUSE_INTERRUPT, FUSE_NOTIFY, CUSE, BMAP, POLL, IOCTL
......
...@@ -9,7 +9,8 @@ import ( ...@@ -9,7 +9,8 @@ import (
const ( const (
// bufSize should be a power of two to minimize lossage in // bufSize should be a power of two to minimize lossage in
// BufferPool. // BufferPool. The minimum is 8k, but it doesn't cost anything to
// use a much larger buffer.
bufSize = (1 << 16) bufSize = (1 << 16)
maxRead = bufSize - PAGESIZE maxRead = bufSize - PAGESIZE
) )
......
...@@ -51,10 +51,10 @@ func (me *LoopbackFileSystem) OpenDir(name string) (stream chan DirEntry, status ...@@ -51,10 +51,10 @@ func (me *LoopbackFileSystem) OpenDir(name string) (stream chan DirEntry, status
if err != nil { if err != nil {
return nil, OsErrorToErrno(err) return nil, OsErrorToErrno(err)
} }
output := make(chan DirEntry, 500) want := 500
output := make(chan DirEntry, want)
go func() { go func() {
for { for {
want := 500
infos, err := f.Readdir(want) infos, err := f.Readdir(want)
for i, _ := range infos { for i, _ := range infos {
output <- DirEntry{ output <- DirEntry{
......
...@@ -59,6 +59,11 @@ const ( ...@@ -59,6 +59,11 @@ const (
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
func doInit(state *MountState, req *request) { func doInit(state *MountState, req *request) {
const (
FUSE_KERNEL_VERSION = 7
FUSE_KERNEL_MINOR_VERSION = 13
)
input := (*InitIn)(req.inData) input := (*InitIn)(req.inData)
if input.Major != FUSE_KERNEL_VERSION { if input.Major != FUSE_KERNEL_VERSION {
log.Printf("Major versions does not match. Given %d, want %d\n", input.Major, FUSE_KERNEL_VERSION) log.Printf("Major versions does not match. Given %d, want %d\n", input.Major, FUSE_KERNEL_VERSION)
......
...@@ -6,43 +6,20 @@ import ( ...@@ -6,43 +6,20 @@ import (
) )
const ( const (
FUSE_KERNEL_VERSION = 7
FUSE_KERNEL_MINOR_VERSION = 13
FUSE_ROOT_ID = 1 FUSE_ROOT_ID = 1
// OpenIn.Flags
FOPEN_DIRECT_IO = (1 << 0)
FOPEN_KEEP_CACHE = (1 << 1)
FOPEN_NONSEEKABLE = (1 << 2)
FUSE_UNKNOWN_INO = 0xffffffff FUSE_UNKNOWN_INO = 0xffffffff
CUSE_UNRESTRICTED_IOCTL = (1 << 0) CUSE_UNRESTRICTED_IOCTL = (1 << 0)
FUSE_RELEASE_FLUSH = (1 << 0) FUSE_RELEASE_FLUSH = (1 << 0)
// If set, GetAttrIn has a file handle set.
FUSE_GETATTR_FH = (1 << 0)
FUSE_LK_FLOCK = (1 << 0) FUSE_LK_FLOCK = (1 << 0)
FUSE_WRITE_CACHE = (1 << 0)
FUSE_WRITE_LOCKOWNER = (1 << 1)
FUSE_READ_LOCKOWNER = (1 << 1)
FUSE_IOCTL_COMPAT = (1 << 0)
FUSE_IOCTL_UNRESTRICTED = (1 << 1)
FUSE_IOCTL_RETRY = (1 << 2)
FUSE_IOCTL_MAX_IOV = 256 FUSE_IOCTL_MAX_IOV = 256
FUSE_POLL_SCHEDULE_NOTIFY = (1 << 0) FUSE_POLL_SCHEDULE_NOTIFY = (1 << 0)
FUSE_MIN_READ_BUFFER = 8192
CUSE_INIT_INFO_MAX = 4096 CUSE_INIT_INFO_MAX = 4096
S_IFDIR = syscall.S_IFDIR S_IFDIR = syscall.S_IFDIR
...@@ -149,6 +126,11 @@ type ForgetIn struct { ...@@ -149,6 +126,11 @@ type ForgetIn struct {
Nlookup uint64 Nlookup uint64
} }
const (
// Mask for GetAttrIn.Flags. If set, GetAttrIn has a file handle set.
FUSE_GETATTR_FH = (1 << 0)
)
type GetAttrIn struct { type GetAttrIn struct {
Flags uint32 Flags uint32
Dummy uint32 Dummy uint32
...@@ -214,6 +196,13 @@ type SetAttrIn struct { ...@@ -214,6 +196,13 @@ type SetAttrIn struct {
Unused5 uint32 Unused5 uint32
} }
const (
// OpenIn.Flags
FOPEN_DIRECT_IO = (1 << 0)
FOPEN_KEEP_CACHE = (1 << 1)
FOPEN_NONSEEKABLE = (1 << 2)
)
type OpenIn struct { type OpenIn struct {
Flags uint32 Flags uint32
Unused uint32 Unused uint32
...@@ -251,6 +240,9 @@ type FlushIn struct { ...@@ -251,6 +240,9 @@ type FlushIn struct {
LockOwner uint64 LockOwner uint64
} }
const (
FUSE_READ_LOCKOWNER = (1 << 1)
)
type ReadIn struct { type ReadIn struct {
Fh uint64 Fh uint64
Offset uint64 Offset uint64
...@@ -261,6 +253,11 @@ type ReadIn struct { ...@@ -261,6 +253,11 @@ type ReadIn struct {
Padding uint32 Padding uint32
} }
const (
FUSE_WRITE_CACHE = (1 << 0)
FUSE_WRITE_LOCKOWNER = (1 << 1)
)
type WriteIn struct { type WriteIn struct {
Fh uint64 Fh uint64
Offset uint64 Offset uint64
...@@ -277,7 +274,7 @@ type WriteOut struct { ...@@ -277,7 +274,7 @@ type WriteOut struct {
} }
type StatfsOut struct { type StatfsOut struct {
St Kstatfs Kstatfs
} }
type FsyncIn struct { type FsyncIn struct {
...@@ -382,6 +379,11 @@ type BmapOut struct { ...@@ -382,6 +379,11 @@ type BmapOut struct {
Block uint64 Block uint64
} }
const (
FUSE_IOCTL_COMPAT = (1 << 0)
FUSE_IOCTL_UNRESTRICTED = (1 << 1)
FUSE_IOCTL_RETRY = (1 << 2)
)
type IoctlIn struct { type IoctlIn struct {
Fh uint64 Fh uint64
Flags uint32 Flags uint32
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment