On Fri, 18 Dec 2020 15:38:43 +0800
Chenbo Xia <chenbo....@intel.com> wrote:

> +typedef struct vfio_user_msg {
> +     uint16_t msg_id;
> +     uint16_t cmd;
> +     uint32_t size;
> +#define VFIO_USER_TYPE_CMD   (0x0)           /* Message type is COMMAND */
> +#define VFIO_USER_TYPE_REPLY (0x1 << 0)      /* Message type is REPLY */
> +#define VFIO_USER_NEED_NO_RP (0x1 << 4)      /* Message needs no reply */
> +#define VFIO_USER_ERROR              (0x1 << 5)      /* Reply message has 
> error */
> +     uint32_t flags;
> +     uint32_t err;                           /* Valid in reply, optional */
> +     union {
> +             struct vfio_user_version ver;
> +     } payload;
> +     int fds[VFIO_USER_MAX_FD];
> +     int fd_num;
> +} __attribute((packed)) VFIO_USER_MSG;

Please don't introduce all capitals typedefs.
Don't use packed,  it generates slower code. Better to use tools
like pahole and make the layout of the structure naturally packed.
Also, if you put fds[] at the end you could use dynamic sized array
and not be constrained by VFIO_USER_MAX_FD.


Since this is DPDK library the symbols should all start with rte_

Reply via email to