Re: [PATCH v3 07/29] selftests/resctrl: Refactor get_cbm_mask() and rename to get_full_cbm()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux