From: Philipp Zabel <p.zabel@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH 18/19] fs: tftp: Switch to dcache implementation
Date: Fri, 18 May 2018 13:54:13 +0200 [thread overview]
Message-ID: <1526644453.3948.8.camel@pengutronix.de> (raw)
In-Reply-To: <20180403074851.5411-19-s.hauer@pengutronix.de>
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;
+
> - tftp_do_close(priv);
> + d_add(dentry, inode);
>
> - return 0;
> + return NULL;
> }
regards
Philipp
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2018-05-18 11:54 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-03 7:48 [PATCH 00/19] Add Linux " Sascha Hauer
2018-04-03 7:48 ` [PATCH 01/19] rename file_operations -> cdev_operations Sascha Hauer
2018-04-03 7:48 ` [PATCH 02/19] ubifs: remove dead code Sascha Hauer
2018-04-03 7:48 ` [PATCH 03/19] ubifs: Remove Linux struct definitions we already have Sascha Hauer
2018-04-03 7:48 ` [PATCH 04/19] ubifs: remove dead code Sascha Hauer
2018-04-03 7:48 ` [PATCH 05/19] fs: Add super_operations Sascha Hauer
2018-04-03 7:48 ` [PATCH 06/19] fs: Move mem_write/mem_read to devfs-core Sascha Hauer
2018-04-03 7:48 ` [PATCH 07/19] fs: Cleanup whitespace damage Sascha Hauer
2018-04-03 7:48 ` [PATCH 08/19] fs: Fix finding correct directory for mkdir/rmdir Sascha Hauer
2018-04-03 7:48 ` [PATCH 09/19] glob: do not unnecessarily opendir() a directory Sascha Hauer
2018-04-03 7:48 ` [PATCH 10/19] ls: Do not depend on normalise_path() Sascha Hauer
2018-04-03 7:48 ` [PATCH 11/19] loadenv: " Sascha Hauer
2018-04-03 7:48 ` [PATCH 12/19] fs: dcache implementation Sascha Hauer
2018-04-03 7:48 ` [PATCH 13/19] fs: ramfs: Switch to " Sascha Hauer
2018-04-03 7:48 ` [PATCH 14/19] fs: devfs: " Sascha Hauer
2018-04-03 7:48 ` [PATCH 15/19] fs: ext4: " Sascha Hauer
2018-04-03 7:48 ` [PATCH 16/19] fs: ubifs: " Sascha Hauer
2018-04-03 7:48 ` [PATCH 17/19] fs: nfs: " Sascha Hauer
2018-04-03 7:48 ` [PATCH 18/19] fs: tftp: " Sascha Hauer
2018-05-18 11:54 ` Philipp Zabel [this message]
2018-05-22 7:12 ` Sascha Hauer
2018-05-22 8:21 ` Philipp Zabel
2018-04-03 7:48 ` [PATCH 19/19] block: Adjust cache sizes Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1526644453.3948.8.camel@pengutronix.de \
--to=p.zabel@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox