Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp535768lqh; Fri, 31 May 2024 08:42:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWogl5iBbWnDF3rGU/5HsYAPJJtKyULOSstl/VPkBDSK/Z9CEAym0T9SBZAetrVb0WR8kdw6UvClF9rz2fCrbLnIYtM/KZuTjC1+QNaTw== X-Google-Smtp-Source: AGHT+IHhNNfH+ORAnbJEO23Y0gWz7bsqqZAabTfgsPbc9B4ZEt8TXDv3KTH/2Pw89RYeRkQoO5aa X-Received: by 2002:a81:9e46:0:b0:61a:e903:8d4f with SMTP id 00721157ae682-62c797ef689mr21544877b3.37.1717170172712; Fri, 31 May 2024 08:42:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717170172; cv=pass; d=google.com; s=arc-20160816; b=U0x977+VN7Ip6serCtqxWu/ZgBkYi5OjDS+IzUFM83AFWvDu1kRkDp+1Guvp2Nfpuj 2fVYLL/p+l1WRyss2ecKtPszDIv9Go02ppAOQjnYPdSEtk5cW2Z/PYa8ZLwF6KHBWv7J /AVUbHqlBooLlvcnCF1rspK7EJLTExTQv2eheoT6CcsJtA1zjEHlyGjnHyrPcE0pBLWz LYFk03TwgZ2Hb+u9HOnjFVyvXU6fooruiRISPcDCrwjnyWIzFRg/NzbAn86QtxfDzW7j ueeSAi+5ugvmrNXJg22cXnrMN7QAUHHhbW6L4sHF0i33nF0Ynk7Fq8+bSQcktYq4C8Lk UzAw== 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=fvn9udsv561b3JPgyn8yYLSoKzdTrBHlbbk/oKp/nXc=; fh=3qdKZaZnWy2Zq4/Kg/IJyvunFN5PAGmH2zs2MHj5FgQ=; b=ajI0iMt07yuDk4k8YFgzbPcULxvNpxAZ33Vkae4pqhiT7Pg6cSoX+Juljm/vy1RQCO e6pK70keiNdI/2/wQWnDsdAU4f6Sxvc83Brkqayk4L2f53zXnj3z0Bh0qUDYnnJffWvO BwtRQs9ufGLs7IpzghPTSKMfNCjLZE3OSndQNt6Yl+jvI6xL/u6l8NAEvMJYZysUR4Aj qSj2tA1+jAgYZ6v3AlGXswlrG6UQeQQOvZ2jqei0bfqqb+0j9iGEb4PVn/QwjxtqsTKU TV3WBLzh9INzDdjVQ6AR9Ee10E39SLZQm4qyL1kNw1RG1LKDn4EVigUv2B++WGBpqjda c1Ig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VLP+UOu9; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-196860-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196860-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 d75a77b69052e-43ff23d90f7si7891341cf.164.2024.05.31.08.42.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 08:42:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-196860-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=VLP+UOu9; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-196860-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196860-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 48C211C2615F for ; Fri, 31 May 2024 13:15:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0D0AB158A2E; Fri, 31 May 2024 13:13:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="VLP+UOu9" 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 E4FE9158A37; Fri, 31 May 2024 13:13:50 +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=1717161232; cv=none; b=oEZUXDwtv3/VmRDVgpsNp2bZJaTjcdHmi6xaiWHA8kKbYnTvfDGdXhdm171lfyRu1G9g5pV3ppcX0JB+IWEIMelcxlcFpysiBGTCzwsfpy3K6/wvFFbP4GhH1mqpSPwpOS1kH32bwKaQRFZX+QvoQfSbQ4mThyWa3w6Ml3Tp98E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717161232; c=relaxed/simple; bh=oyiBqZIntQPj4G6U3zZCp1m6/YoI8zCEvCRwFyxhcXA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=n0R5YsOpNJ5tOuKSFUkga0hmOUt3ry+E5c6heMXpLFiL2uxLd8jfAFVpSeL/06c1HPebnUNwG0FoKm9NjJzvY7MndDEwPANRiYKW6Olt82re7NTM6/ySd/gQAetO2+vX7JebrDlgyLjQ4guzF5lzC5LH1YSSO1fsKtYCR7A1j+U= 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=VLP+UOu9; 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=1717161231; x=1748697231; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oyiBqZIntQPj4G6U3zZCp1m6/YoI8zCEvCRwFyxhcXA=; b=VLP+UOu9WfSS54KYptPPRWEsk5EMmytMhLlQQkfljE7wGUeF2KiDC4Vb OpjnA+py8SAJ8KIfq+N6YgZl4MXVFi+Y0pzerAqjuBa1vP3DbovH2WS6w /cMaZkBVFYVFUpwp3nPNhH06UsqiN2YF+RsJvX4yEhjApegA1uPxwqXna OdtlN7p6ksoifXdJFtaEpT1PyEvYBJK5TtMQ72K43nRbGa//VCwP51kZT SvgVb3/kibG2onYH2CW0GGyc7hIb8l6jj/9uqop1Hog5/sfKqrAD7rWz4 hQNdjoYG+WOveI8rWj3+kgp3iggLUI6VsIuv2Ojgd6w/vYAwdIrLc05Jr g==; X-CSE-ConnectionGUID: 5zMq6Mb2QGewtUUfX1WWcw== X-CSE-MsgGUID: 2+BNHhM6Rx67zm6RKHuFzA== X-IronPort-AV: E=McAfee;i="6600,9927,11088"; a="24263325" X-IronPort-AV: E=Sophos;i="6.08,204,1712646000"; d="scan'208";a="24263325" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2024 06:13:51 -0700 X-CSE-ConnectionGUID: bGhuBRP3Rlia0poHogO87Q== X-CSE-MsgGUID: G39GX+foQAqBZMCHvl5OtQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,204,1712646000"; d="scan'208";a="36098382" Received: from ijarvine-desk1.ger.corp.intel.com (HELO localhost) ([10.245.247.152]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2024 06:13:47 -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 v5 12/16] selftests/resctrl: Make some strings passed to resctrlfs functions const Date: Fri, 31 May 2024 16:11:38 +0300 Message-Id: <20240531131142.1716-13-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240531131142.1716-1-ilpo.jarvinen@linux.intel.com> References: <20240531131142.1716-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 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