fn bind_mount_unit()

in metalos/lib/systemd/src/systemd_manager.rs [398:857]


    fn bind_mount_unit(
        &self,
        name: &UnitName,
        source: &FilePath,
        destination: &FilePath,
        read_only: bool,
        mkdir: bool,
    ) -> zbus::Result<()>;

    /// Cancel a specific job identified by its numeric ID.
    /// This operation is also available as [JobProxy::cancel] exists primarily
    /// to reduce the necessary round trips to execute this operation. Note that
    /// this will not have any effect on jobs whose execution has already begun.
    fn cancel_job(&self, id: JobId) -> zbus::Result<()>;

    /// Flushes the job queue, removing all jobs that are still queued.
    /// Note that this does not have any effect on jobs whose execution has
    /// already begun. It only flushes jobs that are queued and have not yet
    /// begun execution.
    fn clear_jobs(&self) -> zbus::Result<()>;

    /// Inverse of [enable_unit_files](ManagerProxy::enable_unit_files)
    #[dbus_proxy(name = "DisableUnitFilesWithFlags")]
    fn disable_unit_files(
        &self,
        units: &[&UnitName],
        flags: EnableDisableUnitFlags,
    ) -> zbus::Result<Vec<UnitFileChange>>;

    /// Enable one or more units in the system (by creating symlinks to them in
    /// /etc/ or /run/).
    /// * `files`   - file names or full absolute paths (if the unit files are
    ///      residing outside the usual unit search path)
    ///
    /// Returns a boolean that signals whether any of the unit files contained
    /// any enablement information (i.e. an \[Install\]) section, and a Vec of
    /// [UnitFileChange]s made.
    #[dbus_proxy(name = "EnableUnitFilesWithFlags")]
    fn enable_unit_files(
        &self,
        files: &[&UnitName],
        flags: EnableDisableUnitFlags,
    ) -> zbus::Result<(bool, Vec<UnitFileChange>)>;

    /// Create reload/restart jobs for units which have been appropriately
    /// marked with `Markers` in
    /// [set_unit_properties)](ManagerProxy::set_unit_properties).
    /// This is equivalent to calling
    /// [try_restart_unit](ManagerProxy::try_restart_unit) or
    /// [reload_or_try_restart_unit](ManagerProxy::reload_or_try_restart_unit)
    /// for the marked units.
    fn enqueue_marked_jobs(&self) -> zbus::Result<Vec<TypedObjectPath<JobProxy<'_>>>>;

    /// Ask the manager to exit. This is not available for the system manager
    /// and is useful only for user session managers.
    fn exit(&self) -> zbus::Result<()>;

    /// Retrieve the name of the unit to which default.target is aliased.
    fn get_default_target(&self) -> zbus::Result<String>;

    /// Get the [JobProxy] for a specific job, identified by its id.
    #[dbus_proxy(object = "Job")]
    fn get_job(&self, id: JobId);

    /// Get the unit object proxy for a unit name.
    /// If a unit has not been loaded yet by this name this method will fail.
    #[dbus_proxy(object = "Unit")]
    fn get_unit(&self, name: &UnitName);

    /// Get a specialized [ServiceProxy] for the named unit.
    /// See [get_unit](ManagerProxy::get_unit).
    #[dbus_proxy(object = "Service", name = "GetUnit")]
    fn get_service_unit(&self, name: &UnitName);

    /// Get the [UnitProxy] that a process ID belongs to.
    /// The PID must refer to an existing system process.
    #[dbus_proxy(object = "Unit")]
    fn get_unit_by_pid(&self, pid: u32);

    /// Get the current enablement status of a specific unit file.
    fn get_unit_file_state(&self, file: &OwnedFilePath) -> zbus::Result<UnitFileState>;

    /// See [reboot](ManagerProxy::reboot)
    fn halt(&self) -> zbus::Result<()>;

    /// See [reboot](ManagerProxy::reboot)
    fn kexec(&self) -> zbus::Result<()>;

    /// Send a signal to all processes of a unit.
    fn kill_unit(&self, name: &UnitName, whom: &KillWhom, signal: Signal) -> zbus::Result<()>;

    /// Link unit files that are located outside of the usual unit search paths
    /// into the unit search path.
    fn link_unit_files(
        &self,
        files: &[&FilePath],
        runtime: bool,
        force: bool,
    ) -> zbus::Result<Vec<UnitFileChange>>;

    /// Get all currently queued jobs.
    /// Note that a job is only considered queued while it is starting, not
    /// while it's running.
    fn list_jobs(&self) -> zbus::Result<Vec<ListedJob>>;

    /// Returns an array of unit names and their enablement status. Note that
    /// [list_units](ManagerProxy::list_units) returns a list of units currently
    /// loaded into memory, while
    /// [list_unit_files](ManagerProxy::list_unit_files) returns a list of unit
    /// files that were found on disk. Note that while most units are read
    /// directly from a unit file with the same name, some units are not backed
    /// by files and some files (templates) cannot directly be loaded as units
    /// but need to be instantiated instead.
    fn list_unit_files(&self) -> zbus::Result<Vec<(OwnedFilePath, UnitFileState)>>;

    /// Get an array of all currently loaded units.
    /// Note that units may be known by multiple names at the same name, and
    /// hence there might be more unit names loaded than actual units behind
    /// them.
    fn list_units(&self) -> zbus::Result<Vec<ListedUnit>>;

    /// Similar to [get_unit](ManagerProxy::get_unit) but will load the unit
    /// from disk if possible and necessary.
    #[dbus_proxy(object = "Unit")]
    fn load_unit(&self, name: &UnitName);

    /// Mask unit files.
    /// See [enable_unit_files](ManagerProxy::enable_unit_files) for details on
    /// the boolean flags.
    fn mask_unit_files(
        &self,
        files: &[&FilePath],
        runtime: bool,
        force: bool,
    ) -> zbus::Result<Vec<UnitFileChange>>;

    /// Mount new images into a running service mount namespace.
    fn mount_image_unit(
        &self,
        name: &UnitName,
        source: &FilePath,
        destination: &FilePath,
        read_only: bool,
        mkdir: bool,
        options: &[(&str, &str)],
    ) -> zbus::Result<()>;

    /// See [reboot](ManagerProxy::reboot)
    fn power_off(&self) -> zbus::Result<()>;

    /// [reboot](ManagerProxy::reboot), [power_off](ManagerProxy::power_off),
    /// [halt](ManagerProxy::halt), or [kexec](ManagerProxy::kexec) may be used
    /// to ask for immediate reboot, powering down, halt or kexec based reboot
    /// of the system. Note that this does not shut down any services and
    /// immediately transitions into the reboot process. These functions are
    /// normally only called as the last step of shutdown and should not be
    /// called directly.  To shut down the machine, it is generally a better
    /// idea to invoke [reboot](ManagerProxy::reboot) or
    /// [power_off](ManagerProxy::power_off) on the systemd-logind manager
    /// object; see org.freedesktop.login1(5) for more information.
    fn reboot(&self) -> zbus::Result<()>;

    /// Reexecute the main manager process. It will serialize its state,
    /// reexecute, and deserizalize the state again.  This is useful for
    /// upgrades and is a more comprehensive version of
    /// [reload](ManagerProxy::reload).
    fn reexecute(&self) -> zbus::Result<()>;

    /// Reload all unit files.
    fn reload(&self) -> zbus::Result<()>;

    /// Reload a unit if it supports it, otherwise restart.
    /// Fails on a service that is not already running.
    #[dbus_proxy(object = "Unit")]
    fn reload_or_restart_unit(&self, name: &UnitName, mode: &StartMode);

    /// Reload a unit if it supports it, otherwise restart.
    /// No-op if service is not already running.
    #[dbus_proxy(object = "Unit")]
    fn reload_or_try_restart_unit(&self, name: &UnitName, mode: &StartMode);

    /// Reload if the unit is already running, otherwise fail.
    #[dbus_proxy(object = "Unit")]
    fn reload_unit(&self, name: &UnitName, mode: &StartMode);

    /// Reset the "failed" state of all units.
    fn reset_failed(&self) -> zbus::Result<()>;

    /// Resets the "failed" state of a specific unit.
    fn reset_failed_unit(&self, name: &UnitName) -> zbus::Result<()>;

    /// Restart a unit if it is running, otherwise fail.
    #[dbus_proxy(object = "Unit")]
    fn restart_unit(&self, name: &UnitName, mode: &StartMode);

    /// Change the default.target link. See bootup(7) for more information.
    fn set_default_target(&self, name: &UnitName, force: bool)
    -> zbus::Result<Vec<UnitFileChange>>;

    /// Alter the environment block that is passed to all spawned processes.
    /// Any previously set environment variables will be overridden.
    fn set_environment(&self, assignments: &Environment) -> zbus::Result<()>;

    /// May be used to modify certain unit properties at runtime. Not all
    /// properties may be changed at runtime, but many resource management
    /// settings (primarily those listed in systemd.resource-control(5)) may.
    /// The changes are applied instantly and stored on disk for future boots,
    /// unless runtime is true, in which case the settings only apply until the
    /// next reboot. name is the name of the unit to modify. Properties are the
    /// settings to set, encoded as an array of property name and value pairs.
    /// Note that this is not a dictionary!  Also note that when setting array
    /// properties with this method usually results in appending to the
    /// pre-configured array. To reset the configured arrays, set the property
    /// to an empty array first and then append to it.
    fn set_unit_properties(
        &self,
        name: &UnitName,
        runtime: bool,
        properties: &[(&str, zbus::zvariant::Value<'_>)],
    ) -> zbus::Result<()>;

    /// Create and start a transient unit which will be released as soon as it
    /// is finished running, not referenced anymore (see
    /// [ref_unit)](ManagerProxy::ref_unit) or the system is rebooted.
    /// `aux` is currently unused and should be passed as an empty array. See
    /// the [New Control Group
    /// Interface](http://www.freedesktop.org/wiki/Software/systemd/ControlGroupInterface/)
    /// for more information how to make use of this functionality for resource
    /// control purposes.
    fn start_transient_unit(
        &self,
        name: &UnitName,
        mode: &StartMode,
        properties: &[(&str, zbus::zvariant::Value<'_>)],
        aux: &[(&str, &[(&str, zbus::zvariant::Value<'_>)])],
    ) -> zbus::Result<TypedObjectPath<JobProxy<'_>>>;

    /// Increment unit reference count.
    fn ref_unit(&self, name: &UnitName) -> zbus::Result<()>;

    /// Decrement unit reference count.
    fn unref_unit(&self, name: &UnitName) -> zbus::Result<()>;

    /// Enqueue a start job and possibly depending jobs.
    #[dbus_proxy(object = "Job")]
    fn start_unit(&self, name: &UnitName, mode: &StartMode);

    /// Similar to [start_unit](ManagerProxy::start_unit) but replaces a job
    /// that is queued for one unit by a job for another unit.
    #[dbus_proxy(object = "Job")]
    fn start_unit_replace(&self, old_unit: &UnitName, new_unit: &UnitName, mode: &StartMode);

    /// Stops the specified unit.
    /// Note that the "isolate" mode is invalid for this method.
    #[dbus_proxy(object = "Job")]
    fn stop_unit(&self, name: &UnitName, mode: &StartMode);

    /// Enable most bus signals to be sent out. Clients which are interested in
    /// signals need to call this method. Signals are only sent out if at least
    /// one client invoked this method.
    /// See [unsubscribe](ManagerProxy::unsubscribe) for unsubscription / closing semantics.
    fn subscribe(&self) -> zbus::Result<()>;

    /// Transition to a new root directory. This is intended to be used by
    /// initial RAM disks. The method takes two arguments: the new root
    /// directory (which needs to be specified) and an init binary path (which
    /// may be left empty, in which case it is automatically searched for). The
    /// state of the system manager will be serialized before the transition.
    /// After the transition, the manager binary on the main system is invoked
    /// and replaces the old PID 1. All state will then be deserialized.
    fn switch_root(&self, new_root: &FilePath, init: &FilePath) -> zbus::Result<()>;

    /// Restart a unit if it's running, otherwise do nothing.
    #[dbus_proxy(object = "Job")]
    fn try_restart_unit(&self, name: &UnitName, mode: &StartMode);

    /// Unmask unit files.
    /// See [enable_unit_files](ManagerProxy::enable_unit_files) for a
    /// description of the boolean flags.
    fn unmask_unit_files(
        &self,
        files: &[&FilePath],
        runtime: bool,
    ) -> zbus::Result<Vec<UnitFileChange>>;

    /// Combination of [unset_environment](ManagerProxy::unset_environment) and
    /// [set_environment](ManagerProxy::set_environment).  It takes two lists.
    /// The first list contains variables to unset, the second one contains
    /// assignments to set.  If a variable is listed in both, the variable is
    /// set after this method returns, i.e. the set list overrides the unset
    /// list.
    fn unset_and_set_environment(
        &self,
        names: &[&str],
        assignments: &Environment,
    ) -> zbus::Result<()>;

    /// Unset environment variables. It takes a string array of environment
    /// variable names. All variables specified will be unset (if they have been
    /// set previously) and no longer be passed to all spawned processes. This
    /// method has no effect for variables that were previously not set, but
    /// will not fail in that case.
    fn unset_environment(&self, names: &[&str]) -> zbus::Result<()>;

    /// Reverts the signal subscription that
    /// [subscribe](ManagerProxy::subscribe) sets up.  It is not usually
    /// necessary to invoke [unsubscribe](ManagerProxy::unsubscribe) as clients
    /// are tracked. Signals are no longer sent out as soon as all clients which
    /// previously asked for [subscribe](ManagerProxy::subscribe) either closed
    /// their connection to the bus or invoked
    /// [unsubscribe](ManagerProxy::unsubscribe).
    fn unsubscribe(&self) -> zbus::Result<()>;

    /// Sent out each time a new job is enqueued or dequeued. Includes the
    /// numeric job ID, the bus path and the primary unit name for this job as
    /// arguments.
    #[dbus_proxy(signal)]
    fn job_new(
        &self,
        id: JobId,
        job: TypedObjectPath<JobProxy<'_>>,
        unit: UnitName,
    ) -> zbus::Result<()>;

    /// Similar to [job_new](ManagerProxy::job_new), but also includes the
    /// [JobResult] of the finished job.
    #[dbus_proxy(signal)]
    fn job_removed(
        &self,
        id: JobId,
        job: TypedObjectPath<JobProxy<'_>>,
        unit: UnitName,
        result: JobResult,
    ) -> zbus::Result<()>;

    /// Sent out immediately before a daemon reload is done (with the boolean
    /// parameter set to True) and after a daemon reload is completed (with the
    /// boolean parameter set to False). This may be used by UIs to optimize UI
    /// updates.
    #[dbus_proxy(signal)]
    fn reloading(&self, active: bool) -> zbus::Result<()>;

    /// Sent out when startup finishes. It carries six microsecond timespan
    /// values, each indicating how much boot time has been spent in each layer
    /// (firmware, bootloader, kernel, initrd) if known, and the always-known
    /// timestamps in the userspace layer, and the total time.
    /// These values may also be calculated from the
    /// [firmware_timestamp_monotonic](ManagerProxy::firmware_timestamp_monotonic),
    /// [loader_timestamp_monotonic](ManagerProxy::loader_timestamp_monotonic),
    /// [initrd_timestamp_monotonic](ManagerProxy::initrd_timestamp_monotonic),
    /// [userspace_timestamp_monotonic](ManagerProxy::userspace_timestamp_monotonic),
    /// and
    /// [finish_timestamp_monotonic](ManagerProxy::finish_timestamp_monotonic)
    /// properties if the system is already ready without the complexity of
    /// handling a signal.
    #[dbus_proxy(signal)]
    fn startup_finished(
        &self,
        firmware: MonotonicTimestamp,
        loader: MonotonicTimestamp,
        kernel: MonotonicTimestamp,
        initrd: MonotonicTimestamp,
        userspace: MonotonicTimestamp,
        total: MonotonicTimestamp,
    ) -> zbus::Result<()>;

    /// Sent out each time the list of enabled or masked unit files on disk have
    /// changed.
    #[dbus_proxy(signal)]
    fn unit_files_changed(&self) -> zbus::Result<()>;

    /// Sent out each time a new unit is loaded or unloaded.
    /// Note that this has little to do with whether a unit is available on disk
    /// or not, and simply reflects the units that are currently loaded into
    /// memory.
    #[dbus_proxy(signal)]
    fn unit_new(&self, id: UnitName, unit: TypedObjectPath<UnitProxy<'_>>) -> zbus::Result<()>;

    /// Sent out each time a new unit is unloaded.
    /// See [unit_new](ManagerProxy::unit_new)
    #[dbus_proxy(signal)]
    fn unit_removed(&self, id: UnitName, unit: TypedObjectPath<UnitProxy<'_>>) -> zbus::Result<()>;

    /// Short ID string describing the architecture the systemd instance is
    /// running on. This follows the same vocabulary as ConditionArchitectures=.
    #[dbus_proxy(property)]
    fn architecture(&self) -> zbus::Result<String>;

    /// Environment property
    #[dbus_proxy(property)]
    fn environment(&self) -> zbus::Result<Environment>;

    /// Features encodes the features that have been enabled and disabled for
    /// this build. Enabled options are prefixed with +, disabled options with
    /// -.
    #[dbus_proxy(property)]
    fn features(&self) -> zbus::Result<String>;

    #[dbus_proxy(property)]
    fn system_state(&self) -> zbus::Result<SystemState>;

    /// Encodes a couple of taint flags as a colon-separated list. When systemd
    /// detects it is running on a system with certain problems, it will set an
    /// appropriate taint flag. Taints may be used to lower the chance of bogus
    /// bug reports.
    #[dbus_proxy(property)]
    fn tainted(&self) -> zbus::Result<TaintSet>;

    /// Version string of the running systemd instance. Note that the version
    /// string is purely informational. It should not be parsed and one may not
    /// assume the version to be formatted in any particular way. We take the
    /// liberty to change the versioning scheme at any time and it is not part
    /// of the public API.
    #[dbus_proxy(property)]
    fn version(&self) -> zbus::Result<String>;

    /// Short ID string describing the virtualization technology the system runs
    /// in. Note that only the "innermost" virtualization technology is exported
    /// here. This detects both full-machine virtualizations (VMs) and
    /// shared-kernel virtualization (containers).
    #[dbus_proxy(property)]
    fn virtualization(&self) -> zbus::Result<Virtualization>;

    #[dbus_proxy(property)]
    fn firmware_timestamp_monotonic(&self) -> zbus::Result<MonotonicTimestamp>;
    #[dbus_proxy(property)]
    fn firmware_timestamp(&self) -> zbus::Result<Timestamp>;

    #[dbus_proxy(property)]
    fn loader_timestamp_monotonic(&self) -> zbus::Result<MonotonicTimestamp>;
    #[dbus_proxy(property)]
    fn loader_timestamp(&self) -> zbus::Result<Timestamp>;

    #[dbus_proxy(property)]
    fn kernel_timestamp_monotonic(&self) -> zbus::Result<MonotonicTimestamp>;
    #[dbus_proxy(property)]
    fn kernel_timestamp(&self) -> zbus::Result<Timestamp>;

    #[dbus_proxy(property, name = "InitRDTimestampMonotonic")]
    fn initrd_timestamp_monotonic(&self) -> zbus::Result<MonotonicTimestamp>;
    #[dbus_proxy(property, name = "InitRDTimestamp")]
    fn initrd_timestamp(&self) -> zbus::Result<Timestamp>;

    #[dbus_proxy(property)]
    fn userspace_timestamp_monotonic(&self) -> zbus::Result<MonotonicTimestamp>;
    #[dbus_proxy(property)]
    fn userspace_timestamp(&self) -> zbus::Result<Timestamp>;

    #[dbus_proxy(property)]
    fn finished_timestamp_monotonic(&self) -> zbus::Result<MonotonicTimestamp>;
    #[dbus_proxy(property)]
    fn finished_timestamp(&self) -> zbus::Result<Timestamp>;
}

#[dbus_proxy(
    interface = "org.freedesktop.systemd1.Job",
    default_service = "org.freedesktop.systemd1",
    gen_blocking = false
)]
trait Job {