Commit 06a252bd authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Run gofmt

Change-Id: I144cb541
parent 144cb541
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
// Package fs provides infrastructure to build tree-organized filesystems. // Package fs provides infrastructure to build tree-organized filesystems.
// //
// Structure of a file system implementation // # Structure of a file system implementation
// //
// To create a file system, you should first define types for the // To create a file system, you should first define types for the
// nodes of the file system tree. // nodes of the file system tree.
...@@ -34,13 +34,13 @@ ...@@ -34,13 +34,13 @@
// // start serving the file system // // start serving the file system
// server.Wait() // server.Wait()
// //
// Error handling // # Error handling
// //
// All error reporting must use the syscall.Errno type. This is an // All error reporting must use the syscall.Errno type. This is an
// integer with predefined error codes, where the value 0 (`OK`) // integer with predefined error codes, where the value 0 (`OK`)
// should be used to indicate success. // should be used to indicate success.
// //
// File system concepts // # File system concepts
// //
// The FUSE API is very similar to Linux' internal VFS API for // The FUSE API is very similar to Linux' internal VFS API for
// defining file systems in the kernel. It is therefore useful to // defining file systems in the kernel. It is therefore useful to
...@@ -87,8 +87,7 @@ ...@@ -87,8 +87,7 @@
// Go-FUSE, but the result of Lookup operation essentially is a // Go-FUSE, but the result of Lookup operation essentially is a
// dirent, which the kernel puts in a cache. // dirent, which the kernel puts in a cache.
// //
// // # Kernel caching
// Kernel caching
// //
// The kernel caches several pieces of information from the FUSE process: // The kernel caches several pieces of information from the FUSE process:
// //
...@@ -123,13 +122,13 @@ ...@@ -123,13 +122,13 @@
// AttrTimeout: &sec, // AttrTimeout: &sec,
// } // }
// //
// Locking // # Locking
// //
// Locks for networked filesystems are supported through the suite of // Locks for networked filesystems are supported through the suite of
// Getlk, Setlk and Setlkw methods. They alllow locks on regions of // Getlk, Setlk and Setlkw methods. They alllow locks on regions of
// regular files. // regular files.
// //
// Parallelism // # Parallelism
// //
// The VFS layer in the kernel is optimized to be highly parallel, and // The VFS layer in the kernel is optimized to be highly parallel, and
// this parallelism also affects FUSE file systems: many FUSE // this parallelism also affects FUSE file systems: many FUSE
...@@ -138,7 +137,7 @@ ...@@ -138,7 +137,7 @@
// system issuing file operations in parallel, and using the race // system issuing file operations in parallel, and using the race
// detector to weed out data races. // detector to weed out data races.
// //
// Dynamically discovered file systems // # Dynamically discovered file systems
// //
// File system data usually cannot fit all in RAM, so the kernel must // File system data usually cannot fit all in RAM, so the kernel must
// discover the file system dynamically: as you are entering and list // discover the file system dynamically: as you are entering and list
...@@ -151,7 +150,7 @@ ...@@ -151,7 +150,7 @@
// individual children of directories, and 2. Readdir, part of the // individual children of directories, and 2. Readdir, part of the
// NodeReaddirer interface for listing the contents of a directory. // NodeReaddirer interface for listing the contents of a directory.
// //
// Static in-memory file systems // # Static in-memory file systems
// //
// For small, read-only file systems, getting the locking mechanics of // For small, read-only file systems, getting the locking mechanics of
// Lookup correct is tedious, so Go-FUSE provides a feature to // Lookup correct is tedious, so Go-FUSE provides a feature to
...@@ -401,7 +400,6 @@ type DirStream interface { ...@@ -401,7 +400,6 @@ type DirStream interface {
// children in directories. Hence, they also return *Inode and must // children in directories. Hence, they also return *Inode and must
// populate their fuse.EntryOut arguments. // populate their fuse.EntryOut arguments.
//
type NodeLookuper interface { type NodeLookuper interface {
Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*Inode, syscall.Errno) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*Inode, syscall.Errno)
} }
......
...@@ -207,7 +207,6 @@ func (n *testDeletedIno) Getattr(ctx context.Context, f FileHandle, out *fuse.At ...@@ -207,7 +207,6 @@ func (n *testDeletedIno) Getattr(ctx context.Context, f FileHandle, out *fuse.At
// We used to panic like this because inode number 1 was special: // We used to panic like this because inode number 1 was special:
// //
// panic: using reserved ID 1 for inode number // panic: using reserved ID 1 for inode number
//
func TestIno1(t *testing.T) { func TestIno1(t *testing.T) {
rootNode := testIno1{} rootNode := testIno1{}
mnt, _, clean := testMount(t, &rootNode, nil) mnt, _, clean := testMount(t, &rootNode, nil)
......
...@@ -29,7 +29,6 @@ import ( ...@@ -29,7 +29,6 @@ import (
// $ ls -i1 /tmp/x/2 /tmp/x/8/6/4/2 // $ ls -i1 /tmp/x/2 /tmp/x/8/6/4/2
// 2 /tmp/x/2 // 2 /tmp/x/2
// 2 /tmp/x/8/6/4/2 // 2 /tmp/x/8/6/4/2
//
type numberNode struct { type numberNode struct {
// Must embed an Inode for the struct to work as a node. // Must embed an Inode for the struct to work as a node.
fs.Inode fs.Inode
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
// see https://github.com/hanwen/go-fuse/issues/261 for an example of that // see https://github.com/hanwen/go-fuse/issues/261 for an example of that
// problem. // problem.
// //
// Higher level interfaces // # Higher level interfaces
// //
// As said above this packages provides way to implement filesystems in terms of // As said above this packages provides way to implement filesystems in terms of
// raw FUSE protocol. // raw FUSE protocol.
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
// Package github.com/hanwen/go-fuse/v2/fs provides way to implement // Package github.com/hanwen/go-fuse/v2/fs provides way to implement
// filesystems in terms of paths and/or inodes. // filesystems in terms of paths and/or inodes.
// //
// Mount styles // # Mount styles
// //
// The NewServer() handles mounting the filesystem, which // The NewServer() handles mounting the filesystem, which
// involves opening `/dev/fuse` and calling the // involves opening `/dev/fuse` and calling the
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build linux
// +build linux // +build linux
package pathfs package pathfs
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build linux
// +build linux // +build linux
package pathfs package pathfs
......
...@@ -123,7 +123,7 @@ func (ms *Server) RecordLatencies(l LatencyMap) { ...@@ -123,7 +123,7 @@ func (ms *Server) RecordLatencies(l LatencyMap) {
// //
// fusermount -u /path/to/real/mountpoint // fusermount -u /path/to/real/mountpoint
// //
/// in this case. // / in this case.
func (ms *Server) Unmount() (err error) { func (ms *Server) Unmount() (err error) {
if ms.mountPoint == "" { if ms.mountPoint == "" {
return nil return nil
......
...@@ -19,12 +19,12 @@ func (s *Server) setSplice() { ...@@ -19,12 +19,12 @@ func (s *Server) setSplice() {
// //
// This is a four-step process: // This is a four-step process:
// //
// 1) Splice data form fdData.Fd into the "pair1" pipe buffer --> pair1: [payload] // 1. Splice data form fdData.Fd into the "pair1" pipe buffer --> pair1: [payload]
// Now we know the actual payload length and can // Now we know the actual payload length and can
// construct the reply header // construct the reply header
// 2) Write header into the "pair2" pipe buffer --> pair2: [header] // 2. Write header into the "pair2" pipe buffer --> pair2: [header]
// 4) Splice data from "pair1" into "pair2" --> pair2: [header][payload] // 4. Splice data from "pair1" into "pair2" --> pair2: [header][payload]
// 3) Splice the data from "pair2" into /dev/fuse // 3. Splice the data from "pair2" into /dev/fuse
// //
// This dance is neccessary because header and payload cannot be split across // This dance is neccessary because header and payload cannot be split across
// two splices and we cannot seek in a pipe buffer. // two splices and we cannot seek in a pipe buffer.
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build linux
// +build linux // +build linux
package test package test
......
...@@ -45,7 +45,6 @@ func (r *tRoot) Lookup(out *fuse.Attr, name string, fctx *fuse.Context) (*nodefs ...@@ -45,7 +45,6 @@ func (r *tRoot) Lookup(out *fuse.Attr, name string, fctx *fuse.Context) (*nodefs
return node.Inode(), st return node.Inode(), st
} }
// verifyFileRead verifies that file @path has content == dataOK. // verifyFileRead verifies that file @path has content == dataOK.
func verifyFileRead(path string, dataOK string) error { func verifyFileRead(path string, dataOK string) error {
v, err := ioutil.ReadFile(path) v, err := ioutil.ReadFile(path)
...@@ -99,7 +98,7 @@ func TestNodeParallelLookup(t *testing.T) { ...@@ -99,7 +98,7 @@ func TestNodeParallelLookup(t *testing.T) {
}() }()
// the test will deadlock if the client cannot issue several lookups simultaneously // the test will deadlock if the client cannot issue several lookups simultaneously
if srv.KernelSettings().Flags & fuse.CAP_PARALLEL_DIROPS == 0 { if srv.KernelSettings().Flags&fuse.CAP_PARALLEL_DIROPS == 0 {
t.Skip("Kernel serializes dir lookups") t.Skip("Kernel serializes dir lookups")
} }
...@@ -110,10 +109,10 @@ func TestNodeParallelLookup(t *testing.T) { ...@@ -110,10 +109,10 @@ func TestNodeParallelLookup(t *testing.T) {
defer cancel() defer cancel()
wg, ctx := errgroup.WithContext(ctx0) wg, ctx := errgroup.WithContext(ctx0)
wg.Go(func() error { wg.Go(func() error {
return verifyFileRead(dir + "/hello", "abc") return verifyFileRead(dir+"/hello", "abc")
}) })
wg.Go(func() error { wg.Go(func() error {
return verifyFileRead(dir + "/world", "def") return verifyFileRead(dir+"/world", "def")
}) })
// wait till both threads queue into Lookup // wait till both threads queue into Lookup
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build linux
// +build linux // +build linux
package test package test
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build linux
// +build linux // +build linux
package test package test
......
...@@ -16,6 +16,7 @@ import ( ...@@ -16,6 +16,7 @@ import (
// Called by TestLoopbackFileUtimens and TestLoopbackFileSystemUtimens. // Called by TestLoopbackFileUtimens and TestLoopbackFileSystemUtimens.
// //
// Parameters: // Parameters:
//
// path ........ path to the backing file // path ........ path to the backing file
// utimensFn ... Utimens() function that acts on the backing file // utimensFn ... Utimens() function that acts on the backing file
func TestLoopbackUtimens(t *testing.T, path string, utimensFn func(atime *time.Time, mtime *time.Time) fuse.Status) { func TestLoopbackUtimens(t *testing.T, path string, utimensFn func(atime *time.Time, mtime *time.Time) fuse.Status) {
......
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