[PATCH] examples/vm_power: replace list foreach with while loop
Thomas Monjalon
thomas at monjalon.net
Tue Mar 8 14:26:10 CET 2022
01/03/2022 15:53, Shibin Koikkara Reeny:
> Linux header files don't support LIST_FOREACH_SAFE so replacing
> LIST_FOREACH with while loop.
What is the original issue you are trying to solve?
> - struct virtual_machine_info *vm_info;
> -
> - LIST_FOREACH(vm_info, &vm_list_head, vms_info) {
> + struct virtual_machine_info *vm_info = LIST_FIRST(&vm_list_head);
>
> + /* No LIST_FOREACH_SAFE, using while instead. */
> + while (vm_info) {
> rte_spinlock_lock(&(vm_info->config_spinlock));
>
> memcpy(mask, (char *)vm_info->channel_mask, RTE_MAX_LCORE);
> @@ -1024,6 +1024,8 @@ channel_manager_exit(void)
>
> LIST_REMOVE(vm_info, vms_info);
> rte_free(vm_info);
> +
> + vm_info = LIST_NEXT((vm_info), vms_info);
> }
More information about the stable
mailing list