|
15 | 15 | #include <fcntl.h> |
16 | 16 | #include <pthread.h> |
17 | 17 |
|
18 | | -#include <rte_function_versioning.h> |
19 | 18 | #include <rte_log.h> |
20 | 19 |
|
21 | 20 | #include "fd_man.h" |
@@ -64,7 +63,6 @@ struct vhost_user_socket { |
64 | 63 | struct rte_vdpa_device *vdpa_dev; |
65 | 64 |
|
66 | 65 | struct rte_vhost_device_ops const *notify_ops; |
67 | | - struct rte_vhost_device_ops *malloc_notify_ops; |
68 | 66 | }; |
69 | 67 |
|
70 | 68 | struct vhost_user_connection { |
@@ -880,7 +878,6 @@ vhost_user_socket_mem_free(struct vhost_user_socket *vsocket) |
880 | 878 | return; |
881 | 879 |
|
882 | 880 | free(vsocket->path); |
883 | | - free(vsocket->malloc_notify_ops); |
884 | 881 | free(vsocket); |
885 | 882 | } |
886 | 883 |
|
@@ -1146,69 +1143,21 @@ rte_vhost_driver_unregister(const char *path) |
1146 | 1143 | /* |
1147 | 1144 | * Register ops so that we can add/remove device to data core. |
1148 | 1145 | */ |
1149 | | -static int |
1150 | | -vhost_driver_callback_register(const char *path, |
1151 | | - struct rte_vhost_device_ops const * const ops, |
1152 | | - struct rte_vhost_device_ops *malloc_ops) |
| 1146 | +int |
| 1147 | +rte_vhost_driver_callback_register(const char *path, |
| 1148 | + struct rte_vhost_device_ops const * const ops) |
1153 | 1149 | { |
1154 | 1150 | struct vhost_user_socket *vsocket; |
1155 | 1151 |
|
1156 | 1152 | pthread_mutex_lock(&vhost_user.mutex); |
1157 | 1153 | vsocket = find_vhost_user_socket(path); |
1158 | | - if (vsocket) { |
| 1154 | + if (vsocket) |
1159 | 1155 | vsocket->notify_ops = ops; |
1160 | | - free(vsocket->malloc_notify_ops); |
1161 | | - vsocket->malloc_notify_ops = malloc_ops; |
1162 | | - } |
1163 | 1156 | pthread_mutex_unlock(&vhost_user.mutex); |
1164 | 1157 |
|
1165 | 1158 | return vsocket ? 0 : -1; |
1166 | 1159 | } |
1167 | 1160 |
|
1168 | | -int __vsym |
1169 | | -rte_vhost_driver_callback_register_v24(const char *path, |
1170 | | - struct rte_vhost_device_ops const * const ops) |
1171 | | -{ |
1172 | | - return vhost_driver_callback_register(path, ops, NULL); |
1173 | | -} |
1174 | | - |
1175 | | -int __vsym |
1176 | | -rte_vhost_driver_callback_register_v23(const char *path, |
1177 | | - struct rte_vhost_device_ops const * const ops) |
1178 | | -{ |
1179 | | - int ret; |
1180 | | - |
1181 | | - /* |
1182 | | - * Although the ops structure is a const structure, we do need to |
1183 | | - * override the guest_notify operation. This is because with the |
1184 | | - * previous APIs it was "reserved" and if any garbage value was passed, |
1185 | | - * it could crash the application. |
1186 | | - */ |
1187 | | - if (ops && !ops->guest_notify) { |
1188 | | - struct rte_vhost_device_ops *new_ops; |
1189 | | - |
1190 | | - new_ops = malloc(sizeof(*new_ops)); |
1191 | | - if (new_ops == NULL) |
1192 | | - return -1; |
1193 | | - |
1194 | | - memcpy(new_ops, ops, sizeof(*new_ops)); |
1195 | | - new_ops->guest_notify = NULL; |
1196 | | - |
1197 | | - ret = vhost_driver_callback_register(path, new_ops, new_ops); |
1198 | | - } else { |
1199 | | - ret = vhost_driver_callback_register(path, ops, NULL); |
1200 | | - } |
1201 | | - |
1202 | | - return ret; |
1203 | | -} |
1204 | | - |
1205 | | -/* Mark the v23 function as the old version, and v24 as the default version. */ |
1206 | | -VERSION_SYMBOL(rte_vhost_driver_callback_register, _v23, 23); |
1207 | | -BIND_DEFAULT_SYMBOL(rte_vhost_driver_callback_register, _v24, 24); |
1208 | | -MAP_STATIC_SYMBOL(int rte_vhost_driver_callback_register(const char *path, |
1209 | | - struct rte_vhost_device_ops const * const ops), |
1210 | | - rte_vhost_driver_callback_register_v24); |
1211 | | - |
1212 | 1161 | struct rte_vhost_device_ops const * |
1213 | 1162 | vhost_driver_callback_get(const char *path) |
1214 | 1163 | { |
|
0 commit comments