6 /* Constants and macros */
9 * Constants for nbd_request.magic == NBD_TRACELOG_MAGIC
11 /* 1) stored in nbd_req.type */
13 /* enable/disable logging actual data.
14 * nbd_request.len is the new value (true/false)
16 NBD_TRACELOG_SET_DATALOG
= 1
19 /* 2) Must be in nbd_req.from */
20 #define NBD_TRACELOG_FROM_MAGIC 0x4A93BA39A54F31B6ULL
25 * Translate a command name into human readable form
27 * @param command The command number (after applying NBD_CMD_MASK_COMMAND)
28 * @return pointer to the command name
30 #define ENUM2STR(x) case x: return #x
31 static inline const char * getcommandname(uint32_t command
) {
33 ENUM2STR(NBD_CMD_READ
);
34 ENUM2STR(NBD_CMD_WRITE
);
35 ENUM2STR(NBD_CMD_DISC
);
36 ENUM2STR(NBD_CMD_FLUSH
);
37 ENUM2STR(NBD_CMD_TRIM
);
38 ENUM2STR(NBD_CMD_CACHE
);
39 ENUM2STR(NBD_CMD_WRITE_ZEROES
);
40 ENUM2STR(NBD_CMD_BLOCK_STATUS
);
41 ENUM2STR(NBD_CMD_RESIZE
);
48 * Translate a tracelog parameter name into human readable form
50 * @type tracelog parameter number from struct nbd_req.type
51 * @return pointer to the name
53 static inline const char * gettracelogname(uint32_t type
) {
55 ENUM2STR(NBD_TRACELOG_SET_DATALOG
);
61 static inline const char *getstructreplname(uint16_t type
) {
63 ENUM2STR(NBD_REPLY_TYPE_NONE
);
64 ENUM2STR(NBD_REPLY_TYPE_OFFSET_DATA
);
65 ENUM2STR(NBD_REPLY_TYPE_OFFSET_HOLE
);
66 ENUM2STR(NBD_REPLY_TYPE_BLOCK_STATUS
);
68 ENUM2STR(NBD_REPLY_TYPE_ERROR
);
69 ENUM2STR(NBD_REPLY_TYPE_ERROR_OFFSET
);