From patchwork Fri Apr 8 13:36:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12806749 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 879B5C433F5 for ; Fri, 8 Apr 2022 13:36:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235274AbiDHNif (ORCPT ); Fri, 8 Apr 2022 09:38:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234295AbiDHNie (ORCPT ); Fri, 8 Apr 2022 09:38:34 -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 32B211D760E for ; Fri, 8 Apr 2022 06:36:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1649424988; 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=mv9ZtsyTL4eTyuTVOi/hHDsyHVs2Fc09mfLmUojK/LU=; b=nQI+fSJF8+LfcjFqmJnSBSIwSNU85+azgXLYyJu4zBfysKjWd158nMb88wr1/sv00oJl28 vwbypL8Iohjb4FBo2JT/MBryQ1ZvcB/mZyWjVYL5AW+3JzceLoRQN7ouZ7EOPqU8wze7/i iTyllXONZgZQaj79jr3T/TmxOJMjPDg= Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05lp2109.outbound.protection.outlook.com [104.47.18.109]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id de-mta-36-2iN7Dl57NOyBcc1clDg5Yw-1; Fri, 08 Apr 2022 15:36:23 +0200 X-MC-Unique: 2iN7Dl57NOyBcc1clDg5Yw-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CcxJUGKcmEVaTuyxYIBB3cn1jriaj+phBjrdMwpkHLiDddi+/hDOI+gky8y2lX7L0AnhH9aF7XuqJJ7XQUkSueor7qKupQwRVM9CJXmzg04z6FU6qbsF1Owno1aliV1tNPIZ+4mB3OuOgZjNfxCUX8kzFdgL2TGftSZSeHYizZn7kjUfnVq935zw1EAsXVJKFaIK7AZM9FUxeJikZZWYNh2IprPV71Q+6BfNKW6rSUGy9hX76tCAzIGXH+YVaxE5nx+nd4mSBNew0AFmZjEEB3NhnfhFTEooj5VJi8jELputYwq8WiuPehk56IKFtZ3jZH8Nigc+fOuXeICPEosJYA== 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=NE3wGDfK9cEpoGNGy9nW5e859E7jqC6Y5KVKakYH5pg=; b=KI6Iz5GVfwPG7vAqFmB0HmnyxvTKyCFEkAic27aeQeedt+y2XDtZflAFqbqwak/lUVLhqpxBj/i8SX6pNcN1ay0Os/Jlg6CTh4mkme+aexXNVgmV7audyOguEtRX3mp3NLm5Oc9kGPGCyO39i9rI8j6OGManw9Rjkob6ILzlmLDzpkz6petUY6DYgOLP1x0uX9xM++Z/g4iUts+pkh9fFQgJ6TqWJGMDsAeh8smcEEzxpa9l+tC0/tFY6ngutwdvr/3FYkEvA964sm7wnTZ/ng00Jz3uK1LlUpU+xpCOaYoRG8LAV87V1vsaImEC+VYCCo3jb48Ke/pFuTxo0/BDFA== 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 AS8PR04MB7766.eurprd04.prod.outlook.com (2603:10a6:20b:2aa::13) 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 13:36:22 +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 13:36:22 +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 v2 1/2] selftests: bpf: drop duplicate max/min definitions Date: Fri, 8 Apr 2022 21:36:23 +0800 Message-ID: <0efb81dab7a8de23044302c5c7fa9af308766236.1649424565.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-ClientProxiedBy: TYBP286CA0011.JPNP286.PROD.OUTLOOK.COM (2603:1096:404:ce::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: a8a13b46-4fe1-42a7-0f7a-08da1964c55f X-MS-TrafficTypeDiagnostic: AS8PR04MB7766: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: wT80ZpHEsE71MhcO4UnTwHS26ZD3m7FZu+vGt3U/MamH3lkTybTbGEVb6HwMrkkJ4tyb3q5Fk5BXb0TiAPMyg1RGlGvxmDvXWzHISFRhuT6ausjwGyQNLDRcJknnpZp1lWQLhx+AadzNBSmew8l0E+bCBH0vSjLVUd3ur3itcmzdch1sjUrcM4cCcM52+hXDYNS3lXyIf9W2rABUOg42F/At7kI6JlKOOXhYwLDJucP/axQmhfk6vUsiB3+3TZirdYyDGPm8wA049LcEKtmJHiQgK07170VHWDQjs4mR+ePQ343nYWfVtr9z4U3VNc2GikXLBpiM46k5EbEHoN1hrjBpFolk6jzrBAdxpRJo3bd1kK/FD++IhG+nyLlvRf4iVmg12yIlYMgMbgMcrdG2DaO+Hy59PlT9Oqj4GVNpFt4CHzlA+7Dx9p1X7hwhYrhXQ/G5ARxgyF5p3zPbe/62bDOkXRumz1h2wOIHhecu4K8jqY4/szd4vtlwfslMWj5a6xvNvg45zAgdw1B7u/86Uk9BLgsejsNjT8Dx1KmVrVNMynuWTooz7+EJ6GqSJRzkiH6ubz26ON2VD/80BirrnPS9Ra/V/tgB5r2IYmaM7p7gQTLpW1ywUaj7upM8RN+vFcndfdASO7xG03mcJUzYaD94UVD9wqXESYoteEuf6kfbk4lqJdsh/gqM0WMoqhHl165vLle25awcAvrijOIJQA== 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)(38100700002)(4326008)(8676002)(66946007)(66556008)(66476007)(5660300002)(7416002)(26005)(316002)(110136005)(36756003)(508600001)(186003)(6486002)(2616005)(6512007)(6506007)(2906002)(8936002)(86362001)(44832011)(83380400001)(13296009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 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VkdretAKNeqAp0YsZ/jCZvzq7WOAnI8mQMvdKzcrnUitm7D3odSk3i4f64fyRi3+cK9lj3bI+vn5xTfzmcHqYztjOY3Z33g7ScQt9ejIZuUFBSEv6pjxhLodoTyAim88Nw2S0miyQ8gYcBE8WQmvnxezv3T+twPSJTCCVTkF5OtoO2fQh+SMcmth2BXH32wwJfB4uKq918vRqx9kJ8Ii1Kvu9H4k7JFqsR0bP09fV6mzBfn/R9fcQNVY1U3ylOu+wkKjIZ+84rJExGvfVFogxLHF2wttlMn9QPCTrgS0yEunSmoh4Vkt1sxnGqwSyHWEbUsdH9uVs93YB38AoLVW3RUAir634xxRJ6VhS9egelyg27FpaHvgFTLYywmtyMm8T7RUttv6/Vj8YpNF3Zjat5CThl9CbgSxuxWCpVQu1hla9IpX5Ak0gSXJbQnylR+B9nJyk5eHwS9QF9pQOQJQFEpQYSSvnXWjBw/yRnrNSyarjkyzZjwYRmvS801GQDyI1SwJWQ53W2sS2QAxslSzSIyDR0C8Ultl0S2+/8guDaVFr7aG2Y0rp0txI1z6wIaspgieNcDrTrLOnIA+j7m+7bLI5yNKXYbcIz4+KP+eZKJbrF/b2QqQbCbxBBFfd6YeFlKXhxXhsplqTrwJfFAI+72sMe+0orbtub94v1Qgyhi60vZbNjn07QwJhmYiILf2arHW/XUIkbwYH14= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8a13b46-4fe1-42a7-0f7a-08da1964c55f X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Apr 2022 13:36:22.8392 (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: QIAy2xWT/zhPnKQmHNgOwGFl07G5XvCs0Vb73vFA3uawbDoixEqbqr5pIW0wzaHaazc1RHLPVPUuQMmOsWIt6w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7766 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Drop duplicate macros min() and MAX() definitions in prog_tests, use MIN() or MAX() in sys/param.h instead. Signed-off-by: Geliang Tang Reviewed-by: Shuah Khan --- tools/testing/selftests/bpf/prog_tests/bpf_iter.c | 5 ++--- tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c | 7 +++---- tools/testing/selftests/bpf/prog_tests/snprintf.c | 5 ++--- tools/testing/selftests/bpf/prog_tests/tc_redirect.c | 2 +- 4 files changed, 8 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..86561c0b0dea 100644 --- a/tools/testing/selftests/bpf/prog_tests/bpf_iter.c +++ b/tools/testing/selftests/bpf/prog_tests/bpf_iter.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ +#include #include #include "bpf_iter_ipv6_route.skel.h" #include "bpf_iter_netlink.skel.h" @@ -1192,8 +1193,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 +1228,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..ceed369361fc 100644 --- a/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c +++ b/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c @@ -3,6 +3,7 @@ #include #include +#include #include #include "network_helpers.h" #include "bpf_dctcp.skel.h" @@ -10,8 +11,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 +52,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 +145,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..5ca70aa15c4a 100644 --- a/tools/testing/selftests/bpf/prog_tests/snprintf.c +++ b/tools/testing/selftests/bpf/prog_tests/snprintf.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Google LLC. */ +#include #include #include "test_snprintf.skel.h" #include "test_snprintf_single.skel.h" @@ -83,8 +84,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 +94,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..52f1b9139145 100644 --- a/tools/testing/selftests/bpf/prog_tests/tc_redirect.c +++ b/tools/testing/selftests/bpf/prog_tests/tc_redirect.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include "test_progs.h" @@ -949,7 +950,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, From patchwork Fri Apr 8 13:36:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12806750 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 86514C433EF for ; Fri, 8 Apr 2022 13:36:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236324AbiDHNip (ORCPT ); Fri, 8 Apr 2022 09:38:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234089AbiDHNio (ORCPT ); Fri, 8 Apr 2022 09:38:44 -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 B14AD1DF850 for ; Fri, 8 Apr 2022 06:36:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1649424999; 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=IKdcxpOz1DyHa/CeTgqzVboScxL1jmFTTaFgp2/2558DTmPAUJ5LeddYTLkzR4680QF9Hk jfM+knjOFw1rXTTahbuA+WJckLU2ddPL+QoIrVwPRmbp+Ig70jZpAWLrxS5idrypRO0TG9 NSGvmHQiB172ezax7uGJJsHcTW9ksTI= Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05lp2109.outbound.protection.outlook.com [104.47.18.109]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id de-mta-26-W6Bp9XJlPxikTONmP6GMig-1; Fri, 08 Apr 2022 15:36:33 +0200 X-MC-Unique: W6Bp9XJlPxikTONmP6GMig-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SpT4Kv0Br+fXm+yfc078qhu8ZCdD0VAtjBYtGzzMMFsZ3+2MORvWSIEWVnmwBcuSBLS+HIew+Zp3J6zVv/M+0G5PoU8bOTJ8bgHw8Krq0UXAzfdHr75/nik8Fd8ysdzg2pGcVUppKcgIStTng5OpXc/DHZQL2pnamZZAprJl525uZFT57d8DErkMKRnzeLd/3UWu1Cv3tr8rmein/EF4tTE9nZGQQLq1bzL7cIzsc6VST48psB+1kDde5qKpnAJ+/je/IT0NBuwTjk62Au1vd7Z2X9cDvYZ08DofFyYm3S8KukTx+JdR6v8dar0H1MxL1SRC0NfI/rdiiaEn8ULPmw== 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=O7E09N8Ytb06FU4/+wopJlOV0FqcW3RC/tfdMYhm8PD9zkcyThq1aUieu2NzAWdV5GSNnZRcTPQrD74q2qIfLTsttyuWgUSJZcbMvcWllUYQQGoyLghoQYVgAFP+saOA22QBmmRaJYmykhXvZiFNrdyb312mMk6pK6NJKnXwdtoBrw6yAijxcZ1IsU39NzH5gK9UcanGLc6O07FeA593rGuxotvCAFsD9rJo0LK+lNo+egJ1KKlPfgDzD8wJATSbJ5aatCNRUhsGNCaEQzqmAnvj8DBXDPLV6D39r5QYXf0eShohVo5JrIEa9qyOPsmq1EK3wfU82yCUVPoOvGwYWQ== 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 AS8PR04MB7766.eurprd04.prod.outlook.com (2603:10a6:20b:2aa::13) 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 13:36:32 +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 13:36:32 +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 v2 2/2] selftests: mqueue: drop duplicate min definition Date: Fri, 8 Apr 2022 21:36:24 +0800 Message-ID: <36201289cc9281ea7653127b0008ba01a1c14290.1649424565.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-ClientProxiedBy: TYBP286CA0014.JPNP286.PROD.OUTLOOK.COM (2603:1096:404:ce::26) 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: d219f4f6-360c-434a-10bb-08da1964cb12 X-MS-TrafficTypeDiagnostic: AS8PR04MB7766: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: 1uThhfdjZwoXiZD4vofp6WzQhc4VgALfbFRSewbk8htjFnXci5WiYU/GsqAwyKTVQx+WmLDuGXzXiQLLOgctJnM8koyYcaOuhIhKhve/n21ea5/5Xn2DRVF9YyCKTV5kS3GnJqd17GGNyibfRswAbztD6EmNUu4nZ3l0h7Orqe8n7GCap255WX8QwyHzcISYoNGRvm8zVergwqY57mOOWqpDFPhlCZhwRKyaTizmK99DEkXEk2laPvcRlCLdqAnioR8tWMWi2YUtWz/8sBrqBzA8osRATEvLVYeSZReFRPQ52IICd9c8sk056fTbUewQWqWrfQvStcxCyKavP5etIgi0ow+nIVaL+WFKKLsZ90sYfuDjfM2JGdBtybn2b0vZKSQNYEr4oWY8/RjXiGelOOA5Ya1tIse4KNOPIBQMPAAQMQ7LP/xEoJegc2ePn2e0SgIkJAL1um2jLRuuDNDNyl1jpGqw7+SFK71ysx8mfwsDEroKy8IpewWUgcH3feYGKumtkArJ56jxMxB+lr82dxAjVczf7SenTxwE+90vvdqtnNVMZqB/9awJmpkckIq1oPHicvNA0bgK9elZnawLISgpEIuoox357GYkVZFlecrXnScuzPxK2/UF/qKfBLEsnA6f3+a7yB4CWZpUsu8JRSIsIuqQNpCX5aoFNnAICEtnBtDmANZq2bHsy6IiB0TsH3pqp/8uJDQ7o6tRhqkU1A== 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)(38100700002)(4326008)(8676002)(66946007)(66556008)(66476007)(5660300002)(7416002)(26005)(316002)(110136005)(36756003)(508600001)(186003)(6486002)(2616005)(6666004)(6512007)(6506007)(2906002)(8936002)(86362001)(44832011)(83380400001)(13296009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2f3/1Sboez7y5ehOOqy09KO0kzHh6gBJvnejMcXudyAhTJnxOBbyYLXO3kaUVM8MxRU0vcs7LJSXJ+48pQZlLV7cGaKtJz5DV2DmzUums739CjBtIqHlKYayeuNkLhX0FDx/dlGkA8z+fZTQ6kOQk0GhAIlxNC2yiNGUWDbHXAI9wt6zX+uGVHCdbzO/UDfCBdZocvlUv3m8+8vBGz1paHAIP990qyhzEAld3I18rnE6OTvq/hlQ8MLu4esWyk8gcDoi5Ow+N9VgMn4tI0WPMX/ksXtVoS9o2sstZ/o/cQWVt281AAgM9buK2xyhkOnvnAYxgRyYDhIJWxfsmWMIqxdTgAITk0MQjDA8dZnQiX9DaCeyM3iefSVrnAVZI1u09O8JgaVUlFTckaB0kssvibNd9DE2o9KL4PSjVBYr55CCkntQKfYbuPUaRkxDEYu7TvCIc1qzHnOHyO2Q5g3Ysy3dJZIgwM0+tvTtdbG6wlI6embYPXaWcIo1Yo6wMoHCCdmmK1YczDRgxpJUnUCZQpWJohlOjT6+qALVMhbtIdUNLv5tw6avcdX/Leb294OYHkOVg5qFnFKYDkSXBJ5upZRA3WD7G2abGxYZNOGfLMchL+60PqoWSXZfz+XApvlNhS4HADgPD+fAOT/Kw4/Br51uFsfocbHjKdlZlzov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rmLnv/EG3VogFsA= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: d219f4f6-360c-434a-10bb-08da1964cb12 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Apr 2022 13:36:32.1354 (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: mXMlS+xa5K7v/y3EUp5taRgHWxFQhI10QwF3Z5AYVsOrtHFlXv0JJzXL5KBR6gY1yF7rDqb2WsRjpKIpAPRwkQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7766 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@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()");