Retire libc_{log, block, fs, rom}
Those plugins are superseded by libc_vfs. Issue #999
This commit is contained in:
parent
8876dd057d
commit
c7f1b85652
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# \brief Test for using the libc_fs plugin with the Linux file system
|
||||
# \brief Test for using the libc_vfs plugin with the Linux file system
|
||||
# \author Norman Feske
|
||||
# \author Christian Helmuth
|
||||
# \date 2013-11-07
|
||||
|
@ -11,7 +11,7 @@ assert_spec linux
|
|||
# Build
|
||||
#
|
||||
|
||||
build { core init server/lx_fs test/libc_fs }
|
||||
build { core init server/lx_fs test/libc_vfs }
|
||||
|
||||
create_boot_directory
|
||||
|
||||
|
@ -37,10 +37,18 @@ install_config {
|
|||
<start name="lx_fs">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides> <service name="File_system"/> </provides>
|
||||
<config> <policy label="" root="/libc_fs" writeable="yes" /> </config>
|
||||
<config> <policy label="" root="/libc_vfs" writeable="yes" /> </config>
|
||||
</start>
|
||||
<start name="test-libc_fs">
|
||||
<start name="test-libc_vfs">
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
<config>
|
||||
<libc stdout="/dev/log">
|
||||
<vfs>
|
||||
<fs />
|
||||
<dir name="dev"> <log/> </dir>
|
||||
</vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>
|
||||
</config>
|
||||
}
|
||||
|
@ -49,17 +57,15 @@ install_config {
|
|||
# Create test-directory structure
|
||||
#
|
||||
|
||||
exec mkdir -p bin/libc_fs
|
||||
exec mkdir -p bin/libc_vfs
|
||||
|
||||
#
|
||||
# Boot modules
|
||||
#
|
||||
|
||||
build_boot_image {
|
||||
core init
|
||||
ld.lib.so libc.lib.so libc_log.lib.so libc_fs.lib.so
|
||||
lx_fs test-libc_fs
|
||||
libc_fs
|
||||
core init ld.lib.so libc.lib.so lx_fs test-libc_vfs
|
||||
libc_vfs
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -74,6 +80,6 @@ puts "\ntest succeeded\n"
|
|||
# Cleanup test-directory structure
|
||||
#
|
||||
|
||||
exec rm -r bin/libc_fs
|
||||
exec rm -r bin/libc_vfs
|
||||
|
||||
# vi: set ft=tcl :
|
||||
|
|
|
@ -44,7 +44,6 @@ append_if [expr {$test_type eq "static"}] config {
|
|||
<start name="test-lx_rmap_static">}
|
||||
append_if [expr {$test_type eq "dynamic"}] config {
|
||||
<start name="test-lx_rmap_dynamic">}
|
||||
|
||||
append config {
|
||||
<resource name="RAM" quantum="8M"/>
|
||||
</start>
|
||||
|
@ -61,9 +60,6 @@ set boot_modules { core init}
|
|||
lappend_if [expr {$test_type eq "static"}] boot_modules test-lx_rmap_static
|
||||
lappend_if [expr {$test_type eq "dynamic"}] boot_modules test-lx_rmap_dynamic
|
||||
lappend_if [expr {$test_type eq "dynamic"}] boot_modules ld.lib.so
|
||||
lappend_if [expr {$test_type eq "dynamic"}] boot_modules libc.lib.so
|
||||
lappend_if [expr {$test_type eq "dynamic"}] boot_modules libc_log.lib.so
|
||||
lappend_if [expr {$test_type eq "dynamic"}] boot_modules libm.lib.so
|
||||
|
||||
build_boot_image $boot_modules
|
||||
|
||||
|
|
|
@ -5,6 +5,6 @@ endif
|
|||
|
||||
TARGET = test-lx_rmap_dynamic
|
||||
SRC_CC = main.cc
|
||||
LIBS = base libc
|
||||
LIBS = base ld
|
||||
|
||||
vpath main.cc $(PRG_DIR)/..
|
||||
|
|
|
@ -63,6 +63,11 @@ set config {
|
|||
</start>
|
||||
<start name="test-lwip_httpsrv">
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
<config>
|
||||
<libc stdout="/dev/log">
|
||||
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>}
|
||||
|
||||
append_if [have_spec acpi] config {
|
||||
|
@ -112,7 +117,7 @@ install_config $config
|
|||
set boot_modules {
|
||||
core init timer
|
||||
usb_drv
|
||||
ld.lib.so libc.lib.so libc_log.lib.so lwip.lib.so test-lwip_httpsrv
|
||||
ld.lib.so libc.lib.so lwip.lib.so test-lwip_httpsrv
|
||||
}
|
||||
|
||||
lappend_if [have_spec acpi] boot_modules acpi_drv
|
||||
|
|
|
@ -12,7 +12,7 @@ set build_components {
|
|||
drivers/timer
|
||||
server/ram_blk
|
||||
server/rump_fs
|
||||
test/libc_fs
|
||||
test/libc_vfs
|
||||
}
|
||||
|
||||
build $build_components
|
||||
|
@ -60,8 +60,16 @@ append config {
|
|||
<provides><service name="File_system"/></provides>
|
||||
<config fs="ext2fs"><policy label="" root="/" writeable="yes"/></config>
|
||||
</start>
|
||||
<start name="test-libc_fs">
|
||||
<start name="test-libc_vfs">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<config>
|
||||
<libc stdout="/dev/log">
|
||||
<vfs>
|
||||
<dir name="dev"> <log/> </dir>
|
||||
<fs/>
|
||||
</vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>
|
||||
</config>}
|
||||
|
||||
|
@ -73,10 +81,9 @@ install_config $config
|
|||
|
||||
# generic modules
|
||||
set boot_modules {
|
||||
core init timer test-libc_fs ram_blk
|
||||
core init timer test-libc_vfs ram_blk
|
||||
rump.lib.so rump_fs.lib.so rump_fs
|
||||
ld.lib.so ext2.raw libc.lib.so
|
||||
libc_fs.lib.so libc_log.lib.so
|
||||
}
|
||||
|
||||
build_boot_image $boot_modules
|
||||
|
|
|
@ -12,7 +12,7 @@ set build_components {
|
|||
drivers/timer
|
||||
server/ram_blk
|
||||
server/rump_fs
|
||||
test/libc_fs
|
||||
test/libc_vfs
|
||||
}
|
||||
|
||||
build $build_components
|
||||
|
@ -60,8 +60,16 @@ append config {
|
|||
<provides><service name="File_system"/></provides>
|
||||
<config fs="msdos"><policy label="" root="/" writeable="yes"/></config>
|
||||
</start>
|
||||
<start name="test-libc_fs">
|
||||
<start name="test-libc_vfs">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<config>
|
||||
<libc stdout="/dev/log">
|
||||
<vfs>
|
||||
<dir name="dev"> <log/> </dir>
|
||||
<fs/>
|
||||
</vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>
|
||||
</config>}
|
||||
|
||||
|
@ -73,10 +81,9 @@ install_config $config
|
|||
|
||||
# generic modules
|
||||
set boot_modules {
|
||||
core init timer test-libc_fs ram_blk
|
||||
core init timer test-libc_vfs ram_blk
|
||||
rump.lib.so rump_fs.lib.so rump_fs
|
||||
ld.lib.so fs.raw libc.lib.so
|
||||
libc_fs.lib.so libc_log.lib.so
|
||||
}
|
||||
|
||||
build_boot_image $boot_modules
|
||||
|
|
|
@ -17,7 +17,6 @@ if {$use_nic_driver} { set network_driver "nic_drv" }
|
|||
set build_components {
|
||||
core init
|
||||
drivers/timer
|
||||
server/ram_fs
|
||||
server/nic_bridge
|
||||
server/http_blk
|
||||
app/lighttpd
|
||||
|
@ -126,36 +125,6 @@ append config {
|
|||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
<start name="ram_fs">
|
||||
<resource name="RAM" quantum="15M"/>
|
||||
<provides><service name="File_system"/></provides>
|
||||
<config>
|
||||
<policy label="lighttpd" root="/" />
|
||||
<content>
|
||||
<dir name="etc">
|
||||
<dir name="lighttpd">
|
||||
<inline name="lighttpd.conf">
|
||||
# lighttpd configuration
|
||||
server.port = 80
|
||||
server.document-root = "/website"
|
||||
server.event-handler = "select"
|
||||
server.network-backend = "write"
|
||||
index-file.names = (
|
||||
"index.xhtml", "index.html", "index.htm"
|
||||
)
|
||||
mimetype.assign = (
|
||||
".html" => "text/html",
|
||||
".htm" => "text/html"
|
||||
)
|
||||
</inline>
|
||||
</dir>
|
||||
</dir>
|
||||
<dir name="website">
|
||||
<rom name="index.bin" as="index.bin" />
|
||||
</dir>
|
||||
</content>
|
||||
</config>
|
||||
</start>
|
||||
<start name="http_blk">
|
||||
<resource name="RAM" quantum="2M" />
|
||||
<provides><service name="Block"/></provides>
|
||||
|
@ -178,7 +147,36 @@ mimetype.assign = (
|
|||
<arg value="-f" />
|
||||
<arg value="/etc/lighttpd/lighttpd.conf" />
|
||||
<arg value="-D" />
|
||||
<libc ip_addr="10.0.1.1" gateway="10.0.1.5" netmask="255.255.255.0"/>
|
||||
<libc stdin="/dev/null" stdout="/dev/log" stderr="/dev/log"
|
||||
ip_addr="10.0.1.1" gateway="10.0.1.5" netmask="255.255.255.0">
|
||||
<vfs>
|
||||
<dir name="dev">
|
||||
<log/>
|
||||
<null/>
|
||||
</dir>
|
||||
<dir name="etc">
|
||||
<dir name="lighttpd">
|
||||
<inline name="lighttpd.conf">
|
||||
# lighttpd configuration
|
||||
server.port = 80
|
||||
server.document-root = "/website"
|
||||
server.event-handler = "select"
|
||||
server.network-backend = "write"
|
||||
index-file.names = (
|
||||
"index.xhtml", "index.html", "index.htm"
|
||||
)
|
||||
mimetype.assign = (
|
||||
".html" => "text/html",
|
||||
".htm" => "text/html"
|
||||
)
|
||||
</inline>
|
||||
</dir>
|
||||
</dir>
|
||||
<dir name="website">
|
||||
<rom name="index.bin" as="index.bin" />
|
||||
</dir>
|
||||
</vfs>
|
||||
</libc>
|
||||
</config>
|
||||
<route>
|
||||
<service name="Nic"> <child name="nic_bridge"/> </service>
|
||||
|
@ -197,8 +195,8 @@ catch { exec dd if=/dev/zero of=bin/index.bin bs=512 count=400 }
|
|||
|
||||
# generic modules
|
||||
set boot_modules {
|
||||
core init timer ld.lib.so ram_fs
|
||||
libc.lib.so libm.lib.so libc_fs.lib.so libc_log.lib.so
|
||||
core init timer ld.lib.so
|
||||
libc.lib.so libm.lib.so
|
||||
lwip.lib.so zlib.lib.so
|
||||
lighttpd nic_bridge http_blk index.bin test-rom_blk
|
||||
}
|
||||
|
|
|
@ -59,6 +59,9 @@ set config {
|
|||
<provides> <service name="Terminal"/> </provides>
|
||||
<config>
|
||||
<policy label="test-terminal_echo" port="8888"/>
|
||||
<libc stdout="/dev/log">
|
||||
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
||||
</lib>
|
||||
</config>
|
||||
</start>
|
||||
<start name="test-terminal_echo">
|
||||
|
@ -85,7 +88,7 @@ install_config $config
|
|||
set boot_modules {
|
||||
core init timer
|
||||
nic_drv
|
||||
ld.lib.so libc.lib.so lwip.lib.so libc_log.lib.so libc_lock_pipe.lib.so
|
||||
ld.lib.so libc.lib.so lwip.lib.so libc_lock_pipe.lib.so
|
||||
tcp_terminal
|
||||
test-terminal_echo
|
||||
}
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
File terminal is a service that provides Genode's Terminal_session interface
|
||||
for a given file via a File_system_session.
|
||||
File terminal is a service that provides a terminal-session interface and
|
||||
redirects the terminal input and output to a file.
|
||||
|
||||
! <config>
|
||||
! <policy label="client1" filename="test.txt" />
|
||||
! <policy label="client2" filename="file.dat" io_buffer_size="4K"/>h
|
||||
! <libc stdout="/dev/log">
|
||||
! <vfs>
|
||||
! <dir name="dev"> <log/> </dir>
|
||||
! <fs/>
|
||||
! </vfs>
|
||||
! </libc>
|
||||
! </config>
|
||||
|
||||
To keep things simple a client can only open one file at the moment.
|
||||
To keep things simple, a client can only open one file at the moment.
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TARGET = file_terminal
|
||||
SRC_CC = main.cc
|
||||
LIBS = libc libc_fs libc_log
|
||||
LIBS = libc libc_vfs
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TARGET = tcp_terminal
|
||||
SRC_CC = main.cc
|
||||
LIBS = libc libc_lwip_nic_dhcp libc_log libc_lock_pipe
|
||||
LIBS = libc libc_lwip_nic_dhcp libc_vfs libc_lock_pipe
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
LIBS = libc
|
||||
|
||||
SRC_CC = plugin.cc
|
||||
|
||||
vpath %.cc $(REP_DIR)/src/lib/libc_block
|
||||
|
||||
SHARED_LIB = yes
|
|
@ -1,7 +0,0 @@
|
|||
SRC_CC = plugin.cc
|
||||
LIBS += libc
|
||||
INC_DIR += $(REP_DIR)/src/lib/libc
|
||||
|
||||
vpath plugin.cc $(REP_DIR)/src/lib/libc_fs
|
||||
|
||||
SHARED_LIB = yes
|
|
@ -4,7 +4,7 @@ EXFAT_DIR = $(REP_DIR)/contrib/$(EXFAT)
|
|||
SRC_C = $(notdir $(EXFAT_DIR)/fuse/main.c)
|
||||
SRC_CC = init.cc
|
||||
|
||||
LIBS = libc libc_block libc_fuse libfuse libexfat
|
||||
LIBS = libc libc_vfs libc_fuse libfuse libexfat
|
||||
|
||||
vpath %.c $(EXFAT_DIR)/fuse
|
||||
vpath %.cc $(REP_DIR)/src/lib/exfat
|
||||
|
|
|
@ -5,7 +5,7 @@ FILTER_OUT = fuse-ext2.probe.c fuse-ext2.wait.c
|
|||
SRC_C = $(filter-out $(FILTER_OUT), $(notdir $(wildcard $(FUSE_EXT2_DIR)/*.c)))
|
||||
SRC_CC = init.cc
|
||||
|
||||
LIBS = libc libc_block libc_fuse libfuse libext2fs
|
||||
LIBS = libc libc_vfs libc_fuse libfuse libext2fs
|
||||
|
||||
CC_OPT = -DHAVE_CONFIG_H -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ NTFS_3G_DIR = $(REP_DIR)/contrib/$(NTFS_3G)
|
|||
SRC_C = ntfs-3g.c ntfs-3g_common.c
|
||||
SRC_CC = init.cc
|
||||
|
||||
LIBS = libc libc_block libc_fuse libfuse libntfs-3g
|
||||
LIBS = libc libc_vfs libc_fuse libfuse libntfs-3g
|
||||
|
||||
CC_OPT = -DHAVE_TIMESPEC -DHAVE_CONFIG_H -DRECORD_LOCKING_NOT_IMPLEMENTED
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
SRC_CC = plugin.cc
|
||||
LIBS += libc
|
||||
|
||||
vpath plugin.cc $(REP_DIR)/src/lib/libc_log
|
||||
|
||||
SHARED_LIB = yes
|
|
@ -1,6 +0,0 @@
|
|||
SRC_CC = plugin.cc
|
||||
LIBS += libc
|
||||
|
||||
vpath plugin.cc $(REP_DIR)/src/lib/libc_rom
|
||||
|
||||
SHARED_LIB = yes
|
|
@ -95,7 +95,7 @@ append config {
|
|||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Timer"/></provides>
|
||||
</start>
|
||||
<start name="oss_drv">
|
||||
<start name="audio_out_drv">
|
||||
<resource name="RAM" quantum="6M"/>
|
||||
<route>
|
||||
<any-service> <any-child /> <parent /></any-service>
|
||||
|
@ -108,7 +108,7 @@ append config {
|
|||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Audio_out"/></provides>
|
||||
<route>
|
||||
<service name="Audio_out"> <child name="oss_drv"/> </service>
|
||||
<service name="Audio_out"> <child name="audio_out_drv"/> </service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
@ -118,6 +118,12 @@ append config {
|
|||
<arg value="avplay"/>
|
||||
<arg value="mediafile"/>
|
||||
<sdl_audio_volume value="100"/>
|
||||
<libc stdout="/dev/log" stderr="/dev/log">
|
||||
<vfs>
|
||||
<dir name="dev"> <log/> </dir>
|
||||
<rom name="mediafile"/>
|
||||
</vfs>
|
||||
</libc>
|
||||
</config>
|
||||
<route>
|
||||
<service name="PCI"> <any-child /> </service>
|
||||
|
@ -135,8 +141,8 @@ install_config $config
|
|||
#
|
||||
|
||||
set boot_modules {
|
||||
core init timer oss_drv mixer avplay
|
||||
ld.lib.so libc.lib.so libc_log.lib.so libc_rom.lib.so libm.lib.so pthread.lib.so zlib.lib.so sdl.lib.so
|
||||
core init timer audio_out_drv mixer avplay
|
||||
ld.lib.so libc.lib.so libm.lib.so pthread.lib.so zlib.lib.so sdl.lib.so
|
||||
avfilter.lib.so avutil.lib.so avcodec.lib.so avformat.lib.so swscale.lib.so
|
||||
mediafile
|
||||
}
|
||||
|
|
|
@ -97,6 +97,11 @@ append config {
|
|||
<start name="eglgears">
|
||||
<resource name="RAM" quantum="1G"/>
|
||||
<route><any-service> <parent /> <any-child/> </any-service></route>
|
||||
<config>
|
||||
<libc stdout="/dev/log">
|
||||
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>
|
||||
</config>
|
||||
</launcher>
|
||||
|
@ -110,7 +115,7 @@ install_config $config
|
|||
set boot_modules {
|
||||
core init ld.lib.so timer nitpicker nit_fb
|
||||
launchpad eglgears
|
||||
gallium.lib.so libc.lib.so libm.lib.so libc_log.lib.so pthread.lib.so
|
||||
gallium.lib.so libc.lib.so libm.lib.so pthread.lib.so
|
||||
}
|
||||
|
||||
lappend_if [have_spec linux] boot_modules fb_sdl
|
||||
|
|
|
@ -40,7 +40,15 @@ install_config {
|
|||
<start name="test-expat">
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
<config>
|
||||
<test_tag test_attribute="test_value" />
|
||||
<libc stdout="/dev/log">
|
||||
<vfs>
|
||||
<inline name="config"><config>
|
||||
<test_tag test_attribute="test_value" />
|
||||
</config>
|
||||
</inline>
|
||||
<dir name="dev"> <log/> </dir>
|
||||
</vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>
|
||||
</config>
|
||||
|
@ -52,7 +60,7 @@ install_config {
|
|||
|
||||
build_boot_image {
|
||||
core init timer
|
||||
ld.lib.so libc.lib.so libc_log.lib.so libc_rom.lib.so expat.lib.so
|
||||
ld.lib.so libc.lib.so expat.lib.so
|
||||
test-expat
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ requires_installation_of lynx
|
|||
|
||||
build {
|
||||
core init
|
||||
drivers/pci drivers/timer drivers/nic
|
||||
drivers/acpi drivers/pci drivers/timer drivers/nic
|
||||
test/lwip/http_srv_tracing
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ set config {
|
|||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</default-route>
|
||||
<start name="timer">
|
||||
<resource name="RAM" quantum="568K"/>
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides> <service name="Timer"/> </provides>
|
||||
</start>
|
||||
<start name="nic_drv">
|
||||
|
@ -68,13 +68,32 @@ set config {
|
|||
</start>
|
||||
<start name="test-lwip_httpsrv_tracing">
|
||||
<resource name="RAM" quantum="64M"/>
|
||||
</start> }
|
||||
<config>
|
||||
<libc stdout="/dev/log" stderr="/dev/log">
|
||||
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>}
|
||||
|
||||
append_if [have_spec pci] config {
|
||||
append_if [have_spec acpi] config {
|
||||
<start name="acpi">
|
||||
<resource name="RAM" quantum="6M"/>
|
||||
<binary name="acpi_drv"/>
|
||||
<provides>
|
||||
<service name="PCI"/>
|
||||
<service name="IRQ" />
|
||||
</provides>
|
||||
<route>
|
||||
<service name="PCI"> <any-child /> </service>
|
||||
<any-service> <parent/> <any-child /> </any-service>
|
||||
</route>
|
||||
</start>}
|
||||
|
||||
append_if [expr ![have_spec acpi] && [have_spec pci]] config {
|
||||
<start name="pci_drv">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<resource name="RAM" quantum="3M"/>
|
||||
<provides> <service name="PCI"/> </provides>
|
||||
</start> }
|
||||
</start>}
|
||||
|
||||
append config {
|
||||
</config>
|
||||
|
@ -90,12 +109,13 @@ install_config $config
|
|||
set boot_modules {
|
||||
core init timer
|
||||
nic_drv
|
||||
ld.lib.so libc.lib.so libc_log.lib.so lwip.lib.so
|
||||
ld.lib.so libc.lib.so lwip.lib.so
|
||||
test-lwip_httpsrv_tracing
|
||||
}
|
||||
|
||||
# platform-specific modules
|
||||
lappend_if [have_spec pci] boot_modules pci_drv
|
||||
lappend_if [have_spec pci] boot_modules pci_drv
|
||||
lappend_if [have_spec acpi] boot_modules acpi_drv
|
||||
|
||||
build_boot_image $boot_modules
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ set boot_modules {
|
|||
usb_drv
|
||||
gpio_drv
|
||||
test-lwip_httpsrv_tracing_nob
|
||||
ld.lib.so libc.lib.so libc_log.lib.so lwip.lib.so
|
||||
ld.lib.so libc.lib.so lwip.lib.so
|
||||
}
|
||||
|
||||
build_boot_image [join $boot_modules " "]
|
||||
|
|
|
@ -60,6 +60,11 @@ set config {
|
|||
|
||||
<start name="test-lwip_httpsrv_tracing">
|
||||
<resource name="RAM" quantum="64M"/>
|
||||
<config>
|
||||
<libc stdout="/dev/log" stderr="/dev/log">
|
||||
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>
|
||||
</config>}
|
||||
|
||||
|
@ -75,7 +80,7 @@ set boot_modules {
|
|||
usb_drv
|
||||
gpio_drv
|
||||
test-lwip_httpsrv_tracing
|
||||
ld.lib.so libc.lib.so libc_log.lib.so lwip.lib.so
|
||||
ld.lib.so libc.lib.so lwip.lib.so
|
||||
}
|
||||
|
||||
build_boot_image [join $boot_modules " "]
|
||||
|
|
|
@ -20,14 +20,19 @@ install_config {
|
|||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</default-route>
|
||||
<start name="test-libc">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<config>
|
||||
<libc stdout="/dev/log">
|
||||
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>
|
||||
</config>
|
||||
}
|
||||
|
||||
build_boot_image {
|
||||
core init test-libc
|
||||
ld.lib.so libc.lib.so libc_log.lib.so libm.lib.so
|
||||
ld.lib.so libc.lib.so libm.lib.so
|
||||
}
|
||||
|
||||
append qemu_args " -nographic -m 64 "
|
|
@ -76,6 +76,14 @@ set config {
|
|||
<start name="test-libc_block">
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
<config>
|
||||
<libc stdout="/dev/log">
|
||||
<vfs>
|
||||
<dir name="dev">
|
||||
<log/>
|
||||
<block name="blkdev"/>
|
||||
</dir>
|
||||
</vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>
|
||||
}
|
||||
|
@ -128,7 +136,7 @@ install_config $config
|
|||
# generic modules
|
||||
set boot_modules {
|
||||
core init timer
|
||||
ld.lib.so libc.lib.so libc_log.lib.so libc_block.lib.so
|
||||
ld.lib.so libc.lib.so
|
||||
test-libc_block
|
||||
}
|
||||
|
||||
|
|
|
@ -2,4 +2,11 @@ set mkfs_cmd mkfs.vfat
|
|||
set mkfs_opts "-F32"
|
||||
set filesystem ffat
|
||||
|
||||
#
|
||||
# The ffat_libc plugin opens a block session directly. If the VFS opened
|
||||
# the block session, the plugin would try to open a second one, which
|
||||
# would get denied by the block driver.
|
||||
#
|
||||
set libc_dev_blkdev ""
|
||||
|
||||
source ${genode_dir}/libports/run/libc_filesystem_test.inc
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# \brief Test for using the libc_fs plugin with the FFAT file system
|
||||
# \brief Test for using the libc_vfs plugin with the FFAT file system
|
||||
# \author Christian Prochaska
|
||||
# \date 2012-07-03
|
||||
#
|
||||
|
@ -21,7 +21,7 @@ set build_components {
|
|||
core init
|
||||
drivers/timer
|
||||
server/ffat_fs
|
||||
test/libc_fs
|
||||
test/libc_vfs
|
||||
}
|
||||
|
||||
lappend_if [have_spec pci] build_components drivers/pci
|
||||
|
@ -63,8 +63,16 @@ set config {
|
|||
<provides> <service name="File_system"/> </provides>
|
||||
<config> <policy label="" root="/" writeable="yes" /> </config>
|
||||
</start>
|
||||
<start name="test-libc_fs">
|
||||
<start name="test-libc_vfs">
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
<config>
|
||||
<libc stdout="/dev/log">
|
||||
<vfs>
|
||||
<dir name="dev"> <log/> </dir>
|
||||
<fs/>
|
||||
</vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>
|
||||
}
|
||||
|
||||
|
@ -116,8 +124,8 @@ install_config $config
|
|||
# generic modules
|
||||
set boot_modules {
|
||||
core init timer ffat_fs
|
||||
ld.lib.so libc.lib.so libc_log.lib.so libc_fs.lib.so
|
||||
test-libc_fs
|
||||
ld.lib.so libc.lib.so
|
||||
test-libc_vfs
|
||||
}
|
||||
|
||||
lappend_if [have_spec pci] boot_modules pci_drv
|
||||
|
|
|
@ -105,9 +105,17 @@ append config {
|
|||
<resource name="RAM" quantum="8M"/>
|
||||
<config>
|
||||
<iterations value="1"/>
|
||||
<libc stdout="/dev/log" stderr="/dev/log">
|
||||
<vfs>
|
||||
<dir name="dev">}
|
||||
append config $libc_dev_blkdev
|
||||
append config {
|
||||
<log/>
|
||||
</dir>
|
||||
</vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>
|
||||
}
|
||||
</start>}
|
||||
|
||||
append_if [have_spec acpi] config {
|
||||
<start name="acpi">
|
||||
|
@ -171,7 +179,7 @@ install_config $config
|
|||
# generic modules
|
||||
set boot_modules {
|
||||
core init timer
|
||||
ld.lib.so libc.lib.so libc_log.lib.so libc_block.lib.so
|
||||
ld.lib.so libc.lib.so
|
||||
}
|
||||
|
||||
append boot_modules test-libc_$filesystem
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
#
|
||||
# \brief Test for using the libc_fs plugin with the RAM file system
|
||||
# \author Norman Feske
|
||||
# \date 2012-04-11
|
||||
#
|
||||
|
||||
#
|
||||
# Build
|
||||
#
|
||||
|
||||
build { core init server/ram_fs test/libc_fs }
|
||||
|
||||
create_boot_directory
|
||||
|
||||
#
|
||||
# Generate config
|
||||
#
|
||||
|
||||
install_config {
|
||||
<config>
|
||||
<parent-provides>
|
||||
<service name="ROM"/>
|
||||
<service name="RAM"/>
|
||||
<service name="CAP"/>
|
||||
<service name="PD"/>
|
||||
<service name="RM"/>
|
||||
<service name="CPU"/>
|
||||
<service name="LOG"/>
|
||||
<service name="SIGNAL"/>
|
||||
</parent-provides>
|
||||
<default-route>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</default-route>
|
||||
<start name="ram_fs">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides> <service name="File_system"/> </provides>
|
||||
<config> <policy label="" root="/" writeable="yes" /> </config>
|
||||
</start>
|
||||
<start name="test-libc_fs">
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
<config>
|
||||
<iterations value="1"/>
|
||||
</config>
|
||||
</start>
|
||||
</config>
|
||||
}
|
||||
|
||||
#
|
||||
# Boot modules
|
||||
#
|
||||
|
||||
build_boot_image {
|
||||
core init
|
||||
ld.lib.so libc.lib.so libc_log.lib.so libc_fs.lib.so
|
||||
ram_fs test-libc_fs
|
||||
}
|
||||
|
||||
#
|
||||
# Execute test case
|
||||
#
|
||||
|
||||
append qemu_args " -m 128 -nographic "
|
||||
run_genode_until {.*child exited with exit value 0.*} 60
|
||||
|
||||
puts "\ntest succeeded\n"
|
||||
|
||||
# vi: set ft=tcl :
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# \brief Test for using the libc_fs plugin with the TAR file system
|
||||
# \brief Test for using the libc_vfs plugin with the TAR file system
|
||||
# \author Christian Prochaska
|
||||
# \date 2012-08-20
|
||||
#
|
||||
|
@ -53,6 +53,14 @@ set config {
|
|||
</start>
|
||||
<start name="test-libc_fs_tar_fs">
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
<config>
|
||||
<libc stdout="/dev/log">
|
||||
<vfs>
|
||||
<dir name="dev"> <log/> </dir>
|
||||
<fs/>
|
||||
</vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>
|
||||
}
|
||||
|
||||
|
@ -82,7 +90,7 @@ exec tar cfv bin/libc_fs_tar_fs.tar -C bin/libc_fs_tar_fs .
|
|||
# generic modules
|
||||
set boot_modules {
|
||||
core init timer tar_fs
|
||||
ld.lib.so libc.lib.so libc_log.lib.so libc_fs.lib.so
|
||||
ld.lib.so libc.lib.so
|
||||
test-libc_fs_tar_fs libc_fs_tar_fs.tar
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
set mkfs_cmd mkfs.exfat
|
||||
set mkfs_opts ""
|
||||
set filesystem fuse_exfat
|
||||
set mkfs_cmd mkfs.exfat
|
||||
set mkfs_opts ""
|
||||
set filesystem fuse_exfat
|
||||
set libc_dev_blkdev {<block name="blkdev"/>}
|
||||
|
||||
source ${genode_dir}/libports/run/libc_filesystem_test.inc
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
set mkfs_cmd mkfs.ext2
|
||||
set mkfs_opts "-F"
|
||||
set filesystem fuse_ext2
|
||||
set mkfs_cmd mkfs.ext2
|
||||
set mkfs_opts "-F"
|
||||
set filesystem fuse_ext2
|
||||
set libc_dev_blkdev {<block name="blkdev"/>}
|
||||
|
||||
source ${genode_dir}/libports/run/libc_filesystem_test.inc
|
||||
|
|
|
@ -40,11 +40,12 @@ install_config {
|
|||
<resource name="RAM" quantum="2M"/>
|
||||
<config>
|
||||
<iterations value="1"/>
|
||||
<libc cwd="/tmp" >
|
||||
<libc stdout="/dev/log" cwd="/tmp" >
|
||||
<vfs>
|
||||
<dir name="tmp" >
|
||||
<fs/>
|
||||
</dir>
|
||||
<dir name="dev"> <log/> </dir>
|
||||
</vfs>
|
||||
</libc>
|
||||
</config>
|
||||
|
@ -58,7 +59,7 @@ install_config {
|
|||
|
||||
build_boot_image {
|
||||
core init
|
||||
ld.lib.so libc.lib.so libc_log.lib.so
|
||||
ld.lib.so libc.lib.so
|
||||
ram_fs test-libc_vfs
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,12 @@ set config {
|
|||
</start>
|
||||
<start name="test-lwip_httpsrv">
|
||||
<resource name="RAM" quantum="5M"/>
|
||||
</start> }
|
||||
<config>
|
||||
<libc stdout="/dev/log" stderr="/dev/log">
|
||||
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>}
|
||||
|
||||
append_if [have_spec platform_arndale] config {
|
||||
<start name="platform_drv">
|
||||
|
@ -125,7 +130,7 @@ append_if [expr ![have_spec acpi] && [have_spec pci]] config {
|
|||
<start name="pci_drv">
|
||||
<resource name="RAM" quantum="3M"/>
|
||||
<provides> <service name="PCI"/> </provides>
|
||||
</start> }
|
||||
</start>}
|
||||
|
||||
append config {
|
||||
</config>
|
||||
|
@ -140,7 +145,7 @@ install_config $config
|
|||
# generic modules
|
||||
set boot_modules {
|
||||
core init timer
|
||||
ld.lib.so libc.lib.so libc_log.lib.so lwip.lib.so test-lwip_httpsrv
|
||||
ld.lib.so libc.lib.so lwip.lib.so test-lwip_httpsrv
|
||||
}
|
||||
|
||||
# platform-specific modules
|
||||
|
|
|
@ -42,6 +42,11 @@ set config {
|
|||
</start>
|
||||
<start name="test-lwip_httpsrv">
|
||||
<resource name="RAM" quantum="5M"/>
|
||||
<config>
|
||||
<libc stdout="/dev/log" stderr="/dev/log">
|
||||
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>
|
||||
</config>
|
||||
}
|
||||
|
@ -54,7 +59,7 @@ install_config $config
|
|||
|
||||
set boot_modules {
|
||||
core init timer nic_drv
|
||||
ld.lib.so libc.lib.so libc_log.lib.so lwip.lib.so test-lwip_httpsrv
|
||||
ld.lib.so libc.lib.so lwip.lib.so test-lwip_httpsrv
|
||||
}
|
||||
|
||||
build_boot_image $boot_modules
|
||||
|
|
|
@ -28,13 +28,18 @@ install_config {
|
|||
</start>
|
||||
<start name="test-moon">
|
||||
<resource name="RAM" quantum="1G"/>
|
||||
<config>
|
||||
<libc stdout="/dev/log">
|
||||
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>
|
||||
</config>
|
||||
}
|
||||
|
||||
build_boot_image {
|
||||
core init timer test-moon
|
||||
ld.lib.so libc.lib.so libc_log.lib.so libm.lib.so
|
||||
ld.lib.so libc.lib.so libm.lib.so
|
||||
}
|
||||
|
||||
append qemu_args " -nographic -m 64 "
|
||||
|
|
|
@ -61,6 +61,14 @@ append config {
|
|||
</start>
|
||||
<start name="mupdf">
|
||||
<resource name="RAM" quantum="1G"/>
|
||||
<config>
|
||||
<libc stdout="/dev/log" stderr="/dev/log">
|
||||
<vfs>
|
||||
<rom name="test.pdf" />
|
||||
<dir name="dev"> <log/> </dir>
|
||||
</vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>
|
||||
</config>
|
||||
}
|
||||
|
@ -83,7 +91,7 @@ if {![file exist bin/test.pdf]} {
|
|||
set boot_modules {
|
||||
core init ld.lib.so timer
|
||||
mupdf
|
||||
libc.lib.so libm.lib.so libc_log.lib.so libc_rom.lib.so
|
||||
libc.lib.so libm.lib.so
|
||||
openjpeg.lib.so freetype.lib.so libpng.lib.so zlib.lib.so jbig2dec.lib.so
|
||||
mupdf.lib.so jpeg.lib.so
|
||||
test.pdf
|
||||
|
|
|
@ -81,6 +81,9 @@ append config {
|
|||
<resource name="RAM" quantum="16M"/>
|
||||
<config>
|
||||
<argv verbose="0" listenip="0.0.0.0" />
|
||||
<libc stdout="/dev/log" stderr="/dev/log">
|
||||
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
||||
</libc>
|
||||
</config>
|
||||
<route> }
|
||||
append_if $use_nic_bridge config {
|
||||
|
@ -147,7 +150,7 @@ install_config $config
|
|||
# generic modules
|
||||
set boot_modules {
|
||||
core init timer
|
||||
ld.lib.so libc.lib.so lwip.lib.so libc_log.lib.so
|
||||
ld.lib.so libc.lib.so lwip.lib.so
|
||||
}
|
||||
|
||||
lappend_if $use_nic_bridge boot_modules nic_bridge
|
||||
|
|
|
@ -21,13 +21,18 @@ install_config {
|
|||
</default-route>
|
||||
<start name="test-pthread">
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
<config>
|
||||
<libc stdout="/dev/log">
|
||||
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>
|
||||
</config>
|
||||
}
|
||||
|
||||
build_boot_image {
|
||||
core init test-pthread
|
||||
ld.lib.so libc.lib.so libc_log.lib.so pthread.lib.so
|
||||
ld.lib.so libc.lib.so pthread.lib.so
|
||||
}
|
||||
|
||||
append qemu_args " -nographic -m 64 "
|
||||
|
|
|
@ -41,6 +41,24 @@ set config {
|
|||
<resource name="RAM" quantum="3M"/>
|
||||
<config>
|
||||
<script name="hello.py"/>
|
||||
<libc stdout="/dev/log" stderr="/dev/log">
|
||||
<vfs>
|
||||
<dir name="dev"> <log/> </dir>
|
||||
<inline name="hello.py">
|
||||
print " \r\n\r";
|
||||
print " -============================-";
|
||||
print " || ||";
|
||||
print " || Python Core 2.6.4 ||";
|
||||
print " || ||";
|
||||
print " || Genode 11.11 ||";
|
||||
print " || ||";
|
||||
print " -============================-";
|
||||
print " \r";
|
||||
print " 2011 by Genode Labs <www.genode-labs.com>";
|
||||
print " \r\n\r";
|
||||
</inline>
|
||||
</vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>
|
||||
</config>
|
||||
|
@ -52,29 +70,11 @@ install_config $config
|
|||
# Boot modules
|
||||
#
|
||||
|
||||
# Fill up hello.py with zeros, otherwise on OKL4 it fails on native machines.
|
||||
# OKL4 bootstrap procedure loads the script to the designated address but does
|
||||
# not clear the remainder of the page. Hence, the script is followed by some
|
||||
# garbage, which the interpreter tries to execute.
|
||||
|
||||
set test_file "[genode_dir]/libports/src/test/python/hello.py"
|
||||
set file_size [exec du -b $test_file]
|
||||
set file_size [regexp -inline {[0-9]+} $file_size]
|
||||
set file_size [expr 4096 - $file_size]
|
||||
catch { exec dd if=/dev/zero of=bin/hello.py.tmp bs=1 count=$file_size}
|
||||
exec cp $test_file bin/hello.py
|
||||
exec cat bin/hello.py.tmp >>bin/hello.py
|
||||
exec rm bin/hello.py.tmp
|
||||
set file_size [exec du -b bin/hello.py]
|
||||
set file_size [regexp -inline {[0-9]+} $file_size]
|
||||
if {$file_size != 4096 } { puts "hello.py could not be prepared properly"; exit 1 }
|
||||
|
||||
# generic modules
|
||||
set boot_modules {
|
||||
core init
|
||||
ld.lib.so libc.lib.so libc_log.lib.so libc_rom.lib.so libm.lib.so python.lib.so
|
||||
ld.lib.so libc.lib.so libm.lib.so python.lib.so
|
||||
test-python
|
||||
hello.py
|
||||
}
|
||||
|
||||
build_boot_image $boot_modules
|
||||
|
@ -102,6 +102,4 @@ compare_output_to {
|
|||
[init -> test-python]
|
||||
}
|
||||
|
||||
exec rm bin/hello.py
|
||||
|
||||
# vi: set ft=tcl :
|
||||
|
|
|
@ -103,7 +103,6 @@ set boot_modules {
|
|||
icu.lib.so
|
||||
ld.lib.so
|
||||
libc.lib.so
|
||||
libc_log.lib.so
|
||||
libc_lock_pipe.lib.so
|
||||
libm.lib.so
|
||||
libpng.lib.so
|
||||
|
|
|
@ -120,7 +120,6 @@ set boot_modules {
|
|||
icu.lib.so
|
||||
ld.lib.so
|
||||
libc.lib.so
|
||||
libc_log.lib.so
|
||||
libc_lock_pipe.lib.so
|
||||
libm.lib.so
|
||||
libpng.lib.so
|
||||
|
@ -140,8 +139,6 @@ set boot_modules {
|
|||
swscale.lib.so
|
||||
sdl.lib.so
|
||||
pthread.lib.so
|
||||
libc_log.lib.so
|
||||
libc_rom.lib.so
|
||||
avplay
|
||||
mediafile
|
||||
stdcxx.lib.so
|
||||
|
|
|
@ -100,7 +100,6 @@ set boot_modules {
|
|||
icu.lib.so
|
||||
ld.lib.so
|
||||
libc.lib.so
|
||||
libc_log.lib.so
|
||||
libc_lock_pipe.lib.so
|
||||
libm.lib.so
|
||||
libpng.lib.so
|
||||
|
|
|
@ -10,7 +10,6 @@ build {
|
|||
drivers/framebuffer
|
||||
drivers/timer
|
||||
server/nitpicker
|
||||
server/liquid_framebuffer
|
||||
app/qt5/examples/openglwindow
|
||||
}
|
||||
|
||||
|
@ -77,6 +76,11 @@ append config {
|
|||
</start>
|
||||
<start name="openglwindow">
|
||||
<resource name="RAM" quantum="80M"/>
|
||||
<config>
|
||||
<libc stdout="/dev/log" stderr="/dev/log">
|
||||
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>
|
||||
</config>
|
||||
}
|
||||
|
@ -93,14 +97,12 @@ set boot_modules {
|
|||
init
|
||||
timer
|
||||
nitpicker
|
||||
liquid_fb
|
||||
openglwindow
|
||||
freetype.lib.so
|
||||
gallium.lib.so
|
||||
icu.lib.so
|
||||
ld.lib.so
|
||||
libc.lib.so
|
||||
libc_log.lib.so
|
||||
libc_lock_pipe.lib.so
|
||||
libm.lib.so
|
||||
libpng.lib.so
|
||||
|
|
|
@ -100,7 +100,6 @@ set boot_modules {
|
|||
icu.lib.so
|
||||
ld.lib.so
|
||||
libc.lib.so
|
||||
libc_log.lib.so
|
||||
libc_lock_pipe.lib.so
|
||||
libm.lib.so
|
||||
libpng.lib.so
|
||||
|
|
|
@ -10,7 +10,6 @@ build {
|
|||
drivers/framebuffer
|
||||
drivers/timer
|
||||
server/nitpicker
|
||||
server/liquid_framebuffer
|
||||
server/loader
|
||||
server/tar_rom
|
||||
test/nitpicker
|
||||
|
@ -102,7 +101,6 @@ set boot_modules {
|
|||
init
|
||||
timer
|
||||
nitpicker
|
||||
liquid_fb
|
||||
loader
|
||||
tar_rom
|
||||
testnit
|
||||
|
@ -112,7 +110,6 @@ set boot_modules {
|
|||
icu.lib.so
|
||||
ld.lib.so
|
||||
libc.lib.so
|
||||
libc_log.lib.so
|
||||
libc_lock_pipe.lib.so
|
||||
libcrypto.lib.so
|
||||
libm.lib.so
|
||||
|
|
|
@ -10,8 +10,6 @@ build {
|
|||
drivers/framebuffer
|
||||
drivers/timer
|
||||
server/nitpicker
|
||||
server/liquid_framebuffer
|
||||
server/tar_fs
|
||||
app/qt5/qt_quicktest
|
||||
lib/qt5/qtdeclarative/src/imports/qtquick2
|
||||
}
|
||||
|
@ -83,16 +81,16 @@ append config {
|
|||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Nitpicker"/></provides>
|
||||
</start>
|
||||
<start name="tar_fs">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides> <service name="File_system"/> </provides>
|
||||
<config>
|
||||
<archive name="qt5_fs.tar" />
|
||||
<policy label="" root="/" />
|
||||
</config>
|
||||
</start>
|
||||
<start name="qt_quicktest">
|
||||
<resource name="RAM" quantum="80M"/>
|
||||
<config>
|
||||
<libc stdout="/dev/log" stderr="/dev/log">
|
||||
<vfs>
|
||||
<dir name="dev"> <log/> </dir>
|
||||
<tar name="qt5_fs.tar" />
|
||||
</vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>
|
||||
</config>
|
||||
}
|
||||
|
@ -113,16 +111,12 @@ set boot_modules {
|
|||
init
|
||||
timer
|
||||
nitpicker
|
||||
liquid_fb
|
||||
tar_fs
|
||||
qt_quicktest
|
||||
freetype.lib.so
|
||||
gallium.lib.so
|
||||
icu.lib.so
|
||||
ld.lib.so
|
||||
libc.lib.so
|
||||
libc_fs.lib.so
|
||||
libc_log.lib.so
|
||||
libc_lock_pipe.lib.so
|
||||
libcrypto.lib.so
|
||||
libm.lib.so
|
||||
|
|
|
@ -10,8 +10,6 @@ build {
|
|||
drivers/framebuffer
|
||||
drivers/timer
|
||||
server/nitpicker
|
||||
server/liquid_framebuffer
|
||||
server/tar_fs
|
||||
app/qt5/examples/samegame
|
||||
lib/qt5/qtdeclarative/src/imports/qtquick2
|
||||
}
|
||||
|
@ -83,16 +81,16 @@ append config {
|
|||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Nitpicker"/></provides>
|
||||
</start>
|
||||
<start name="tar_fs">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides> <service name="File_system"/> </provides>
|
||||
<config>
|
||||
<archive name="qt5_fs.tar" />
|
||||
<policy label="" root="/" />
|
||||
</config>
|
||||
</start>
|
||||
<start name="samegame">
|
||||
<resource name="RAM" quantum="128M"/>
|
||||
<config>
|
||||
<libc stdout="/dev/log" stderr="/dev/log">
|
||||
<vfs>
|
||||
<dir name="dev"> <log/> </dir>
|
||||
<tar name="qt5_fs.tar" />
|
||||
</vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>
|
||||
</config>
|
||||
}
|
||||
|
@ -113,16 +111,12 @@ set boot_modules {
|
|||
init
|
||||
timer
|
||||
nitpicker
|
||||
liquid_fb
|
||||
tar_fs
|
||||
samegame
|
||||
freetype.lib.so
|
||||
gallium.lib.so
|
||||
icu.lib.so
|
||||
ld.lib.so
|
||||
libc.lib.so
|
||||
libc_fs.lib.so
|
||||
libc_log.lib.so
|
||||
libc_lock_pipe.lib.so
|
||||
libcrypto.lib.so
|
||||
libm.lib.so
|
||||
|
|
|
@ -10,7 +10,6 @@ build {
|
|||
drivers/framebuffer
|
||||
drivers/timer
|
||||
server/nitpicker
|
||||
server/liquid_framebuffer
|
||||
app/qt5/examples/tetrix
|
||||
}
|
||||
|
||||
|
@ -93,14 +92,12 @@ set boot_modules {
|
|||
init
|
||||
timer
|
||||
nitpicker
|
||||
liquid_fb
|
||||
tetrix
|
||||
freetype.lib.so
|
||||
gallium.lib.so
|
||||
icu.lib.so
|
||||
ld.lib.so
|
||||
libc.lib.so
|
||||
libc_log.lib.so
|
||||
libc_lock_pipe.lib.so
|
||||
libm.lib.so
|
||||
libpng.lib.so
|
||||
|
|
|
@ -135,12 +135,20 @@ append config {
|
|||
</start>
|
||||
<start name="textedit">
|
||||
<resource name="RAM" quantum="70M"/>
|
||||
<config xpos="3" ypos="0" width="500" height="710"/>
|
||||
<config xpos="3" ypos="0" width="500" height="710">
|
||||
<libc>
|
||||
<vfs> <fs/> </vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>
|
||||
<start name="textedit2">
|
||||
<binary name="textedit" />
|
||||
<resource name="RAM" quantum="70M"/>
|
||||
<config xpos="512" ypos="0" width="500" height="710"/>
|
||||
<config xpos="512" ypos="0" width="500" height="710">
|
||||
<libc>
|
||||
<vfs> <fs/> </vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>
|
||||
</config>
|
||||
}
|
||||
|
@ -164,9 +172,7 @@ set boot_modules {
|
|||
icu.lib.so
|
||||
ld.lib.so
|
||||
libc.lib.so
|
||||
libc_log.lib.so
|
||||
libc_lock_pipe.lib.so
|
||||
libc_fs.lib.so
|
||||
libm.lib.so
|
||||
libpng.lib.so
|
||||
jpeg.lib.so
|
||||
|
|
|
@ -70,6 +70,9 @@ append config {
|
|||
</start>
|
||||
<start name="test-sdl">
|
||||
<resource name="RAM" quantum="32M"/>
|
||||
<libc stdout="/dev/log">
|
||||
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
||||
</libc>
|
||||
</start>
|
||||
</config>}
|
||||
|
||||
|
@ -84,7 +87,7 @@ set boot_modules {
|
|||
core init
|
||||
timer
|
||||
test-sdl
|
||||
ld.lib.so libc.lib.so libc_log.lib.so sdl.lib.so pthread.lib.so
|
||||
ld.lib.so libc.lib.so sdl.lib.so pthread.lib.so
|
||||
}
|
||||
|
||||
# platform-specific modules
|
||||
|
|
|
@ -71,6 +71,11 @@ append config {
|
|||
<service name="Nic"> <child name="nic_bridge"/> </service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
<config>
|
||||
<libc stdout="/dev/log" stderr="/dev/log">
|
||||
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>
|
||||
<start name="test-http_clnt">
|
||||
<resource name="RAM" quantum="32M"/>
|
||||
|
@ -78,6 +83,11 @@ append config {
|
|||
<service name="Nic"> <child name="nic_bridge"/> </service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
<config>
|
||||
<libc stdout="/dev/log" stderr="/dev/log">
|
||||
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>
|
||||
</config>}
|
||||
|
||||
|
@ -93,7 +103,7 @@ set boot_modules {
|
|||
timer nic_drv
|
||||
nic_bridge
|
||||
ld.lib.so
|
||||
libc.lib.so libc_log.lib.so
|
||||
libc.lib.so
|
||||
lwip.lib.so
|
||||
test-http_clnt
|
||||
test-lwip_httpsrv_static
|
||||
|
|
|
@ -4,9 +4,8 @@
|
|||
|
||||
set build_components {
|
||||
core init
|
||||
drivers/timer drivers/pci drivers/nic
|
||||
drivers/timer drivers/input drivers/pci drivers/nic
|
||||
server/nic_bridge
|
||||
server/ram_fs
|
||||
app/lighttpd
|
||||
test/lwip/http_clnt
|
||||
|
||||
|
@ -66,15 +65,23 @@ append config {
|
|||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
<start name="ram_fs">
|
||||
<resource name="RAM" quantum="10M"/>
|
||||
<provides><service name="File_system"/></provides>
|
||||
<start name="lighttpd">
|
||||
<resource name="RAM" quantum="256M" />
|
||||
<config>
|
||||
<policy label="lighttpd" root="/" />
|
||||
<content>
|
||||
<dir name="etc">
|
||||
<dir name="lighttpd">
|
||||
<inline name="lighttpd.conf">
|
||||
<arg value="lighttpd" />
|
||||
<arg value="-f" />
|
||||
<arg value="/etc/lighttpd/lighttpd.conf" />
|
||||
<arg value="-D" />
|
||||
<libc stdin="/dev/null" stdout="/dev/log" stderr="/dev/log"
|
||||
ip_addr="10.0.2.55" netmask="255.255.255.0" gateway="10.0.2.1">
|
||||
<vfs>
|
||||
<dir name="dev">
|
||||
<log/>
|
||||
<null/>
|
||||
</dir>
|
||||
<dir name="etc">
|
||||
<dir name="lighttpd">
|
||||
<inline name="lighttpd.conf">
|
||||
# lighttpd configuration
|
||||
server.port = 80
|
||||
server.document-root = "/website"
|
||||
|
@ -87,11 +94,11 @@ mimetype.assign = (
|
|||
".html" => "text/html",
|
||||
".htm" => "text/html"
|
||||
)
|
||||
</inline>
|
||||
</inline>
|
||||
</dir>
|
||||
</dir>
|
||||
</dir>
|
||||
<dir name="website">
|
||||
<inline name="index.html">
|
||||
<dir name="website">
|
||||
<inline name="index.html">
|
||||
<html>
|
||||
<head>
|
||||
<title>Hello</title>
|
||||
|
@ -101,19 +108,10 @@ mimetype.assign = (
|
|||
<b>I am bold ;-)</b>
|
||||
</body>
|
||||
</html>
|
||||
</inline>
|
||||
</dir>
|
||||
</content>
|
||||
</config>
|
||||
</start>
|
||||
<start name="lighttpd">
|
||||
<resource name="RAM" quantum="256M" />
|
||||
<config>
|
||||
<libc ip_addr="10.0.2.55" netmask="255.255.255.0" gateway="10.0.2.1"/>
|
||||
<arg value="lighttpd" />
|
||||
<arg value="-f" />
|
||||
<arg value="/etc/lighttpd/lighttpd.conf" />
|
||||
<arg value="-D" />
|
||||
</inline>
|
||||
</dir>
|
||||
</vfs>
|
||||
</libc>
|
||||
</config>
|
||||
<route>
|
||||
<service name="Nic"> <child name="nic_bridge"/> </service>
|
||||
|
@ -126,6 +124,11 @@ mimetype.assign = (
|
|||
<service name="Nic"> <child name="nic_bridge"/> </service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
<config>
|
||||
<libc stdout="/dev/log" stderr="/dev/log">
|
||||
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>
|
||||
</config>}
|
||||
|
||||
|
@ -141,12 +144,11 @@ set boot_modules {
|
|||
timer nic_drv
|
||||
nic_bridge
|
||||
ld.lib.so
|
||||
libc.lib.so libc_log.lib.so
|
||||
libc.lib.so
|
||||
lwip.lib.so
|
||||
test-http_clnt
|
||||
ram_fs
|
||||
libm.lib.so libc_fs.lib.so
|
||||
zlib.lib.so libcrypto.lib.so libssl.lib.so
|
||||
libm.lib.so
|
||||
zlib.lib.so
|
||||
lighttpd
|
||||
}
|
||||
|
||||
|
@ -164,5 +166,6 @@ append_if [have_spec x86] qemu_args " -net nic,model=pcnet "
|
|||
append_if [have_spec lan9118] qemu_args " -net nic,model=lan9118 "
|
||||
|
||||
append qemu_args " -net user "
|
||||
append qemu_args " -nographic -serial mon:stdio "
|
||||
|
||||
run_genode_until forever
|
||||
|
|
|
@ -109,11 +109,16 @@ append config {
|
|||
<arg value="1024"/>
|
||||
<arg value="-endsize"/>
|
||||
<arg value="1024"/>
|
||||
<arg value="-serverip"/> }
|
||||
<arg value="-serverip"/>}
|
||||
append config "
|
||||
<arg value=\"$ip_addr\"/>
|
||||
<arg value=\"$ip_addr\"/>"
|
||||
append config {
|
||||
<argv verbose="0" listenip="0.0.0.0" />
|
||||
<libc stdout="/dev/log" stderr="/dev/log">
|
||||
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start> "
|
||||
</start>}
|
||||
|
||||
append config {
|
||||
</config>
|
||||
|
@ -128,7 +133,7 @@ install_config $config
|
|||
# generic modules
|
||||
set boot_modules {
|
||||
core init timer
|
||||
ld.lib.so libc.lib.so libc_log.lib.so lwip_nic_dhcp.lib.so lwip.lib.so
|
||||
ld.lib.so libc.lib.so lwip.lib.so
|
||||
test-ping_client_libc_lwip
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,9 @@ set config {
|
|||
<resource name="RAM" quantum="16M"/>
|
||||
<config>
|
||||
<argv verbose="0" listenip="0.0.0.0" />
|
||||
<libc stdout="/dev/log" stderr="/dev/log">
|
||||
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start> }
|
||||
|
||||
|
@ -104,7 +107,7 @@ install_config $config
|
|||
# generic modules
|
||||
set boot_modules {
|
||||
core init timer
|
||||
ld.lib.so libc.lib.so lwip.lib.so libc_log.lib.so
|
||||
ld.lib.so libc.lib.so lwip.lib.so
|
||||
test-ping_server_libc_lwip
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ include $(REP_DIR)/lib/import/import-av.inc
|
|||
TARGET = avplay
|
||||
SRC_C = avplay.c cmdutils.c libc_dummies.c
|
||||
LIBS += avfilter avformat avcodec avutil swscale
|
||||
LIBS += sdl libc libm libc_log libc_rom config_args
|
||||
LIBS += sdl libc libm libc_vfs config_args
|
||||
|
||||
CC_WARN += -Wno-parentheses -Wno-switch -Wno-uninitialized \
|
||||
-Wno-format-zero-length -Wno-pointer-sign
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TARGET = eglgears
|
||||
SRC_C = eglgears.c
|
||||
LIBS = libc libm libc_log gallium
|
||||
LIBS = libc libc_vfs libm gallium
|
||||
|
|
|
@ -2,7 +2,7 @@ MUPDF_DIR = $(REP_DIR)/contrib/mupdf-0.9
|
|||
TARGET = mupdf
|
||||
SRC_C = pdfapp.c
|
||||
SRC_CC = main.cc
|
||||
LIBS = libc mupdf libc_log libc_rom
|
||||
LIBS = libc mupdf libc_vfs
|
||||
INC_DIR += $(MUPDF_DIR)/apps
|
||||
|
||||
vpath pdfapp.c $(MUPDF_DIR)/apps
|
||||
|
|
|
@ -6,5 +6,3 @@ include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_defaults.inc
|
|||
|
||||
include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_final.inc
|
||||
|
||||
LIBS += libc_fs
|
||||
|
||||
|
|
|
@ -13,4 +13,3 @@ include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_defaults.inc
|
|||
|
||||
include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_final.inc
|
||||
|
||||
LIBS += libc_fs
|
||||
|
|
|
@ -54,6 +54,25 @@ class Avplay_policy : public QObject, public Genode::Slave_policy
|
|||
arg1_node.setAttribute("value", _mediafile);
|
||||
config_node.appendChild(arg1_node);
|
||||
|
||||
/*
|
||||
* Configure libc of avplay to direct output to LOG and to obtain
|
||||
* the mediafile from ROM.
|
||||
*/
|
||||
QDomElement libc_node = config_doc.createElement("libc");
|
||||
libc_node.setAttribute("stdout", "/dev/log");
|
||||
libc_node.setAttribute("stderr", "/dev/log");
|
||||
QDomElement libc_vfs_node = config_doc.createElement("vfs");
|
||||
QDomElement libc_vfs_dev_node = config_doc.createElement("dir");
|
||||
libc_vfs_dev_node.setAttribute("name", "dev");
|
||||
QDomElement libc_vfs_dev_log_node = config_doc.createElement("log");
|
||||
libc_vfs_dev_node.appendChild(libc_vfs_dev_log_node);
|
||||
libc_vfs_node.appendChild(libc_vfs_dev_node);
|
||||
QDomElement libc_vfs_mediafile_node = config_doc.createElement("rom");
|
||||
libc_vfs_mediafile_node.setAttribute("name", "mediafile");
|
||||
libc_vfs_node.appendChild(libc_vfs_mediafile_node);
|
||||
libc_node.appendChild(libc_vfs_node);
|
||||
config_node.appendChild(libc_node);
|
||||
|
||||
QDomElement sdl_audio_volume_node = config_doc.createElement("sdl_audio_volume");
|
||||
sdl_audio_volume_node.setAttribute("value", QString::number(_sdl_audio_volume));
|
||||
config_node.appendChild(sdl_audio_volume_node);
|
||||
|
|
|
@ -6,5 +6,3 @@ include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_defaults.inc
|
|||
|
||||
include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_final.inc
|
||||
|
||||
LIBS += libc_fs
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
INC_DIR += $(PRG_DIR)
|
||||
|
||||
LIBS += libc libc_log
|
||||
LIBS += libc libc_vfs
|
||||
|
||||
# set the stack size of the main thread
|
||||
CC_CXX_OPT += -DQT_MAIN_STACK_SIZE=$(QT_MAIN_STACK_SIZE)
|
||||
|
|
|
@ -1,544 +0,0 @@
|
|||
/*
|
||||
* \brief Libc Block_session plugin
|
||||
* \author Josef Soentgen
|
||||
* \date 2013-11-04
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/allocator_avl.h>
|
||||
#include <base/printf.h>
|
||||
#include <block_session/connection.h>
|
||||
|
||||
/* libc plugin includes */
|
||||
#include <libc-plugin/plugin.h>
|
||||
#include <libc-plugin/fd_alloc.h>
|
||||
|
||||
/* libc includes */
|
||||
#include <sys/disk.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
static bool const verbose = false;
|
||||
|
||||
/**
|
||||
* There is a off_t typedef clash between sys/socket.h
|
||||
* and base/stdint.h. We define the macro here to circumvent
|
||||
* this issue.
|
||||
*/
|
||||
#undef DIOCGMEDIASIZE
|
||||
#define DIOCGMEDIASIZE _IOR('d', 129, Genode::off_t)
|
||||
|
||||
/************
|
||||
** Plugin **
|
||||
************/
|
||||
|
||||
namespace {
|
||||
|
||||
struct Plugin_context : Libc::Plugin_context
|
||||
{
|
||||
private:
|
||||
|
||||
Genode::Allocator *_md_alloc;
|
||||
Genode::Allocator_avl _tx_block_alloc;
|
||||
|
||||
char *_block_buffer;
|
||||
|
||||
Block::Connection *_block;
|
||||
size_t _block_size;
|
||||
Block::sector_t _block_count;
|
||||
Block::Session::Operations _block_ops;
|
||||
Block::Session::Tx::Source *_tx_source;
|
||||
|
||||
::off_t _cur_offset;
|
||||
|
||||
bool _readable;
|
||||
bool _writeable;
|
||||
|
||||
int _flags;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
enum { BUFFER_BLOCK_NUMBER = 16 };
|
||||
|
||||
Plugin_context(Genode::Allocator *md_alloc, int flags)
|
||||
:
|
||||
_md_alloc(md_alloc),
|
||||
_tx_block_alloc(_md_alloc),
|
||||
_block_buffer(0),
|
||||
_block(new (_md_alloc) Block::Connection(&_tx_block_alloc)),
|
||||
_tx_source(_block->tx()),
|
||||
_cur_offset(0),
|
||||
_readable(false),
|
||||
_writeable(false),
|
||||
_flags(flags)
|
||||
{
|
||||
_block->info(&_block_count, &_block_size, &_block_ops);
|
||||
|
||||
_readable = _block_ops.supported(Block::Packet_descriptor::READ);
|
||||
_writeable = _block_ops.supported(Block::Packet_descriptor::WRITE);
|
||||
|
||||
_block_buffer = reinterpret_cast<char*>(malloc(BUFFER_BLOCK_NUMBER * _block_size));
|
||||
|
||||
if (verbose) {
|
||||
PDBG("number of blocks: %llu with block size: %zu (bytes)"
|
||||
" , readable: %d writeable: %d",
|
||||
_block_count, _block_size, _readable, _writeable);
|
||||
}
|
||||
}
|
||||
|
||||
~Plugin_context()
|
||||
{
|
||||
destroy(_md_alloc, _block);
|
||||
free(_block_buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return read/write state
|
||||
*/
|
||||
bool readable() const { return _readable; }
|
||||
bool writeable() const { return _writeable; }
|
||||
|
||||
/**
|
||||
* Return file descriptor flags
|
||||
*/
|
||||
int flags() const { return _flags; }
|
||||
|
||||
/**
|
||||
* Return seek offset
|
||||
*/
|
||||
::off_t seek_offset() const { return _cur_offset; }
|
||||
|
||||
/**
|
||||
* Set seek offset
|
||||
*/
|
||||
void seek_offset(size_t seek_offset) { _cur_offset = seek_offset; }
|
||||
|
||||
/**
|
||||
* Advance current seek offset position by 'incr' number of bytes
|
||||
*/
|
||||
void advance_seek_offset(size_t incr) { _cur_offset += incr; }
|
||||
|
||||
/**
|
||||
* Set seek offset to maximum value
|
||||
*/
|
||||
void infinite_seek_offset() { _cur_offset = ~0; }
|
||||
|
||||
/**
|
||||
* Return pointer to memory used as block puffer
|
||||
*/
|
||||
char *block_buffer() const { return _block_buffer; }
|
||||
|
||||
/**
|
||||
* Return number of blocks
|
||||
*/
|
||||
size_t block_count() const { return _block_count; }
|
||||
|
||||
/**
|
||||
* Return size of a block
|
||||
*/
|
||||
size_t block_size() const { return _block_size; }
|
||||
|
||||
/**
|
||||
* Issue a block operation
|
||||
*
|
||||
* This implementation operates synchronized, it will wait for the
|
||||
* acknowlegdement for the submitted packet.
|
||||
*
|
||||
* \param nr number of start block
|
||||
* \param buf buffer to read from or write to
|
||||
* \param sz size of buffer
|
||||
* \param write if true issue write operation, otherwise issue read opertion
|
||||
* \param bulk if true operate on as many block as fit into the block buffer
|
||||
*
|
||||
* return number of bytes transfered
|
||||
*/
|
||||
ssize_t block_io(size_t nr, void *buf, size_t sz, bool write, bool bulk = false)
|
||||
{
|
||||
/* sync offset */
|
||||
_cur_offset = nr * _block_size;
|
||||
|
||||
Block::Packet_descriptor::Opcode op;
|
||||
op = write ? Block::Packet_descriptor::WRITE : Block::Packet_descriptor::READ;
|
||||
|
||||
size_t packet_size = bulk ? sz : _block_size;
|
||||
size_t packet_count = bulk ? (sz / _block_size) : 1;
|
||||
|
||||
/* sanity check */
|
||||
if (packet_count > BUFFER_BLOCK_NUMBER) {
|
||||
packet_size = BUFFER_BLOCK_NUMBER * _block_size;
|
||||
packet_count = BUFFER_BLOCK_NUMBER;
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
PDBG("%5s: block:%zu size:%zu packets:%zu",
|
||||
write ? "write" : "read", nr, sz, packet_count);
|
||||
|
||||
Block::Packet_descriptor p(_tx_source->alloc_packet(packet_size), op,
|
||||
nr, packet_count);
|
||||
|
||||
if (write)
|
||||
Genode::memcpy(_tx_source->packet_content(p), buf, packet_size);
|
||||
|
||||
_tx_source->submit_packet(p);
|
||||
p = _tx_source->get_acked_packet();
|
||||
|
||||
if (!p.succeeded()) {
|
||||
PERR("Could not read block(s)");
|
||||
_tx_source->release_packet(p);
|
||||
errno = EIO;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!write)
|
||||
Genode::memcpy(buf, _tx_source->packet_content(p), packet_size);
|
||||
|
||||
_cur_offset += packet_size;
|
||||
|
||||
_tx_source->release_packet(p);
|
||||
return packet_size;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
static inline Plugin_context *context(Libc::File_descriptor *fd)
|
||||
{
|
||||
return static_cast<Plugin_context *>(fd->context);
|
||||
}
|
||||
|
||||
class Plugin : public Libc::Plugin
|
||||
{
|
||||
private:
|
||||
|
||||
/**
|
||||
* File name this plugin feels responsible for
|
||||
*/
|
||||
static char const *_dev_name() { return "/dev/blkdev"; }
|
||||
|
||||
bool _supports_path(const char *path)
|
||||
{
|
||||
return (Genode::strcmp(path, "/dev") == 0) ||
|
||||
(Genode::strcmp(path, _dev_name()) == 0);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Plugin() { }
|
||||
|
||||
bool supports_open(const char *pathname, int flags) {
|
||||
return _supports_path(pathname); }
|
||||
|
||||
bool supports_stat(const char *path) {
|
||||
return _supports_path(path); }
|
||||
|
||||
int close(Libc::File_descriptor *fd)
|
||||
{
|
||||
Plugin_context *ctx = context(fd);
|
||||
|
||||
destroy(env()->heap(), ctx);
|
||||
Libc::file_descriptor_allocator()->free(fd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fcntl(Libc::File_descriptor *fd, int cmd, long arg)
|
||||
{
|
||||
switch (cmd) {
|
||||
case F_GETFL:
|
||||
return context(fd)->flags();
|
||||
case F_SETLK:
|
||||
/**
|
||||
* We do not support locking a block device but we keep
|
||||
* the caller happy.
|
||||
*/
|
||||
return 0;
|
||||
default:
|
||||
PDBG("cmd: %d not implemented, return error.", cmd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return -1; /* never reached */
|
||||
}
|
||||
|
||||
int fstat(Libc::File_descriptor *fd, struct stat *buf)
|
||||
{
|
||||
/* we pretent to be a block device */
|
||||
if (buf) {
|
||||
Genode::memset(buf, 0, sizeof (struct stat));
|
||||
buf->st_mode = S_IFBLK;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fsync(Libc::File_descriptor *fd)
|
||||
{
|
||||
/**
|
||||
* Currently all block I/O is done synchronized. To
|
||||
* keep the caller happy we pretent that the fsync()
|
||||
* call was successful.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ioctl(Libc::File_descriptor *fd, int req, char *argp)
|
||||
{
|
||||
Plugin_context *ctx = context(fd);
|
||||
|
||||
switch (req) {
|
||||
case DIOCGMEDIASIZE:
|
||||
return ctx->block_count();
|
||||
case DIOCGSECTORSIZE:
|
||||
return ctx->block_size();
|
||||
default:
|
||||
PDBG("request: %d not supported", req);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
::off_t lseek(Libc::File_descriptor *fd, ::off_t offset, int whence)
|
||||
{
|
||||
Plugin_context *ctx = context(fd);
|
||||
|
||||
switch (whence) {
|
||||
case SEEK_SET:
|
||||
ctx->seek_offset(offset);
|
||||
return offset;
|
||||
|
||||
case SEEK_CUR:
|
||||
ctx->advance_seek_offset(offset);
|
||||
return ctx->seek_offset();
|
||||
|
||||
case SEEK_END:
|
||||
if (offset != 0) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
ctx->infinite_seek_offset();
|
||||
return (ctx->block_count() * ctx->block_size());
|
||||
|
||||
default:
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
Libc::File_descriptor *open(const char *pathname, int flags)
|
||||
{
|
||||
try {
|
||||
if (verbose)
|
||||
PDBG("open block device '%s'", pathname);
|
||||
|
||||
Plugin_context *context = new (Genode::env()->heap())
|
||||
Plugin_context(env()->heap(), flags);
|
||||
|
||||
return Libc::file_descriptor_allocator()->alloc(this, context);
|
||||
} catch (...) {
|
||||
PERR("could not create plugin context");
|
||||
}
|
||||
|
||||
errno = ENOENT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ssize_t read(Libc::File_descriptor *fd, void *buf, ::size_t count)
|
||||
{
|
||||
Plugin_context *ctx = context(fd);
|
||||
|
||||
if (!ctx->readable()) {
|
||||
PERR("block device is not readable");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
size_t blk_size = ctx->block_size();
|
||||
char *blk_buffer = ctx->block_buffer();
|
||||
char *_buf = (char*) buf;
|
||||
|
||||
ssize_t read = 0;
|
||||
while (count > 0) {
|
||||
size_t displ = 0;
|
||||
size_t length = 0;
|
||||
ssize_t nbytes = 0;
|
||||
size_t blk_nr = ctx->seek_offset() / blk_size;
|
||||
|
||||
displ = ctx->seek_offset() % blk_size;
|
||||
|
||||
if ((displ + count) > blk_size)
|
||||
length = (blk_size - displ);
|
||||
else
|
||||
length = count;
|
||||
|
||||
/**
|
||||
* We take a shortcut and read the blocks all at once if the
|
||||
* offset is aligned on a block boundary and we the count is a
|
||||
* multiple of the block size, e.g. 4K reads will be read at
|
||||
* once.
|
||||
*
|
||||
* XXX this is quite hackish because we have to omit partial
|
||||
* blocks at the end.
|
||||
*/
|
||||
if (displ == 0 && (count % blk_size) >= 0 && !(count < blk_size)) {
|
||||
size_t bytes_left = count - (count % blk_size);
|
||||
|
||||
nbytes = ctx->block_io(blk_nr, _buf + read, bytes_left, false, true);
|
||||
if (nbytes == -1) {
|
||||
PERR("error while reading block:%zu from block device",
|
||||
blk_nr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
read += nbytes;
|
||||
count -= nbytes;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (displ > 0)
|
||||
PWRN("offset:%lld is not aligned to block_size:%zu"
|
||||
" displacement:%zu", ctx->seek_offset(), blk_size, displ);
|
||||
|
||||
nbytes = ctx->block_io(blk_nr, blk_buffer, blk_size, false);
|
||||
if ((unsigned)nbytes != blk_size) {
|
||||
PERR("error while reading block:%zu from block device",
|
||||
blk_nr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
Genode::memcpy(_buf + read, blk_buffer + displ, length);
|
||||
|
||||
read += length;
|
||||
count -= length;
|
||||
}
|
||||
|
||||
return read;
|
||||
}
|
||||
|
||||
int stat(const char *path, struct stat *buf)
|
||||
{
|
||||
/* we pretent to be a block device */
|
||||
if (buf) {
|
||||
Genode::memset(buf, 0, sizeof (struct stat));
|
||||
if (Genode::strcmp(path, "/dev") == 0)
|
||||
buf->st_mode = S_IFDIR;
|
||||
else if (Genode::strcmp(path, _dev_name()) == 0)
|
||||
buf->st_mode = S_IFBLK;
|
||||
else {
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
ssize_t write(Libc::File_descriptor *fd, const void *buf, ::size_t count)
|
||||
{
|
||||
Plugin_context *ctx = context(fd);
|
||||
|
||||
if (!ctx->writeable()) {
|
||||
PERR("block device is not writeable");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
size_t blk_size = ctx->block_size();
|
||||
char *blk_buffer = ctx->block_buffer();
|
||||
const char *_buf = (const char*)buf;
|
||||
|
||||
ssize_t written = 0;
|
||||
while (count > 0) {
|
||||
size_t displ = 0;
|
||||
size_t length = 0;
|
||||
ssize_t nbytes = 0;
|
||||
size_t blk_nr = ctx->seek_offset() / blk_size;
|
||||
|
||||
displ = ctx->seek_offset() % blk_size;
|
||||
|
||||
if ((displ + count) > blk_size)
|
||||
length = (blk_size - displ);
|
||||
else
|
||||
length = count;
|
||||
|
||||
/**
|
||||
* We take a shortcut and write as much as possible without
|
||||
* using the block buffer if the offset is aligned on a block
|
||||
* boundary and the count is a multiple of the block size,
|
||||
* e.g. 4K writes will be written at once.
|
||||
*
|
||||
* XXX this is quite hackish because we have to omit partial
|
||||
* blocks at the end.
|
||||
*/
|
||||
if (displ == 0 && (count % blk_size) >= 0 && !(count < blk_size)) {
|
||||
size_t bytes_left = count - (count % blk_size);
|
||||
|
||||
nbytes = ctx->block_io(blk_nr, (void*)(_buf + written),
|
||||
bytes_left, true, true);
|
||||
if (nbytes == -1) {
|
||||
PERR("error while reading block:%zu from block device",
|
||||
blk_nr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
written += nbytes;
|
||||
count -= nbytes;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* The offset is not aligned on a block boundary. Therefore
|
||||
* we need to read the block to the block buffer first and
|
||||
* put the buffer content at the right offset before we can
|
||||
* write the whole block back. In addition if length is less
|
||||
* than block size, we also have to read the block first.
|
||||
*/
|
||||
if (displ > 0 || length < blk_size) {
|
||||
PWRN("offset:%lld block_size:%zd displacement:%zd length:%zu",
|
||||
ctx->seek_offset(), blk_size, displ, length);
|
||||
|
||||
ctx->block_io(blk_nr, blk_buffer, blk_size, false);
|
||||
/* rewind seek offset to account for the block read */
|
||||
ctx->seek_offset(ctx->seek_offset()-blk_size);
|
||||
}
|
||||
|
||||
Genode::memcpy(blk_buffer + displ, _buf + written, length);
|
||||
|
||||
nbytes = ctx->block_io(blk_nr, blk_buffer, blk_size, true);
|
||||
if ((unsigned)nbytes != blk_size) {
|
||||
PERR("error while reading block:%zu from Block_device",
|
||||
blk_nr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
written += length;
|
||||
count -= length;
|
||||
}
|
||||
|
||||
return written;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} /* unnamed namespace */
|
||||
|
||||
void __attribute__((constructor)) init_libc_block(void)
|
||||
{
|
||||
PDBG("using the libc_block plugin");
|
||||
static Plugin plugin;
|
||||
}
|
|
@ -162,12 +162,17 @@ class Plugin : public Libc::Plugin
|
|||
return directory_plugin_context->ffat_dir();
|
||||
}
|
||||
|
||||
/*
|
||||
* Override libc_vfs
|
||||
*/
|
||||
enum { PLUGIN_PRIORITY = 1 };
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Plugin()
|
||||
Plugin() : Libc::Plugin(PLUGIN_PRIORITY)
|
||||
{
|
||||
/* mount the file system */
|
||||
if (verbose)
|
||||
|
@ -188,42 +193,59 @@ class Plugin : public Libc::Plugin
|
|||
* TODO: decide if the file named <path> shall be handled by this plugin
|
||||
*/
|
||||
|
||||
bool supports_mkdir(const char *path, mode_t)
|
||||
bool supports_mkdir(const char *path, mode_t) override
|
||||
{
|
||||
if (verbose)
|
||||
PDBG("path = %s", path);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool supports_open(const char *pathname, int flags)
|
||||
bool supports_open(const char *pathname, int flags) override
|
||||
{
|
||||
if (verbose)
|
||||
PDBG("pathname = %s", pathname);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool supports_rename(const char *oldpath, const char *newpath)
|
||||
bool supports_rename(const char *oldpath, const char *newpath) override
|
||||
{
|
||||
if (verbose)
|
||||
PDBG("oldpath = %s, newpath = %s", oldpath, newpath);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool supports_stat(const char *path)
|
||||
bool supports_rmdir(const char *path) override
|
||||
{
|
||||
if (verbose)
|
||||
PDBG("path = %s", path);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool supports_unlink(const char *path)
|
||||
bool supports_stat(const char *path) override
|
||||
{
|
||||
if (verbose)
|
||||
PDBG("path = %s", path);
|
||||
return true;
|
||||
}
|
||||
|
||||
int close(Libc::File_descriptor *fd)
|
||||
bool supports_unlink(const char *path) override
|
||||
{
|
||||
if (verbose)
|
||||
PDBG("path = %s", path);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool supports_symlink(const char *, const char *) override
|
||||
{
|
||||
/*
|
||||
* Even though FFAT does not support symlinks, we still want
|
||||
* to capture calls of 'symlink' to return ENOSYS, which is
|
||||
* checked in the file-system test.
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
int close(Libc::File_descriptor *fd) override
|
||||
{
|
||||
using namespace Ffat;
|
||||
|
||||
|
@ -257,7 +279,7 @@ class Plugin : public Libc::Plugin
|
|||
}
|
||||
}
|
||||
|
||||
int fcntl(Libc::File_descriptor *fd, int cmd, long arg)
|
||||
int fcntl(Libc::File_descriptor *fd, int cmd, long arg) override
|
||||
{
|
||||
switch (cmd) {
|
||||
case F_GETFD: return context(fd)->fd_flags();
|
||||
|
@ -267,12 +289,12 @@ class Plugin : public Libc::Plugin
|
|||
}
|
||||
}
|
||||
|
||||
int fstat(Libc::File_descriptor *fd, struct stat *buf)
|
||||
int fstat(Libc::File_descriptor *fd, struct stat *buf) override
|
||||
{
|
||||
return stat(context(fd)->filename(), buf);
|
||||
}
|
||||
|
||||
int fstatfs(Libc::File_descriptor *, struct statfs *buf)
|
||||
int fstatfs(Libc::File_descriptor *, struct statfs *buf) override
|
||||
{
|
||||
/* libc's opendir() fails if _fstatfs() returns -1, so we return 0 here */
|
||||
if (verbose)
|
||||
|
@ -280,7 +302,7 @@ class Plugin : public Libc::Plugin
|
|||
return 0;
|
||||
}
|
||||
|
||||
int fsync(Libc::File_descriptor *fd)
|
||||
int fsync(Libc::File_descriptor *fd) override
|
||||
{
|
||||
using namespace Ffat;
|
||||
|
||||
|
@ -302,7 +324,7 @@ class Plugin : public Libc::Plugin
|
|||
}
|
||||
}
|
||||
|
||||
int ftruncate(Libc::File_descriptor *fd, ::off_t length)
|
||||
int ftruncate(Libc::File_descriptor *fd, ::off_t length) override
|
||||
{
|
||||
using namespace Ffat;
|
||||
|
||||
|
@ -330,7 +352,7 @@ class Plugin : public Libc::Plugin
|
|||
}
|
||||
|
||||
ssize_t getdirentries(Libc::File_descriptor *fd, char *buf,
|
||||
::size_t nbytes, ::off_t *basep)
|
||||
::size_t nbytes, ::off_t *basep) override
|
||||
{
|
||||
using namespace Ffat;
|
||||
|
||||
|
@ -392,7 +414,7 @@ class Plugin : public Libc::Plugin
|
|||
return sizeof(struct dirent);
|
||||
}
|
||||
|
||||
::off_t lseek(Libc::File_descriptor *fd, ::off_t offset, int whence)
|
||||
::off_t lseek(Libc::File_descriptor *fd, ::off_t offset, int whence) override
|
||||
{
|
||||
using namespace Ffat;
|
||||
|
||||
|
@ -430,7 +452,7 @@ class Plugin : public Libc::Plugin
|
|||
}
|
||||
}
|
||||
|
||||
int mkdir(const char *path, mode_t mode)
|
||||
int mkdir(const char *path, mode_t mode) override
|
||||
{
|
||||
using namespace Ffat;
|
||||
|
||||
|
@ -465,7 +487,7 @@ class Plugin : public Libc::Plugin
|
|||
}
|
||||
}
|
||||
|
||||
Libc::File_descriptor *open(const char *pathname, int flags)
|
||||
Libc::File_descriptor *open(const char *pathname, int flags) override
|
||||
{
|
||||
using namespace Ffat;
|
||||
|
||||
|
@ -567,7 +589,7 @@ class Plugin : public Libc::Plugin
|
|||
}
|
||||
}
|
||||
|
||||
int rename(const char *oldpath, const char *newpath)
|
||||
int rename(const char *oldpath, const char *newpath) override
|
||||
{
|
||||
using namespace Ffat;
|
||||
|
||||
|
@ -603,7 +625,7 @@ class Plugin : public Libc::Plugin
|
|||
}
|
||||
}
|
||||
|
||||
ssize_t read(Libc::File_descriptor *fd, void *buf, ::size_t count)
|
||||
ssize_t read(Libc::File_descriptor *fd, void *buf, ::size_t count) override
|
||||
{
|
||||
using namespace Ffat;
|
||||
|
||||
|
@ -629,7 +651,7 @@ class Plugin : public Libc::Plugin
|
|||
}
|
||||
}
|
||||
|
||||
int stat(const char *path, struct stat *buf)
|
||||
int stat(const char *path, struct stat *buf) override
|
||||
{
|
||||
using namespace Ffat;
|
||||
|
||||
|
@ -705,7 +727,7 @@ class Plugin : public Libc::Plugin
|
|||
return 0;
|
||||
}
|
||||
|
||||
int unlink(const char *path)
|
||||
int unlink(const char *path) override
|
||||
{
|
||||
using namespace Ffat;
|
||||
|
||||
|
@ -738,7 +760,12 @@ class Plugin : public Libc::Plugin
|
|||
}
|
||||
}
|
||||
|
||||
ssize_t write(Libc::File_descriptor *fd, const void *buf, ::size_t count)
|
||||
int rmdir(const char *path) override
|
||||
{
|
||||
return unlink(path);
|
||||
}
|
||||
|
||||
ssize_t write(Libc::File_descriptor *fd, const void *buf, ::size_t count) override
|
||||
{
|
||||
using namespace Ffat;
|
||||
|
||||
|
@ -763,6 +790,12 @@ class Plugin : public Libc::Plugin
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int symlink(const char *, const char *) override
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,824 +0,0 @@
|
|||
/*
|
||||
* \brief Libc plugin for accessing a file-system session
|
||||
* \author Norman Feske
|
||||
* \date 2012-04-11
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2012-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/env.h>
|
||||
#include <base/printf.h>
|
||||
#include <file_system_session/connection.h>
|
||||
#include <os/path.h>
|
||||
|
||||
/* libc includes */
|
||||
#include <errno.h>
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
/* libc plugin interface */
|
||||
#include <libc-plugin/plugin.h>
|
||||
#include <libc-plugin/fd_alloc.h>
|
||||
|
||||
/* libc-internal includes */
|
||||
#include <libc_mem_alloc.h>
|
||||
|
||||
static bool const verbose = false;
|
||||
|
||||
|
||||
namespace File_system { struct Packet_ref { }; }
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
enum { PATH_MAX_LEN = 256 };
|
||||
|
||||
typedef Genode::Path<PATH_MAX_LEN> Canonical_path;
|
||||
|
||||
|
||||
static File_system::Session *file_system()
|
||||
{
|
||||
static Genode::Allocator_avl tx_buffer_alloc(Genode::env()->heap());
|
||||
static File_system::Connection fs(tx_buffer_alloc);
|
||||
return &fs;
|
||||
}
|
||||
|
||||
|
||||
struct Node_handle_guard
|
||||
{
|
||||
File_system::Node_handle handle;
|
||||
|
||||
Node_handle_guard(File_system::Node_handle handle) : handle(handle) { }
|
||||
|
||||
~Node_handle_guard() { file_system()->close(handle); }
|
||||
};
|
||||
|
||||
|
||||
class Plugin_context : public Libc::Plugin_context,
|
||||
public File_system::Packet_ref
|
||||
{
|
||||
private:
|
||||
|
||||
enum Type { TYPE_FILE, TYPE_DIR, TYPE_SYMLINK };
|
||||
|
||||
Type _type;
|
||||
|
||||
File_system::Node_handle _node_handle;
|
||||
|
||||
int _fd_flags;
|
||||
int _status_flags;
|
||||
|
||||
/**
|
||||
* Current file position if manually seeked, or ~0 for append mode
|
||||
*/
|
||||
off_t _seek_offset;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Plugin_context(File_system::File_handle handle)
|
||||
: _type(TYPE_FILE), _node_handle(handle), _fd_flags(0),
|
||||
_status_flags(0), _seek_offset(~0) { }
|
||||
|
||||
Plugin_context(File_system::Dir_handle handle)
|
||||
: _type(TYPE_DIR), _node_handle(handle), _fd_flags(0),
|
||||
_status_flags(0), _seek_offset(0){ }
|
||||
|
||||
Plugin_context(File_system::Symlink_handle handle)
|
||||
: _type(TYPE_SYMLINK), _node_handle(handle), _fd_flags(0),
|
||||
_status_flags(0), _seek_offset(~0) { }
|
||||
|
||||
File_system::Node_handle node_handle() const { return _node_handle; }
|
||||
|
||||
/**
|
||||
* Set/get file descriptor flags
|
||||
*/
|
||||
void fd_flags(int flags) { _fd_flags = flags; }
|
||||
int fd_flags() { return _fd_flags; }
|
||||
|
||||
/**
|
||||
* Set/get file status status flags
|
||||
*/
|
||||
void status_flags(int flags) { _status_flags = flags; }
|
||||
int status_flags() { return _status_flags; }
|
||||
|
||||
/**
|
||||
* Return true of handle is append mode
|
||||
*/
|
||||
bool is_appending() const { return ~0 == _seek_offset; }
|
||||
|
||||
/**
|
||||
* Set seek offset, switch to non-append mode
|
||||
*/
|
||||
void seek_offset(size_t seek_offset) { _seek_offset = seek_offset; }
|
||||
|
||||
/**
|
||||
* Return seek offset if handle is in non-append mode
|
||||
*/
|
||||
off_t seek_offset() const { return _seek_offset; }
|
||||
|
||||
/**
|
||||
* Advance current seek position by 'incr' number of bytes
|
||||
*
|
||||
* This function has no effect if the handle is in append mode.
|
||||
*/
|
||||
void advance_seek_offset(size_t incr)
|
||||
{
|
||||
if (!is_appending())
|
||||
_seek_offset += incr;
|
||||
}
|
||||
|
||||
void infinite_seek_offset()
|
||||
{
|
||||
_seek_offset = ~0;
|
||||
}
|
||||
|
||||
virtual ~Plugin_context() { }
|
||||
};
|
||||
|
||||
|
||||
static inline Plugin_context *context(Libc::File_descriptor *fd)
|
||||
{
|
||||
return fd->context ? static_cast<Plugin_context *>(fd->context) : 0;
|
||||
}
|
||||
|
||||
static size_t const session_max_packet_size(File_system::Session::Tx::Source &source)
|
||||
{
|
||||
using Policy = File_system::Session::Tx_policy;
|
||||
|
||||
return source.bulk_buffer_size() - (sizeof(Policy::Ack_queue)
|
||||
+ sizeof(Policy::Submit_queue));
|
||||
}
|
||||
|
||||
|
||||
static void obtain_stat_for_node(File_system::Node_handle node_handle,
|
||||
struct stat *buf)
|
||||
{
|
||||
if (!buf)
|
||||
return;
|
||||
|
||||
File_system::Status status = file_system()->status(node_handle);
|
||||
|
||||
/*
|
||||
* Translate status information to 'struct stat' format
|
||||
*/
|
||||
memset(buf, 0, sizeof(struct stat));
|
||||
buf->st_size = status.size;
|
||||
|
||||
if (status.is_directory())
|
||||
buf->st_mode |= S_IFDIR;
|
||||
else if (status.is_symlink())
|
||||
buf->st_mode |= S_IFLNK;
|
||||
else
|
||||
buf->st_mode |= S_IFREG;
|
||||
|
||||
struct tm tm;
|
||||
memset(&tm, 0, sizeof(struct tm));
|
||||
|
||||
buf->st_mtime = mktime(&tm);
|
||||
|
||||
if (buf->st_mtime == -1 && verbose)
|
||||
PERR("mktime() returned -1, the file modification time reported by stat() will be incorrect");
|
||||
}
|
||||
|
||||
|
||||
class Plugin : public Libc::Plugin
|
||||
{
|
||||
private:
|
||||
|
||||
Genode::Lock _rw_lock;
|
||||
|
||||
::off_t _file_size(Libc::File_descriptor *fd)
|
||||
{
|
||||
struct stat stat_buf;
|
||||
if (fstat(fd, &stat_buf) == -1)
|
||||
return -1;
|
||||
return stat_buf.st_size;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* Use priority 1 to override libc_vfs.
|
||||
*/
|
||||
Plugin() : Libc::Plugin(1) { }
|
||||
|
||||
~Plugin() { }
|
||||
|
||||
bool supports_mkdir(const char *path, mode_t)
|
||||
{
|
||||
if (verbose)
|
||||
PDBG("path = %s", path);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool supports_open(const char *pathname, int flags)
|
||||
{
|
||||
if (verbose)
|
||||
PDBG("pathname = %s", pathname);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool supports_readlink(const char *path, char *, size_t)
|
||||
{
|
||||
if (verbose)
|
||||
PDBG("path = %s", path);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool supports_rename(const char *oldpath, const char *newpath)
|
||||
{
|
||||
if (verbose)
|
||||
PDBG("oldpath = %s, newpath = %s", oldpath, newpath);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool supports_stat(const char *path)
|
||||
{
|
||||
if (verbose)
|
||||
PDBG("path = %s", path);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool supports_symlink(const char *oldpath, const char *newpath)
|
||||
{
|
||||
if (verbose)
|
||||
PDBG("oldpath = %s, newpath = %s", oldpath, newpath);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool supports_unlink(const char *path)
|
||||
{
|
||||
if (verbose)
|
||||
PDBG("path = %s", path);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool supports_mmap() { return true; }
|
||||
|
||||
int close(Libc::File_descriptor *fd)
|
||||
{
|
||||
file_system()->close(context(fd)->node_handle());
|
||||
|
||||
Genode::destroy(Genode::env()->heap(), context(fd));
|
||||
Libc::file_descriptor_allocator()->free(fd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fcntl(Libc::File_descriptor *fd, int cmd, long arg)
|
||||
{
|
||||
switch (cmd) {
|
||||
case F_GETFD: return context(fd)->fd_flags();
|
||||
case F_SETFD: context(fd)->fd_flags(arg); return 0;
|
||||
case F_GETFL: return context(fd)->status_flags();
|
||||
default: PERR("fcntl(): command %d not supported", cmd); return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int fstat(Libc::File_descriptor *fd, struct stat *buf)
|
||||
{
|
||||
try {
|
||||
obtain_stat_for_node(context(fd)->node_handle(), buf);
|
||||
return 0;
|
||||
}
|
||||
catch (...) {
|
||||
struct Unhandled_exception_in_fstat { };
|
||||
throw Unhandled_exception_in_fstat();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int fstatfs(Libc::File_descriptor *, struct statfs *buf)
|
||||
{
|
||||
/* libc's opendir() fails if _fstatfs() returns -1, so we return 0 here */
|
||||
if (verbose)
|
||||
PDBG("_fstatfs() called - not yet implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fsync(Libc::File_descriptor *fd)
|
||||
{
|
||||
if (verbose)
|
||||
PDBG("not implemented");
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ftruncate(Libc::File_descriptor *fd, ::off_t length)
|
||||
{
|
||||
File_system::Node_handle node_handle = context(fd)->node_handle();
|
||||
File_system::File_handle &file_handle =
|
||||
static_cast<File_system::File_handle&>(node_handle);
|
||||
|
||||
try {
|
||||
file_system()->truncate(file_handle, length);
|
||||
} catch (File_system::Invalid_handle) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
} catch (File_system::Permission_denied) {
|
||||
errno = EPERM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* *basep does not get initialized by the libc and is therefore
|
||||
* useless for determining a specific directory index. This
|
||||
* function uses the plugin-internal seek offset instead.
|
||||
*/
|
||||
ssize_t getdirentries(Libc::File_descriptor *fd, char *buf,
|
||||
::size_t nbytes, ::off_t *basep)
|
||||
{
|
||||
using namespace File_system;
|
||||
|
||||
if (nbytes < sizeof(struct dirent)) {
|
||||
PERR("buf too small");
|
||||
return -1;
|
||||
}
|
||||
|
||||
Directory_entry entry;
|
||||
size_t num_bytes = read(fd, &entry, sizeof(entry));
|
||||
|
||||
/* detect end of directory entries */
|
||||
if (num_bytes == 0)
|
||||
return 0;
|
||||
|
||||
if (num_bytes != sizeof(entry)) {
|
||||
PERR("getdirentries retrieved unexpected directory entry size");
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct dirent *dirent = (struct dirent *)buf;
|
||||
Genode::memset(dirent, 0, sizeof(struct dirent));
|
||||
|
||||
switch (entry.type) {
|
||||
case Directory_entry::TYPE_DIRECTORY: dirent->d_type = DT_DIR; break;
|
||||
case Directory_entry::TYPE_FILE: dirent->d_type = DT_REG; break;
|
||||
case Directory_entry::TYPE_SYMLINK: dirent->d_type = DT_LNK; break;
|
||||
}
|
||||
|
||||
dirent->d_fileno = 1 + (context(fd)->seek_offset() / sizeof(struct dirent));
|
||||
dirent->d_reclen = sizeof(struct dirent);
|
||||
|
||||
Genode::strncpy(dirent->d_name, entry.name, sizeof(dirent->d_name));
|
||||
|
||||
dirent->d_namlen = Genode::strlen(dirent->d_name);
|
||||
|
||||
*basep += sizeof(struct dirent);
|
||||
return sizeof(struct dirent);
|
||||
}
|
||||
|
||||
::off_t lseek(Libc::File_descriptor *fd, ::off_t offset, int whence)
|
||||
{
|
||||
switch (whence) {
|
||||
|
||||
case SEEK_SET:
|
||||
context(fd)->seek_offset(offset);
|
||||
return offset;
|
||||
|
||||
case SEEK_CUR:
|
||||
context(fd)->advance_seek_offset(offset);
|
||||
if (context(fd)->is_appending())
|
||||
return _file_size(fd);
|
||||
return context(fd)->seek_offset();
|
||||
|
||||
case SEEK_END:
|
||||
if (offset != 0) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
context(fd)->infinite_seek_offset();
|
||||
return _file_size(fd);
|
||||
|
||||
default:
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int mkdir(const char *path, mode_t mode)
|
||||
{
|
||||
Canonical_path canonical_path(path);
|
||||
|
||||
try {
|
||||
File_system::Dir_handle const handle =
|
||||
file_system()->dir(canonical_path.base(), true);
|
||||
file_system()->close(handle);
|
||||
return 0;
|
||||
}
|
||||
catch (File_system::Permission_denied) { errno = EPERM; }
|
||||
catch (File_system::Node_already_exists) { errno = EEXIST; }
|
||||
catch (File_system::Lookup_failed) { errno = ENOENT; }
|
||||
catch (File_system::Name_too_long) { errno = ENAMETOOLONG; }
|
||||
catch (File_system::No_space) { errno = ENOSPC; }
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
Libc::File_descriptor *open(const char *pathname, int flags)
|
||||
{
|
||||
Canonical_path path(pathname);
|
||||
|
||||
File_system::Mode mode;
|
||||
switch (flags & O_ACCMODE) {
|
||||
case O_RDONLY: mode = File_system::READ_ONLY; break;
|
||||
case O_WRONLY: mode = File_system::WRITE_ONLY; break;
|
||||
case O_RDWR: mode = File_system::READ_WRITE; break;
|
||||
default: mode = File_system::STAT_ONLY; break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Probe for an existing directory to open
|
||||
*/
|
||||
try {
|
||||
if (verbose)
|
||||
PDBG("open dir '%s'", path.base());
|
||||
File_system::Dir_handle const handle =
|
||||
file_system()->dir(path.base(), false);
|
||||
|
||||
Plugin_context *context = new (Genode::env()->heap())
|
||||
Plugin_context(handle);
|
||||
|
||||
return Libc::file_descriptor_allocator()->alloc(this, context);
|
||||
} catch (File_system::Lookup_failed) { }
|
||||
|
||||
/*
|
||||
* Determine directory path that contains the node to open
|
||||
*/
|
||||
Canonical_path dir_path(pathname);
|
||||
dir_path.strip_last_element();
|
||||
|
||||
Canonical_path basename(pathname);
|
||||
basename.keep_only_last_element();
|
||||
|
||||
try {
|
||||
/*
|
||||
* Open directory that contains the file to be opened/created
|
||||
*/
|
||||
File_system::Dir_handle const dir_handle =
|
||||
file_system()->dir(dir_path.base(), false);
|
||||
|
||||
Node_handle_guard guard(dir_handle);
|
||||
|
||||
File_system::File_handle handle;
|
||||
|
||||
/*
|
||||
* Open or create file
|
||||
*/
|
||||
bool const create = (flags & O_CREAT) != 0;
|
||||
|
||||
bool opened = false;
|
||||
while (!opened) {
|
||||
try {
|
||||
handle = file_system()->file(dir_handle, basename.base() + 1, mode, create);
|
||||
opened = true;
|
||||
} catch (File_system::Node_already_exists) {
|
||||
if (flags & O_EXCL) {
|
||||
errno = EEXIST;
|
||||
return 0;
|
||||
}
|
||||
/* try to open the existing file */
|
||||
try {
|
||||
handle = file_system()->file(dir_handle, basename.base() + 1, mode, false);
|
||||
opened = true;
|
||||
} catch (File_system::Lookup_failed) {
|
||||
/* the file got deleted in the meantime */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Plugin_context *context = new (Genode::env()->heap())
|
||||
Plugin_context(handle);
|
||||
|
||||
/*
|
||||
* Prevent returning the file size as current seek offset
|
||||
* for files that are opened read only because this
|
||||
* behaviour is only useful for appending write operations
|
||||
* to files.
|
||||
*
|
||||
* XXX Improve handling of files opened in append mode.
|
||||
*/
|
||||
if ((flags & O_ACCMODE) == O_RDONLY)
|
||||
context->seek_offset(0);
|
||||
|
||||
context->status_flags(flags);
|
||||
|
||||
Libc::File_descriptor *fd = Libc::file_descriptor_allocator()->alloc(this, context);
|
||||
if ((flags & O_TRUNC) && (ftruncate(fd, 0) == -1)) {
|
||||
Libc::file_descriptor_allocator()->free(fd);
|
||||
destroy(Genode::env()->heap(), context);
|
||||
return 0;
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
catch (File_system::Lookup_failed) {
|
||||
PERR("open(%s) lookup failed", pathname); }
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rename(const char *oldpath, const char *newpath)
|
||||
{
|
||||
if (verbose)
|
||||
PDBG("not implemented");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ssize_t read(Libc::File_descriptor *fd, void *buf, ::size_t count)
|
||||
{
|
||||
Genode::Lock::Guard guard(_rw_lock);
|
||||
|
||||
File_system::Session::Tx::Source &source = *file_system()->tx();
|
||||
|
||||
size_t const max_packet_size = session_max_packet_size(source);
|
||||
|
||||
size_t remaining_count = count;
|
||||
|
||||
if (context(fd)->seek_offset() == ~0)
|
||||
context(fd)->seek_offset(0);
|
||||
|
||||
while (remaining_count) {
|
||||
|
||||
size_t curr_packet_size = Genode::min(remaining_count, max_packet_size);
|
||||
File_system::Packet_descriptor packet(
|
||||
source.alloc_packet(curr_packet_size),
|
||||
static_cast<File_system::Packet_ref *>(context(fd)),
|
||||
context(fd)->node_handle(),
|
||||
File_system::Packet_descriptor::READ,
|
||||
curr_packet_size,
|
||||
context(fd)->seek_offset());
|
||||
|
||||
|
||||
/* pass packet to server side */
|
||||
source.submit_packet(packet);
|
||||
packet = source.get_acked_packet();
|
||||
|
||||
/*
|
||||
* XXX check if acked packet belongs to request,
|
||||
* needed for thread safety
|
||||
*/
|
||||
|
||||
size_t read_num_bytes = Genode::min(packet.length(), curr_packet_size);
|
||||
|
||||
/* copy-out payload into destination buffer */
|
||||
memcpy(buf, source.packet_content(packet), read_num_bytes);
|
||||
|
||||
source.release_packet(packet);
|
||||
|
||||
/* prepare next iteration */
|
||||
context(fd)->advance_seek_offset(read_num_bytes);
|
||||
buf = (void *)((Genode::addr_t)buf + read_num_bytes);
|
||||
remaining_count -= read_num_bytes;
|
||||
|
||||
/*
|
||||
* If we received less bytes than requested, we reached the end
|
||||
* of the file.
|
||||
*/
|
||||
if (read_num_bytes < curr_packet_size)
|
||||
break;
|
||||
}
|
||||
return count - remaining_count;
|
||||
}
|
||||
|
||||
ssize_t readlink(const char *path, char *buf, size_t bufsiz)
|
||||
{
|
||||
if (verbose)
|
||||
PDBG("path = %s, bufsiz = %zu", path, bufsiz);
|
||||
|
||||
Canonical_path abs_path(path);
|
||||
abs_path.strip_last_element();
|
||||
|
||||
Canonical_path symlink_name(path);
|
||||
symlink_name.keep_only_last_element();
|
||||
|
||||
try {
|
||||
::File_system::Dir_handle dir_handle = file_system()->dir(abs_path.base(), false);
|
||||
|
||||
::File_system::Symlink_handle symlink_handle =
|
||||
file_system()->symlink(dir_handle, symlink_name.base() + 1, false);
|
||||
|
||||
if (symlink_handle.value == -1) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
Plugin_context *context = new (Genode::env()->heap())
|
||||
Plugin_context(symlink_handle);
|
||||
|
||||
Libc::File_descriptor *fd = Libc::file_descriptor_allocator()->alloc(this, context);
|
||||
|
||||
ssize_t result = read(fd, buf, bufsiz);
|
||||
if (verbose)
|
||||
PDBG("result = %zd, buf = %s", result, buf[result] ?
|
||||
"<not zero terminated>" : buf);
|
||||
close(fd);
|
||||
|
||||
return result;
|
||||
} catch (...) { }
|
||||
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int stat(const char *pathname, struct stat *buf)
|
||||
{
|
||||
if (verbose)
|
||||
PDBG("stat %s", pathname);
|
||||
|
||||
Canonical_path path(pathname);
|
||||
|
||||
try {
|
||||
File_system::Node_handle const node_handle =
|
||||
file_system()->node(path.base());
|
||||
Node_handle_guard guard(node_handle);
|
||||
|
||||
obtain_stat_for_node(node_handle, buf);
|
||||
return 0;
|
||||
}
|
||||
catch (File_system::Lookup_failed) {
|
||||
PERR("stat(%s): lookup failed", pathname);
|
||||
errno = ENOENT;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int symlink(const char *oldpath, const char *newpath)
|
||||
{
|
||||
Canonical_path abs_path(newpath);
|
||||
abs_path.strip_last_element();
|
||||
|
||||
Canonical_path symlink_name(newpath);
|
||||
symlink_name.keep_only_last_element();
|
||||
|
||||
try {
|
||||
/*
|
||||
* Open directory that contains the file to be opened/created
|
||||
*/
|
||||
File_system::Dir_handle const dir_handle =
|
||||
file_system()->dir(abs_path.base(), false);
|
||||
|
||||
Node_handle_guard guard(dir_handle);
|
||||
|
||||
File_system::Symlink_handle symlink_handle =
|
||||
file_system()->symlink(dir_handle, symlink_name.base() + 1, true);
|
||||
|
||||
if (symlink_handle.value == -1) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
Plugin_context *context = new (Genode::env()->heap())
|
||||
Plugin_context(symlink_handle);
|
||||
|
||||
Libc::File_descriptor *fd =
|
||||
Libc::file_descriptor_allocator()->alloc(this, context);
|
||||
|
||||
ssize_t res = write(fd, oldpath, strlen(oldpath) + 1);
|
||||
|
||||
Libc::file_descriptor_allocator()->free(fd);
|
||||
destroy(Genode::env()->heap(), context);
|
||||
|
||||
if (res == -1) {
|
||||
errno = EIO;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch (File_system::Lookup_failed) {
|
||||
PERR("symlink(%s) lookup failed", newpath); }
|
||||
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int unlink(const char *path)
|
||||
{
|
||||
Canonical_path dir_path(path);
|
||||
dir_path.strip_last_element();
|
||||
|
||||
Canonical_path basename(path);
|
||||
basename.keep_only_last_element();
|
||||
|
||||
try {
|
||||
/*
|
||||
* Open directory that contains the file to be opened/created
|
||||
*/
|
||||
File_system::Dir_handle const dir_handle =
|
||||
file_system()->dir(dir_path.base(), false);
|
||||
|
||||
Node_handle_guard guard(dir_handle);
|
||||
|
||||
file_system()->unlink(dir_handle, basename.base() + 1);
|
||||
} catch (...) {
|
||||
PERR("unlink(%s) failed", path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
ssize_t write(Libc::File_descriptor *fd, const void *buf, ::size_t count)
|
||||
{
|
||||
Genode::Lock::Guard guard(_rw_lock);
|
||||
|
||||
File_system::Session::Tx::Source &source = *file_system()->tx();
|
||||
|
||||
size_t const max_packet_size = session_max_packet_size(source);
|
||||
|
||||
size_t remaining_count = count;
|
||||
|
||||
while (remaining_count) {
|
||||
|
||||
|
||||
size_t curr_packet_size = Genode::min(remaining_count, max_packet_size);
|
||||
|
||||
File_system::Packet_descriptor
|
||||
packet(source.alloc_packet(curr_packet_size),
|
||||
static_cast<File_system::Packet_ref *>(context(fd)),
|
||||
context(fd)->node_handle(),
|
||||
File_system::Packet_descriptor::WRITE,
|
||||
curr_packet_size,
|
||||
context(fd)->seek_offset());
|
||||
|
||||
/* copy-in payload into packet */
|
||||
memcpy(source.packet_content(packet), buf, curr_packet_size);
|
||||
|
||||
/* pass packet to server side */
|
||||
source.submit_packet(packet);
|
||||
packet = source.get_acked_packet();
|
||||
|
||||
/* prepare next iteration */
|
||||
context(fd)->advance_seek_offset(curr_packet_size);
|
||||
buf = (void *)((Genode::addr_t)buf + curr_packet_size);
|
||||
remaining_count -= curr_packet_size;
|
||||
|
||||
source.release_packet(packet);
|
||||
|
||||
}
|
||||
if (verbose)
|
||||
PDBG("write returns %zd", count);
|
||||
return count;
|
||||
}
|
||||
|
||||
void *mmap(void *addr_in, ::size_t length, int prot, int flags,
|
||||
Libc::File_descriptor *fd, ::off_t offset)
|
||||
{
|
||||
if (prot != PROT_READ) {
|
||||
PERR("mmap for prot=%x not supported", prot);
|
||||
errno = EACCES;
|
||||
return (void *)-1;
|
||||
}
|
||||
|
||||
if (addr_in != 0) {
|
||||
PERR("mmap for predefined address not supported");
|
||||
errno = EINVAL;
|
||||
return (void *)-1;
|
||||
}
|
||||
|
||||
void *addr = Libc::mem_alloc()->alloc(length, PAGE_SHIFT);
|
||||
if (addr == (void *)-1) {
|
||||
errno = ENOMEM;
|
||||
return (void *)-1;
|
||||
}
|
||||
|
||||
if (::pread(fd->libc_fd, addr, length, offset) < 0) {
|
||||
PERR("mmap could not obtain file content");
|
||||
::munmap(addr, length);
|
||||
errno = EACCES;
|
||||
return (void *)-1;
|
||||
}
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
int munmap(void *addr, ::size_t)
|
||||
{
|
||||
Libc::mem_alloc()->free(addr);
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} /* unnamed namespace */
|
||||
|
||||
|
||||
void __attribute__((constructor)) init_libc_fs(void)
|
||||
{
|
||||
PDBG("using the libc_fs plugin");
|
||||
static Plugin plugin;
|
||||
}
|
|
@ -55,9 +55,9 @@ static inline int check_result(int res)
|
|||
}
|
||||
|
||||
|
||||
/***************************
|
||||
/****************************
|
||||
** override libc defaults **
|
||||
***************************/
|
||||
****************************/
|
||||
|
||||
/*
|
||||
extern "C" int access(const char *pathname, int mode)
|
||||
|
@ -122,12 +122,14 @@ namespace {
|
|||
{
|
||||
private:
|
||||
|
||||
enum { PLUGIN_PRIORITY = 1 };
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Plugin()
|
||||
Plugin() : Libc::Plugin(PLUGIN_PRIORITY)
|
||||
{
|
||||
if (!Fuse::init_fs()) {
|
||||
PERR("FUSE fs initialization failed");
|
||||
|
@ -172,6 +174,14 @@ namespace {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool supports_rmdir(const char *path)
|
||||
{
|
||||
PDBGV("path: %s", path);
|
||||
if (Fuse::fuse() == 0)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool supports_stat(const char *path)
|
||||
{
|
||||
PDBGV("path: %s", path);
|
||||
|
@ -498,6 +508,14 @@ namespace {
|
|||
return check_result(res);
|
||||
}
|
||||
|
||||
int rmdir(const char *path)
|
||||
{
|
||||
PDBGV("path: %s", path);
|
||||
int res = Fuse::fuse()->op.rmdir(path);
|
||||
|
||||
return check_result(res);
|
||||
}
|
||||
|
||||
int stat(const char *path, struct stat *buf)
|
||||
{
|
||||
PDBGV("path: %s", path);
|
||||
|
@ -545,8 +563,17 @@ namespace {
|
|||
|
||||
} /* unnamed namespace */
|
||||
|
||||
|
||||
void __attribute__((constructor)) init_libc_fuse(void)
|
||||
{
|
||||
/*
|
||||
* During the initialization of the plugin, we already require the VFS.
|
||||
* Hence, we need to make sure to initialize the VFS before doing our
|
||||
* own initialization.
|
||||
*/
|
||||
extern void init_libc_vfs(void);
|
||||
init_libc_vfs();
|
||||
|
||||
PDBGV("using the libc_fuse plugin");
|
||||
static Plugin plugin;
|
||||
}
|
||||
|
|
|
@ -1,129 +0,0 @@
|
|||
/*
|
||||
* \brief Libc plugin that uses Genode's LOG service as stdout
|
||||
* \author Norman Feske
|
||||
* \date 2011-02-15
|
||||
*
|
||||
* The plugin allocates the file descriptors 1 and 2 and forwards write
|
||||
* operations referring to those descriptors to Genode's LOG service.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* libc plugin interface */
|
||||
#include <libc-plugin/plugin.h>
|
||||
#include <libc-plugin/fd_alloc.h>
|
||||
|
||||
/* libc includes */
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
|
||||
/* interface to 'log_console' */
|
||||
extern "C" int stdout_write(const char *);
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
struct Plugin_context : Libc::Plugin_context { };
|
||||
|
||||
|
||||
class Plugin : public Libc::Plugin
|
||||
{
|
||||
private:
|
||||
|
||||
Plugin_context _context;
|
||||
|
||||
Libc::File_descriptor *_stdout;
|
||||
Libc::File_descriptor *_stderr;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Plugin() :
|
||||
_stdout(Libc::file_descriptor_allocator()->alloc(this, &_context, 1)),
|
||||
_stderr(Libc::file_descriptor_allocator()->alloc(this, &_context, 2))
|
||||
{ }
|
||||
|
||||
int fcntl(Libc::File_descriptor *fd, int cmd, long arg)
|
||||
{
|
||||
switch (cmd) {
|
||||
case F_GETFL: return O_WRONLY;
|
||||
default: PERR("fcntl(): command %d not supported", cmd); return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We provide fstat here because printf inqueries _fstat about stdout
|
||||
*/
|
||||
int fstat(Libc::File_descriptor *, struct stat *buf)
|
||||
{
|
||||
/*
|
||||
* The following values were obtained with small test program that
|
||||
* calls fstat for stdout on linux.
|
||||
*/
|
||||
buf->st_dev = 11;
|
||||
buf->st_ino = 4;
|
||||
buf->st_mode = 8592;
|
||||
buf->st_nlink = 1;
|
||||
buf->st_uid = 0;
|
||||
buf->st_gid = 0;
|
||||
buf->st_rdev = 34818;
|
||||
buf->st_size = 0;
|
||||
buf->st_blksize = 1024;
|
||||
buf->st_blocks = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
ssize_t write(Libc::File_descriptor *fd, const void *buf, ::size_t count)
|
||||
{
|
||||
if (fd != _stdout && fd != _stderr) {
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
||||
char *src = (char *)buf;
|
||||
|
||||
/* count does not include the trailing '\0' */
|
||||
int orig_count = count;
|
||||
while (count > 0) {
|
||||
char tmp[128];
|
||||
int curr_count= count > sizeof(tmp) - 1 ? sizeof(tmp) - 1 : count;
|
||||
strncpy(tmp, src, curr_count);
|
||||
tmp[curr_count > 0 ? curr_count : 0] = 0;
|
||||
stdout_write(tmp);
|
||||
count -= curr_count;
|
||||
src += curr_count;
|
||||
}
|
||||
return orig_count;
|
||||
}
|
||||
|
||||
int ioctl(Libc::File_descriptor *, int request, char *)
|
||||
{
|
||||
/*
|
||||
* Some programs or libraries use to perform 'TIOCGETA'
|
||||
* operations on stdout, in particular the termios module of
|
||||
* Python. Those programs may break if 'tcgetattr' return with
|
||||
* an error. We pretend to be more successful than we really
|
||||
* are to make them happy.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} /* unnamed namespace */
|
||||
|
||||
|
||||
void __attribute__((constructor)) init_libc_log(void)
|
||||
{
|
||||
static Plugin plugin;
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
The 'libc_rom' plugin allows the use of Genode's ROM-session interface via file
|
||||
operations of the C library.
|
||||
|
||||
This implementation is very preliminary. It supports no file operations other
|
||||
than open and read.
|
|
@ -1,186 +0,0 @@
|
|||
/*
|
||||
* \brief Libc plugin that uses Genode's ROM session
|
||||
* \author Norman Feske
|
||||
* \date 2012-01-09
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <os/attached_rom_dataspace.h>
|
||||
#include <util/misc_math.h>
|
||||
#include <base/printf.h>
|
||||
#include <base/env.h>
|
||||
|
||||
/* libc plugin interface */
|
||||
#include <libc-plugin/plugin.h>
|
||||
#include <libc-plugin/fd_alloc.h>
|
||||
|
||||
/* libc includes */
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
namespace {
|
||||
|
||||
/**
|
||||
* An open file descriptor for this plugin corresponds to a ROM connection
|
||||
*
|
||||
* The connection is created along with the context.
|
||||
*/
|
||||
struct Plugin_context : Libc::Plugin_context, Genode::Attached_rom_dataspace
|
||||
{
|
||||
Genode::off_t read_offset;
|
||||
|
||||
Plugin_context(char const *filename)
|
||||
: Genode::Attached_rom_dataspace(filename), read_offset(0) { }
|
||||
};
|
||||
|
||||
|
||||
static inline Plugin_context *context(Libc::File_descriptor *fd)
|
||||
{
|
||||
return static_cast<Plugin_context *>(fd->context);
|
||||
}
|
||||
|
||||
|
||||
class Plugin : public Libc::Plugin
|
||||
{
|
||||
private:
|
||||
|
||||
bool _probe_rom(char const *filename)
|
||||
{
|
||||
try {
|
||||
/*
|
||||
* Create ROM connection as local variable. The connection
|
||||
* gets closed automatically when leaving the scope of this
|
||||
* function.
|
||||
*/
|
||||
Genode::Rom_connection rom(filename);
|
||||
return true;
|
||||
} catch (...) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Plugin()
|
||||
{ }
|
||||
|
||||
bool supports_open(const char *path, int flags)
|
||||
{
|
||||
return _probe_rom(&path[1]);
|
||||
}
|
||||
|
||||
bool supports_stat(const char *path)
|
||||
{
|
||||
return _probe_rom(&path[1]);
|
||||
}
|
||||
|
||||
Libc::File_descriptor *open(const char *pathname, int flags)
|
||||
{
|
||||
Plugin_context *context = new (Genode::env()->heap())
|
||||
Plugin_context(&pathname[1]);
|
||||
return Libc::file_descriptor_allocator()->alloc(this, context);
|
||||
}
|
||||
|
||||
int close(Libc::File_descriptor *fd)
|
||||
{
|
||||
Genode::destroy(Genode::env()->heap(), context(fd));
|
||||
Libc::file_descriptor_allocator()->free(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int stat(const char *path, struct stat *buf)
|
||||
{
|
||||
Genode::Rom_connection rom(&path[1]);
|
||||
|
||||
memset(buf, 0, sizeof(struct stat));
|
||||
buf->st_mode = S_IFREG;
|
||||
buf->st_size = Genode::Dataspace_client(rom.dataspace()).size();
|
||||
return 0;
|
||||
}
|
||||
|
||||
ssize_t read(Libc::File_descriptor *fd, void *buf, ::size_t count)
|
||||
{
|
||||
Plugin_context *rom = context(fd);
|
||||
|
||||
/* file read limit is the size of data space */
|
||||
Genode::size_t const max_size = rom->size();
|
||||
|
||||
/* shortcut to current read offset */
|
||||
Genode::off_t &read_offset = rom->read_offset;
|
||||
|
||||
/* maximum read offset, clamped to dataspace size */
|
||||
Genode::off_t const end_offset = Genode::min(count + read_offset, max_size);
|
||||
|
||||
/* source address within the dataspace */
|
||||
char const *src = rom->local_addr<char>() + read_offset;
|
||||
|
||||
/* check if end of file is reached */
|
||||
if (read_offset >= end_offset)
|
||||
return 0;
|
||||
|
||||
/* copy-out bytes from ROM dataspace */
|
||||
Genode::off_t num_bytes = end_offset - read_offset;
|
||||
memcpy(buf, src, num_bytes);
|
||||
|
||||
/* advance read offset */
|
||||
read_offset += num_bytes;
|
||||
|
||||
return num_bytes;
|
||||
}
|
||||
|
||||
::off_t lseek(Libc::File_descriptor *fd, ::off_t offset, int whence)
|
||||
{
|
||||
Plugin_context *rom = context(fd);
|
||||
|
||||
switch (whence) {
|
||||
|
||||
case SEEK_CUR:
|
||||
|
||||
offset += rom->read_offset;
|
||||
|
||||
/*
|
||||
* falling through...
|
||||
*/
|
||||
|
||||
case SEEK_SET:
|
||||
|
||||
if (offset > (::off_t)rom->size()) {
|
||||
errno = EINVAL;
|
||||
return (::off_t)(-1);
|
||||
}
|
||||
|
||||
rom->read_offset = offset;
|
||||
break;
|
||||
|
||||
case SEEK_END:
|
||||
|
||||
rom->read_offset = rom->size();
|
||||
break;
|
||||
|
||||
default:
|
||||
errno = EINVAL;
|
||||
return (::off_t)(-1);
|
||||
}
|
||||
|
||||
return rom->read_offset;
|
||||
}
|
||||
};
|
||||
|
||||
} /* unnamed namespace */
|
||||
|
||||
|
||||
void __attribute__((constructor)) init_libc_rom(void)
|
||||
{
|
||||
static Plugin plugin;
|
||||
}
|
|
@ -534,9 +534,9 @@ ssize_t Libc::Vfs_plugin::getdirentries(Libc::File_descriptor *fd, char *buf,
|
|||
case Vfs::Directory_service::DIRENT_TYPE_FILE: dirent->d_type = DT_REG; break;
|
||||
case Vfs::Directory_service::DIRENT_TYPE_SYMLINK: dirent->d_type = DT_LNK; break;
|
||||
case Vfs::Directory_service::DIRENT_TYPE_FIFO: dirent->d_type = DT_FIFO; break;
|
||||
case Vfs::Directory_service::DIRENT_TYPE_CHARDEV: dirent->d_type = DT_CHR; break;
|
||||
case Vfs::Directory_service::DIRENT_TYPE_BLOCKDEV: dirent->d_type = DT_BLK; break;
|
||||
case Vfs::Directory_service::DIRENT_TYPE_END: return 0;
|
||||
case Vfs::Directory_service::DIRENT_TYPE_CHARDEV: dirent->d_type = DT_CHR; break;
|
||||
case Vfs::Directory_service::DIRENT_TYPE_BLOCKDEV: dirent->d_type = DT_BLK; break;
|
||||
case Vfs::Directory_service::DIRENT_TYPE_END: return 0;
|
||||
}
|
||||
|
||||
dirent->d_fileno = dirent_out.fileno;
|
||||
|
|
|
@ -117,12 +117,19 @@ namespace {
|
|||
Gpu_driver *_driver;
|
||||
Gpu_driver::Client *_client;
|
||||
|
||||
/*
|
||||
* Assign a priority of 1 to override libc_vfs.
|
||||
*/
|
||||
enum { PLUGIN_PRIORITY = 1 };
|
||||
|
||||
public:
|
||||
|
||||
Plugin(Gpu_driver *driver) : _driver(driver), _client(0)
|
||||
Plugin(Gpu_driver *driver)
|
||||
:
|
||||
Libc::Plugin(PLUGIN_PRIORITY), _driver(driver), _client(0)
|
||||
{
|
||||
if (!_driver) {
|
||||
PERR("could not initalize GPU driver");
|
||||
PERR("could not initialize GPU driver");
|
||||
return;
|
||||
}
|
||||
_client = _driver->create_client();
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TARGET = fs_log
|
||||
SRC_CC = main.cc
|
||||
LIBS = base libc_fs libc
|
||||
LIBS = base libc_vfs libc
|
||||
|
|
|
@ -7,7 +7,7 @@ SRC_C = $(notdir $(EXFAT_DIR)/fuse/main.c)
|
|||
SRC_CC = fuse_fs_main.cc \
|
||||
init.cc
|
||||
|
||||
LIBS = base config server libc libc_log libc_block libfuse libexfat
|
||||
LIBS = base config server libc libc_vfs libfuse libexfat
|
||||
INC_DIR += $(PRG_DIR)/..
|
||||
|
||||
CC_OPT += -Wno-unused-function
|
||||
|
|
|
@ -10,7 +10,7 @@ SRC_C = $(filter-out $(FILTER_OUT), $(notdir $(wildcard $(FUSE_EXT2_DIR)/*.c)))
|
|||
SRC_CC = fuse_fs_main.cc \
|
||||
init.cc
|
||||
|
||||
LIBS = base config server libc libc_log libc_block libfuse libext2fs
|
||||
LIBS = base config server libc libc_vfs libfuse libext2fs
|
||||
|
||||
CC_OPT += -DHAVE_CONFIG_H -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ SRC_C = ntfs-3g.c ntfs-3g_common.c
|
|||
SRC_CC = fuse_fs_main.cc \
|
||||
init.cc
|
||||
|
||||
LIBS = base config server libc libc_log libc_block libfuse libntfs-3g
|
||||
LIBS = base config server libc libc_vfs libfuse libntfs-3g
|
||||
|
||||
CC_OPT = -DHAVE_TIMESPEC -DHAVE_CONFIG_H -DRECORD_LOCKING_NOT_IMPLEMENTED
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TARGET = test-expat
|
||||
SRC_CC = main.cc
|
||||
LIBS = expat libc libc_log libc_rom
|
||||
LIBS = expat libc libc_vfs
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TARGET = test-libc
|
||||
SRC_CC = main.cc
|
||||
LIBS = libm libc libc_log
|
||||
LIBS = libm libc libc_vfs
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TARGET = test-libc_block
|
||||
LIBS = libc libc_log libc_block
|
||||
LIBS = libc libc_vfs
|
||||
SRC_CC = main.cc
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TARGET = test-libc_ffat
|
||||
LIBS = libc libc_log libc_ffat
|
||||
LIBS = libc libc_vfs libc_ffat
|
||||
SRC_CC = main.cc
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
TARGET = test-libc_fs
|
||||
LIBS = libc libc_log libc_fs
|
||||
SRC_CC = main.cc
|
||||
|
||||
# we re-use the libc_ffat test
|
||||
vpath main.cc $(REP_DIR)/src/test/libc_ffat
|
|
@ -1,3 +1,3 @@
|
|||
TARGET = test-libc_fs_tar_fs
|
||||
LIBS = libc libc_log libc_fs
|
||||
LIBS = libc libc_vfs
|
||||
SRC_CC = main.cc
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
TARGET = test-libc_fuse_exfat
|
||||
LIBS = libc libc_log libc_fuse_exfat
|
||||
LIBS = libc libc_vfs libc_fuse_exfat
|
||||
SRC_CC = main.cc
|
||||
|
||||
vpath %.cc $(PRG_DIR)/../libc_ffat/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
TARGET = test-libc_fuse_ext2
|
||||
LIBS = libc libc_log libc_fuse_ext2
|
||||
LIBS = libc libc_vfs libc_fuse_ext2
|
||||
SRC_CC = main.cc
|
||||
|
||||
vpath %.cc $(PRG_DIR)/../libc_ffat
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
TARGET = test-libc_fuse_ntfs-3g
|
||||
LIBS = libc libc_log libc_fuse_ntfs-3g
|
||||
LIBS = libc libc_vfs libc_fuse_ntfs-3g
|
||||
SRC_CC = main.cc
|
||||
|
||||
vpath %.cc $(PRG_DIR)/../libc_ffat
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
TARGET = test-libc_vfs
|
||||
LIBS = libc libc_log libc_vfs
|
||||
LIBS = libc libc_vfs
|
||||
SRC_CC = main.cc
|
||||
|
||||
# we re-use the libc_ffat test
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
TARGET = test-http_clnt
|
||||
LIBS = lwip libc libc_log
|
||||
LIBS = lwip libc libc_vfs
|
||||
SRC_CC = main.cc
|
||||
REQUIRES = foc
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
TARGET = test-lwip_httpsrv
|
||||
LIBS = lwip libc libc_log
|
||||
LIBS = lwip libc
|
||||
SRC_CC = main.cc
|
||||
|
||||
INC_DIR += $(REP_DIR)/src/lib/lwip/include
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
TARGET = test-lwip_httpsrv_static
|
||||
LIBS = lwip libc libc_log
|
||||
LIBS = lwip libc libc_vfs
|
||||
SRC_CC = main.cc
|
||||
|
||||
INC_DIR += $(REP_DIR)/src/lib/lwip/include
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
TARGET = test-lwip_httpsrv_tracing
|
||||
LIBS = lwip libc libc_log
|
||||
LIBS = lwip libc libc_vfs
|
||||
SRC_CC = main.cc
|
||||
REQUIRES = foc
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
TARGET = test-lwip_httpsrv_tracing_nob
|
||||
LIBS = lwip libc libc_log
|
||||
LIBS = lwip libc libc_vfs
|
||||
SRC_CC = main.cc
|
||||
REQUIRES = foc
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TARGET = test-lwip_loop
|
||||
LIBS = lwip libc libc_lwip_loopback libc_log
|
||||
LIBS = lwip libc libc_lwip_loopback libc_vfs
|
||||
SRC_CC = main.cc
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
TARGET = test-ping_client_libc_lwip
|
||||
LIBS = base libc libc_lwip lwip libc_lwip_nic_dhcp libc_log config_args
|
||||
LIBS = base libc lwip libc_lwip_nic_dhcp libc_vfs config_args
|
||||
SRC_CC = main.cc pingpong.cc
|
||||
|
||||
vpath main.cc $(PRG_DIR)/..
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
TARGET = test-ping_client_lwip
|
||||
LIBS = base libc lwip libc_log config_args
|
||||
LIBS = base libc lwip libc_vfs config_args
|
||||
SRC_CC = main.cc pingpong.cc
|
||||
|
||||
INC_DIR += $(REP_DIR)/src/lib/lwip/include
|
||||
|
|
|
@ -75,12 +75,13 @@ sendping(const char *addr, size_t dsize, size_t count)
|
|||
if (n == 0)
|
||||
break;
|
||||
if (n != (sizeof (Packetheader) + p.h.dsize)) {
|
||||
printf("ERROR: size mismatch: %ld != %lu\n", n, sizeof (Packetheader) + p.h.dsize);
|
||||
printf("ERROR: size mismatch: %ld != %lu\n",
|
||||
(long)n, (long)(sizeof (Packetheader) + p.h.dsize));
|
||||
break;
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
printf("%u %ld\n", p.h.id, n);
|
||||
printf("%u %ld\n", (unsigned)p.h.id, (long)n);
|
||||
}
|
||||
|
||||
close(s);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
TARGET = test-ping_server_libc_lwip
|
||||
LIBS = base libc libc_lwip_nic_dhcp libc_lwip lwip libc_log config_args
|
||||
LIBS = base libc libc_vfs libc_lwip_nic_dhcp libc_lwip lwip config_args
|
||||
SRC_CC = main.cc pingpong.cc
|
||||
|
||||
vpath main.cc $(PRG_DIR)/..
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
TARGET = test-ping_server_lwip
|
||||
LIBS = base libc lwip libc_log config_args
|
||||
LIBS = base libc lwip libc_vfs config_args
|
||||
SRC_CC = main.cc pingpong.cc
|
||||
|
||||
CC_OPT += -DLWIP_NATIVE
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TARGET = test-moon
|
||||
LIBS = luacxx libc libc_log libm
|
||||
LIBS = luacxx libc libm libc_vfs
|
||||
SRC_CC = main.cc
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TARGET = test-pthread
|
||||
SRC_CC = main.cc
|
||||
LIBS = libc libc_log pthread
|
||||
LIBS = libc libc_vfs pthread
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue