Re: [PATCH 3/7] vhost: refactor source code structure
From: Maxime Coquelin <hidden>
Date: 2016-08-24 07:53:34
On 08/18/2016 10:48 AM, Yuanhan Liu wrote:
The code structure is a bit messy now. For example, vhost-user message
handling is spread to three different files:
vhost-net-user.c virtio-net.c virtio-net-user.c
Where, vhost-net-user.c is the entrance to handle all those messages
and then invoke the right method for a specific message. Some of them
are stored at virtio-net.c, while others are stored at virtio-net-user.c.
The truth is all of them should be in one file, vhost_user.c.
So this patch refactors the source code structure: mainly on renaming
files and moving code from one file to another file that is more suitable
for storing it. Thus, no functional changes are made.
After the refactor, the code structure becomes to:
- socket.c handles all vhost-user socket file related stuff, such
as, socket file creation for server mode, reconnection
for client mode.
- vhost.c mainly on stuff like vhost device creation/destroy/reset.
Most of the vhost API implementation are there, too.
- vhost_user.c all stuff about vhost-user messages handling goes there.
- virtio_net.c all stuff about virtio-net should go there. It has virtio
net Rx/Tx implementation only so far: it's just a rename
from vhost_rxtx.c
Signed-off-by: Yuanhan Liu <redacted>
---
lib/librte_vhost/Makefile | 6 +-
lib/librte_vhost/{vhost-net-user.c => socket.c} | 209 +---
lib/librte_vhost/vhost.c | 409 ++++++++
lib/librte_vhost/{vhost-net.h => vhost.h} | 24 +-
lib/librte_vhost/vhost_user.c | 1040 ++++++++++++++++++++
.../{vhost-net-user.h => vhost_user.h} | 17 +-
lib/librte_vhost/virtio-net-user.c | 470 ---------
lib/librte_vhost/virtio-net-user.h | 62 --
lib/librte_vhost/virtio-net.c | 847 ----------------
lib/librte_vhost/{vhost_rxtx.c => virtio_net.c} | 4 +-
10 files changed, 1489 insertions(+), 1599 deletions(-)
rename lib/librte_vhost/{vhost-net-user.c => socket.c} (71%)
create mode 100644 lib/librte_vhost/vhost.c
rename lib/librte_vhost/{vhost-net.h => vhost.h} (92%)
create mode 100644 lib/librte_vhost/vhost_user.c
rename lib/librte_vhost/{vhost-net-user.h => vhost_user.h} (87%)
delete mode 100644 lib/librte_vhost/virtio-net-user.c
delete mode 100644 lib/librte_vhost/virtio-net-user.h
delete mode 100644 lib/librte_vhost/virtio-net.c
rename lib/librte_vhost/{vhost_rxtx.c => virtio_net.c} (99%)The structure is much cleaner now, and thanks for the detailed information. I didn't catch any error, and agree on the change: Reviewed-by: Maxime Coquelin <redacted> Thanks, Maxime