Hi Simon,<div><br></div><div>Thanks for your reply! I've followed your first suggestion and it works! Didn't try the NFS way though. And the command line tweaking is just not elegant.</div><div><br></div><div>For those who may also concern. let me elaborate a little bit. To access a file named "test.dat" in my program, I did the following.</div>
<div><br></div><div>1) Create a cpio archive named test_ramfs.cpio. The name is arbitrary but must ends with _ramfs.cpio</div><div><br></div><div>$ find test.dat -print | cpio -o > test_ramfs.cpio</div><div><br></div>
<div>
2) gzip it</div><div><br></div><div>$ gzip test_ramfs.cpio</div><div><br></div><div>3) Put the file generated in last step ("test_ramfs.cpio.gz") into /build directory, and then add this line in menu.lst.scc</div>
<div><br></div><div>module /test_ramfs.cpio.gz</div><div><br></div><div>4) Add this line in app's Hakefile to link to libvfs</div><div><br></div><div>addLibraries = libDeps [ "vfs", "OTHER LIBS" ],</div>
<div><br></div><div>5) In app code, call vfs_init and then open the file. Its path is "/test.dat"</div><div><br></div><div>FILE* input = fopen("/test.dat", "r");</div><div><br></div><div>Thanks,</div>
<div>Jinghao</div><div><br></div><div><br><br><div class="gmail_quote">On Tue, Nov 27, 2012 at 3:13 AM, Simon Peter <span dir="ltr"><<a href="mailto:speter@inf.ethz.ch" target="_blank">speter@inf.ethz.ch</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Hi Jinghao,<br>
<br>
Both options work. Barrelfish has a filesystem that should be
sufficient for your needs. You can do any of:<br>
<br>
1. Include the file in the RAM disk (gzipped or not), by adding it
as a module to the menu.lst.scc file. If you want to gzip it, you
have to put it in a cpio archive and postfix it _ramfs.cpio.gz.
Look at the skb_ramfs.cpio.gz file for reference. Barrelfish has a
native file system interface in include/vfs/vfs.h and both C and
POSIX compatible ones in the standard headers. You might need to
call vfs_init() in your program and link to libvfs.a, but the rest
should "just work".<br>
<br>
2. Use NFS. You need to have your SCC connected to the network and
make sure that the network driver works.<br>
<br>
3. Tweak the linker parameters to include your data as an array
directly in your executable. I don't know why your program just
halts when you set it to a very high address, but it's likely
you've put it on top of other sensitive data structures.<br>
<br>
Hope this helps,<br>
Simon<div><div class="h5"><br>
<br>
On 12-11-26 03:22 AM, Shi Jinghao wrote:<br>
</div></div></div>
<blockquote type="cite"><div><div class="h5">
Hi,
<div><br>
</div>
<div>I'm porting a benchmark program to Barrelfish (SCC). This
program needs to read input from a file. But I didn't find any
file I/O interface from the Barrelfish doc or from the source
code. Any ideas on this?</div>
<div><br>
</div>
<div>Currently, I first format the input file and then include it
within a static array declaration. The expanded array size will
be about 20M. The following compile error occurs:</div>
<div><br>
</div>
<div>
/usr/bin/ld: section .<a href="http://data.rel.ro" target="_blank">data.rel.ro</a> loaded at
[0000000000600000,0000000000600723] overlaps section .rodata
loaded at [00000000003a39c0,00000000016c7f77]</div>
<div><br>
</div>
<div>And from the command line, I found these options:</div>
<div><br>
</div>
<div>-Wl,-section-start,.text=0x300000 -Wl,-section-start,.<a href="http://data.rel.ro" target="_blank">data.rel.ro</a>=0x600000</div>
<div><br>
</div>
<div>Does it mean that the text section must fit in [0x300000,
0x600000]? I tried to move the <a href="http://data.rel.ro" target="_blank">data.rel.ro</a> section to some
other address like 0x6000000, but the program just halts. If
Barrelfish (scc) doesn't not support file system at the moment,
is it possible that I tweak these parameters and get
the giant array fits ?</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Jinghao</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<br>
<fieldset></fieldset>
<br>
</div></div><pre>_______________________________________________
Barrelfish-users mailing list
<a href="mailto:Barrelfish-users@lists.inf.ethz.ch" target="_blank">Barrelfish-users@lists.inf.ethz.ch</a>
<a href="https://lists.inf.ethz.ch/mailman/listinfo/barrelfish-users" target="_blank">https://lists.inf.ethz.ch/mailman/listinfo/barrelfish-users</a>
</pre>
</blockquote>
<br>
</div>
</blockquote></div><br></div>