[PATCH 1/4] fs/mount: add autodetection type support

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Mon Aug 13 03:30:01 EDT 2012


On 09:08 Mon 13 Aug     , Uwe Kleine-König wrote:
> Hello,
> 
> On Sun, Aug 12, 2012 at 01:49:36PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > +static const char * detect_fs(const char *filename)
> > +{
> > +	enum filetype type = file_name_detect_type(filename);
> > +	struct driver_d *drv;
> > +	struct fs_driver_d *fdrv;
> > +
> > +	if (type == filetype_unknown)
> > +		return NULL;
> > +
> > +	for_each_driver(drv) {
> > +		fdrv = drv_to_fs_driver(drv);
> > +
> > +		if (drv->bus != &fs_bus)
> > +			continue;
> > +
> > +		if(type == fdrv->type)
> > +			return drv->name;
> fdrv could be local to this loop only.
I never declare a var in a loop

Best Regards,
J.



More information about the barebox mailing list