aio: print IOCB_CMD_* using xlat
* xlat/aio_cmds.in: New file. * aio.c (tprint_lio_opcode): Change array of structs "cmds" to array of enums "subs", use printxval_indexn_ex for printing cmd, return sub type using subs array.
This commit is contained in:
parent
59974bed26
commit
b54134352a
36
aio.c
36
aio.c
@ -33,6 +33,8 @@
|
||||
#include "print_fields.h"
|
||||
#include <linux/aio_abi.h>
|
||||
|
||||
#include "xlat/aio_cmds.h"
|
||||
|
||||
SYS_FUNC(io_setup)
|
||||
{
|
||||
if (entering(tcp))
|
||||
@ -56,28 +58,22 @@ enum iocb_sub {
|
||||
static enum iocb_sub
|
||||
tprint_lio_opcode(unsigned int cmd)
|
||||
{
|
||||
static const struct {
|
||||
const char *name;
|
||||
enum iocb_sub sub;
|
||||
} cmds[] = {
|
||||
{ "IOCB_CMD_PREAD", SUB_COMMON },
|
||||
{ "IOCB_CMD_PWRITE", SUB_COMMON },
|
||||
{ "IOCB_CMD_FSYNC", SUB_NONE },
|
||||
{ "IOCB_CMD_FDSYNC", SUB_NONE },
|
||||
{ "IOCB_CMD_PREADX", SUB_NONE },
|
||||
{ "IOCB_CMD_POLL", SUB_NONE },
|
||||
{ "IOCB_CMD_NOOP", SUB_NONE },
|
||||
{ "IOCB_CMD_PREADV", SUB_VECTOR },
|
||||
{ "IOCB_CMD_PWRITEV", SUB_VECTOR },
|
||||
static const enum iocb_sub subs[] = {
|
||||
[IOCB_CMD_PREAD] = SUB_COMMON,
|
||||
[IOCB_CMD_PWRITE] = SUB_COMMON,
|
||||
[IOCB_CMD_FSYNC] = SUB_NONE,
|
||||
[IOCB_CMD_FDSYNC] = SUB_NONE,
|
||||
[IOCB_CMD_PREADX] = SUB_NONE,
|
||||
[IOCB_CMD_POLL] = SUB_NONE,
|
||||
[IOCB_CMD_NOOP] = SUB_NONE,
|
||||
[IOCB_CMD_PREADV] = SUB_VECTOR,
|
||||
[IOCB_CMD_PWRITEV] = SUB_VECTOR,
|
||||
};
|
||||
|
||||
if (cmd < ARRAY_SIZE(cmds)) {
|
||||
tprints(cmds[cmd].name);
|
||||
return cmds[cmd].sub;
|
||||
}
|
||||
tprintf("%u", cmd);
|
||||
tprints_comment("IOCB_CMD_???");
|
||||
return SUB_NONE;
|
||||
printxval_indexn_ex(ARRSZ_PAIR(aio_cmds), cmd, "IOCB_CMD_???",
|
||||
XLAT_STYLE_FMT_U);
|
||||
|
||||
return cmd < ARRAY_SIZE(subs) ? subs[cmd] : SUB_NONE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
10
xlat/aio_cmds.in
Normal file
10
xlat/aio_cmds.in
Normal file
@ -0,0 +1,10 @@
|
||||
#value_indexed
|
||||
IOCB_CMD_PREAD 0
|
||||
IOCB_CMD_PWRITE 1
|
||||
IOCB_CMD_FSYNC 2
|
||||
IOCB_CMD_FDSYNC 3
|
||||
IOCB_CMD_PREADX 4
|
||||
IOCB_CMD_POLL 5
|
||||
IOCB_CMD_NOOP 6
|
||||
IOCB_CMD_PREADV 7
|
||||
IOCB_CMD_PWRITEV 8
|
Loading…
x
Reference in New Issue
Block a user