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

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

 



On Tue, 2018-05-22 at 09:12 +0200, Sascha Hauer wrote:
> 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?

For the case I tested (bootm -o /mnt/tftp/...) it worked as expected.

I'm just not sure if storing the TFTP fake filesize in the d_inode could
have other undesirable side effects.

regards
Philipp

_______________________________________________
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