Commit e8e94fea authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Run gofmt.

parent 49cf5940
......@@ -16,7 +16,7 @@ type MutableDataFile struct {
}
func (me *MutableDataFile) Read(r *ReadIn, bp *BufferPool) ([]byte, Status) {
return me.data[r.Offset:r.Offset+uint64(r.Size)], OK
return me.data[r.Offset : r.Offset+uint64(r.Size)], OK
}
func (me *MutableDataFile) Write(w *WriteIn, d []byte) (uint32, Status) {
......@@ -135,7 +135,7 @@ func TestFSetAttr(t *testing.T) {
go state.Loop(false)
fn := dir + "/file"
f, err := os.OpenFile(fn, os.O_CREATE | os.O_WRONLY, 0755)
f, err := os.OpenFile(fn, os.O_CREATE|os.O_WRONLY, 0755)
CheckSuccess(err)
defer f.Close()
......@@ -151,7 +151,7 @@ func TestFSetAttr(t *testing.T) {
t.Error("truncate")
}
if state.KernelSettings().Flags & CAP_FILE_OPS == 0 {
if state.KernelSettings().Flags&CAP_FILE_OPS == 0 {
log.Println("Mount does not support file operations")
m, _ := json.Marshal(state.KernelSettings())
log.Println("Kernel settings: ", string(m))
......@@ -167,7 +167,7 @@ func TestFSetAttr(t *testing.T) {
err = os.Chmod(fn, 024)
CheckSuccess(err)
if fs.file.FileInfo.Mode & 07777 != 024 {
if fs.file.FileInfo.Mode&07777 != 024 {
t.Error("chmod")
}
......
......@@ -16,7 +16,7 @@ package fuse
lookups (eg. after doing a symlink). We could probably do without
the GetAttr calls.
*/
*/
import (
"fmt"
......
......@@ -74,7 +74,7 @@ func (me *FileSystemConnector) Forget(h *InHeader, input *ForgetIn) {
}
func (me *FileSystemConnector) GetAttr(header *InHeader, input *GetAttrIn) (out *AttrOut, code Status) {
if input.Flags & FUSE_GETATTR_FH != 0 {
if input.Flags&FUSE_GETATTR_FH != 0 {
f, mount := me.getFile(input.Fh)
attr := f.GetAttr()
if attr != nil {
......@@ -205,14 +205,14 @@ func (me *FileSystemConnector) SetAttr(header *InHeader, input *SetAttrIn) (out
fileResult = ENOSYS
}
}
if err == OK && (input.Valid& (FATTR_ATIME|FATTR_MTIME|FATTR_ATIME_NOW|FATTR_MTIME_NOW) != 0) {
atime := uint64(input.Atime*1e9)+uint64(input.Atimensec)
if input.Valid & FATTR_ATIME_NOW != 0 {
if err == OK && (input.Valid&(FATTR_ATIME|FATTR_MTIME|FATTR_ATIME_NOW|FATTR_MTIME_NOW) != 0) {
atime := uint64(input.Atime*1e9) + uint64(input.Atimensec)
if input.Valid&FATTR_ATIME_NOW != 0 {
atime = uint64(time.Nanoseconds())
}
mtime := uint64(input.Mtime*1e9)+uint64(input.Mtimensec)
if input.Valid & FATTR_MTIME_NOW != 0 {
mtime := uint64(input.Mtime*1e9) + uint64(input.Mtimensec)
if input.Valid&FATTR_MTIME_NOW != 0 {
mtime = uint64(time.Nanoseconds())
}
......
......@@ -243,6 +243,7 @@ type FlushIn struct {
const (
FUSE_READ_LOCKOWNER = (1 << 1)
)
type ReadIn struct {
Fh uint64
Offset uint64
......@@ -258,6 +259,7 @@ const (
FUSE_WRITE_CACHE = (1 << 0)
FUSE_WRITE_LOCKOWNER = (1 << 1)
)
type WriteIn struct {
Fh uint64
Offset uint64
......@@ -384,6 +386,7 @@ const (
FUSE_IOCTL_UNRESTRICTED = (1 << 1)
FUSE_IOCTL_RETRY = (1 << 2)
)
type IoctlIn struct {
Fh uint64
Flags uint32
......
......@@ -330,11 +330,11 @@ func TestTruncate(t *testing.T) {
writeToFile(wd+"/ro/file", "hello")
os.Truncate(wd+"/mount/file", 2)
content := readFromFile(wd+"/mount/file")
content := readFromFile(wd + "/mount/file")
if content != "he" {
t.Errorf("unexpected content %v", content)
}
content2 := readFromFile(wd+"/rw/file")
content2 := readFromFile(wd + "/rw/file")
if content2 != content {
t.Errorf("unexpected rw content %v", content2)
}
......
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