public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [RFC] ubi: tmp hack for lstat
@ 2008-10-19 13:21 Sebastian Andrzej Siewior
  2008-10-20  5:13 ` Artem Bityutskiy
  0 siblings, 1 reply; 5+ messages in thread
From: Sebastian Andrzej Siewior @ 2008-10-19 13:21 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: linux-mtd

lstat() on /dev/ubi%d_%d returns 0 in the st_size field. This hack
allows to get the correct file size (as long as nobody updates the volume
in the meantime).

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
I have userpsace programs which stat() the file and process the
returned number bytes. The other work around is to copy the file
somewhere and use this file instead of /dev/ubi.
Artem, do you thing it is possible to implement this functionality
properly or would it be reasonable not to use stat() at all on ubi
volumes?

 drivers/mtd/ubi/cdev.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c
index 03c759b..921dd81 100644
--- a/drivers/mtd/ubi/cdev.c
+++ b/drivers/mtd/ubi/cdev.c
@@ -123,6 +123,7 @@ static int vol_cdev_open(struct inode *inode, struct file *file)
 	if (IS_ERR(desc))
 		return PTR_ERR(desc);
 
+	i_size_write(inode, desc->vol->used_bytes);
 	file->private_data = desc;
 	return 0;
 }
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-10-20 12:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-19 13:21 [RFC] ubi: tmp hack for lstat Sebastian Andrzej Siewior
2008-10-20  5:13 ` Artem Bityutskiy
2008-10-20  9:11   ` Sebastian Andrzej Siewior
2008-10-20  9:21     ` Artem Bityutskiy
2008-10-20 12:57       ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox