CDEmu daemon
About
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.
Features
- Written in C, based on GLib and GObjects
- D-BUS interface for communication with clients
- Implemens a set of packet commands specified by MMC-3, therefore emulating real optical device
- Can register itself either on session or system bus
- Debugging; on-fly change of debug traces verbosity
Requirements
- CMake >= 2.8.5
- GLib >= 2.30
- libao >= 0.8.0
- libmirage >= 3.2.0 (part of the suite)
- VHBA module >= 20170610 (part of the suite)
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.