]> git.ozlabs.org Git - yaboot.git/commit
fs_of: Add an ino_seek() method.
authorTony Breeds <tony@bakeyournoodle.com>
Fri, 21 Sep 2012 10:06:39 +0000 (20:06 +1000)
committerTony Breeds <tony@bakeyournoodle.com>
Sat, 11 May 2013 05:29:47 +0000 (15:29 +1000)
commit57a24d7b07ceef22166ac508dd478926e9172f4b
tree867ffc6dda83e25a67034266dd4d062ab9d7c1cb
parent57ec85144e2a06f60b6581ef3013bc9d627397eb
fs_of: Add an ino_seek() method.

When booting from DVD we fallback to using fs_of functions to read the
from the DVD.  In the case where we need to boot a kernel and initrd
we may run into a situation where we start loading the initrd below
'real-base' and as we grow the buffer 1MB at a time we eventually hit
real-base and get a claim fail.

If we could detect in advance the size of the initrd (as we can for ext*
and netboot) we wouldn't have tis issue as we'd claim the buffer in one
chunk.

So implement an ino_size() method for fs_of.

There is a small complication.  OF doesn't correctly support 'seek' so
we cannot just seek to the end of the file and get the size, then seek
to the begining.  So we need to read the file to determine it's size.

Ideally we'd then seek to the begining of the file ready to read it
again. ... See previous comment about seek :(

So we have to close and re-open the file to get the fp back to 0.

In order to make this a little less disturbing, move the ino_size()
checks so that if the re-open() fails (it /really/ shouldn't) we can at
least handle the failure somewhat gracefully.

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
include/file.h
include/fs.h
second/fs_ext2.c
second/fs_of.c
second/yaboot.c