CDEmu daemon


CDEmu illustration

CDEmu daemon is the userspace daemon part of the cdemu suite.

It receives SCSI commands from kernel module and processes them, passing the requested data back to the kernel.

Daemon implements the actual virtual device; one instance per each device registered by kernel module. It uses libMirage, an image access library that is part of cdemu suite, for the image access (e.g. sector reading).

Daemon is controlled through methods that are exposed via D-BUS. It is written in C and based on GLib (and thus GObjects), but being controlled over D-BUS, it allows for different clients written in different languages.



System bus vs. Session bus

CDEmu daemon registers a D-BUS interface that can be used by clients to communicate with it; the interface can be registered either on system or session bus.

A session bus instance is created for every user session, and is visible only within that session. On the other hand, there's only one instance of system bus, which is visible system-wide.

This means that when session bus is used, every user can run its own instance of CDEmu daemon, as long as device number limit of VHBA module is not reached. There can be only one instance of the daemon running on system bus, but it is visible to all users. Also, a single instance of daemon on system bus and multiple instances on session busses can be running at the same time.

Note that running on system bus requires special permissions; to this end, CDEmu daemon installs a D-BUS config file which by default allows root to run daemon on system bus. Session bus requires no such permissions, but the user running the daemon must have read/write permissions to VHBA character control device.

Packaging guidelines

There are no special considerations when packaging the daemon, except maybe for D-BUS configuration file; this one is needed only if daemon is going to be run with system bus. By default it allows the daemon to be run as root; should you wish to use another use, please edit the file. Also, note that the file should be installed in appropriate directory; on most systems, this is /etc/dbus-1/system.d. Due to the way autotools are used, the system dir path gets prefixed, therefore you need to either specify --sysconfdir=/etc or use --with-dbus-config-dir=/etc/dbus-1/system.d when running configure. If daemon is not intended to be run on system bus, the config file needs not to be included.