Changeset af92309 in mainline


Ignore:
Timestamp:
2019-08-07T09:33:04Z (5 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
9532981
Parents:
918ac9b
git-author:
Michal Koutný <xm.koutny+hos@…> (2015-11-02 22:12:18)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2019-08-07 09:33:04)
Message:

sysman: Rename configuration to repo(sitory)

It's better suited for dynamic nature of the storage.

Location:
uspace/srv/sysman
Files:
7 edited
2 moved

Legend:

Unmodified
Added
Removed
  • uspace/srv/sysman/Makefile

    r918ac9b raf92309  
    3838
    3939SYSMAN_SOURCES = \
    40         configuration.c \
    4140        connection_broker.c \
    4241        connection_ctl.c \
     
    4443        job.c \
    4544        log.c \
     45        repo.c \
     46        sm_task.c \
    4647        sysman.c \
    4748        unit.c \
    4849        units/unit_cfg.c \
    4950        units/unit_mnt.c \
     51        units/unit_svc.c \
    5052        units/unit_tgt.c \
    51         units/unit_svc.c \
    52         sm_task.c \
    5353        util.c
    5454
  • uspace/srv/sysman/connection_broker.c

    r918ac9b raf92309  
    3131#include <stdlib.h>
    3232
    33 #include "configuration.h"
     33#include "repo.h"
    3434#include "connection_broker.h"
    3535#include "log.h"
     
    6767        }
    6868
    69         unit_t *unit = configuration_find_unit_by_name(unit_name);
     69        unit_t *unit = repo_find_unit_by_name(unit_name);
    7070        if (unit == NULL) {
    7171                //sysman_log(LVL_NOTE, "Unit '%s' not found.", unit_name);
  • uspace/srv/sysman/connection_ctl.c

    r918ac9b raf92309  
    3333#include <str.h>
    3434
    35 #include "configuration.h"
     35#include "repo.h"
    3636#include "connection_ctl.h"
    3737#include "job.h"
     
    7979
    8080        // TODO this is connection fibril, UNSYNCHRONIZED access to units!
    81         unit_t *unit = configuration_find_unit_by_name(unit_name);
     81        unit_t *unit = repo_find_unit_by_name(unit_name);
    8282        if (unit == NULL) {
    8383                sysman_log(LVL_NOTE, "Unit '%s' not found.", unit_name);
     
    180180       
    181181        // TODO UNSYNCHRONIZED access to units!
    182         unit_t *u = configuration_find_unit_by_handle(IPC_GET_ARG1(*icall));
     182        unit_t *u = repo_find_unit_by_handle(IPC_GET_ARG1(*icall));
    183183        if (u == NULL) {
    184184                async_answer_0(callid, ENOENT);
     
    196196{
    197197        // TODO UNSYNCHRONIZED access to units!
    198         unit_t *u = configuration_find_unit_by_handle(IPC_GET_ARG1(*icall));
     198        unit_t *u = repo_find_unit_by_handle(IPC_GET_ARG1(*icall));
    199199        if (u == NULL) {
    200200                async_answer_0(iid, ENOENT);
  • uspace/srv/sysman/job.c

    r918ac9b raf92309  
    3232#include <stdlib.h>
    3333
    34 #include "configuration.h"
     34#include "repo.h"
    3535#include "dep.h"
    3636#include "job.h"
  • uspace/srv/sysman/main.c

    r918ac9b raf92309  
    3737#include <str.h>
    3838
    39 #include "configuration.h"
     39#include "repo.h"
    4040#include "connection_broker.h"
    4141#include "connection_ctl.h"
     
    131131         * Add units to configuration and start the default target.
    132132         */
    133         configuration_start_update();
    134 
    135         configuration_add_unit(mnt_initrd);
    136         configuration_add_unit(cfg_init);
    137         configuration_add_unit(tgt_init);
     133        repo_begin_update();
     134
     135        repo_add_unit(mnt_initrd);
     136        repo_add_unit(cfg_init);
     137        repo_add_unit(tgt_init);
    138138
    139139        rc = dep_add_dependency(tgt_init, cfg_init);
     
    147147        }
    148148
    149         configuration_commit();
     149        repo_commit();
    150150
    151151        return EOK;
     
    158158
    159159rollback:
    160         configuration_rollback();
     160        repo_rollback();
    161161        return rc;
    162162}
     
    186186
    187187        /* Previous targets should have loaded new units */
    188         unit_t *tgt = configuration_find_unit_by_name(target_name);
     188        unit_t *tgt = repo_find_unit_by_name(target_name);
    189189        if (tgt == NULL) {
    190190                sysman_log(LVL_ERROR,
     
    210210         */
    211211        // TODO check return values and abort start
    212         configuration_init();
     212        repo_init();
    213213        sysman_events_init();
    214214        job_queue_init();
  • uspace/srv/sysman/repo.c

    r918ac9b raf92309  
    3434#include <fibril_synch.h>
    3535
    36 #include "configuration.h"
     36#include "repo.h"
    3737#include "dep.h"
    3838#include "log.h"
     
    113113};
    114114
    115 /* Configuration functions */
    116 
    117 void configuration_init(void)
     115/* Repository functions */
     116
     117void repo_init(void)
    118118{
    119119        hash_table_create(&units_by_name, 0, 0, &units_by_name_ht_ops);
     
    121121}
    122122
    123 int configuration_add_unit(unit_t *unit)
     123int repo_add_unit(unit_t *unit)
    124124{
    125125        assert(unit);
     
    141141}
    142142
    143 void configuration_start_update(void) {
    144         sysman_log(LVL_DEBUG2, "%s", __func__);
    145 }
    146 
    147 static bool configuration_commit_unit(ht_link_t *ht_link, void *arg)
     143void repo_begin_update(void) {
     144        sysman_log(LVL_DEBUG2, "%s", __func__);
     145}
     146
     147static bool repo_commit_unit(ht_link_t *ht_link, void *arg)
    148148{
    149149        unit_t *unit = hash_table_get_inst(ht_link, unit_t, units_by_name);
     
    162162
    163163/** Marks newly added units_by_name as usable (via state change) */
    164 void configuration_commit(void)
     164void repo_commit(void)
    165165{
    166166        sysman_log(LVL_DEBUG2, "%s", __func__);
     
    170170         * deps, thus eventually commiting all embryo deps as well.
    171171         */
    172         hash_table_apply(&units_by_name, &configuration_commit_unit, NULL);
    173 }
    174 
    175 static bool configuration_rollback_unit(ht_link_t *ht_link, void *arg)
     172        hash_table_apply(&units_by_name, &repo_commit_unit, NULL);
     173}
     174
     175static bool repo_rollback_unit(ht_link_t *ht_link, void *arg)
    176176{
    177177        unit_t *unit = hash_table_get_inst(ht_link, unit_t, units_by_name);
     
    198198 * Memory used by removed object is released.
    199199 */
    200 void configuration_rollback(void)
    201 {
    202         sysman_log(LVL_DEBUG2, "%s", __func__);
    203 
    204         hash_table_apply(&units_by_name, &configuration_rollback_unit, NULL);
    205 }
    206 
    207 static bool configuration_resolve_unit(ht_link_t *ht_link, void *arg)
     200void repo_rollback(void)
     201{
     202        sysman_log(LVL_DEBUG2, "%s", __func__);
     203
     204        hash_table_apply(&units_by_name, &repo_rollback_unit, NULL);
     205}
     206
     207static bool repo_resolve_unit(ht_link_t *ht_link, void *arg)
    208208{
    209209        bool *has_error_ptr = arg;
     
    218218
    219219                unit_t *dependency =
    220                     configuration_find_unit_by_name(dep->dependency_name);
     220                    repo_find_unit_by_name(dep->dependency_name);
    221221                if (dependency == NULL) {
    222222                        sysman_log(LVL_ERROR,
     
    238238 * @return ENOENT  when one or more resolution fails, information is logged
    239239 */
    240 int configuration_resolve_dependecies(void)
     240int repo_resolve_dependecies(void)
    241241{
    242242        sysman_log(LVL_DEBUG2, "%s", __func__);
    243243
    244244        bool has_error = false;
    245         hash_table_apply(&units_by_name, &configuration_resolve_unit, &has_error);
     245        hash_table_apply(&units_by_name, &repo_resolve_unit, &has_error);
    246246
    247247        return has_error ? ENOENT : EOK;
    248248}
    249249
    250 unit_t *configuration_find_unit_by_name(const char *name)
     250unit_t *repo_find_unit_by_name(const char *name)
    251251{
    252252        ht_link_t *ht_link = hash_table_find(&units_by_name, (void *)name);
     
    258258}
    259259
    260 unit_t *configuration_find_unit_by_handle(unit_handle_t handle)
     260unit_t *repo_find_unit_by_handle(unit_handle_t handle)
    261261{
    262262        ht_link_t *ht_link = hash_table_find(&units_by_handle, &handle);
  • uspace/srv/sysman/repo.h

    r918ac9b raf92309  
    2727 */
    2828
    29 #ifndef SYSMAN_CONFIGURATION_H
    30 #define SYSMAN_CONFIGURATION_H
     29#ifndef SYSMAN_REPO_H
     30#define SYSMAN_REPO_H
    3131
    3232#include <adt/list.h>
     
    3737extern list_t units;
    3838
    39 extern void configuration_init(void);
     39extern void repo_init(void);
    4040
    41 extern int configuration_add_unit(unit_t *);
     41extern int repo_add_unit(unit_t *);
    4242
    43 extern void configuration_start_update(void);
     43extern void repo_begin_update(void);
    4444
    45 extern void configuration_commit(void);
     45extern void repo_commit(void);
    4646
    47 extern void configuration_rollback(void);
     47extern void repo_rollback(void);
    4848
    49 extern int configuration_resolve_dependecies(void);
     49extern int repo_resolve_dependecies(void);
    5050
    51 extern unit_t *configuration_find_unit_by_name(const char *);
    52 extern unit_t *configuration_find_unit_by_handle(unit_handle_t);
     51extern unit_t *repo_find_unit_by_name(const char *);
     52extern unit_t *repo_find_unit_by_handle(unit_handle_t);
    5353
    5454
  • uspace/srv/sysman/sm_task.c

    r918ac9b raf92309  
    3131#include <task.h>
    3232
    33 #include "configuration.h"
     33#include "repo.h"
    3434#include "log.h"
    3535#include "sysman.h"
  • uspace/srv/sysman/units/unit_cfg.c

    r918ac9b raf92309  
    3838#include <sysman/unit.h>
    3939
    40 #include "configuration.h"
     40#include "repo.h"
    4141#include "log.h"
    4242#include "unit.h"
     
    8282        }
    8383       
    84         unit_t *u = configuration_find_unit_by_name(unit_name);
     84        unit_t *u = repo_find_unit_by_name(unit_name);
    8585        if (u != NULL) {
    8686                // TODO allow updating configuration of existing unit
     
    162162        }
    163163
    164         configuration_start_update();
     164        repo_begin_update();
    165165
    166166        while ((de = readdir(dir))) {
     
    178178
    179179                assert(unit->state == STATE_EMBRYO);
    180                 configuration_add_unit(unit);
     180                repo_add_unit(unit);
    181181        }
    182182        closedir(dir);
    183183
    184         int rc = configuration_resolve_dependecies();
     184        int rc = repo_resolve_dependecies();
    185185        if (rc != EOK) {
    186                 configuration_rollback();
     186                repo_rollback();
    187187                return rc;
    188188        }
    189189
    190         configuration_commit();
     190        repo_commit();
    191191        return EOK;
    192192}
Note: See TracChangeset for help on using the changeset viewer.