os: make 'Block::Operation' printable

Issue #3283
This commit is contained in:
Norman Feske 2019-04-11 21:37:53 +02:00 committed by Christian Helmuth
parent e5f27b44b5
commit 976f67eee6
1 changed files with 18 additions and 0 deletions

View File

@ -16,6 +16,7 @@
/* Genode includes */
#include <base/stdint.h>
#include <base/output.h>
namespace Block {
@ -41,6 +42,23 @@ struct Block::Operation
return type == Type::READ || type == Type::WRITE
|| type == Type::SYNC || type == Type::TRIM;
}
static char const *type_name(Type type)
{
switch (type) {
case Type::INVALID: return "INVALID";
case Type::READ: return "READ";
case Type::WRITE: return "WRITE";
case Type::SYNC: return "SYNC";
case Type::TRIM: return "TRIM";
}
return "INVALID";
}
void print(Genode::Output &out) const
{
Genode::print(out, type_name(type), " block=", block_number, " count=", count);
}
};