From patchwork Fri Apr 8 23:58:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12807279 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03559C433F5 for ; Fri, 8 Apr 2022 23:58:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235148AbiDIAAj (ORCPT ); Fri, 8 Apr 2022 20:00:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229727AbiDIAAh (ORCPT ); Fri, 8 Apr 2022 20:00:37 -0400 Received: from de-smtp-delivery-102.mimecast.com (de-smtp-delivery-102.mimecast.com [194.104.111.102]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D42B31906 for ; Fri, 8 Apr 2022 16:58:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1649462310; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yqM2OvyuADdY6McndBW+ZsooHSmnM9esxu/OrxiyYFc=; b=HFsK+hT5EYUVyPj5mKirlhwCsJilLprs86HHd2BkCQoUAEBY+VaPSMtBCYIupS8Ss8HEka y146DAXaLeL0zdWv2HhYrZRm6D05oKJ8stGev/O/s2CiWGaUglgRyf5xszU+S/BXEXDueV HF5X3Iopmjdd+yglDWVZUjlQLQ62Kbg= Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2111.outbound.protection.outlook.com [104.47.17.111]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id de-mta-16-RtOkO6wxOsG1iWJDGzPaNw-2; Sat, 09 Apr 2022 01:58:29 +0200 X-MC-Unique: RtOkO6wxOsG1iWJDGzPaNw-2 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XAcIIIzbM3hWvJNgsEefl1pcImiW3cxSnMefIh1/LKwKieAT1fvqQTsXF7LXU/tgDbUPLol26Uw1WsQrrrVWb2W2JPGxjaiWe+fyNuvoExY7XyYZ/IiGgZx8oA2Shgxgj9jCFlaPKYUrVv2lbq3NDZkDE/9E4IIyYmMqE0DV7xEgR9aOQke/KQkq8X4bjKq3jh0SP2VoMmiIqM0wDV+KqynD7wOKp88cTOZMnqLiMmCkXS9vo/OY0H0XleV/FeS/ha2a9+kuDjRVEMz2KJVZx1RxmrrkJnZ6PCZFJoJoUo+empoRS6taAwXOE6DUBXxCvvglxyeHRoEWxDINMDzKDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gyOP5smgO9uVD+ZjgNN+xB0ewJASClkyLYGmjNwtjZs=; b=ah22EtRGhb4WiqjCjWab1f69OwBTQTJN04KJxJaHe0pA6cW2/iw0AbC8KB5/pHkHHHaX/2xCf324jwVUCwq/8eZu/S2Nr4fYI8mYtvUHRaMTmJLiUIH9ZyIwXv2ZtPkqwXu1XIFFc9DkTG4vbWAGzxffJUjwuMy7tHk2o/+w44M7jd8zgCozSMK53gXbCeHUYrb284+jkwYgGC4Ymya57j401D95GByDLOvmtRO0u+MYsg/jj89CYUalaewBGawnlMxZLQj27Rzin5+Mbc+4JIG7zpCSha5EDDBF6ALEC/YNGxgrb+VgSrUZL9gazvpNHaQrz3Sxrd+tI/6/VeT6PQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by VI1PR04MB4430.eurprd04.prod.outlook.com (2603:10a6:803:65::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.22; Fri, 8 Apr 2022 23:58:27 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::9974:fd5e:e3c0:14dc]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::9974:fd5e:e3c0:14dc%3]) with mapi id 15.20.5123.031; Fri, 8 Apr 2022 23:58:27 +0000 From: Geliang Tang To: Shuah Khan , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh CC: Geliang Tang , bpf@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v3 1/2] selftests: bpf: drop duplicate max/min definitions Date: Sat, 9 Apr 2022 07:58:17 +0800 Message-ID: <1ae276da9925c2de59b5bdc93b693b4c243e692e.1649462033.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-ClientProxiedBy: TYAPR03CA0011.apcprd03.prod.outlook.com (2603:1096:404:14::23) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e3dfeba1-54f8-48eb-1282-08da19bbac60 X-MS-TrafficTypeDiagnostic: VI1PR04MB4430:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: L2FMU6DVqsw7GbJrRRS47p/jsFFklSZpkfj1q1r0S19IUvrYWqwwyvSCLZk0RgxNhvyXnWZGcSYFSsIYq6oC2HFGmou74t5j2pjiNyW8D925KzSLvoXvoA7OLsPkVsA+dmyEu4slOV3ydcO4eHUI9RaOPCqEhf7CHAN4U5vi1spnHgv381729cChwA0a8y/1xlFV/6E8JTsJSY9Y11VDBvDw4ogSlpK+OqoWnEhgDznGwoRCblXoHD0gJlJgjZna7KpfKpgr7d7UoLsc9q03+QkQpG3rk09iIjyt2tDcpVbHOth9ntR+U5R9S3elrYfRa9NcgvvNdDxUqVjmY72D3ykbrCAX7ruyoTL0yQ5GhpfhaXnEzAy/gaCc0YNcJTUa7ykhm62PZEygpHCGHXkUJoCvrNn3wUov4/fx/xgnsuJ/+rDnsxfMjOfGTSFKrW1iNp5QQzrAYrsNrPx+mY+StydAzu5h8vkYJt1rRPpt7vYwz/+fmPU9QddedtnbNIuyVi0jsIyKdikY1BQcGY6ySQDGPzpaUVaK8DyO1pBWTWQhA+l0HdLCc2FEq++tKY5WB1Cq+TUDQpItzlR2PelaLerCUzae1HIBu3QSFZ375QT6SvzBJRSn6TIkC7JB3qmWxrQ7+y/3Qj9pPT2DJ22Db9QPaRrQZ3nIh7uZHQJM1HWwZ1QWEc/PbLq1kKxW5KZ0/Qknfc1D9BcxcPmW+Y5HMw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(186003)(26005)(83380400001)(36756003)(6512007)(2906002)(2616005)(7416002)(4326008)(6506007)(6666004)(110136005)(66946007)(316002)(44832011)(8676002)(38100700002)(5660300002)(86362001)(66476007)(66556008)(508600001)(6486002)(8936002)(13296009);D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83/rMu3tA2STPsFPt6q5/F131ob+99nTsKGOlpa0f5FqDTcWTMpSvuvjv740FzpNCCBNH2t5SL/p/vg7kr09SPxUook/DN6+D7Xj8Q5Zq+shdPzN+pDhLSQrrxlwgSBNLT8ailhn+c0izTyj6DjzbjLp6A/JebOL5tE1UBjVuIgCMHNmxKGiz7lsqbgCy+rGkHlKeJzrsPxaz1J6UwDWLsKa5O0CsKT3w5ISJrnkUqypyFXvL9ztWad4nP3xTS61xoUP6onVwBp5u+iPWxJQ0tAwVzSKSWoqsNb7CyalqgAFxxzUlTK/j6B8vhN7mGAo3U3RFfO+neXnk5BzXDNjaaM+YsTNGd0fa643yi8aQddYIF2SPTIfyqUqsRsj9o4MDJL61NplLZurTSPKsiBxw/EijerZEVAjeDNvJp7HgVUloBgvN+QBYGmbOWEJD/rNrzmNEAfcHXgLxeIVRSxEc3I62GIxsKYHVs0TeyzvccfOExOuslX7f1DWq0Z8ZaDAbdVrtnPBrYUln4u2w0SHLMLpPLVg0GUtElbegRwauzWfiPLPyUFqZER39XmswYZFmPt3oldrJdxJhlcCP5ap2XLjga7fo/qHB2sRZkSeDEA6gf0qTkfaITxOpzP72dbGvaKcyxauAqCoudCDDQStFzHgAV4z1Sv++epmlmLIizECmtcIPjbCfqw7sgeUclwnuGNlkE+Q4tBR+x4YfQJCAvJ1ifQk045CpZ32kowjdU+Ok8XcxqUYxH5x6TqiwcI6ji+eVkRdWGs= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: e3dfeba1-54f8-48eb-1282-08da19bbac60 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Apr 2022 23:58:27.1652 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: nT+eNX8ud/HlEuzOxbfNA3S42PLiLl4Kf4mvrx7y8mneHAIiY5315h+SmiXx/RcwsBKAF/g4wpziWga3wd3qyQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4430 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-Delegate: bpf@iogearbox.net Drop duplicate macros min() and MAX() definitions in prog_tests, use MIN() or MAX() in sys/param.h instead. Signed-off-by: Geliang Tang Acked-by: Song Liu --- tools/testing/selftests/bpf/prog_tests/bpf_iter.c | 4 +--- tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c | 6 ++---- tools/testing/selftests/bpf/prog_tests/snprintf.c | 4 +--- tools/testing/selftests/bpf/prog_tests/tc_redirect.c | 1 - tools/testing/selftests/bpf/test_progs.h | 1 + 5 files changed, 5 insertions(+), 11 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_iter.c b/tools/testing/selftests/bpf/prog_tests/bpf_iter.c index 5142a7d130b2..2c403ddc8076 100644 --- a/tools/testing/selftests/bpf/prog_tests/bpf_iter.c +++ b/tools/testing/selftests/bpf/prog_tests/bpf_iter.c @@ -1192,8 +1192,6 @@ static void str_strip_first_line(char *str) *dst = '\0'; } -#define min(a, b) ((a) < (b) ? (a) : (b)) - static void test_task_vma(void) { int err, iter_fd = -1, proc_maps_fd = -1; @@ -1229,7 +1227,7 @@ static void test_task_vma(void) len = 0; while (len < CMP_BUFFER_SIZE) { err = read_fd_into_buffer(iter_fd, task_vma_output + len, - min(read_size, CMP_BUFFER_SIZE - len)); + MIN(read_size, CMP_BUFFER_SIZE - len)); if (!err) break; if (CHECK(err < 0, "read_iter_fd", "read_iter_fd failed\n")) diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c b/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c index 8f7a1cef7d87..e9a9a31b2ffe 100644 --- a/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c +++ b/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c @@ -10,8 +10,6 @@ #include "bpf_tcp_nogpl.skel.h" #include "bpf_dctcp_release.skel.h" -#define min(a, b) ((a) < (b) ? (a) : (b)) - #ifndef ENOTSUPP #define ENOTSUPP 524 #endif @@ -53,7 +51,7 @@ static void *server(void *arg) while (bytes < total_bytes && !READ_ONCE(stop)) { nr_sent = send(fd, &batch, - min(total_bytes - bytes, sizeof(batch)), 0); + MIN(total_bytes - bytes, sizeof(batch)), 0); if (nr_sent == -1 && errno == EINTR) continue; if (nr_sent == -1) { @@ -146,7 +144,7 @@ static void do_test(const char *tcp_ca, const struct bpf_map *sk_stg_map) /* recv total_bytes */ while (bytes < total_bytes && !READ_ONCE(stop)) { nr_recv = recv(fd, &batch, - min(total_bytes - bytes, sizeof(batch)), 0); + MIN(total_bytes - bytes, sizeof(batch)), 0); if (nr_recv == -1 && errno == EINTR) continue; if (nr_recv == -1) diff --git a/tools/testing/selftests/bpf/prog_tests/snprintf.c b/tools/testing/selftests/bpf/prog_tests/snprintf.c index 394ebfc3bbf3..4be6fdb78c6a 100644 --- a/tools/testing/selftests/bpf/prog_tests/snprintf.c +++ b/tools/testing/selftests/bpf/prog_tests/snprintf.c @@ -83,8 +83,6 @@ static void test_snprintf_positive(void) test_snprintf__destroy(skel); } -#define min(a, b) ((a) < (b) ? (a) : (b)) - /* Loads an eBPF object calling bpf_snprintf with up to 10 characters of fmt */ static int load_single_snprintf(char *fmt) { @@ -95,7 +93,7 @@ static int load_single_snprintf(char *fmt) if (!skel) return -EINVAL; - memcpy(skel->rodata->fmt, fmt, min(strlen(fmt) + 1, 10)); + memcpy(skel->rodata->fmt, fmt, MIN(strlen(fmt) + 1, 10)); ret = test_snprintf_single__load(skel); test_snprintf_single__destroy(skel); diff --git a/tools/testing/selftests/bpf/prog_tests/tc_redirect.c b/tools/testing/selftests/bpf/prog_tests/tc_redirect.c index 7ad66a247c02..958dae769c52 100644 --- a/tools/testing/selftests/bpf/prog_tests/tc_redirect.c +++ b/tools/testing/selftests/bpf/prog_tests/tc_redirect.c @@ -949,7 +949,6 @@ static int tun_open(char *name) return -1; } -#define MAX(a, b) ((a) > (b) ? (a) : (b)) enum { SRC_TO_TARGET = 0, TARGET_TO_SRC = 1, diff --git a/tools/testing/selftests/bpf/test_progs.h b/tools/testing/selftests/bpf/test_progs.h index eec4c7385b14..e6ae2e52a668 100644 --- a/tools/testing/selftests/bpf/test_progs.h +++ b/tools/testing/selftests/bpf/test_progs.h @@ -25,6 +25,7 @@ typedef __u16 __sum16; #include #include #include +#include #include #include #include From patchwork Fri Apr 8 23:58:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12807280 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81F77C433F5 for ; Fri, 8 Apr 2022 23:58:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233449AbiDIAAx (ORCPT ); Fri, 8 Apr 2022 20:00:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240125AbiDIAAu (ORCPT ); Fri, 8 Apr 2022 20:00:50 -0400 Received: from de-smtp-delivery-102.mimecast.com (de-smtp-delivery-102.mimecast.com [194.104.111.102]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C869180237 for ; Fri, 8 Apr 2022 16:58:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1649462321; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tlxIOHtAN/TwcqxBd9NUAqYjDhRKf8AmmPp1TVtAmVo=; b=HyKPuY0dqyqUOsYEtIOiyFd6AyJAu+980JONTeb0D97Yczytmr6KlBzbABmXD0960Km4SJ nMNEhCGCTAmvpBFjSb8SnNpzQvEmHjiyPG0htL0DH+D7gFEF0LzTeKdQW3+8h7+/KI71KZ 0za9qSmkroIwhyI4kQn2trbeJBVnGZo= Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2106.outbound.protection.outlook.com [104.47.17.106]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id de-mta-24-XzBgpT_rNhC_789DGB9HBA-1; Sat, 09 Apr 2022 01:58:39 +0200 X-MC-Unique: XzBgpT_rNhC_789DGB9HBA-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NKXG+I28hzslvpk7LoS4elrWV4O2KNRf64xX5VvQ5VJM3Ziqhu4oHNwiVQRbHpc7fA/g85G4D8Uq+tNfQK+IN9EPeeUD6Sa6vVEQ5MC93Ragz55PNPZNxRvw6zEHOUt+Enr5IABFzejQNdcpJPHXWm++PHbkeIdEw68oFmWjwOANndJiNZ9lNbEtZS9oyxLySHtiAtCqm2AVjcZAs9ABzPCufTT4CidEbOie2P6kWvQgSxAjVkrTc9BbEEihYgNt5RYw4zrFb/rmq0cx7/zjDsOaOGmc7kD3KZhEeApk57BWzrQoUVvdBr6jISmDR4nas7pS1ZPligusVf9dqr5nyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=F9vI8VJ4yC5Z8TvyYDjRUJlglc6DEkr4mOvob4RcWeg=; b=btJsP4F6+RHEHDZgnkRUA9yPdZ2i1vXDxunm+iXeC3XdCVj1PUZoQ0cgJMnn7lxIr+jLWj0LVrRcUh9U3aZEpBdf8NGGdr15ppvCmejPMCVTcSOY6bcwgjv6CMtIFeA+4k6bkEwrRkrpqFA6hp4yZgeTFvSEZK2a163wJYgLw1WN7KyLFUHuRM5pX8nQHvkWnCO8Vv7nkYAbE92WS1BKbpQRDKWIh2bsmakE8Ayk62eS5YjSISP/yz4LwUOZMn7HoiUtv8P9OfKwZiiQy9o6muH4v49jTspGBCeaNUBkm74zuBujdP7/vmKdu1YbID9aALG6sOqMyGzjG44IFHjFOg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by VI1PR04MB4430.eurprd04.prod.outlook.com (2603:10a6:803:65::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.22; Fri, 8 Apr 2022 23:58:37 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::9974:fd5e:e3c0:14dc]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::9974:fd5e:e3c0:14dc%3]) with mapi id 15.20.5123.031; Fri, 8 Apr 2022 23:58:37 +0000 From: Geliang Tang To: Shuah Khan , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh CC: Geliang Tang , bpf@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v3 2/2] selftests: mqueue: drop duplicate min definition Date: Sat, 9 Apr 2022 07:58:18 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-ClientProxiedBy: TYAPR03CA0022.apcprd03.prod.outlook.com (2603:1096:404:14::34) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ad77c879-f56f-4b69-cbf1-08da19bbb2d1 X-MS-TrafficTypeDiagnostic: VI1PR04MB4430:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cnc8AaH6Rckt14aft0au9YWKSQSIaaCIuCKR7v3M7HLg+0vHJb6LD5H+BAF+dDsBI0D0DWesEBhk7oTo0YBHCYsqFlsT8DlGGqXvxpZF3QYljYnSNKohsF/MCL5x3ij5jkYOxxeilxHtvHcLOepyHfozydKpSFwMWv34FqkqV/QMcH/qQ1OPofPd1xche2bY2xJNW4Emmix6kfZPPzwh2q1M4W91QcS6Jt7a1N1AMyRe6i8XUHOo9xSDNk2Fyfm9l6X4ltMn+lAUICfsfYm1L1TxHeR2Iwu/jGBjo+NnDoTjm5lj+R+udROYtxERR/WJlKh1P7uhxCK06wDjIQ2yjyjqlULwiowmT+9rizStYrxh7olY9woZC60RIYsAyLlWhbP96AAZCO/Gw7HDH/hlEs7TtAbWsR1yYQGsoTMrbktzoh95K1ZOfS60nmxOU00snHWuVbCwC4ZXC+4P/QbVLMfn3cJ9MFMb6eMAOYLrhYdP+CQ06x/V+2xJ3BjF62Cn94B6CqH05k3Ho/vXm0secDPl9jPU/000wcAkftZtfNz1KJp4toDYqR9Jr6dl+2MDAefkLR63XvjCt8JFjZEwcALQxqZULHgMjDXW/qDPwGeWGdQZYTCUo2T7fjbwVRE2ZwA0gte5dfIB56BiKfAfNT/LcNNy8C91eOD4Cuf+8RaYeWKbKGSKB2oEhyLZEkTp/X7Qamr3kcntRoD7wSh62A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(186003)(26005)(83380400001)(36756003)(6512007)(2906002)(2616005)(7416002)(4326008)(6506007)(6666004)(110136005)(66946007)(316002)(44832011)(8676002)(38100700002)(5660300002)(86362001)(66476007)(66556008)(508600001)(6486002)(8936002)(13296009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ck03i09T1iuKbvSjJIYlLAYhdq7HAFMZgUQlJgQcv7nAGInUvVjdPUPWRM/dcAgqcH4CdcSk0gJUUU3CkeDVrPE3taLyYxJ5/T8eVAtau4hQ/MfErAfsebbitDoNf1Gqo/BTLKyfL/vSxUj7vpL0wy3rEDWK+1P57s7M84u4brFUcQL3ISWb5qoeF1AKgMi3XgSfvTAy1nHkV67mMx3JZhlmmQxe8lCrTnJUWywsxSNUJ2ntKzH/Vxq0IVJDN74HMBBwK7ksA2B6hdmGx4k5b2nkd/IUIp+8GY9SGwGUHK2MLo4e81DrXoYaAEGEpAW6KCejIkgNYJdm8pXrjgAqzn6q7oxAUhRUMr5i2m0w6pgG/ePhBxdQ66H9XtXgmVCk12dEzJuKFmBsFOhaiR+eVy/fUNpZHtx0k8GXaYir2NFR878UYo3FI843OCTIE2ubhGRHt6YBkFo4Y5G+sFGlmjhAeUaeZHvzlnuhzh8nv/gbHXETdDKUrNDYFZV7puvoJYRtojquLSS068pMPMA+j0bQiE1XArsUO2aUBHNTwwfmx/xcgJwta02SfHMAZm/QIh5NQgXPc+mxOzHAAANdbRJS9QQgEvb/1X5y5J3tjzsW2CtHE84n5iG54yU+Ld0O1YijdOrXXh5mIg+THcxOiKcTCh/DaYGr8YVBpLlW2tse5F/xgQ1t/OP+8c3QNRH77/0pwZBxepVvDsNWs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ossTenant-Network-Message-Id: ad77c879-f56f-4b69-cbf1-08da19bbb2d1 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Apr 2022 23:58:37.7112 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: EftzXqR29wJOUEnGbb6OYMgSbQ63nsk7Q2WTQ6lhnani4IHQ8D8TWaw2U/0N+vAlttaR5Ka403VTwMf0qoj7DQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4430 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org Drop duplicate macro min() definition in mq_perf_tests.c, use MIN() in sys/param.h instead. Signed-off-by: Geliang Tang --- tools/testing/selftests/mqueue/mq_perf_tests.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/mqueue/mq_perf_tests.c b/tools/testing/selftests/mqueue/mq_perf_tests.c index b019e0b8221c..6df1b2a7ec88 100644 --- a/tools/testing/selftests/mqueue/mq_perf_tests.c +++ b/tools/testing/selftests/mqueue/mq_perf_tests.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -73,7 +74,6 @@ static char *usage = char *MAX_MSGS = "/proc/sys/fs/mqueue/msg_max"; char *MAX_MSGSIZE = "/proc/sys/fs/mqueue/msgsize_max"; -#define min(a, b) ((a) < (b) ? (a) : (b)) #define MAX_CPUS 64 char *cpu_option_string; int cpus_to_pin[MAX_CPUS]; @@ -551,7 +551,7 @@ int main(int argc, char *argv[]) perror("sysconf(_SC_NPROCESSORS_ONLN)"); exit(1); } - cpus_online = min(MAX_CPUS, sysconf(_SC_NPROCESSORS_ONLN)); + cpus_online = MIN(MAX_CPUS, sysconf(_SC_NPROCESSORS_ONLN)); cpu_set = CPU_ALLOC(cpus_online); if (cpu_set == NULL) { perror("CPU_ALLOC()");