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

Gofmt.

parent 77177c5d
...@@ -4,8 +4,7 @@ ...@@ -4,8 +4,7 @@
package fuse package fuse
import ( import ()
)
// Types for users to implement. // Types for users to implement.
......
...@@ -50,9 +50,6 @@ func (me FileMode) IsSymlink() bool { return (uint32(me) & syscall.S_IFMT) == sy ...@@ -50,9 +50,6 @@ func (me FileMode) IsSymlink() bool { return (uint32(me) & syscall.S_IFMT) == sy
// IsSocket reports whether the FileInfo describes a socket. // IsSocket reports whether the FileInfo describes a socket.
func (me FileMode) IsSocket() bool { return (uint32(me) & syscall.S_IFMT) == syscall.S_IFSOCK } func (me FileMode) IsSocket() bool { return (uint32(me) & syscall.S_IFMT) == syscall.S_IFSOCK }
func (me *Attr) IsFifo() bool { return (uint32(me.Mode) & syscall.S_IFMT) == syscall.S_IFIFO } func (me *Attr) IsFifo() bool { return (uint32(me.Mode) & syscall.S_IFMT) == syscall.S_IFIFO }
// IsChar reports whether the FileInfo describes a character special file. // IsChar reports whether the FileInfo describes a character special file.
...@@ -73,31 +70,30 @@ func (me *Attr) IsSymlink() bool { return (uint32(me.Mode) & syscall.S_IFMT) == ...@@ -73,31 +70,30 @@ func (me *Attr) IsSymlink() bool { return (uint32(me.Mode) & syscall.S_IFMT) ==
// IsSocket reports whether the FileInfo describes a socket. // IsSocket reports whether the FileInfo describes a socket.
func (me *Attr) IsSocket() bool { return (uint32(me.Mode) & syscall.S_IFMT) == syscall.S_IFSOCK } func (me *Attr) IsSocket() bool { return (uint32(me.Mode) & syscall.S_IFMT) == syscall.S_IFSOCK }
func (a *Attr) Atimens() int64 { func (a *Attr) Atimens() int64 {
return int64(1e9 * a.Atime) + int64(a.Atimensec) return int64(1e9*a.Atime) + int64(a.Atimensec)
} }
func (a *Attr) Mtimens() int64 { func (a *Attr) Mtimens() int64 {
return int64(1e9 * a.Mtime) + int64(a.Mtimensec) return int64(1e9*a.Mtime) + int64(a.Mtimensec)
} }
func (a *Attr) Ctimens() int64 { func (a *Attr) Ctimens() int64 {
return int64(1e9 * a.Ctime) + int64(a.Ctimensec) return int64(1e9*a.Ctime) + int64(a.Ctimensec)
} }
func (a *Attr) SetTimes(atimens int64, mtimens int64, ctimens int64) { func (a *Attr) SetTimes(atimens int64, mtimens int64, ctimens int64) {
if atimens >= 0 { if atimens >= 0 {
a.Atime = uint64(atimens/1e9) a.Atime = uint64(atimens / 1e9)
a.Atimensec = uint32(atimens%1e9) a.Atimensec = uint32(atimens % 1e9)
} }
if mtimens >= 0 { if mtimens >= 0 {
a.Mtime = uint64(mtimens/1e9) a.Mtime = uint64(mtimens / 1e9)
a.Mtimensec = uint32(mtimens%1e9) a.Mtimensec = uint32(mtimens % 1e9)
} }
if atimens >= 0 { if atimens >= 0 {
a.Ctime = uint64(ctimens/1e9) a.Ctime = uint64(ctimens / 1e9)
a.Ctimensec = uint32(ctimens%1e9) a.Ctimensec = uint32(ctimens % 1e9)
} }
} }
......
...@@ -3,8 +3,8 @@ package fuse ...@@ -3,8 +3,8 @@ package fuse
import ( import (
"fmt" "fmt"
"log" "log"
"sync"
"strings" "strings"
"sync"
"unsafe" "unsafe"
) )
...@@ -99,7 +99,7 @@ func (me *BufferPoolImpl) AllocBuffer(size uint32) []byte { ...@@ -99,7 +99,7 @@ func (me *BufferPoolImpl) AllocBuffer(size uint32) []byte {
sz = PAGESIZE sz = PAGESIZE
} }
if sz % PAGESIZE != 0 { if sz%PAGESIZE != 0 {
sz += PAGESIZE sz += PAGESIZE
} }
psz := sz / PAGESIZE psz := sz / PAGESIZE
...@@ -112,7 +112,7 @@ func (me *BufferPoolImpl) AllocBuffer(size uint32) []byte { ...@@ -112,7 +112,7 @@ func (me *BufferPoolImpl) AllocBuffer(size uint32) []byte {
b = me.getBuffer(psz) b = me.getBuffer(psz)
if b == nil { if b == nil {
me.createdBuffers++ me.createdBuffers++
b = make([]byte, size, psz * PAGESIZE) b = make([]byte, size, psz*PAGESIZE)
} else { } else {
b = b[:size] b = b[:size]
} }
...@@ -134,7 +134,7 @@ func (me *BufferPoolImpl) FreeBuffer(slice []byte) { ...@@ -134,7 +134,7 @@ func (me *BufferPoolImpl) FreeBuffer(slice []byte) {
if slice == nil { if slice == nil {
return return
} }
if cap(slice) % PAGESIZE != 0 || cap(slice) == 0 { if cap(slice)%PAGESIZE != 0 || cap(slice) == 0 {
return return
} }
psz := cap(slice) / PAGESIZE psz := cap(slice) / PAGESIZE
......
package fuse package fuse
import ( import ()
)
// DefaultFileSystem // DefaultFileSystem
func (me *DefaultFileSystem) GetAttr(name string, context *Context) (*Attr, Status) { func (me *DefaultFileSystem) GetAttr(name string, context *Context) (*Attr, Status) {
......
...@@ -40,7 +40,6 @@ type PathNodeFs struct { ...@@ -40,7 +40,6 @@ type PathNodeFs struct {
options *PathNodeFsOptions options *PathNodeFsOptions
} }
func (me *PathNodeFs) Mount(path string, nodeFs NodeFileSystem, opts *FileSystemOptions) Status { func (me *PathNodeFs) Mount(path string, nodeFs NodeFileSystem, opts *FileSystemOptions) Status {
dir, name := filepath.Split(path) dir, name := filepath.Split(path)
if dir != "" { if dir != "" {
......
...@@ -13,7 +13,9 @@ var _ = fmt.Print ...@@ -13,7 +13,9 @@ var _ = fmt.Print
var _ = log.Print var _ = log.Print
var CheckSuccess = fuse.CheckSuccess var CheckSuccess = fuse.CheckSuccess
const entryTtl = 0.1 const entryTtl = 0.1
var testAOpts = AutoUnionFsOptions{ var testAOpts = AutoUnionFsOptions{
UnionFsOptions: testOpts, UnionFsOptions: testOpts,
FileSystemOptions: fuse.FileSystemOptions{ FileSystemOptions: fuse.FileSystemOptions{
......
...@@ -24,7 +24,7 @@ func HeaderToFileInfo(h *tar.Header) (*fuse.Attr, string) { ...@@ -24,7 +24,7 @@ func HeaderToFileInfo(h *tar.Header) (*fuse.Attr, string) {
} }
a.Uid = uint32(h.Uid) a.Uid = uint32(h.Uid)
a.Gid = uint32(h.Gid) a.Gid = uint32(h.Gid)
a.SetTimes(h.Atime, h.Mtime,h.Ctime) a.SetTimes(h.Atime, h.Mtime, h.Ctime)
return a, h.Name return a, h.Name
} }
......
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