vhost: rework message handling as a callback array
authorNikolay Nikolaev <nicknickolaev@gmail.com>
Mon, 24 Sep 2018 20:17:32 +0000 (23:17 +0300)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 27 Sep 2018 23:41:03 +0000 (01:41 +0200)
commit2f270595c05d8161f50524a967a1c1e3f5e9958e
tree80a49d57ed03aa8431f9aac6aaaeaad00a54b218
parent0bff510b5ea6d7a9ea7f5407e66b438a0797987f
vhost: rework message handling as a callback array

Introduce vhost_message_handlers, which maps the message request
type to the message handler. Then replace the switch construct
with a map and call.

Failing vhost_user_set_features is fatal and all processing should
stop immediately and propagate the error to the upper layers. Change
the code accordingly to reflect that.

Signed-off-by: Nikolay Nikolaev <nicknickolaev@gmail.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
lib/librte_vhost/vhost_user.c