lkml.org 
[lkml]   [2023]   [Dec]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 07/29] selftests/resctrl: Refactor get_cbm_mask() and rename to get_full_cbm()
On Wed, 13 Dec 2023, Reinette Chatre wrote:

> 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, ...).

Yeah, good point, thanks. Somehow I dismissed the opportunity and thought
there's no need to do anything even if this came up during series conflict
resolution phase.


--
i.
\
 
 \ /
  Last update: 2023-12-14 11:15    [W:0.050 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site