Changeset af92309 in mainline for uspace/srv/sysman/repo.c
- Timestamp:
- 2019-08-07T09:33:04Z (6 years ago)
- 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)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/sysman/repo.c
r918ac9b raf92309 34 34 #include <fibril_synch.h> 35 35 36 #include " configuration.h"36 #include "repo.h" 37 37 #include "dep.h" 38 38 #include "log.h" … … 113 113 }; 114 114 115 /* Configurationfunctions */116 117 void configuration_init(void)115 /* Repository functions */ 116 117 void repo_init(void) 118 118 { 119 119 hash_table_create(&units_by_name, 0, 0, &units_by_name_ht_ops); … … 121 121 } 122 122 123 int configuration_add_unit(unit_t *unit)123 int repo_add_unit(unit_t *unit) 124 124 { 125 125 assert(unit); … … 141 141 } 142 142 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)143 void repo_begin_update(void) { 144 sysman_log(LVL_DEBUG2, "%s", __func__); 145 } 146 147 static bool repo_commit_unit(ht_link_t *ht_link, void *arg) 148 148 { 149 149 unit_t *unit = hash_table_get_inst(ht_link, unit_t, units_by_name); … … 162 162 163 163 /** Marks newly added units_by_name as usable (via state change) */ 164 void configuration_commit(void)164 void repo_commit(void) 165 165 { 166 166 sysman_log(LVL_DEBUG2, "%s", __func__); … … 170 170 * deps, thus eventually commiting all embryo deps as well. 171 171 */ 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 175 static bool repo_rollback_unit(ht_link_t *ht_link, void *arg) 176 176 { 177 177 unit_t *unit = hash_table_get_inst(ht_link, unit_t, units_by_name); … … 198 198 * Memory used by removed object is released. 199 199 */ 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)200 void 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 207 static bool repo_resolve_unit(ht_link_t *ht_link, void *arg) 208 208 { 209 209 bool *has_error_ptr = arg; … … 218 218 219 219 unit_t *dependency = 220 configuration_find_unit_by_name(dep->dependency_name);220 repo_find_unit_by_name(dep->dependency_name); 221 221 if (dependency == NULL) { 222 222 sysman_log(LVL_ERROR, … … 238 238 * @return ENOENT when one or more resolution fails, information is logged 239 239 */ 240 int configuration_resolve_dependecies(void)240 int repo_resolve_dependecies(void) 241 241 { 242 242 sysman_log(LVL_DEBUG2, "%s", __func__); 243 243 244 244 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); 246 246 247 247 return has_error ? ENOENT : EOK; 248 248 } 249 249 250 unit_t * configuration_find_unit_by_name(const char *name)250 unit_t *repo_find_unit_by_name(const char *name) 251 251 { 252 252 ht_link_t *ht_link = hash_table_find(&units_by_name, (void *)name); … … 258 258 } 259 259 260 unit_t * configuration_find_unit_by_handle(unit_handle_t handle)260 unit_t *repo_find_unit_by_handle(unit_handle_t handle) 261 261 { 262 262 ht_link_t *ht_link = hash_table_find(&units_by_handle, &handle);
Note:
See TracChangeset
for help on using the changeset viewer.