Changeset 8fab3f6 in mainline for uspace/srv/sysman/connection_ctl.c


Ignore:
Timestamp:
2019-08-17T13:50:05Z (6 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
31ef7c1
Parents:
504d103
git-author:
Michal Koutný <xm.koutny+hos@…> (2015-12-04 17:21:21)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2019-08-17 13:50:05)
Message:

sysctl: Add start operation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/sysman/connection_ctl.c

    r504d103 r8fab3f6  
    138138}
    139139
    140 static void sysman_unit_stop(ipc_callid_t iid, ipc_call_t *icall)
     140static void sysman_unit_operation(ipc_callid_t iid, ipc_call_t *icall,
     141    unit_state_t state)
    141142{
    142143        sysarg_t retval;
     
    144145        unit_handle_t handle = IPC_GET_ARG1(*icall);
    145146        int flags = IPC_GET_ARG2(*icall);
    146         sysman_log(LVL_DEBUG2, "%s(%i, %x)", __func__, handle, flags);
     147        sysman_log(LVL_DEBUG2, "%s(%i, %x, %i)", __func__, handle, flags, state);
    147148
    148149        unit_t *unit = repo_find_unit_by_handle(handle);
     
    153154
    154155        if (!(flags & IPC_FLAG_BLOCKING)) {
    155                 retval = sysman_run_job(unit, STATE_STOPPED, NULL, NULL);
     156                retval = sysman_run_job(unit, state, NULL, NULL);
    156157                goto answer;
    157158        }
     
    162163                goto answer;
    163164        }
    164         retval = sysman_run_job(unit, STATE_STOPPED, &answer_callback,
     165        retval = sysman_run_job(unit, state, &answer_callback,
    165166            iid_ptr);
    166167        if (retval != EOK) {
     
    173174answer:
    174175        async_answer_0(iid, retval);
     176}
     177
     178static void sysman_unit_start(ipc_callid_t iid, ipc_call_t *icall)
     179{
     180        sysman_unit_operation(iid, icall, STATE_STARTED);
     181}
     182
     183static void sysman_unit_stop(ipc_callid_t iid, ipc_call_t *icall)
     184{
     185        sysman_unit_operation(iid, icall, STATE_STOPPED);
    175186}
    176187
     
    289300                        sysman_unit_start_by_name(callid, &call);
    290301                        break;
     302                case SYSMAN_CTL_UNIT_START:
     303                        sysman_unit_start(callid, &call);
     304                        break;
    291305                case SYSMAN_CTL_UNIT_STOP:
    292306                        sysman_unit_stop(callid, &call);
Note: See TracChangeset for help on using the changeset viewer.