Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp1126223lqt; Fri, 7 Jun 2024 08:41:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU4URBAkQ4Og0FUeqTgOLMzQ22SYnigyX1sBy99IOtGz8huPh2Y3IhsrXZtkiakmmJbis2VddpF2jQPvRYD2Lt/Ref1wkVk7ohQYShANw== X-Google-Smtp-Source: AGHT+IFPvHz4xdRp6LaI+knERK9088Kw/JL5x2iAEXKSZw6QUpf/V8J57zzWZWBg+p542pD6YIEy X-Received: by 2002:a05:6a20:258a:b0:1b0:18e6:ac2c with SMTP id adf61e73a8af0-1b2f9cb9aa4mr3188294637.40.1717774871964; Fri, 07 Jun 2024 08:41:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717774871; cv=pass; d=google.com; s=arc-20160816; b=Q0Vsg8MCc4M1EVyQedlPydD4qixXi2f4kmpOamMRqZ9/O5Z4AjC8oGzC8PbYtoCKRZ F01HiuBH21e+AlosfsaQF4brmDlwLk//bJuqvjrlSfcA2JPe2zMcxkwDt5BaX8sAIIxw j+M4jQ0+BL6CFKk6/evz7QK3uR5p/mR0uWH4hyYu9JBFpmrxAZYhXySCs0lVf4ZmZIBW eNrTwuYjNPHPQ+gcrb9UZrWsdjF4c7PA7CQa0lUgZ3K7PX46TmAVXavfOz+PPnn8xXgU sRQUaT0AXyCt6LHDe3JTrLjX+HGUJNDftjvjZ0R6ZzzM/aorCVMPINL1zOcB7CTlisOL aZ3w== 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=kQLQdQyG5c50jTonE+HASj0ntshMNWGl7eTIDX1ZzZk=; fh=7aBjJTD1LEoGsthbZX/aks6vbaOZYbIjsshak+jNdyY=; b=UWowIIGpU1VlFlC8QrZlLiSztmNYlnGuNLirwBMy1KgyXIxQh0Ede5Vxde3KBqDAba CZXQgpn0Wg+aAUPxu3SySy1WveX+koKwEfle4vbp/zD2tiKAlRf0gEb32MnUgcWP823O gx7p/b1oREQjlAFosLzx0aJTYZtyRKb47h/E9yKXWwZhSmQJJXy6auI54DVuUgAL960S kdGejYh/f5FOlr6uupDt6Z+t3jWQqt/zBkfs8yn1pZCEPkHUDyhZCLM9Z4wlCSkaDZNH n8YeTmN2ysdcrvGYsevdxEJKsh+SgJY4QtErbU4gl7H4GE2xsa2fczZ5cedOaV1uT0Zk YkfA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LjnW7Lfg; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-206100-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206100-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6e577aafffdsi252732a12.744.2024.06.07.08.41.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 08:41:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-206100-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LjnW7Lfg; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-206100-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206100-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 914DBB243B9 for ; Fri, 7 Jun 2024 12:57:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A3E43199398; Fri, 7 Jun 2024 12:55:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="LjnW7Lfg" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (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 77FD3199236; Fri, 7 Jun 2024 12:55:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717764915; cv=none; b=r25iTPgwD37845o2v8nnYSqAHTtPGDivaXKjAKVFL4ZkBrRahRPcCL2YIvhlP7jkzEZ7VeOtgm0BVhwGbt60riygvD9MQAwesLNqWzL5xr9LHiqjz1LNRwJnCtkh4XT2dHR4rb0bqyJ8K6rKJ/vE2Rn8m5poPVSDEfD9vLdrs54= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717764915; c=relaxed/simple; bh=4SCpVL/IeTKG53E42JHkzC4LYfnBdt41K4fBb9PzOZ0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=V+iplYwN4ChGkz5SZjZ3WyHRvtM716LTGoFu/fan8d7ZfkJbf7SinhyB2ROql8UV47XaluQFBj9SlqULYgQNUlWWZWNPkdD4hdzDp5rAvE3EubNrTf1LXzuMJmxdTcXnfMiYrSvJvDV8G8onrJ4bqvpGq3sMCyOZIF6JsTrnTj4= 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=LjnW7Lfg; arc=none smtp.client-ip=198.175.65.11 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=1717764914; x=1749300914; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4SCpVL/IeTKG53E42JHkzC4LYfnBdt41K4fBb9PzOZ0=; b=LjnW7LfgVySWF8gDlwI3Ix50bwUwMHG5kumW8pE8lXyndXRwSbNW5P7X BF41qnaw/f4xxuJYctN+fLtgN3InGHhHaerZDnHepR2X0bDh7785AAjVP 2Nz1Ve4J282XRp3vtjOSYhvU/nIcsNI4fqOBz3FMs26x9azd+cdmS0W4s rZqm+uShZmZd40DHnvD17HIH47XYZB+w/t3pEMXzklIjt+uY+50RSDTte 6sX2N/34pampU7zaOHvsjOMjRThpqAMKh1JdkhvJoO2Adzs60WEr3a0NS AdrRvBYKsGLoWHoZC4wLA7WhEavHdXWybl4tzN4wX8WpFkxCqlNO+ipXV A==; X-CSE-ConnectionGUID: NV8nfm2rQF6xU8NyjbBhgA== X-CSE-MsgGUID: lRTcqGgnT8yaj2pAEjx7GQ== X-IronPort-AV: E=McAfee;i="6600,9927,11096"; a="25055948" X-IronPort-AV: E=Sophos;i="6.08,221,1712646000"; d="scan'208";a="25055948" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2024 05:55:14 -0700 X-CSE-ConnectionGUID: bCMBMlU/S9alneuBSIFFuw== X-CSE-MsgGUID: 7c8plW4JSdWbvr0azYZ0VA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,221,1712646000"; d="scan'208";a="69484057" Received: from ijarvine-desk1.ger.corp.intel.com (HELO localhost) ([10.245.247.184]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2024 05:55:10 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: linux-kselftest@vger.kernel.org, Shuah Khan , Reinette Chatre , =?UTF-8?q?Maciej=20Wiecz=C3=B3r-Retman?= , Babu Moger Cc: Fenghua Yu , linux-kernel@vger.kernel.org, Shuah Khan , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH v6 12/16] selftests/resctrl: Make some strings passed to resctrlfs functions const Date: Fri, 7 Jun 2024 15:53:12 +0300 Message-Id: <20240607125316.7089-13-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240607125316.7089-1-ilpo.jarvinen@linux.intel.com> References: <20240607125316.7089-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 Tested-by: Babu Moger Reviewed-by: Reinette Chatre --- 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 9e4cda154d66..f4dc8ef23a8c 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