genode/repos/gems/run/text_area.run
Norman Feske 2c8beb462f file-system session: root dir via session label
This patch changes the way of how the client-selected sub directory is
communicated to the server. The former opaque session argument is now
passed as last label element, which allows for the flexible tweaking
of this argument by init's session-routing and label-rewriting
mechansims. In particular, it alleviates the need for creating chroot
component instances.

This change requires the following four adaptations at the
configuration level:

- Each file-system session request must now carry a path starting
  with / as last session arguments. Hence, <vfs> <fs> nodes that
  feature a 'label' attributes must extend the attribute value
  with " -> /". For <fs> nodes with no label attribute, "/" is
  used as last label argument by default.

- For matching session-routing rules at init's configuration,
  the matching of full labels should be replaced by 'label_prefix'
  matches, excluding the last (path) argument.

- Wherever a label of a file-system session is rewritten by using
  init's 'label' attribute of a <parent> or <child> target node,
  the new attribute 'identity' should be used instead. This replaces
  the identity part of the label while preserving the client's
  directory argument.

- Analogously to the matching of session-routing rules, server-side
  policy-selection rules that formerly matched a concrete 'label'
  must be changed to match a 'label_prefix' instead.

As a good practice, 'label_prefix' values should end with " ->" if
possible, which clearly delimits the identity part of the label
used by the matching.

Issue #5445
2025-02-24 16:39:20 +01:00

146 lines
4.6 KiB
Plaintext

create_boot_directory
import_from_depot [depot_user]/src/[base_src] \
[depot_user]/pkg/[drivers_interactive_pkg] \
[depot_user]/pkg/fonts_fs \
[depot_user]/src/init \
[depot_user]/src/report_rom \
[depot_user]/src/nitpicker \
[depot_user]/src/libc \
[depot_user]/src/libpng \
[depot_user]/src/zlib \
[depot_user]/src/vfs_import
install_config {
<config>
<parent-provides>
<service name="PD"/>
<service name="CPU"/>
<service name="ROM"/>
<service name="RM"/>
<service name="LOG"/>
<service name="IRQ"/>
<service name="IO_MEM"/>
<service name="IO_PORT"/>
</parent-provides>
<default caps="100" ram="1M"/>
<default-route>
<any-service> <parent/> <any-child/> </any-service>
</default-route>
<start name="timer">
<provides><service name="Timer"/></provides>
</start>
<start name="drivers" caps="1500" ram="64M" managing_system="yes">
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>
<service name="Timer"> <child name="timer"/> </service>
<service name="Capture"> <child name="nitpicker"/> </service>
<service name="Event"> <child name="nitpicker"/> </service>
<any-service> <parent/> </any-service>
</route>
</start>
<start name="report_rom">
<provides> <service name="Report"/> <service name="ROM"/> </provides>
<config verbose="yes">
<policy label="text_area.1 -> hover" report="nitpicker -> hover"/>
<policy label="text_area.2 -> clipboard" report="text_area.2 -> clipboard"/>
</config>
</start>
<start name="nitpicker" ram="4M">
<provides>
<service name="Gui"/> <service name="Capture"/> <service name="Event"/>
</provides>
<config focus="rom">
<capture/> <event/>
<report hover="yes"/>
<background color="#123456"/>
<domain name="pointer" layer="1" content="client" label="no" origin="pointer" />
<domain name="default" layer="3" content="client" label="no" hover="always" />
<domain name="second" layer="2" xpos="200" ypos="300" content="client" label="no" hover="always" />
<policy label_prefix="pointer" domain="pointer"/>
<policy label_prefix="text_area.2" domain="second"/>
<default-policy domain="default"/>
</config>
</start>
<start name="pointer">
<route>
<service name="Gui"> <child name="nitpicker" /> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="fonts_fs" caps="300" ram="8M">
<binary name="vfs"/>
<route>
<service name="ROM" label="config"> <parent label="fonts_fs.config"/> </service>
<any-service> <parent/> </any-service>
</route>
<provides> <service name="File_system"/> </provides>
</start>
<start name="data_fs" caps="300" ram="8M">
<binary name="vfs"/>
<config>
<vfs>
<ram/>
<import>
<rom name="drivers.config" binary="no"/>
</import>
</vfs>
<default-policy root="/" writeable="yes"/>
</config>
<route> <any-service> <parent/> </any-service> </route>
<provides> <service name="File_system"/> </provides>
</start>
<start name="text_area.1" caps="250" ram="8M">
<binary name="text_area"/>
<config path="/data/drivers.config" max_lines="20" min_width="500" min_height="300" watch="yes">
<vfs> <dir name="data"> <fs label="data -> /"/> </dir> </vfs>
</config>
<route>
<service name="ROM" label="hover"> <child name="report_rom"/> </service>
<service name="File_system" label_prefix="fonts ->"> <child name="fonts_fs"/> </service>
<service name="File_system" label_prefix="data ->"> <child name="data_fs"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="text_area.2" caps="250" ram="8M">
<binary name="text_area"/>
<config path="/data/drivers.config" copy="yes" paste="yes"
max_lines="10" min_width="600">
<report saved="yes"/>
<save version="1"/>
<vfs> <dir name="data"> <fs label="data -> /"/> </dir> </vfs>
</config>
<route>
<service name="Report"> <child name="report_rom"/> </service>
<service name="ROM" label="clipboard"> <child name="report_rom"/> </service>
<service name="File_system" label_prefix="fonts ->"> <child name="fonts_fs"/> </service>
<service name="File_system" label_prefix="data ->"> <child name="data_fs"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
</config>}
set fd [open [run_dir]/genode/focus w]
puts $fd "<focus label=\"text_area.2 -> \"/>"
close $fd
build { app/text_area app/menu_view lib/vfs lib/sandbox }
build_boot_image [build_artifacts]
run_genode_until forever