Commit 4f3be4ed authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Print opcodes symbolically.

parent ec5217de
...@@ -251,7 +251,11 @@ func (me *MountState) chopMessage(req *request) *operationHandler { ...@@ -251,7 +251,11 @@ 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.Printf("Unknown opcode %v", req.inHeader.Opcode) msg := "Unimplemented"
if handler == nil {
msg = "Unknown"
}
log.Printf("%s opcode %v", msg, req.inHeader.Opcode)
req.status = ENOSYS req.status = ENOSYS
return handler return handler
} }
......
...@@ -273,6 +273,10 @@ func operationName(opcode Opcode) string { ...@@ -273,6 +273,10 @@ func operationName(opcode Opcode) string {
return h.Name return h.Name
} }
func (op Opcode) String() string {
return operationName(op)
}
func getHandler(o Opcode) *operationHandler { func getHandler(o Opcode) *operationHandler {
if o >= OPCODE_COUNT { if o >= OPCODE_COUNT {
return nil return nil
......
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