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 545C543EF9;
	Wed, 24 Apr 2024 21:06:43 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 433DD40691;
	Wed, 24 Apr 2024 21:06:43 +0200 (CEST)
Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com
 [209.85.214.182])
 by mails.dpdk.org (Postfix) with ESMTP id CA6BD40689
 for <dev@dpdk.org>; Wed, 24 Apr 2024 21:06:41 +0200 (CEST)
Received: by mail-pl1-f182.google.com with SMTP id
 d9443c01a7336-1e3f6f03594so1465235ad.0
 for <dev@dpdk.org>; Wed, 24 Apr 2024 12:06:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1713985601;
 x=1714590401; darn=dpdk.org; 
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:subject:cc:to:from:date:from:to:cc:subject:date
 :message-id:reply-to;
 bh=vIZ/ET5MGuLiOr3DfIYoHe8dfSm2/j/PaR21kITlkkc=;
 b=PMJlQGq7PJFxJiiqIy+YMQiKtvxFq6GJBqsE9u6E2wL5VGxDUa1udKOPM0v3G7xJ8V
 49RAqDxttmt137pRjrXK8THBdGEaP4zQcNurC+M45JbI6ZqgdkGJ2m3PPtC8yC61EqOE
 IcCEXlAum33GRBreCvlvI2QJxD7WY2jYG+G/HbkouXXAvR9AWYhBcpqorMp1zBDU7RFl
 3KtRd876zV/RXXo78i+z3fm21IdzKrHP5TF8Q+JF1snBJh52zEIv5/ntYEP4UGCUyPO5
 DWPCEBslv74U+ubaV2K10HYjWOjtpnNhUwCY1vfEa8RC+fxh9rGYBzWVHmQWV5w3LK3g
 ti3A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1713985601; x=1714590401;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=vIZ/ET5MGuLiOr3DfIYoHe8dfSm2/j/PaR21kITlkkc=;
 b=ZmmXSOd5wUss6tO8WmGItZg606U6IiOZlQPmUVPN+hIAEUjEtEruLLeYlE4jnmN/Ae
 pdoLpN3KDhi/kQnuVV8oVy+ujhGTo44LGdnfHvICZm8rdOuNc1dCvsSu3b1L6nAbni85
 mlI0at7fbd6TJUlEgFLJHm3Qv0FX7IacuEGHGFEXYHTPhBmVHq/nCjfaz45mhDzUxY2o
 cvIiD2nK0wRUo/eqPmXhvMzGFqyET+wt4qIGf+VZCDdu/sn39XrugZ0PU2se1cX07tTn
 TAm1c9F6gz+wxFfvJdvgu0MmBj3Yj8OzYJaD5nlBpY6WJ403FQMloPjOmBvJkR1dLJgu
 dRJQ==
X-Gm-Message-State: AOJu0Yzb4thHpSM2MIaHPCOXAsM7gNCm54TcYTDHTEUVnIOAqUNFiZGV
 nnbM81pGwc0B2ZKtNINaz7E6LxqWiZ8tzDWKfGvAhMWLimRxpFPmfP0LSeF+8v2KqhoShP7HdCo
 7
X-Google-Smtp-Source: AGHT+IHLUNBJJoyyciHdYV8lmbqjtF0XSquuVzB5poTYbsx4vGYPvESYYlJ7xDs5xd3WKGNsaQzDYQ==
X-Received: by 2002:a17:902:f54c:b0:1e5:9dff:a52c with SMTP id
 h12-20020a170902f54c00b001e59dffa52cmr4348275plf.10.1713985600910; 
 Wed, 24 Apr 2024 12:06:40 -0700 (PDT)
Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226])
 by smtp.gmail.com with ESMTPSA id
 q18-20020a170902dad200b001e0937a77e8sm12244619plx.200.2024.04.24.12.06.40
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 24 Apr 2024 12:06:40 -0700 (PDT)
Date: Wed, 24 Apr 2024 12:06:37 -0700
From: Stephen Hemminger <stephen@networkplumber.org>
To: Ferruh Yigit <ferruh.yigit@amd.com>
Cc: dev@dpdk.org
Subject: Re: getting rid of type argument to rte_malloc().
Message-ID: <20240424120637.67385c62@hermes.local>
In-Reply-To: <6e2e5f6e-7ff0-404e-991b-836d496ad164@amd.com>
References: <20240423210847.542cff76@hermes.local>
 <6e2e5f6e-7ff0-404e-991b-836d496ad164@amd.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable
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

On Wed, 24 Apr 2024 11:29:51 +0100
Ferruh Yigit <ferruh.yigit@amd.com> wrote:

> On 4/24/2024 5:08 AM, Stephen Hemminger wrote:
> > For the 24.11 release, I want to remove the unused type string argument
> > that shows up in rte_malloc() and related functions, then percolates do=
wn
> > through.  It was a idea in the 1.0 release of DPDK, never implemented a=
nd
> > never removed.  Yes it will cause API breakage, a large sweeping change;
> > probably easily scripted with coccinelle.
> >=20
> > Maybe doing ABI version now?
> > =20
>=20
> Won't this impact many applications, is there big enough motivation to
> force many DPDK applications to update their code, living with it looks
> simpler.
>=20


Something like this script, and fix up the result.

=46rom 13ec14dff523f6e896ab55a17a3c66b45bd90bbc Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Wed, 24 Apr 2024 09:39:27 -0700
Subject: [PATCH] devtools/cocci: add script to find unnecessary malloc type

The malloc type argument is unused and should be NULL.
This script finds and fixes those places.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 devtools/cocci/malloc-type.cocci | 33 ++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 devtools/cocci/malloc-type.cocci

diff --git a/devtools/cocci/malloc-type.cocci b/devtools/cocci/malloc-type.=
cocci
new file mode 100644
index 0000000000..cd74797ecb
--- /dev/null
+++ b/devtools/cocci/malloc-type.cocci
@@ -0,0 +1,33 @@
+//
+// The Ting type field in malloc routines was never
+// implemented and should be NULL
+//
+@@
+expression T !=3D NULL;
+expression num, socket, size, align;
+@@
+(
+- rte_malloc(T, size, align)
++ rte_malloc(NULL, size, align)
+|
+- rte_zmalloc(T, size, align)
++ rte_zmalloc(NULL,  size, align)
+|
+- rte_calloc(T, num, size, align)
++ rte_calloc(NULL, num, size, align)
+|
+- rte_realloc(T, size, align)
++ rte_realloc(NULL, size, align)
+|
+- rte_realloc_socket(T, size, align, socket)
++ rte_realloc_socket(NULL, size, align, socket)
+|
+- rte_malloc_socket(T, size, align, socket)
++ rte_malloc_socket(NULL, size, align, socket)
+|
+- rte_zmalloc_socket(T, size, align, socket)
++ rte_zmalloc_socket(NULL, size, align, socket)
+|
+- rte_calloc_socket(T, num, size, align, socket)
++ rte_calloc_socket(NULL, num, size, align, socket)
+)
--=20
2.43.0