From patchwork Tue Dec 14 10:36:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Palethorpe X-Patchwork-Id: 1567645 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=susede1 header.b=P9EkpcqO; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JCvvl2VSkz9s5P for ; Tue, 14 Dec 2021 21:37:23 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 4A2063C8CF5 for ; Tue, 14 Dec 2021 11:37:21 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [IPv6:2001:4b78:1:20::5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 5C9C83C1351 for ; Tue, 14 Dec 2021 11:36:59 +0100 (CET) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id A483E60067B for ; Tue, 14 Dec 2021 11:36:58 +0100 (CET) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id C8D6F2114E; Tue, 14 Dec 2021 10:36:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1639478217; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=F1l4+eQwdif6bRyHeqLP4Z/vlLmnGPWCQ6JS6LrqC4M=; b=P9EkpcqOaYK469IBrQQrA544uNAzrpXPAQzqyrx3zbkCfLsZS+Nob+SQbIsA5Z6gRn3hdF 7cHuz1yGweH7Aitw+KbPws8CjaMXQiQ+3CKSHYXgEILB1BFqdmflOqhTOjbYpDZ2Twbv24 XzAXyT0A14af57iQTZLwJia/pn8x48I= Received: from g78.suse.de (unknown [10.163.24.42]) by relay2.suse.de (Postfix) with ESMTP id 9552CA3B83; Tue, 14 Dec 2021 10:36:57 +0000 (UTC) To: ltp@lists.linux.it Date: Tue, 14 Dec 2021 10:36:41 +0000 Message-Id: <20211214103645.16148-1-rpalethorpe@suse.com> X-Mailer: git-send-email 2.34.0 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH 1/5] API/cgroup: Whitespace fixes X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Palethorpe via ltp From: Richard Palethorpe Reply-To: Richard Palethorpe Cc: Richard Palethorpe Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Reduce make check noise Signed-off-by: Richard Palethorpe Reviewed-by: Cyril Hrubis --- lib/tst_cgroup.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c index 61cc02fa7..2dcfbc8ff 100644 --- a/lib/tst_cgroup.c +++ b/lib/tst_cgroup.c @@ -199,7 +199,8 @@ static struct cgroup_ctrl controllers[] = { static const struct tst_cgroup_opts default_opts = { 0 }; /* We should probably allow these to be set in environment - * variables */ + * variables + */ static const char *ltp_cgroup_dir = "ltp"; static const char *ltp_cgroup_drain_dir = "drain"; static char test_cgroup_dir[NAME_MAX + 1]; @@ -798,7 +799,8 @@ void tst_cgroup_cleanup(void) continue; /* This probably does not result in the CGroup root - * being destroyed */ + * being destroyed + */ if (umount2(root->mnt_path, MNT_DETACH)) continue; @@ -817,7 +819,7 @@ clear_data: memset(roots, 0, sizeof(roots)); } -__attribute__ ((nonnull (1))) +__attribute__((nonnull(1))) static void cgroup_group_init(struct tst_cgroup_group *const cg, const char *const group_name) { @@ -832,7 +834,7 @@ static void cgroup_group_init(struct tst_cgroup_group *const cg, strcpy(cg->group_name, group_name); } -__attribute__((nonnull (2, 3))) +__attribute__((nonnull(2, 3))) static void cgroup_group_add_dir(const struct tst_cgroup_group *const parent, struct tst_cgroup_group *const cg, struct cgroup_dir *const dir) @@ -856,7 +858,8 @@ static void cgroup_group_add_dir(const struct tst_cgroup_group *const parent, "+%s", ctrl->ctrl_name); } - for (i = 0; cg->dirs[i]; i++); + for (i = 0; cg->dirs[i]; i++) + ; cg->dirs[i] = dir; } @@ -923,7 +926,7 @@ static const struct cgroup_file *cgroup_file_find(const char *const file, memcpy(ctrl_name, file_name, len); ctrl_name[len] = '\0'; - ctrl = cgroup_find_ctrl(ctrl_name); + ctrl = cgroup_find_ctrl(ctrl_name); if (!ctrl) { tst_brk_(file, lineno, TBROK, From patchwork Tue Dec 14 10:36:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Palethorpe X-Patchwork-Id: 1567643 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=susede1 header.b=u/G6m+eL; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JCvvM5s1xz9s5P for ; Tue, 14 Dec 2021 21:37:03 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 5B10E3C8C4C for ; Tue, 14 Dec 2021 11:37:01 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id A42023C1351 for ; Tue, 14 Dec 2021 11:36:59 +0100 (CET) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id A819B600747 for ; Tue, 14 Dec 2021 11:36:58 +0100 (CET) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 169FD212B5; Tue, 14 Dec 2021 10:36:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1639478218; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=shAg4pHd9bj0Jg9EiTn6M8Xj03sM3sbpCyFv2gVX90I=; b=u/G6m+eLdtO+clbXdG8mKaQ1A0JgV/PRD5sjsyL3S+H0ufnfwumxL1rxk1MZvD0Rh7Wc9V ibAr/r5zEcFUZXUSG6p4WKQIvvHqdo6FdUwJGtfOzVlucqx15nwXvMudxlxlW/dz50v6oO rUgh7Bwosn5d6jRSLfQtb6ZHbxhAnpk= Received: from g78.suse.de (unknown [10.163.24.42]) by relay2.suse.de (Postfix) with ESMTP id D6C47A3B83; Tue, 14 Dec 2021 10:36:57 +0000 (UTC) To: ltp@lists.linux.it Date: Tue, 14 Dec 2021 10:36:42 +0000 Message-Id: <20211214103645.16148-2-rpalethorpe@suse.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211214103645.16148-1-rpalethorpe@suse.com> References: <20211214103645.16148-1-rpalethorpe@suse.com> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH 2/5] API/cgroup: Remove typedef X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Palethorpe via ltp From: Richard Palethorpe Reply-To: Richard Palethorpe Cc: Richard Palethorpe Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Angers make check and is not helpful anymore. Signed-off-by: Richard Palethorpe --- lib/tst_cgroup.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c index 2dcfbc8ff..d9d74faa8 100644 --- a/lib/tst_cgroup.c +++ b/lib/tst_cgroup.c @@ -141,10 +141,7 @@ struct tst_cgroup_group { /* Always use first item for unified hierarchy */ static struct cgroup_root roots[ROOTS_MAX + 1]; -/* Lookup tree for item names. */ -typedef struct cgroup_file files_t[]; - -static const files_t cgroup_ctrl_files = { +static const struct cgroup_file cgroup_ctrl_files[] = { /* procs exists on V1, however it was read-only until kernel v3.0. */ { "cgroup.procs", "tasks", 0 }, { "cgroup.subtree_control", NULL, 0 }, @@ -152,7 +149,7 @@ static const files_t cgroup_ctrl_files = { { } }; -static const files_t memory_ctrl_files = { +static const struct cgroup_file memory_ctrl_files[] = { { "memory.current", "memory.usage_in_bytes", CTRL_MEMORY }, { "memory.max", "memory.limit_in_bytes", CTRL_MEMORY }, { "memory.swappiness", "memory.swappiness", CTRL_MEMORY }, @@ -163,7 +160,7 @@ static const files_t memory_ctrl_files = { { } }; -static const files_t cpu_ctrl_files = { +static const struct cgroup_file cpu_ctrl_files[] = { /* The V1 quota and period files were combined in the V2 max * file. The quota is in the first column and if we just print * a single value to the file, it will be treated as the @@ -175,13 +172,14 @@ static const files_t cpu_ctrl_files = { { } }; -static const files_t cpuset_ctrl_files = { +static const struct cgroup_file cpuset_ctrl_files[] = { { "cpuset.cpus", "cpuset.cpus", CTRL_CPUSET }, { "cpuset.mems", "cpuset.mems", CTRL_CPUSET }, { "cpuset.memory_migrate", "cpuset.memory_migrate", CTRL_CPUSET }, { } }; +/* Lookup tree for item names. */ static struct cgroup_ctrl controllers[] = { [0] = { "cgroup", cgroup_ctrl_files, 0, NULL, 0 }, [CTRL_MEMORY] = { From patchwork Tue Dec 14 10:36:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Palethorpe X-Patchwork-Id: 1567646 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=susede1 header.b=HGjsKmN9; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JCvvw2gXkz9s5P for ; Tue, 14 Dec 2021 21:37:32 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 32A423C8DAA for ; Tue, 14 Dec 2021 11:37:30 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [IPv6:2001:4b78:1:20::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 9413B3C1351 for ; Tue, 14 Dec 2021 11:36:59 +0100 (CET) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id D65CA1A00F64 for ; Tue, 14 Dec 2021 11:36:58 +0100 (CET) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 5A5FB2111A; Tue, 14 Dec 2021 10:36:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1639478218; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R6o4nFx3ev7FpJ1ICm5MByu/71+kpQjPMOQynpgQkPA=; b=HGjsKmN9UPAseTMSLlzCklvMO2bzbQenoIn/6wwv51Z7ygtRfspJTwydrZyt/9ubORNvob Q6PP5rvHSlKLxuLLsXBD6bLT9il9jlANFPXnpGgv4eep+vxKAUGlRZJHMhtbZJ3t1BISI0 wdQIDI8uJq+xqavsraPecACykPKfdwE= Received: from g78.suse.de (unknown [10.163.24.42]) by relay2.suse.de (Postfix) with ESMTP id 27350A3B83; Tue, 14 Dec 2021 10:36:58 +0000 (UTC) To: ltp@lists.linux.it Date: Tue, 14 Dec 2021 10:36:43 +0000 Message-Id: <20211214103645.16148-3-rpalethorpe@suse.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211214103645.16148-1-rpalethorpe@suse.com> References: <20211214103645.16148-1-rpalethorpe@suse.com> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-3.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-3.smtp.seeweb.it Subject: [LTP] [PATCH 3/5] API/cgroup: Lift out assignments in if statements X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Palethorpe via ltp From: Richard Palethorpe Reply-To: Richard Palethorpe Cc: Richard Palethorpe Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" checkpatch.pl forbids this; for good reason because it can mask accidental use of '=' instead of '=='. Also included is a script to automatically fix occurrences of this. Signed-off-by: Richard Palethorpe --- lib/tst_cgroup.c | 22 ++++++++++------ scripts/coccinelle/fix-if-assignment.cocci | 30 ++++++++++++++++++++++ 2 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 scripts/coccinelle/fix-if-assignment.cocci diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c index d9d74faa8..8eeb98a26 100644 --- a/lib/tst_cgroup.c +++ b/lib/tst_cgroup.c @@ -370,7 +370,8 @@ static void cgroup_root_scan(const char *const mnt_type, SAFE_FILE_READAT(mnt_dfd, "cgroup.controllers", buf, sizeof(buf)); for (tok = strtok(buf, " "); tok; tok = strtok(NULL, " ")) { - if ((const_ctrl = cgroup_find_ctrl(tok))) + const_ctrl = cgroup_find_ctrl(tok); + if (const_ctrl) add_ctrl(&ctrl_field, const_ctrl); } @@ -386,7 +387,8 @@ static void cgroup_root_scan(const char *const mnt_type, v1: for (tok = strtok(mnt_opts, ","); tok; tok = strtok(NULL, ",")) { - if ((const_ctrl = cgroup_find_ctrl(tok))) + const_ctrl = cgroup_find_ctrl(tok); + if (const_ctrl) add_ctrl(&ctrl_field, const_ctrl); no_prefix |= !strcmp("noprefix", tok); @@ -1008,8 +1010,9 @@ int safe_cgroup_has(const char *const file, const int lineno, return 0; for_each_dir(cg, cfile->ctrl_indx, dir) { - if (!(alias = cgroup_file_alias(cfile, *dir))) - continue; + alias = cgroup_file_alias(cfile, *dir); + if (!alias) + continue; if (!faccessat((*dir)->dir_fd, alias, F_OK, 0)) return 1; @@ -1077,7 +1080,8 @@ ssize_t safe_cgroup_read(const char *const file, const int lineno, ssize_t read_ret = 0; for_each_dir(cg, cfile->ctrl_indx, dir) { - if (!(alias = cgroup_file_alias(cfile, *dir))) + alias = cgroup_file_alias(cfile, *dir); + if (!alias) continue; if (prev_len) @@ -1115,8 +1119,9 @@ void safe_cgroup_printf(const char *const file, const int lineno, va_list va; for_each_dir(cg, cfile->ctrl_indx, dir) { - if (!(alias = cgroup_file_alias(cfile, *dir))) - continue; + alias = cgroup_file_alias(cfile, *dir); + if (!alias) + continue; va_start(va, fmt); safe_file_vprintfat(file, lineno, @@ -1141,7 +1146,8 @@ void safe_cgroup_scanf(const char *const file, const int lineno, return; va_start(va, fmt); - if ((ret = vsscanf(buf, fmt, va)) < 1) { + ret = vsscanf(buf, fmt, va); + if (ret < 1) { tst_brk_(file, lineno, TBROK | TERRNO, "'%s': vsscanf('%s', '%s', ...)", file_name, buf, fmt); } diff --git a/scripts/coccinelle/fix-if-assignment.cocci b/scripts/coccinelle/fix-if-assignment.cocci new file mode 100644 index 000000000..4dad22fe0 --- /dev/null +++ b/scripts/coccinelle/fix-if-assignment.cocci @@ -0,0 +1,30 @@ +@@ +expression V, E; +@@ + ++ V = E; + if ( +- (V = E) ++ V + ) { ... } + +@@ +expression V, E; +@@ + ++ V = E; + if (! +- (V = E) ++ V + ) { ... } + +@@ +expression V, E; +binary operator B; +@@ + ++ V = E; + if ( +- (V = E) ++ V + B ...) { ... } From patchwork Tue Dec 14 10:36:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Palethorpe X-Patchwork-Id: 1567647 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=susede1 header.b=IT+fGXo5; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JCvw72pb2z9s5P for ; Tue, 14 Dec 2021 21:37:43 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id CC4283C8CB7 for ; Tue, 14 Dec 2021 11:37:40 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [IPv6:2001:4b78:1:20::5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id DA0E03C8CE5 for ; Tue, 14 Dec 2021 11:36:59 +0100 (CET) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id 6D9F06007A4 for ; Tue, 14 Dec 2021 11:36:59 +0100 (CET) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id A80DC1F3C4; Tue, 14 Dec 2021 10:36:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1639478218; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QdGRI8bcuKEl8mzqerw/UGr4mSnqvlE+ZNCqGq3SydQ=; b=IT+fGXo5UTlchf9RF22VvpwVmQS+7/Q/0kuD30Bce60eTl3YTIxWix8nSqj/5NsjQK45QH BY1FQfBC0hCQOu7GPTFA7QEoYWJuV9LMI+ZA5jI/HCEcJD+VFYwlYoqd4NzDhqnUGUiWXV Xg6Pbj+yXkXTV9nmOcYy5tGK970zMcE= Received: from g78.suse.de (unknown [10.163.24.42]) by relay2.suse.de (Postfix) with ESMTP id 69A0CA3B89; Tue, 14 Dec 2021 10:36:58 +0000 (UTC) To: ltp@lists.linux.it Date: Tue, 14 Dec 2021 10:36:44 +0000 Message-Id: <20211214103645.16148-4-rpalethorpe@suse.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211214103645.16148-1-rpalethorpe@suse.com> References: <20211214103645.16148-1-rpalethorpe@suse.com> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH 4/5] API/cgroup: remove ltp_ prefix from static vars X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Palethorpe via ltp From: Richard Palethorpe Reply-To: Richard Palethorpe Cc: Richard Palethorpe Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" LTP-003 reserves this prefix for use in public symbols. Also it tends to be used in parts of the old API. The new API uses tst_. Signed-off-by: Richard Palethorpe --- lib/tst_cgroup.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c index 8eeb98a26..c22f5b32c 100644 --- a/lib/tst_cgroup.c +++ b/lib/tst_cgroup.c @@ -199,11 +199,11 @@ static const struct tst_cgroup_opts default_opts = { 0 }; /* We should probably allow these to be set in environment * variables */ -static const char *ltp_cgroup_dir = "ltp"; -static const char *ltp_cgroup_drain_dir = "drain"; -static char test_cgroup_dir[NAME_MAX + 1]; -static const char *ltp_mount_prefix = "/tmp/cgroup_"; -static const char *ltp_v2_mount = "unified"; +static const char *cgroup_ltp_dir = "ltp"; +static const char *cgroup_ltp_drain_dir = "drain"; +static char cgroup_test_dir[NAME_MAX + 1]; +static const char *cgroup_mount_ltp_prefix = "/tmp/cgroup_"; +static const char *cgroup_v2_ltp_mount = "unified"; #define first_root \ (roots[0].ver ? roots : roots + 1) @@ -464,7 +464,7 @@ static void cgroup_mount_v2(void) { char mnt_path[PATH_MAX]; - sprintf(mnt_path, "%s%s", ltp_mount_prefix, ltp_v2_mount); + sprintf(mnt_path, "%s%s", cgroup_mount_ltp_prefix, cgroup_v2_ltp_mount); if (!mkdir(mnt_path, 0777)) { roots[0].mnt_dir.we_created_it = 1; @@ -506,7 +506,7 @@ static void cgroup_mount_v1(struct cgroup_ctrl *const ctrl) char mnt_path[PATH_MAX]; int made_dir = 0; - sprintf(mnt_path, "%s%s", ltp_mount_prefix, ctrl->ctrl_name); + sprintf(mnt_path, "%s%s", cgroup_mount_ltp_prefix, ctrl->ctrl_name); if (!mkdir(mnt_path, 0777)) { made_dir = 1; @@ -653,7 +653,7 @@ mkdirs: } if (!root->ltp_dir.dir_fd) - cgroup_dir_mk(&root->mnt_dir, ltp_cgroup_dir, &root->ltp_dir); + cgroup_dir_mk(&root->mnt_dir, cgroup_ltp_dir, &root->ltp_dir); else root->ltp_dir.ctrl_field |= root->mnt_dir.ctrl_field; @@ -668,10 +668,10 @@ mkdirs: cgroup_copy_cpuset(root); } - cgroup_dir_mk(&root->ltp_dir, ltp_cgroup_drain_dir, &root->drain_dir); + cgroup_dir_mk(&root->ltp_dir, cgroup_ltp_drain_dir, &root->drain_dir); - sprintf(test_cgroup_dir, "test-%d", getpid()); - cgroup_dir_mk(&root->ltp_dir, test_cgroup_dir, &root->test_dir); + sprintf(cgroup_test_dir, "test-%d", getpid()); + cgroup_dir_mk(&root->ltp_dir, cgroup_test_dir, &root->test_dir); } static void cgroup_drain(const enum tst_cgroup_ver ver, From patchwork Tue Dec 14 10:36:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Palethorpe X-Patchwork-Id: 1567644 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=susede1 header.b=FPKGAU+l; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JCvvb52Y0z9s5P for ; Tue, 14 Dec 2021 21:37:15 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 608243C8C37 for ; Tue, 14 Dec 2021 11:37:12 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 0F3FD3C1351 for ; Tue, 14 Dec 2021 11:36:59 +0100 (CET) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id 6E35C1401211 for ; Tue, 14 Dec 2021 11:36:59 +0100 (CET) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id F32CC212B6; Tue, 14 Dec 2021 10:36:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1639478219; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZN82T4PUnYJak2ZAAli54dMySqS4v8moyUI0CDPjAoA=; b=FPKGAU+l/kxB3FxHAXCdiqWYGhqoKb/FpNZ6Auhau8VE96UTJWqICEKOeaDlzItmZkZzna SnRsdVHcnQUmXRueHhRRuUIg0edkcXaegUhW1r6RYfnmSXGoO3JtTYqAMLxphGcEHKRAyb +pzKr5Ax99rJ2Gs1RBnfhYMP379Nhqo= Received: from g78.suse.de (unknown [10.163.24.42]) by relay2.suse.de (Postfix) with ESMTP id B7CD4A3B85; Tue, 14 Dec 2021 10:36:58 +0000 (UTC) To: ltp@lists.linux.it Date: Tue, 14 Dec 2021 10:36:45 +0000 Message-Id: <20211214103645.16148-5-rpalethorpe@suse.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211214103645.16148-1-rpalethorpe@suse.com> References: <20211214103645.16148-1-rpalethorpe@suse.com> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH 5/5] API/cgroup: Use __func__ in tst_cgroup_require X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Palethorpe via ltp From: Richard Palethorpe Reply-To: Richard Palethorpe Cc: Richard Palethorpe Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Required by checkpatch.pl. Signed-off-by: Richard Palethorpe --- lib/tst_cgroup.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c index c22f5b32c..7c4de34c6 100644 --- a/lib/tst_cgroup.c +++ b/lib/tst_cgroup.c @@ -609,10 +609,9 @@ void tst_cgroup_require(const char *const ctrl_name, if (!options) options = &default_opts; - if (ctrl->we_require_it) { - tst_res(TWARN, "Duplicate tst_cgroup_require(%s, )", - ctrl->ctrl_name); - } + if (ctrl->we_require_it) + tst_res(TWARN, "Duplicate %s(%s, )", __func__, ctrl->ctrl_name); + ctrl->we_require_it = 1; if (ctrl->ctrl_root)