[OpenWrt-Devel] [PATCH] libfstools: Output error in case of loop blkdev failure

Petr Štetiar ynezz at true.cz
Wed Mar 27 04:45:11 EDT 2019


Jo-Philipp Wich <jo at mein.io> [2019-03-27 08:05:50]:

Hi,

> I suggest to rephrase the subject to something like "print error in
> case". I kept reading "output error" and wondered what went wrong with
> the output.

Good point.

> > -	if (!p->loop_name[0] && rootdisk_create_loop(p) != 0)
> > +	if (!p->loop_name[0] && rootdisk_create_loop(p) != 0) {
> > +		ULOG_ERR("unable to create loop device\n");
> 
> Do we have a valid errno value here? Would be useful to append the
> strerror(3) description as well to see whether its ENOSYS, EINVAL etc.

I was thinking about the same, but I wasn't 100% sure, that the errno after
rootdisk_create_loop() would be always valid and I think, that in some corner
cases errno won't be set at all (strcmp, offset comparison), thus I've chosen
to go with generic error, rather then misleading one.

In order to fix this properly, we would probably need to refactor
rootdisk_create_loop, potentialy open some regressions in some corner cases,
increasing the flash footprint and I'm not sure if it's worth the effort,
since this error (missing loop blkdev kernel module) usually happens only
during the development.

-- ynezz

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list