openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/dbus/1.12.16-r0/dbus-1.12.16/bus/driver.c
static dbus_bool_t bus_driver_send_or_activate(BusTransaction* transaction,
                                               DBusMessage* message,
                                               DBusError* error)
{
    BusContext* context;
    BusService* service;
    const char* service_name;
    DBusString service_string;

    _DBUS_ASSERT_ERROR_IS_CLEAR(error);

    service_name = dbus_message_get_destination(message);

    _dbus_assert(service_name != NULL);

    _dbus_string_init_const(&service_string, service_name);

    context = bus_transaction_get_context(transaction);

    service =
        bus_registry_lookup(bus_context_get_registry(context), &service_string);

    if (service == NULL)
    {
        /* destination isn't connected yet; pass the message to activation */
        BusActivation* activation;

        activation = bus_context_get_activation(context);

        if (!bus_transaction_capture(transaction, NULL, NULL, message))
        {
            BUS_SET_OOM(error);
            _dbus_verbose("No memory for bus_transaction_capture()");
            return FALSE;
        }

        if (!bus_activation_activate_service(activation, NULL, transaction,
                                             TRUE, message, service_name,
                                             error))
        {
            _DBUS_ASSERT_ERROR_IS_SET(error);
            _dbus_verbose("bus_activation_activate_service() failed");
            return FALSE;
        }
    }
    else
    {
        DBusConnection* service_conn;

        service_conn = bus_service_get_primary_owners_connection(service);

        if (!bus_transaction_send_from_driver(transaction, service_conn,
                                              message))
        {
            BUS_SET_OOM(error);
            _dbus_verbose("No memory for bus_transaction_send_from_driver()");
            return FALSE;
        }
    }

    return TRUE;
}
/*
 * Send a message from the driver, activating the destination if necessary.
 * The message must already have a destination set.
 */
Send a message from the driver, activating the destination if necessary.
The message must already have a destination set.
Send a message from the driver activating the destination if necessary . The message must already have a destination set .
static dbus_bool_t bus_driver_send_or_activate(BusTransaction* transaction,
                                               DBusMessage* message,
                                               DBusError* error)
{
    BusContext* context;
    BusService* service;
    const char* service_name;
    DBusString service_string;
    _DBUS_ASSERT_ERROR_IS_CLEAR(error);
    service_name = dbus_message_get_destination(message);
    _dbus_assert(service_name != NULL);
    _dbus_string_init_const(&service_string, service_name);
    context = bus_transaction_get_context(transaction);
    service =
        bus_registry_lookup(bus_context_get_registry(context), &service_string);
    if (service == NULL)
    {
        BusActivation* activation;
        activation = bus_context_get_activation(context);
        if (!bus_transaction_capture(transaction, NULL, NULL, message))
        {
            BUS_SET_OOM(error);
            _dbus_verbose("No memory for bus_transaction_capture()");
            return FALSE;
        }
        if (!bus_activation_activate_service(activation, NULL, transaction,
                                             TRUE, message, service_name,
                                             error))
        {
            _DBUS_ASSERT_ERROR_IS_SET(error);
            _dbus_verbose("bus_activation_activate_service() failed");
            return FALSE;
        }
    }
    else
    {
        DBusConnection* service_conn;
        service_conn = bus_service_get_primary_owners_connection(service);
        if (!bus_transaction_send_from_driver(transaction, service_conn,
                                              message))
        {
            BUS_SET_OOM(error);
            _dbus_verbose("No memory for bus_transaction_send_from_driver()");
            return FALSE;
        }
    }
    return TRUE;
}
static dbus_bool_t bus_driver_send_or_activate ( BusTransaction * transaction , DBusMessage * message , DBusError * error ) { BusContext * context ; BusService * service ; const char * service_name ; DBusString service_string ; _DBUS_ASSERT_ERROR_IS_CLEAR ( error ) ; service_name = dbus_message_get_destination ( message ) ; _dbus_assert ( service_name != NULL ) ; _dbus_string_init_const ( & service_string , service_name ) ; context = bus_transaction_get_context ( transaction ) ; service = bus_registry_lookup ( bus_context_get_registry ( context ) , & service_string ) ; if ( service == NULL ) { BusActivation * activation ; activation = bus_context_get_activation ( context ) ; if ( ! bus_transaction_capture ( transaction , NULL , NULL , message ) ) { BUS_SET_OOM ( error ) ; _dbus_verbose ( " " ) ; return FALSE ; } if ( ! bus_activation_activate_service ( activation , NULL , transaction , TRUE , message , service_name , error ) ) { _DBUS_ASSERT_ERROR_IS_SET ( error ) ; _dbus_verbose ( " " ) ; return FALSE ; } } else { DBusConnection * service_conn ; service_conn = bus_service_get_primary_owners_connection ( service ) ; if ( ! bus_transaction_send_from_driver ( transaction , service_conn , message ) ) { BUS_SET_OOM ( error ) ; _dbus_verbose ( " " ) ; return FALSE ; } } return TRUE ; }
Send a message from the driver, activating the destination if necessary.
Send a message from the driver activating the destination if necessary .
/* destination isn't connected yet; pass the message to activation */