[LTP] [PATCH 1/2] tst_device: Print info about acquiring device

Cyril Hrubis chrubis@suse.cz
Wed May 29 17:34:44 CEST 2024


Hi!
> +	tst_resm(TINFO, "Acquiring loop device %u MB", acq_dev_size);
                         ^
			 Maybe "Preallocating device size=%uMB" ?

Since we are at the file preallocation step at this point in the code.

>  	if (tst_prealloc_file(filename, 1024 * 1024, acq_dev_size)) {
> -		tst_resm(TWARN | TERRNO, "Failed to create %s", filename);
> +		tst_resm(TWARN | TERRNO, "Failed to create %s%s", filename,
> +			 errno == ENOSPC ? " (not enough space in $TMPDIR?)" : "");

I guess that we could print the $TMPDIR value here as well with:

		tst_resm(TWARN | TERRNO, "Failed to create %s", filename);

		if (errno == ENOSPC)
			tst_resm(TWARN, "Not enough space at '%s'?", tst_get_tmpdir())


This leaks the memory though, that's because the tst_get_tmpdir() is ugly
function from the old library...

>  		return NULL;
>  	}
>  
> -- 
> 2.43.0
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list