I am working on user level filesystem using FUSE and my requirement is that :
- When I issue read for
File A
, I want to superimpose the contents of another file (sayFile B
) and present the contents ofFile B
asFile A
's contents. - I have already achieved it by buffer modifications by capturing it in my fuse read and internally reading
File B
and copying the buffer contents to the passed in buffer forFile A
and not doing any actual read call forFile A
. So,File A
call returns withFile B
's contents copied in its buffer. - Also,
File A
is of smaller size compared toFile B
.
When checked using debugger, File A
buffer contents look fine (contains whole of File B
contents), but when it gets displayed (say with Vi
) for File A
, I am able to see only those many characters as the File A
's size, but as File B
size is more, the whole data never gets shown even if the returned buffer to File A
(the File B
data copied) has more to display. This is because File A
size is smaller and the display terminates when character count is reached for File A
's filesize.
I tried looking into struct stat
, but it is a read-only thing which shows me the size of File A
which is smaller compared to File B
.
struct stat stat1;
stat(fileA, &stat1);
So, my question is that how do I fake/change the size of File A
on-the-fly, so that it is able to display whole the data (which got superimposed because File B
was bigger).