From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id AD1B0A0C4D;
	Wed, 18 Aug 2021 00:06:21 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 3CFF440DF5;
	Wed, 18 Aug 2021 00:06:21 +0200 (CEST)
Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com
 [209.85.167.49]) by mails.dpdk.org (Postfix) with ESMTP id 475784014E
 for <dev@dpdk.org>; Wed, 18 Aug 2021 00:06:20 +0200 (CEST)
Received: by mail-lf1-f49.google.com with SMTP id u22so55586lfq.13
 for <dev@dpdk.org>; Tue, 17 Aug 2021 15:06:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=date:from:to:cc:subject:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=zPXj6AsPtV6ZNaVrXe5wDe7tR6gYWUjLvsZU3DbnY50=;
 b=lWrmL+dAva9yZDkRLV0DTR8ZyaglGcY5QrhndAufzLRUT5A05Vehj+nnmY+9q6yGYy
 YX49XywholZXkzCeJI7AbrV/NBNakP1CVfZcjb3QykGcmsjIke+GEKqyQE4dgoiXKUrl
 ub1lYFmFK9JfmQcZgWqM3hTJ8NJGmk+DVdYx6TKnuMUu3HycsBlzuCF63E7YmPnkeCnN
 mSigWS59gqrVDl1lvfcmwOi3o+DVMp15oLJ6ZFZWwoLX9qwpOrkyynh6ate5FQ4SsVLB
 5dgk0FW+fhxDMyjXm/CkX8lrn1LcgBv/9XIRRL8xK1WmmvficDzQYv4tbmygFQvA9IQm
 Kr3A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=zPXj6AsPtV6ZNaVrXe5wDe7tR6gYWUjLvsZU3DbnY50=;
 b=XPHFUXJX9YQgZzCzW8RrJ3JhZBywZsvuJSeOyHX8lTw2RWFzR4ZYbx/PaZmC7umcgn
 TNA1iMKkX/kX5B2D0r7dcOtQHxpvq8KQlkDbB+ys2278TqisUSEfOo5orqJQFMV5LU2N
 R38OZXl29eh7awaLq/Ss0xTVKFDICLewQAR0t/jY8u9rwYx0ECGtsNQIAlZRWHakNiSF
 1DPO2djdnwjTC7aTGdV43+RyOTbzLRzR6tWpUcRV3EiupafT31cTWqzulT5qaG9eWktw
 nlqSola2pNliWT7jSovgmKmcDfMdrgaY2erH70LlEpf/zBb5JX7KIwQPJc2/tFtEXLtc
 +7pg==
X-Gm-Message-State: AOAM532FxryRHPxrzTLK94qQ/5/lyw8wQFQFTQX0CTjCmEVsqXyHQfdv
 MYtoYAjLPbQC87MG0PE39e8=
X-Google-Smtp-Source: ABdhPJy2BYUfyYXo1i8STtKuk0YCzKEGNG0US4z2AB3zQ4jqUHKV2LKGKNZ2w3Uf9qfFyvljNho0oA==
X-Received: by 2002:a05:6512:6d6:: with SMTP id
 u22mr3891247lff.263.1629237979754; 
 Tue, 17 Aug 2021 15:06:19 -0700 (PDT)
Received: from sovereign (broadband-37-110-65-23.ip.moscow.rt.ru.
 [37.110.65.23])
 by smtp.gmail.com with ESMTPSA id r11sm365484ljk.71.2021.08.17.15.06.18
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 17 Aug 2021 15:06:19 -0700 (PDT)
Date: Wed, 18 Aug 2021 01:06:18 +0300
From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: William Tu <u9012063@gmail.com>
Cc: dev@dpdk.org, nick.connolly@mayadata.io
Message-ID: <20210818010618.74255cdf@sovereign>
In-Reply-To: <20210814025154.13430-1-u9012063@gmail.com>
References: <20210813033627.78546-1-u9012063@gmail.com>
 <20210814025154.13430-1-u9012063@gmail.com>
