Changeset 4fe7fcb in mainline


Ignore:
Timestamp:
2019-08-03T07:37:38Z (5 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
6efec7e3
Parents:
c0c388d2
git-author:
Michal Koutný <xm.koutny+hos@…> (2015-03-16 22:13:54)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2019-08-03 07:37:38)
Message:

Transform unit dependencies to job ordering

Location:
uspace/srv/sysman
Files:
3 edited

Legend:

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

    rc0c388d2 r4fe7fcb  
    212212}
    213213
     214int job_add_blocking_job(job_t *job, job_t *blocking_job)
     215{
     216        job_link_t *job_link = malloc(sizeof(job_link_t));
     217        if (job_link == NULL) {
     218                return ENOMEM;
     219        }
     220
     221        link_initialize(&job_link->link);
     222        list_append(&job_link->link, &job->blocking_jobs);
     223
     224        job_link->job = blocking_job;
     225        job_add_ref(blocking_job);
     226
     227        return EOK;
     228}
     229
    214230static void job_destroy(job_t **job_ptr)
    215231{
  • uspace/srv/sysman/job.h

    rc0c388d2 r4fe7fcb  
    5555
    5656extern job_t *job_create(job_type_t type);
     57extern int job_add_blocking_job(job_t *, job_t *);
    5758
    5859#endif
  • uspace/srv/sysman/sysman.c

    rc0c388d2 r4fe7fcb  
    66#include "sysman.h"
    77
     8/** Create jobs for cluser of given unit.
     9 *
     10 * @note Using recursion, limits "depth" of dependency graph.
     11 */
    812static int sysman_create_closure_jobs(unit_t *unit, job_t **entry_job_ptr,
    913    list_t *accumulator, job_type_t type)
     
    1721
    1822        job->unit = unit;
    19         // TODO set blocking jobs
    2023
    2124        list_foreach(unit->dependencies, dependencies, unit_dependency_t, edge) {
    22                 rc = sysman_create_closure_jobs(edge->dependency, NULL,
     25                job_t *blocking_job = NULL;
     26                rc = sysman_create_closure_jobs(edge->dependency, &blocking_job,
    2327                    accumulator, type);
     28                if (rc != EOK) {
     29                        goto fail;
     30                }
     31               
     32                rc = job_add_blocking_job(job, blocking_job);
    2433                if (rc != EOK) {
    2534                        goto fail;
Note: See TracChangeset for help on using the changeset viewer.