Changeset 25697163 in mainline
- Timestamp:
- 2019-10-06T19:47:15Z (5 years ago)
- Children:
- 9559cf8
- Parents:
- 102f641
- git-author:
- Matthieu Riolo <matthieu.riolo@…> (2019-09-06 17:58:36)
- git-committer:
- Matthieu Riolo <matthieu.riolo@…> (2019-10-06 19:47:15)
- Location:
- uspace
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/adt/dyn_array.c
r102f641 r25697163 44 44 #include <stdlib.h> 45 45 46 static int dyn_array_realloc(dyn_array_t *da, size_t capacity)46 static errno_t dyn_array_realloc(dyn_array_t *da, size_t capacity) 47 47 { 48 48 if (capacity == da->capacity) { … … 70 70 assert(index < da->size); 71 71 _dyn_array_unshift(da, index, 1); 72 int rc = dyn_array_reserve(da, da->size);72 errno_t rc = dyn_array_reserve(da, da->size); 73 73 assert(rc == EOK); 74 74 } … … 92 92 93 93 _dyn_array_unshift(da, begin, end - begin); 94 int rc = dyn_array_reserve(da, da->size);94 errno_t rc = dyn_array_reserve(da, da->size); 95 95 assert(rc == EOK); 96 96 } … … 104 104 * @return ENOMEM when allocation fails 105 105 */ 106 int dyn_array_concat(dyn_array_t *da1, dyn_array_t *da2)106 errno_t dyn_array_concat(dyn_array_t *da1, dyn_array_t *da2) 107 107 { 108 108 assert(da1->_item_size == da2->_item_size); 109 109 110 int rc = dyn_array_reserve(da1, da1->size + da2->size);110 errno_t rc = dyn_array_reserve(da1, da1->size + da2->size); 111 111 if (rc != EOK) { 112 112 return rc; … … 129 129 * @return ENOMEM 130 130 */ 131 int dyn_array_reserve(dyn_array_t *da, size_t capacity)131 errno_t dyn_array_reserve(dyn_array_t *da, size_t capacity) 132 132 { 133 133 const size_t factor = 2; -
uspace/lib/c/include/adt/dyn_array.h
r102f641 r25697163 36 36 #define LIBC_DYN_ARRAY_H_ 37 37 38 #include <errno.h> 38 39 #include <stdbool.h> 39 40 #include <stddef.h> … … 83 84 size_t _index = (index); \ 84 85 dyn_array_t *_da = (dyn_array); \ 85 int rc = dyn_array_reserve(_da, _da->size + 1); \86 errno_t rc = dyn_array_reserve(_da, _da->size + 1); \ 86 87 if (!rc) { \ 87 88 _dyn_array_shift(_da, _index, 1); \ … … 134 135 void dyn_array_clear(dyn_array_t *); 135 136 void dyn_array_clear_range(dyn_array_t *, size_t, size_t); 136 extern int dyn_array_concat(dyn_array_t *, dyn_array_t *);137 extern int dyn_array_reserve(dyn_array_t *, size_t);137 extern errno_t dyn_array_concat(dyn_array_t *, dyn_array_t *); 138 extern errno_t dyn_array_reserve(dyn_array_t *, size_t); 138 139 139 140 extern void _dyn_array_initialize(dyn_array_t *, size_t); -
uspace/lib/c/include/taskman_noasync.h
r102f641 r25697163 37 37 38 38 /* Internal functions to be used by NS only */ 39 extern int taskman_intro_ns_noasync(void);39 extern errno_t taskman_intro_ns_noasync(void); 40 40 41 41 extern void task_retval_noasync(int); -
uspace/lib/c/test/dyn_array.c
r102f641 r25697163 41 41 { 42 42 dyn_array_initialize(&da, data_t); 43 int rc = dyn_array_reserve(&da, 3);43 errno_t rc = dyn_array_reserve(&da, 3); 44 44 assert(rc == EOK); 45 45 } -
uspace/srv/sysman/connection_broker.c
r102f641 r25697163 60 60 sysarg_t retval; 61 61 62 int rc = async_data_write_accept((void **) &unit_name, true,62 errno_t rc = async_data_write_accept((void **) &unit_name, true, 63 63 0, 0, 0, NULL); 64 64 if (rc != EOK) { … … 89 89 90 90 /* Just accept data and further not supported. */ 91 int rc = async_data_write_accept((void **) &exposee, true,91 errno_t rc = async_data_write_accept((void **) &exposee, true, 92 92 0, 0, 0, NULL); 93 93 if (rc != EOK) { -
uspace/srv/sysman/connection_ctl.c
r102f641 r25697163 70 70 sysarg_t retval; 71 71 72 int rc = async_data_write_accept((void **) &unit_name, true,72 errno_t rc = async_data_write_accept((void **) &unit_name, true, 73 73 0, 0, 0, NULL); 74 74 if (rc != EOK) { … … 97 97 sysarg_t retval; 98 98 99 int rc = async_data_write_accept((void **) &unit_name, true,99 errno_t rc = async_data_write_accept((void **) &unit_name, true, 100 100 0, 0, 0, NULL); 101 101 if (rc != EOK) { … … 186 186 } 187 187 188 static int fill_handles_buffer(unit_handle_t *buffer, size_t size,188 static errno_t fill_handles_buffer(unit_handle_t *buffer, size_t size, 189 189 size_t *act_size) 190 190 { … … 213 213 size_t size; 214 214 size_t act_size; 215 int rc;215 errno_t rc; 216 216 217 217 if (!async_data_read_receive(&call, &size)) { -
uspace/srv/sysman/edge.c
r102f641 r25697163 77 77 } 78 78 79 int edge_sprout_out(unit_t *input, const char *output_name)79 errno_t edge_sprout_out(unit_t *input, const char *output_name) 80 80 { 81 int rc;81 errno_t rc; 82 82 unit_edge_t *e = edge_create(); 83 83 … … 123 123 * @return EEXIST 124 124 */ 125 int edge_connect(unit_t *input, unit_t *output)125 errno_t edge_connect(unit_t *input, unit_t *output) 126 126 { 127 127 if (edge_extract_internal(input, output)) { -
uspace/srv/sysman/edge.h
r102f641 r25697163 65 65 extern void edge_destroy(unit_edge_t **); 66 66 67 extern int edge_sprout_out(unit_t *, const char *);67 extern errno_t edge_sprout_out(unit_t *, const char *); 68 68 extern void edge_resolve_output(unit_edge_t *, unit_t *); 69 69 70 extern int edge_connect(unit_t *, unit_t *);70 extern errno_t edge_connect(unit_t *, unit_t *); 71 71 extern void edge_remove(unit_edge_t **); 72 72 -
uspace/srv/sysman/job.c
r102f641 r25697163 198 198 } 199 199 200 int rc;200 errno_t rc; 201 201 // TODO put here similar evaluation as in job_check 202 202 // goal is to have job_run "idempotent" -
uspace/srv/sysman/job_closure.c
r102f641 r25697163 51 51 * return result of visit (error stops further traversal) 52 52 */ 53 int (*visit)(unit_t *, unit_edge_t *, bfs_ops_t *, void *);53 errno_t (*visit)(unit_t *, unit_edge_t *, bfs_ops_t *, void *); 54 54 55 55 /** Clean units remaining in BFS queue after error */ … … 61 61 */ 62 62 63 static int job_add_blocked_job(job_t *blocking_job, job_t *blocked_job)63 static errno_t job_add_blocked_job(job_t *blocking_job, job_t *blocked_job) 64 64 { 65 65 assert(blocking_job->blocked_jobs.size == 66 66 blocking_job->blocked_jobs_count); 67 67 68 int rc = dyn_array_append(&blocking_job->blocked_jobs, job_t *,68 errno_t rc = dyn_array_append(&blocking_job->blocked_jobs, job_t *, 69 69 blocked_job); 70 70 if (rc != EOK) { … … 86 86 * @return EOK on success 87 87 */ 88 static int visit_propagate_job(unit_t *u, unit_edge_t *e, bfs_ops_t *ops,88 static errno_t visit_propagate_job(unit_t *u, unit_edge_t *e, bfs_ops_t *ops, 89 89 void *arg) 90 90 { 91 int rc = EOK;91 errno_t rc = EOK; 92 92 job_t *created_job = NULL; 93 93 job_closure_t *closure = arg; … … 138 138 } 139 139 140 static int visit_isolate(unit_t *u, unit_edge_t *e, bfs_ops_t *ops, void *arg)141 { 142 int rc = EOK;140 static errno_t visit_isolate(unit_t *u, unit_edge_t *e, bfs_ops_t *ops, void *arg) 141 { 142 errno_t rc = EOK; 143 143 job_t *created_job = NULL; 144 144 job_closure_t *closure = arg; … … 187 187 } 188 188 189 static int bfs_traverse_component_internal(unit_t *origin, bfs_ops_t *ops,189 static errno_t bfs_traverse_component_internal(unit_t *origin, bfs_ops_t *ops, 190 190 void *arg) 191 191 { 192 int rc;192 errno_t rc; 193 193 list_t units_fifo; 194 194 list_initialize(&units_fifo); … … 247 247 } 248 248 249 static int bfs_traverse_component(unit_t *origin, bfs_ops_t *ops, void *arg)249 static errno_t bfs_traverse_component(unit_t *origin, bfs_ops_t *ops, void *arg) 250 250 { 251 251 /* Check invariant */ … … 253 253 assert(u->bfs_tag == false); 254 254 } 255 int rc = bfs_traverse_component_internal(origin, ops, arg);255 errno_t rc = bfs_traverse_component_internal(origin, ops, arg); 256 256 257 257 /* Clean after ourselves (BFS tag jobs) */ … … 262 262 } 263 263 264 static int bfs_traverse_all(bfs_ops_t *ops, void *arg)264 static errno_t bfs_traverse_all(bfs_ops_t *ops, void *arg) 265 265 { 266 266 /* Check invariant */ … … 268 268 assert(u->bfs_tag == false); 269 269 } 270 int rc = EOK;270 errno_t rc = EOK; 271 271 272 272 repo_foreach(origin) { … … 299 299 * @return EOK on success otherwise propagated error 300 300 */ 301 int job_create_closure(job_t *main_job, job_closure_t *job_closure, int flags)301 errno_t job_create_closure(job_t *main_job, job_closure_t *job_closure, int flags) 302 302 { 303 303 sysman_log(LVL_DEBUG2, "%s(%s)", __func__, unit_name(main_job->unit)); … … 308 308 } 309 309 310 int rc = dyn_array_append(job_closure, job_t *, main_job);310 errno_t rc = dyn_array_append(job_closure, job_t *, main_job); 311 311 if (rc != EOK) { 312 312 return rc; -
uspace/srv/sysman/job_closure.h
r102f641 r25697163 38 38 typedef dyn_array_t job_closure_t; 39 39 40 extern int job_create_closure(job_t *, job_closure_t *, int);40 extern errno_t job_create_closure(job_t *, job_closure_t *, int); 41 41 42 42 #endif -
uspace/srv/sysman/job_queue.c
r102f641 r25697163 103 103 * @return error code on fail 104 104 */ 105 static int job_pre_merge(job_t *trunk, job_t *other)105 static errno_t job_pre_merge(job_t *trunk, job_t *other) 106 106 { 107 107 assert(trunk->unit == other->unit); … … 110 110 assert(other->merged_into == NULL); 111 111 112 int rc = dyn_array_concat(&trunk->blocked_jobs, &other->blocked_jobs);112 errno_t rc = dyn_array_concat(&trunk->blocked_jobs, &other->blocked_jobs); 113 113 if (rc != EOK) { 114 114 return rc; … … 134 134 */ 135 135 size_t observers_refs = sysman_observers_count(other); 136 int rc = sysman_move_observers(other, trunk);136 errno_t rc = sysman_move_observers(other, trunk); 137 137 assert(rc == EOK); 138 138 … … 166 166 * @return EBUSY when any job in closure is conflicting 167 167 */ 168 int job_queue_add_closure(job_closure_t *closure)168 errno_t job_queue_add_closure(job_closure_t *closure) 169 169 { 170 170 bool has_error = false; 171 int rc = EOK;171 errno_t rc = EOK; 172 172 173 173 /* Check consistency with existing jobs. */ -
uspace/srv/sysman/job_queue.h
r102f641 r25697163 33 33 34 34 extern void job_queue_init(void); 35 extern int job_queue_add_closure(job_closure_t *);35 extern errno_t job_queue_add_closure(job_closure_t *); 36 36 extern void job_queue_process(void); 37 37 -
uspace/srv/sysman/repo.c
r102f641 r25697163 151 151 } 152 152 153 int repo_add_unit(unit_t *unit)153 errno_t repo_add_unit(unit_t *unit) 154 154 { 155 155 assert(unit); … … 172 172 } 173 173 174 int repo_remove_unit(unit_t *unit)174 errno_t repo_remove_unit(unit_t *unit) 175 175 { 176 176 unit->repo_state = REPO_ZOMBIE; … … 283 283 * @return ENOENT when one or more resolution fails, information is logged 284 284 */ 285 int repo_resolve_references(void)285 errno_t repo_resolve_references(void) 286 286 { 287 287 sysman_log(LVL_DEBUG2, "%s", __func__); -
uspace/srv/sysman/repo.h
r102f641 r25697163 64 64 extern void repo_init(void); 65 65 66 extern int repo_add_unit(unit_t *);67 extern int repo_remove_unit(unit_t *);66 extern errno_t repo_add_unit(unit_t *); 67 extern errno_t repo_remove_unit(unit_t *); 68 68 69 69 extern void repo_begin_update(void); … … 73 73 extern void repo_rollback(void); 74 74 75 extern int repo_resolve_references(void);75 extern errno_t repo_resolve_references(void); 76 76 77 77 extern unit_t *repo_find_unit_by_name(const char *); -
uspace/srv/sysman/sm_task.c
r102f641 r25697163 88 88 unit_t *u_svc = unit_create(UNIT_SERVICE); 89 89 bool in_repo_update = false; 90 int rc = EOK;90 errno_t rc = EOK; 91 91 92 92 if (u_svc == NULL) { … … 139 139 { 140 140 repo_begin_update(); 141 int rc = repo_remove_unit(&u_svc->unit);141 errno_t rc = repo_remove_unit(&u_svc->unit); 142 142 if (rc != EOK) { 143 143 sysman_log(LVL_WARN, "Can't remove unit %s (%i).", -
uspace/srv/sysman/sysman.c
r102f641 r25697163 375 375 free(job_args); 376 376 377 int rc = job_create_closure(job, &job_closure, flags);377 errno_t rc = job_create_closure(job, &job_closure, flags); 378 378 if (rc != EOK) { 379 379 sysman_log(LVL_ERROR, "Cannot create closure for job %p (%i)", -
uspace/srv/sysman/test/job_closure.c
r102f641 r25697163 114 114 115 115 dyn_array_initialize(&exp_closure, job_t *); 116 int rc = dyn_array_reserve(&exp_closure, MAX_TYPES * MAX_UNITS);116 errno_t rc = dyn_array_reserve(&exp_closure, MAX_TYPES * MAX_UNITS); 117 117 assert(rc == EOK); 118 118 … … 153 153 assert(main_job); 154 154 155 int rc = job_create_closure(main_job, &act_closure, 0);155 errno_t rc = job_create_closure(main_job, &act_closure, 0); 156 156 PCUT_ASSERT_INT_EQUALS(EOK, rc); 157 157 … … 185 185 assert(main_job); 186 186 187 int rc = job_create_closure(main_job, &act_closure, 0);187 errno_t rc = job_create_closure(main_job, &act_closure, 0); 188 188 PCUT_ASSERT_INT_EQUALS(EOK, rc); 189 189 … … 219 219 assert(main_job); 220 220 221 int rc = job_create_closure(main_job, &act_closure, 0);221 errno_t rc = job_create_closure(main_job, &act_closure, 0); 222 222 PCUT_ASSERT_INT_EQUALS(EOK, rc); 223 223 … … 266 266 assert(main_job); 267 267 268 int rc = job_create_closure(main_job, &act_closure, CLOSURE_ISOLATE);268 errno_t rc = job_create_closure(main_job, &act_closure, CLOSURE_ISOLATE); 269 269 PCUT_ASSERT_INT_EQUALS(EOK, rc); 270 270 -
uspace/srv/sysman/test/job_queue.c
r102f641 r25697163 86 86 job_t *job = NULL; 87 87 88 int rc = sysman_run_job(u, STATE_STARTED, 0, &job_finished_cb,88 errno_t rc = sysman_run_job(u, STATE_STARTED, 0, &job_finished_cb, 89 89 &job); 90 90 PCUT_ASSERT_INT_EQUALS(EOK, rc); … … 106 106 job_t *job = NULL; 107 107 108 int rc = sysman_run_job(u, STATE_STARTED, 0, &job_finished_cb, &job);108 errno_t rc = sysman_run_job(u, STATE_STARTED, 0, &job_finished_cb, &job); 109 109 PCUT_ASSERT_INT_EQUALS(EOK, rc); 110 110 … … 147 147 /* Run test */ 148 148 job_t *job = NULL; 149 int rc = sysman_run_job(s1, STATE_STARTED, 0, &job_finished_cb, &job);149 errno_t rc = sysman_run_job(s1, STATE_STARTED, 0, &job_finished_cb, &job); 150 150 PCUT_ASSERT_INT_EQUALS(EOK, rc); 151 151 … … 169 169 /* Create and start first job */ 170 170 job_t *j0 = NULL; 171 int rc = sysman_run_job(s0, STATE_STARTED, 0, &job_finished_cb, &j0);171 errno_t rc = sysman_run_job(s0, STATE_STARTED, 0, &job_finished_cb, &j0); 172 172 PCUT_ASSERT_INT_EQUALS(EOK, rc); 173 173 -
uspace/srv/sysman/test/mock_unit.c
r102f641 r25697163 78 78 void mock_add_edge(unit_t *input, unit_t *output) 79 79 { 80 int rc = edge_connect(input, output);80 errno_t rc = edge_connect(input, output); 81 81 assert(rc == EOK); 82 82 … … 87 87 } 88 88 89 int mock_unit_vmt_start_sync(unit_t *unit)89 errno_t mock_unit_vmt_start_sync(unit_t *unit) 90 90 { 91 91 unit->state = STATE_STARTED; … … 93 93 } 94 94 95 int mock_unit_vmt_start_async(unit_t *unit)95 errno_t mock_unit_vmt_start_async(unit_t *unit) 96 96 { 97 97 unit->state = STATE_STARTING; -
uspace/srv/sysman/test/mock_unit.h
r102f641 r25697163 48 48 extern void mock_add_edge(unit_t *, unit_t *); 49 49 50 extern int mock_unit_vmt_start_sync(unit_t *);51 extern int mock_unit_vmt_start_async(unit_t *);50 extern errno_t mock_unit_vmt_start_sync(unit_t *); 51 extern errno_t mock_unit_vmt_start_async(unit_t *); 52 52 extern void mock_unit_vmt_exposee_created(unit_t *); 53 53 -
uspace/srv/sysman/unit.c
r102f641 r25697163 105 105 } 106 106 107 int unit_load(unit_t *unit, ini_configuration_t *ini_conf,107 errno_t unit_load(unit_t *unit, ini_configuration_t *ini_conf, 108 108 text_parse_t *text_parse) 109 109 { 110 110 sysman_log(LVL_DEBUG, "%s('%s')", __func__, unit_name(unit)); 111 111 112 int rc = EOK;112 errno_t rc = EOK; 113 113 ini_section_t *unit_section = ini_get_section(ini_conf, section_name); 114 114 if (unit_section) { … … 135 135 * - STATE_FAILED. (unit state changed and error occured) 136 136 */ 137 int unit_start(unit_t *unit)137 errno_t unit_start(unit_t *unit) 138 138 { 139 139 sysman_log(LVL_NOTE, "%s('%s')", __func__, unit_name(unit)); … … 145 145 * Same semantics like for unit_start applies. 146 146 */ 147 int unit_stop(unit_t *unit)147 errno_t unit_stop(unit_t *unit) 148 148 { 149 149 sysman_log(LVL_NOTE, "%s('%s')", __func__, unit_name(unit)); -
uspace/srv/sysman/unit.h
r102f641 r25697163 120 120 void (*destroy)(unit_t *); 121 121 122 int (*load)(unit_t *, ini_configuration_t *, text_parse_t *);122 errno_t (*load)(unit_t *, ini_configuration_t *, text_parse_t *); 123 123 124 int (*start)(unit_t *);124 errno_t (*start)(unit_t *); 125 125 126 int (*stop)(unit_t *);126 errno_t (*stop)(unit_t *); 127 127 128 128 void (*exposee_created)(unit_t *); … … 150 150 extern void unit_destroy(unit_t **); 151 151 152 extern int unit_load(unit_t *, ini_configuration_t *, text_parse_t *);153 extern int unit_start(unit_t *);154 extern int unit_stop(unit_t *);152 extern errno_t unit_load(unit_t *, ini_configuration_t *, text_parse_t *); 153 extern errno_t unit_start(unit_t *); 154 extern errno_t unit_stop(unit_t *); 155 155 extern void unit_exposee_created(unit_t *); 156 156 extern void unit_fail(unit_t *); -
uspace/srv/sysman/units/unit_tgt.c
r102f641 r25697163 45 45 } 46 46 47 static int unit_tgt_load(unit_t *unit, ini_configuration_t *ini_conf,47 static errno_t unit_tgt_load(unit_t *unit, ini_configuration_t *ini_conf, 48 48 text_parse_t *text_parse) 49 49 { … … 54 54 } 55 55 56 static int unit_tgt_start(unit_t *unit)56 static errno_t unit_tgt_start(unit_t *unit) 57 57 { 58 58 unit_tgt_t *u_tgt = CAST_TGT(unit); … … 63 63 } 64 64 65 static int unit_tgt_stop(unit_t *unit)65 static errno_t unit_tgt_stop(unit_t *unit) 66 66 { 67 67 unit_tgt_t *u_tgt = CAST_TGT(unit); -
uspace/srv/taskman/task.c
r102f641 r25697163 119 119 } 120 120 121 int tasks_init(void)121 errno_t tasks_init(void) 122 122 { 123 123 if (!hash_table_create(&task_hash_table, 0, 0, &task_hash_table_ops)) { … … 191 191 } 192 192 193 int task_intro(task_id_t id)194 { 195 int rc = EOK;193 errno_t task_intro(task_id_t id) 194 { 195 errno_t rc = EOK; 196 196 197 197 fibril_rwlock_write_lock(&task_hash_table_lock); -
uspace/srv/taskman/task.h
r102f641 r25697163 77 77 extern fibril_rwlock_t task_hash_table_lock; 78 78 79 extern int tasks_init(void);79 extern errno_t tasks_init(void); 80 80 81 81 extern task_t *task_get_by_id(task_id_t); … … 85 85 extern void task_remove(task_t **); 86 86 87 extern int task_intro(task_id_t);87 extern errno_t task_intro(task_id_t); 88 88 89 89 #endif
Note:
See TracChangeset
for help on using the changeset viewer.