Subject: Re: install/37521: qemu install from NetBSD-current install floppiesfails
To: None <install-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Stephen Borrill <sborrill@netbsd.org>
List: netbsd-bugs
Date: 12/12/2007 14:00:04
The following reply was made to PR install/37521; it has been noted by GNATS.

From: Stephen Borrill <sborrill@netbsd.org>
To: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Cc: gson@gson.org, gnats-bugs@netbsd.org
Subject: Re: install/37521: qemu install from NetBSD-current install floppiesfails
Date: Wed, 12 Dec 2007 13:55:46 +0000

 Izumi Tsutsui wrote:
 > sborrill@netbsd.org wrote:
 > 
 >> Yes, it would be best to use -DSMALL when building /boot for floppies. I
 >> suspect we are using the same /boot throughout (though I've not
 >> checked). Or as Izumi suggests, we detect the target file system type
 >> and return early from parsebootconf().
 > 
 > Could you please take this PR?
 
 Yes. Though I'll need to work out how to use gnats :-)
 
 > (My too ugly patch attached)
 
 I don''t think that's quite right:
 
 [snip]
 > +	/* don't try to open BOOTCONF if the target fs is ustarfs */
 > +#ifdef SUPPORT_USTARFS
 > +#if !defined(LIBSA_SINGLE_FILESYSTEM)
 > +	fd = open("boot", 0);	/* assume we are loaded as "boot" from here */
 > +	if (fd < 0)
 > +		op_open = NULL;	/* XXX */
 > +	else {
 > +		op_open = files[fd].f_ops->open;
 > +		close(fd);
 > +	}
 > +#else
 > +	op_open = file_system[0].open;
 > +#endif	/* !LIBSA_SINGLE_FILESYSTEM */
 > +	if (op_open == ustarfs_open)
 > +		return;
 > +#endif	/* SUPPORT_USTARFS */
 >  
 >  	/* Clear bootconf structure */
 >  	bzero((void *)&bootconf, sizeof(bootconf));
 > @@ -305,14 +328,16 @@
 >  	/* Set timeout to configured */
 >  	bootconf.timeout = boot_params.bp_timeout;
 
 We should be returning after the bootconf structure has been minimally
 set up.
 
 > -	err = stat(BOOTCONF, &st);
 > -	if (err == -1)
 > -		return;
 > -
 >  	fd = open(BOOTCONF, 0);
 >  	if (fd < 0)
 >  		return;
 >  	
 > +	err = fstat(fd, &st);
 > +	if (err == -1) {
 > +		close(fd);
 > +		return;
 > +	}
 > +
 
 Why swap round stat and open?
 
 -- 
 Dr. Stephen Borrill
 http://www.netbsd.org/~sborrill/