Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp431288lqp; Mon, 10 Jun 2024 08:20:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVxLIG7ryU6qoJ4j2phPMqqJNTs5cESimaZar0X9dAu87zCI59Gwjw24rqSo+mKU2bcnMXeMazoDcFBZbj/jHGitsXUsrYyEvJrz9WqWQ== X-Google-Smtp-Source: AGHT+IH2EspKYLMy1nV5BGGFNOM+4mXp/lePeJSNyvBwIOAL+bhiGsEps9qFwW0TtX24bdPQpswO X-Received: by 2002:a17:906:7109:b0:a6f:266d:adc2 with SMTP id a640c23a62f3a-a6f266db1bdmr138498866b.14.1718032849764; Mon, 10 Jun 2024 08:20:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718032849; cv=pass; d=google.com; s=arc-20160816; b=qHEvWwyLojz0/Ic8m1DKmzanXK7MQJad2pbyIT0QyRaxdaS9bvlzePyjivs0vU7H5t NDmKMWpJh+ipgVWRAkNMGgxO/IbIokTwRtBdLA/4y5eeYeEMplka6NGmjvCWP2VaDEkO +WBVGhvgvy3tzSMC1KIh3Mixu/odICBrMqsLXwEMlZWDZnNNYLHuos67ZVT60X+5cZYB akrWylWcgxjdYNOnCzhrhg4amsOf5mbTCFSTWEFOOLie4Xe/Pv19r0nWJgYCNAPxigcF bo4Qh0sklO7CCLjp+PzU+MbNGJLmZLM4ycpYVEqeB/73RiA2UYySke3oL09+5ukk3nca NN6g== 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=NBWFQeoQJCxKalVKeIRTZaO55uIqw1uKTUtRX+uowOE=; b=i/abl2GkeBABldi5ZQH52gBw56I9pvHjekUDlY0f/U56MMhuZna2XPrMDZhqCGoaPA Coz68I8JvrA0PEd7UK57Vnk17gf4F9iuZ4bMd/qIrRhjvso2R/eQABy9lZb0sE2mQhzF vab8ESY6E3vODgi1PMaJcmkj7LNDhaAlzWwOVMc2hLK5Vjzo4uua9VA4oERuqgbRi0OE NW0IX/FN9moe9EsxNIKgRyrlpxScgBO/QQy3v5pAEiDue99qN6fyaW63gRMWjBRWZG/N V/JIiZ7R8ATBJAOi27TvwOvbWJxMVPgCO6mOnqzPhTWHA7gdGlNaC4tXH6hd2MTdeXCO 2beg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=avrrSabt; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-208456-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208456-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f13720645si169465666b.847.2024.06.10.08.20.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 08:20:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208456-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=avrrSabt; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-208456-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208456-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 7BDC71F25E8B for ; Mon, 10 Jun 2024 15:20:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C0C21143742; Mon, 10 Jun 2024 15:16:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="avrrSabt" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 90EC01514C0; Mon, 10 Jun 2024 15:16:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718032618; cv=none; b=jUZCbuKRhrNxsJ3TG9SFgaZvXIBO1a8any7ekeGPWh39Z6jKjB80+Hq83rb88eHyvhkVh9H0sCbiaYwyL6jVkn8BRQWLikPbG2guUEoEOGqGhOjzBK6a6DJbYdh1Dl7R0o7tHY/iGge6lBaqz3ff1CPaONNG22zTAJC3han+rVA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718032618; c=relaxed/simple; bh=4SCpVL/IeTKG53E42JHkzC4LYfnBdt41K4fBb9PzOZ0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=o1pfSYs/WAnN70g3dkSYyS6rlPql58BF/AD6eS2pVyKlpNDs9RY13otsOWI/iJjtf4+oSz08HUFAbWo80+X2p5nYHokLOKzaL4eYzlJYkKS+tAbiW8Xh4Dl2ZU9nd5kqNmlvyGMo6zOX2KCH4z1EQvHPcF2DI0u16MlqOLPvsBc= 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=avrrSabt; arc=none smtp.client-ip=198.175.65.12 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=1718032617; x=1749568617; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4SCpVL/IeTKG53E42JHkzC4LYfnBdt41K4fBb9PzOZ0=; b=avrrSabthdwbxRfk4m45xkTwth9Vodq8NXLT9+16VoWmwn9sclK+vvlU uOyZji9gIqDtkgkaCUwNEWWw7bKiqvFPGxexBEmI4ylFWJrK2sMuUls+n j8OAgG/qJBqOn0zk3vC5lb0SJxpc3SGfkBgLQ0S7JyH+FalcC4QqytfqJ HZeupE+o5Cp+lTgWwZDEEQfTCl2gL/mnJbWmnqm2kfBkmPzz1rlB9ZjI6 3axfu0HpyxASPJVjsUABkJKyOMzLpmbX83rlvzRpVVe3Jl63k1cScoY0x 9tf8dUj0n6k/WsxJ3rL3oaWXSn1NPlKSOts1/yb6ls42i387ufg2IRhlx w==; X-CSE-ConnectionGUID: zjnNCdwwScGnHaLPsslhuA== X-CSE-MsgGUID: WC1H86mPSf+bnkOTSQCi+g== X-IronPort-AV: E=McAfee;i="6600,9927,11099"; a="26115437" X-IronPort-AV: E=Sophos;i="6.08,227,1712646000"; d="scan'208";a="26115437" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jun 2024 08:16:56 -0700 X-CSE-ConnectionGUID: f11sEXnoQY2aZ83LSBa5cQ== X-CSE-MsgGUID: FRdxjlQKTImxo0Li8xet+Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,227,1712646000"; d="scan'208";a="44026524" Received: from ijarvine-desk1.ger.corp.intel.com (HELO localhost) ([10.245.247.194]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jun 2024 08:16:53 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: linux-kselftest@vger.kernel.org, Shuah Khan , Reinette Chatre , Babu Moger , =?UTF-8?q?Maciej=20Wiecz=C3=B3r-Retman?= Cc: Fenghua Yu , linux-kernel@vger.kernel.org, Shuah Khan , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH v7 12/16] selftests/resctrl: Make some strings passed to resctrlfs functions const Date: Mon, 10 Jun 2024 18:14:53 +0300 Message-Id: <20240610151457.7305-13-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240610151457.7305-1-ilpo.jarvinen@linux.intel.com> References: <20240610151457.7305-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