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",
return -1; }filename, strerror(errno));
- 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",
fclose(fp);filename, strerror(errno));
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