Changeset af92309 in mainline for uspace/srv/sysman/repo.c


Ignore:
Timestamp:
2019-08-07T09:33:04Z (6 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.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • 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);
Note: See TracChangeset for help on using the changeset viewer.