Re: [dpdk-dev] [PATCH 2/9] vfio_user: implement lifecycle related APIs
From: Xing, Beilei <hidden>
Date: 2021-01-05 08:34:42
-----Original Message----- From: dev <redacted> On Behalf Of Chenbo Xia Sent: Friday, December 18, 2020 3:39 PM To: dev@dpdk.org; thomas@monjalon.net; david.marchand@redhat.com Cc: stephen@networkplumber.org; Liang, Cunming [off-list ref]; Lu, Xiuchun [off-list ref]; Li, Miao [off-list ref]; Wu, Jingjing [off-list ref] Subject: [dpdk-dev] [PATCH 2/9] vfio_user: implement lifecycle related APIs This patch implements three lifecycle related APIs for vfio-user server, which are rte_vfio_user_register(), rte_vfio_user_unregister() and rte_vfio_user_start(). Socket an device management is implemented along with the API introduction. Signed-off-by: Chenbo Xia <redacted> Signed-off-by: Xiuchun Lu <redacted> --- lib/librte_vfio_user/meson.build | 3 +- lib/librte_vfio_user/rte_vfio_user.h | 51 ++ lib/librte_vfio_user/version.map | 6 + lib/librte_vfio_user/vfio_user_base.h | 4 + lib/librte_vfio_user/vfio_user_server.c | 690 ++++++++++++++++++++++++ lib/librte_vfio_user/vfio_user_server.h | 55 ++ 6 files changed, 808 insertions(+), 1 deletion(-) create mode 100644 lib/librte_vfio_user/rte_vfio_user.h create mode 100644 lib/librte_vfio_user/vfio_user_server.c create mode 100644 lib/librte_vfio_user/vfio_user_server.h
<...>
+static struct vfio_user_server_socket * find_vfio_user_socket(const
1. How about vfio_user_find_socket which is consistent with other function name?
2. According to the coding style, I think it's better to use such format:
static struct vfio_user_server_socket *
vfio_user_find_socket() {
}
And please also check all other functions.
+char *sock_addr) {
+ uint32_t i;
+
+ if (sock_addr == NULL)
+ return NULL;
+
+ for (i = 0; i < vfio_ep_sock.sock_num; i++) {
+ struct vfio_user_server_socket *s = vfio_ep_sock.sock[i];
+
+ if (!strcmp(s->sock.sock_addr, sock_addr))
+ return s;
+ }
+
+ return NULL;
+}
+<...>
-- 2.17.1