Commit 8bd60ffd authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Use log.Panicf rather than panic(fmt.Sprintf()).

parent 3936f28c
......@@ -5,7 +5,6 @@ package fuse
// are in fsops.go
import (
"fmt"
"log"
"os"
"path/filepath"
......@@ -134,7 +133,7 @@ func (me *FileSystemConnector) forgetUpdate(node *Inode, forgetCount int) {
me.inodeMap.Forget(node.nodeId)
node.nodeId = 0
} else if node.lookupCount < 0 {
panic(fmt.Sprintf("lookupCount underflow: %d: %v", node.lookupCount, me))
log.Panicf("lookupCount underflow: %d: %v", node.lookupCount, me)
}
me.recursiveConsiderDropInode(node)
......@@ -159,7 +158,7 @@ func (me *FileSystemConnector) recursiveConsiderDropInode(n *Inode) (drop bool)
for _, k := range delChildren {
ch := n.rmChild(k)
if ch == nil {
panic(fmt.Sprintf("trying to del child %q, but not present", k))
log.Panicf("trying to del child %q, but not present", k)
}
// TODO - change name? This does not really mark the
// fuse Forget operation.
......
package fuse
import (
"fmt"
"log"
"sync"
)
......@@ -167,7 +166,7 @@ func (me *Inode) addChild(name string, child *Inode) {
if paranoia {
ch := me.children[name]
if ch != nil {
panic(fmt.Sprintf("Already have an Inode with same name: %v: %v", name, ch))
log.Panicf("Already have an Inode with same name: %v: %v", name, ch)
}
}
me.children[name] = child
......@@ -229,31 +228,31 @@ const initDirSize = 20
func (me *Inode) verify(cur *fileSystemMount) {
if me.lookupCount < 0 {
panic(fmt.Sprintf("negative lookup count %d on node %d", me.lookupCount, me.nodeId))
log.Panicf("negative lookup count %d on node %d", me.lookupCount, me.nodeId)
}
if (me.lookupCount == 0) != (me.nodeId == 0) {
panic("kernel registration mismatch")
log.Panicf("kernel registration mismatch: lookup %d id %d", me.lookupCount, me.nodeId)
}
if me.mountPoint != nil {
if me != me.mountPoint.mountInode {
panic("mountpoint mismatch")
log.Panicf("mountpoint mismatch %v %v", me, me.mountPoint.mountInode)
}
cur = me.mountPoint
}
if me.mount != cur {
panic(fmt.Sprintf("me.mount not set correctly %v %v", me.mount, cur))
log.Panicf("me.mount not set correctly %v %v", me.mount, cur)
}
for name, m := range me.mounts {
if m.mountInode != me.children[name] {
panic(fmt.Sprintf("mountpoint parent mismatch: node:%v name:%v ch:%v",
me.mountPoint, name, me.children))
log.Panicf("mountpoint parent mismatch: node:%v name:%v ch:%v",
me.mountPoint, name, me.children)
}
}
for _, ch := range me.children {
for n, ch := range me.children {
if ch == nil {
panic("Found nil child.")
log.Panicf("Found nil child: %q", n)
}
ch.verify(cur)
}
......
......@@ -115,7 +115,7 @@ func ModeToType(mode uint32) uint32 {
func CheckSuccess(e error) {
if e != nil {
panic(fmt.Sprintf("Unexpected error: %v", e))
log.Panicf("Unexpected error: %v", e)
}
}
......
......@@ -26,7 +26,7 @@ func Socketpair(network string) (l, r *os.File, err error) {
domain = syscall.AF_UNIX
typ = syscall.SOCK_SEQPACKET
default:
panic("unknown network " + network)
log.Panicf("unknown network %q", network)
}
fd, errno := syscall.Socketpair(domain, typ, 0)
if errno != 0 {
......
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