[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <150fbd26-cb36-48f8-bd23-fc2eb83f03f2@intel.com>
Date: Wed, 13 Dec 2023 13:55:26 -0800
From: Reinette Chatre <reinette.chatre@...el.com>
To: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
<linux-kselftest@...r.kernel.org>, Shuah Khan <shuah@...nel.org>,
"Shaopeng Tan" <tan.shaopeng@...fujitsu.com>,
Maciej Wieczór-Retman
<maciej.wieczor-retman@...el.com>,
Fenghua Yu <fenghua.yu@...el.com>
CC: <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 07/29] selftests/resctrl: Refactor get_cbm_mask() and
rename to get_full_cbm()
Hi Ilpo,
On 12/11/2023 4:18 AM, Ilpo Järvinen wrote:
> -int get_cbm_mask(char *cache_type, char *cbm_mask)
> +static int get_bit_mask(const char *filename, unsigned long *mask)
> {
> - char cbm_mask_path[1024];
> FILE *fp;
>
> - if (!cbm_mask)
> + if (!filename || !mask)
> return -1;
>
> - sprintf(cbm_mask_path, "%s/%s/cbm_mask", INFO_PATH, cache_type);
> -
> - fp = fopen(cbm_mask_path, "r");
> + fp = fopen(filename, "r");
> if (!fp) {
> - ksft_perror("Failed to open cache level");
> -
> + fprintf(stderr, "Failed to open bit mask file '%s': %s\n",
> + filename, strerror(errno));
> return -1;
> }
> - if (fscanf(fp, "%s", cbm_mask) <= 0) {
> - ksft_perror("Could not get max cbm_mask");
> +
> + if (fscanf(fp, "%lx", mask) <= 0) {
> + fprintf(stderr, "Could not read bit mask file '%s': %s\n",
> + filename, strerror(errno));
> fclose(fp);
>
> return -1;
After seeing the new effort to correct the perror() messages it is
not obvious to me why this patch changes these particular messages to
use fprintf(stderr, ...).
Reinette
Powered by blists - more mailing lists