Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2568843lqo; Mon, 20 May 2024 09:32:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU1gK6bnDEjK90tlnX4IoeyTAWdh/TrjRe35FQUH7217YlyB3x2XgG5hyKdKjyv25iFuai8+6mdVXipsdWjagvvBzrvitxKdRDl3QQ2Pg== X-Google-Smtp-Source: AGHT+IH23seOVccor+pWp64EH+QV9Ydl0VhDWec6kz8prFeQOrNPoiIAj/Vo67C2aG5sks4MrltS X-Received: by 2002:a05:6102:34f5:b0:47c:d98:5863 with SMTP id ada2fe7eead31-4884ff14c5amr4276634137.4.1716222739598; Mon, 20 May 2024 09:32:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716222739; cv=pass; d=google.com; s=arc-20160816; b=Xj4VoOs/IE697ylgbE5zDd0M5ca0Y3z9UrbJTStLo3rMqkpAVAYS+WPHkiA1ZPTRP7 PgR0WFMHCMy6eOuPNZOm5qK7WVhEPgJPFcMh4MwbeIQGYu/dMHaEEPz61ZWBgy6PTZsf WRiw39xJMSYgDoluwuUzzdmZNYVefDt/92SE/TLQcN1D//5Amy5oj4/G7j1LfzOhVcDY 4GMp+te2HgIQf3Boed4NpDpOvqs6u4uPGv87T27iRL8I8xIbzPCX/KjRQ7MzJUhnFI5f +XSfQv8pUrPRmIvzWQoccAKuSFKTG0vsR6Hxa078fdRLcgt4BLbzPzLhzrN2PTvRg/0/ Uqhg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=PqZ5nInK55MAqMK1Fgf/UwfcznE7AyXjwtdMfW5s4AM=; fh=3qdKZaZnWy2Zq4/Kg/IJyvunFN5PAGmH2zs2MHj5FgQ=; b=btLndkzjA8njNIOi0NOUYafaiIpGcWB45wADIR4HjJM9hY2VTLtv0jMMF/clvsMMrT kYFBu6Mf/x3/mmoTGdLT+mxGaBYcuecshntmWbfZEjUM2reKd3KNsjYaGXvphiUj3+ey sS2+B/tqhkzCg0hEfMKxSbAZVFJD5rTqh5ysyD0Gd9ijmzkC7wW3kRIGTyDe3wnZ0sis GnctV+4wfqBZsRhauYrF6H6Eo6rssZtqShGmnFcERtr3e3cI8pyxngWHFfj/6e9UHxS5 5BVmIj+AbbWL9ddSY2m4GtjhHeveUxObs/vpj0YmBeECHntXplWdukU8aR3RYg5P8kBW iB8A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Ug1phEon; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-183743-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183743-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ada2fe7eead31-48591269c11si1801740137.91.2024.05.20.09.32.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 09:32:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-183743-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Ug1phEon; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-183743-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183743-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 75B0D1C22490 for ; Mon, 20 May 2024 12:34:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 850926BFA5; Mon, 20 May 2024 12:32:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Ug1phEon" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 706A56BB5B; Mon, 20 May 2024 12:32:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716208340; cv=none; b=ZQZWgNctAnRE4LfY6wlmGa/Z85wyzuujs/7lXNnxtWn34Go+PGn5+gimh7acjB9WRhibxhnRygxPV+BAR8w18GOsPljAFfNttgyF/3rbZQSjWWJIHoHSgFcZzdtvQBV7yTPwizdYuX1y8BAGuX6wTyr9h8Cj+NrfrUllQe/DRg4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716208340; c=relaxed/simple; bh=530we9tbb1br2D5djQ/lnp1n4VHVKq4UhHt+32wQESQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=mHNNHpryzB70DPnUZ06IDOnT0idUKQf9DH6+IUsD538Hz9He8Vhxd/APid+orcB4mF15LA5JliXSnaqp4jPAhU4+2d2x2bfjbTk8ii84GjqirSpDlw0SXaGclrr10Ng6uHxRFj8PB20xuHLbB2i5cyoeNWJp//OkElFl/2g7b30= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Ug1phEon; arc=none smtp.client-ip=198.175.65.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1716208339; x=1747744339; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=530we9tbb1br2D5djQ/lnp1n4VHVKq4UhHt+32wQESQ=; b=Ug1phEonWEYPXkGzRxjEYLnSG35Rn9dgI3zOMJ9tqwqd1QeaO/Jyc/pb dP89rSeZ+bpO39JG6Y9I4UoTqbfuNSvF6R2bzfdzwSRjnAzs9mma6S+q3 ghscS/41LmgZNmuhat9rJqlTgqoca/NklbJBnrcCPoNdz21oDSjd4JG1E aZwyBEcBySALoQ8XQSfDh4uMeIGnK/n0bC1PxpsRJPbOo2ggol9fk3fb+ pIsOiLDp0FmLZaBvyorbFsvY1PDtCrBdtD+FiuyyL0o8tmRelu2cLCfkQ uMxHjA1PUxh/Y36ohzTNBnfTHv68P6cD8UX2Bbgb3RgK6UAnse6vSoxxf A==; X-CSE-ConnectionGUID: 5pqFe0JDTTKHbbhKZsyXFw== X-CSE-MsgGUID: dN6iL4uMS6CIVDfWIvk4Fw== X-IronPort-AV: E=McAfee;i="6600,9927,11078"; a="12180544" X-IronPort-AV: E=Sophos;i="6.08,175,1712646000"; d="scan'208";a="12180544" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 May 2024 05:32:19 -0700 X-CSE-ConnectionGUID: HONmiqAjShaqzJMUIBk8eQ== X-CSE-MsgGUID: DWdxaSGLSxKapeDDse7UiA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,175,1712646000"; d="scan'208";a="33091261" Received: from unknown (HELO localhost) ([10.245.247.114]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 May 2024 05:32:16 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: linux-kselftest@vger.kernel.org, Reinette Chatre , Shuah Khan , Babu Moger , =?UTF-8?q?Maciej=20Wiecz=C3=B3r-Retman?= Cc: linux-kernel@vger.kernel.org, Fenghua Yu , Shuah Khan , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH v4 12/16] selftests/resctrl: Make some strings passed to resctrlfs functions const Date: Mon, 20 May 2024 15:30:16 +0300 Message-Id: <20240520123020.18938-13-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240520123020.18938-1-ilpo.jarvinen@linux.intel.com> References: <20240520123020.18938-1-ilpo.jarvinen@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Control group, monitor group and resctrl_val are not mutated and should not be mutated within resctrlfs.c functions. Mark this by using const char * for the arguments. Signed-off-by: Ilpo Järvinen --- tools/testing/selftests/resctrl/resctrl.h | 7 ++++--- tools/testing/selftests/resctrl/resctrlfs.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/resctrl/resctrl.h b/tools/testing/selftests/resctrl/resctrl.h index 4446a0e493ef..5967389038d4 100644 --- a/tools/testing/selftests/resctrl/resctrl.h +++ b/tools/testing/selftests/resctrl/resctrl.h @@ -141,9 +141,10 @@ bool test_resource_feature_check(const struct resctrl_test *test); char *fgrep(FILE *inf, const char *str); int taskset_benchmark(pid_t bm_pid, int cpu_no, cpu_set_t *old_affinity); int taskset_restore(pid_t bm_pid, cpu_set_t *old_affinity); -int write_schemata(char *ctrlgrp, char *schemata, int cpu_no, const char *resource); -int write_bm_pid_to_resctrl(pid_t bm_pid, char *ctrlgrp, char *mongrp, - char *resctrl_val); +int write_schemata(const char *ctrlgrp, char *schemata, int cpu_no, + const char *resource); +int write_bm_pid_to_resctrl(pid_t bm_pid, const char *ctrlgrp, + const char *mongrp, const char *resctrl_val); int perf_event_open(struct perf_event_attr *hw_event, pid_t pid, int cpu, int group_fd, unsigned long flags); unsigned char *alloc_buffer(size_t buf_size, int memflush); diff --git a/tools/testing/selftests/resctrl/resctrlfs.c b/tools/testing/selftests/resctrl/resctrlfs.c index aac382eaa032..a0e84157eb63 100644 --- a/tools/testing/selftests/resctrl/resctrlfs.c +++ b/tools/testing/selftests/resctrl/resctrlfs.c @@ -534,8 +534,8 @@ static int write_pid_to_tasks(char *tasks, pid_t pid) * * Return: 0 on success, < 0 on error. */ -int write_bm_pid_to_resctrl(pid_t bm_pid, char *ctrlgrp, char *mongrp, - char *resctrl_val) +int write_bm_pid_to_resctrl(pid_t bm_pid, const char *ctrlgrp, + const char *mongrp, const char *resctrl_val) { char controlgroup[128], monitorgroup[512], monitorgroup_p[256]; char tasks[1024]; @@ -593,7 +593,8 @@ int write_bm_pid_to_resctrl(pid_t bm_pid, char *ctrlgrp, char *mongrp, * * Return: 0 on success, < 0 on error. */ -int write_schemata(char *ctrlgrp, char *schemata, int cpu_no, const char *resource) +int write_schemata(const char *ctrlgrp, char *schemata, int cpu_no, + const char *resource) { char controlgroup[1024], reason[128], schema[1024] = {}; int domain_id, fd, schema_len, ret = 0; -- 2.39.2