Re: [PATCH 18/19] fs: tftp: Switch to dcache implementation

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

 



On Fri, May 18, 2018 at 01:54:13PM +0200, Philipp Zabel wrote:
> Hi Sascha,
> 
> On Tue, 2018-04-03 at 09:48 +0200, Sascha Hauer wrote:
> [...]
> > -static int tftp_stat(struct device_d *dev, const char *filename, struct stat *s)
> > +static struct dentry *tftp_lookup(struct inode *dir, struct dentry *dentry,
> > +			    unsigned int flags)
> >  {
> > -	struct file_priv *priv;
> > +	struct inode *inode;
> >  
> > -	priv = tftp_do_open(dev, O_RDONLY, filename);
> > -	if (IS_ERR(priv))
> > -		return PTR_ERR(priv);
> > +	printf("Lookup: \"%s\"\n", dentry->name);
> >  
> > -	s->st_mode = S_IFREG | S_IRWXU | S_IRWXG | S_IRWXO;
> > -	if (priv->filesize)
> > -		s->st_size = priv->filesize;
> > -	else
> > -		s->st_size = FILESIZE_MAX;
> 
> With this change, stat() on files on TFTP mounts will return 0 where it
> returned FILESIZE_MAX before, if the TFTP server does not send
> information about the file size. This causes read_file_2() to fail,
> which uses stat() to determine file size. read_file_2() is used for
> example by bootm to load the device tree.
> 
> > +	inode = tftp_get_inode(dir->i_sb, dir, S_IFREG | S_IRWXUGO);
> > +	if (!inode)
> > +		return ERR_PTR(-ENOSPC);
> >  
> 
> Can we just store the fake filesize in the d_inode here?
>  
> +       if (inode->i_size == 0)
> +               inode->i_size = FILESIZE_MAX;

Have you tried it? Does it work as expected?

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux