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

Use log.Printf for errors.

parent 547051cf
...@@ -80,8 +80,6 @@ type MountState struct { ...@@ -80,8 +80,6 @@ type MountState struct {
} }
// Mount filesystem on mountPoint. // Mount filesystem on mountPoint.
//
// TODO - error handling should perhaps be user-serviceable.
func (me *MountState) Mount(mountPoint string) os.Error { func (me *MountState) Mount(mountPoint string) os.Error {
file, mp, err := mount(mountPoint) file, mp, err := mount(mountPoint)
if err != nil { if err != nil {
...@@ -104,10 +102,6 @@ func (me *MountState) Unmount() os.Error { ...@@ -104,10 +102,6 @@ func (me *MountState) Unmount() os.Error {
return result return result
} }
func (me *MountState) Error(err os.Error) {
log.Println("error: ", err)
}
func (me *MountState) Write(req *request) { func (me *MountState) Write(req *request) {
if req.outHeaderBytes == nil { if req.outHeaderBytes == nil {
return return
...@@ -122,8 +116,8 @@ func (me *MountState) Write(req *request) { ...@@ -122,8 +116,8 @@ func (me *MountState) Write(req *request) {
} }
if err != nil { if err != nil {
me.Error(os.NewError(fmt.Sprintf("writer: Write/Writev %v failed, err: %v. Opcode: %v", log.Printf("writer: Write/Writev %v failed, err: %v. Opcode: %v",
req.outHeaderBytes, err, operationName(req.inHeader.Opcode)))) req.outHeaderBytes, err, operationName(req.inHeader.Opcode))
} }
} }
...@@ -239,8 +233,7 @@ func (me *MountState) Loop(threaded bool) { ...@@ -239,8 +233,7 @@ func (me *MountState) Loop(threaded bool) {
break break
} }
readErr := os.NewError(fmt.Sprintf("Failed to read from fuse conn: %v", err)) log.Printf("Failed to read from fuse conn: %v", err)
me.Error(readErr)
break break
} }
...@@ -257,7 +250,7 @@ func (me *MountState) Loop(threaded bool) { ...@@ -257,7 +250,7 @@ func (me *MountState) Loop(threaded bool) {
func (me *MountState) chopMessage(req *request) *operationHandler { func (me *MountState) chopMessage(req *request) *operationHandler {
inHSize := unsafe.Sizeof(InHeader{}) inHSize := unsafe.Sizeof(InHeader{})
if len(req.inputBuf) < inHSize { if len(req.inputBuf) < inHSize {
me.Error(os.NewError(fmt.Sprintf("Short read for input header: %v", req.inputBuf))) log.Printf("Short read for input header: %v", req.inputBuf)
return nil return nil
} }
...@@ -266,13 +259,13 @@ func (me *MountState) chopMessage(req *request) *operationHandler { ...@@ -266,13 +259,13 @@ func (me *MountState) chopMessage(req *request) *operationHandler {
handler := getHandler(req.inHeader.Opcode) handler := getHandler(req.inHeader.Opcode)
if handler == nil || handler.Func == nil { if handler == nil || handler.Func == nil {
log.Println("Unknown opcode %d (input)", req.inHeader.Opcode) log.Printf("Unknown opcode %d (input)", req.inHeader.Opcode)
req.status = ENOSYS req.status = ENOSYS
return handler return handler
} }
if len(req.arg) < handler.InputSize { if len(req.arg) < handler.InputSize {
log.Println("Short read for %v: %v", req.inHeader.Opcode, req.arg) log.Printf("Short read for %v: %v", req.inHeader.Opcode, req.arg)
req.status = EIO req.status = EIO
return handler return handler
} }
......
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