X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.32; x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] [PATCH v6] eal: remove sys/queue.h from public
 headers.
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Hi William,
just a few minor corrections remain, please see inline.

2021-08-14 02:51 (UTC+0000), William Tu:
[...]
> diff --git a/lib/eal/common/eal_common_devargs.c b/lib/eal/common/eal_common_devargs.c
> index 23aaf8b7e4..7edc6798fe 100644
> --- a/lib/eal/common/eal_common_devargs.c
> +++ b/lib/eal/common/eal_common_devargs.c
> @@ -9,6 +9,7 @@
>  #include <stdio.h>
>  #include <string.h>
>  #include <stdarg.h>
> +#include <sys/queue.h>
>  
>  #include <rte_bus.h>
>  #include <rte_class.h>
> @@ -18,6 +19,7 @@
>  #include <rte_errno.h>
>  #include <rte_kvargs.h>
>  #include <rte_log.h>
> +#include <rte_os.h>

Not needed, included by `rte_bus.h` -> `rte_common.h` -> `rte_os.h`.

>  #include <rte_tailq.h>
>  #include "eal_private.h"

If you included <sys/queue.h> from `eal_private.h`,
you would need to modify much fewer files in EAL.

>  
> @@ -291,7 +293,7 @@ rte_devargs_insert(struct rte_devargs **da)
>  	if (*da == NULL || (*da)->bus == NULL)
>  		return -1;
>  
> -	TAILQ_FOREACH_SAFE(listed_da, &devargs_list, next, tmp) {
> +	RTE_TAILQ_FOREACH_SAFE(listed_da, &devargs_list, next, tmp) {
>  		if (listed_da == *da)
>  			/* devargs already in the list */
>  			return 0;
> @@ -358,7 +360,7 @@ rte_devargs_remove(struct rte_devargs *devargs)
>  	if (devargs == NULL || devargs->bus == NULL)
>  		return -1;
>  
> -	TAILQ_FOREACH_SAFE(d, &devargs_list, next, tmp) {
> +	RTE_TAILQ_FOREACH_SAFE(d, &devargs_list, next, tmp) {
>  		if (strcmp(d->bus->name, devargs->bus->name) == 0 &&
>  		    strcmp(d->name, devargs->name) == 0) {
>  			TAILQ_REMOVE(&devargs_list, d, next);
[...]
> diff --git a/lib/eal/windows/include/rte_os.h b/lib/eal/windows/include/rte_os.h
> index 66c711d458..54892ab89c 100644
> --- a/lib/eal/windows/include/rte_os.h
> +++ b/lib/eal/windows/include/rte_os.h
> @@ -18,6 +18,37 @@
>  extern "C" {
>  #endif

Comment about compatibility with the bundled sys/queue.h is lost.

> +#define RTE_TAILQ_HEAD(name, type) \
> +struct name { \
> +	struct type *tqh_first; /* first element */ \
> +	struct type **tqh_last; /* addr of last next element */ \
> +}
> +#define RTE_TAILQ_ENTRY(type) \
> +struct { \
> +	struct type *tqe_next; /* next element */ \
> +	struct type **tqe_prev; /* address of previous next element */ \
> +}
> +#define RTE_TAILQ_FOREACH(var, head, field) \
> +	for ((var) = RTE_TAILQ_FIRST((head)); \
> +	    (var); \
> +	    (var) = RTE_TAILQ_NEXT((var), field))
> +#define RTE_TAILQ_FOREACH_SAFE(var, head, field, tvar) \
> +	for ((var) = TAILQ_FIRST((head)); \
> +	    (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
> +	    (var) = (tvar))
> +#define RTE_TAILQ_FIRST(head) ((head)->tqh_first)
> +#define RTE_TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
> +#define RTE_STAILQ_HEAD(name, type) \
> +struct name { \
> +	struct type *stqh_first;/* first element */ \
> +	struct type **stqh_last;/* addr of last next element */ \
> +}
> +#define RTE_STAILQ_ENTRY(type) \
> +struct { \
> +	struct type *stqe_next; /* next element */ \
> +}
> +
> +

Redundant newline.