Hi,Christian
Thanks for your help. Now, the file system can be mounted. However, there's still errors in my test.That is File_system-session creation failed. Here's the output message:
[init -> part_blk] Partition 1: LBA 10240 (7733248 blocks) type: 83
[init] child "part_blk" announces service "Block"
[init -> part_blk] session opened at partition 1 for 'rump_fs -> '
[init -> rump_fs] Using ext2fs as file system
[init -> rump_fs] asserting rump kernel 14253 KB of RAM
[init -> rump_fs] rump: /genode: file system not clean; please fsck(8)
[init] child "rump_fs" announces service "File_system"
[init -> test-file] Error: File_system-session creation failed (ram_quota=163840, cap_quota=12, tx_buf_size=131072, label="", root="", writeable=1)
[init -> test-file] Error: failed to create <fs> VFS node
[init -> test-file] --- start test ---
[init -> test-file] Error: plugin()->open("file.txt") failed
[init -> test-file] open
[init -> test-file] :
[init -> test-file] No such file or directory
I don't know whether it's because there's some mistake in my configuration. Can you give me some hint? The run scripts is just like that I showed you before. And here's test file:
#include <base/attached_rom_dataspace.h>
#include <libc/component.h>
/* libc includes */
#include <dirent.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/uio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
static void test()
{
int fd;
ssize_t n;
off_t offset;
static char buf[100];
static char str[] = "hello,world!";
printf("--- start test ---\n");
fd = open("file.txt",O_WRONLY|O_CREAT);
if (fd == -1) {
perror("open");
return;
}
n = write(fd, str, sizeof (str));
printf("write %d bytes.\n",n);
close(fd);
fd = open("file.txt", O_RDONLY);
if (fd == -1) {
perror("read open");
return;
}
n = read(fd, buf, sizeof (str));
printf("read %d bytes: ", n);
for (size_t i = 0; i < sizeof (str); i++)
printf("%c ", buf[i]);
printf("\n");
close(fd);
printf("--- test finished ---\n");
return;
}
struct Main
{
Main(Genode::Env &env)
{
Genode::Attached_rom_dataspace config_rom { env, "config" };
Libc::with_libc([&] () {
test();
});
env.parent().exit(0);
}
};
void Libc::Component::construct(Libc::Env &env) { static Main main(env); }
------------------
Best wishes