Changeset 241f1985 in mainline for uspace/srv/sysman/units
- Timestamp:
- 2019-08-31T10:45:17Z (7 years ago)
- Children:
- 102f641
- Parents:
- f92b315
- git-author:
- Matthieu Riolo <matthieu.riolo@…> (2019-08-23 22:04:34)
- git-committer:
- Matthieu Riolo <matthieu.riolo@…> (2019-08-31 10:45:17)
- Location:
- uspace/srv/sysman/units
- Files:
-
- 3 edited
-
unit_cfg.c (modified) (9 diffs)
-
unit_mnt.c (modified) (6 diffs)
-
unit_svc.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/sysman/units/unit_cfg.c
rf92b315 r241f1985 55 55 * @param[out] unit_ptr Unit loaded from the file. Undefined when function fails. 56 56 */ 57 static int cfg_parse_file(const char *dirname, const char *filename,57 static errno_t cfg_parse_file(const char *dirname, const char *filename, 58 58 unit_t **unit_ptr) 59 59 { 60 int rc = EOK;60 errno_t rc = EOK; 61 61 unit_t *new_unit = NULL; 62 62 char *fn = NULL; … … 86 86 if (u != NULL) { 87 87 // TODO allow updating configuration of existing unit 88 rc = EEXIST S;88 rc = EEXIST; 89 89 goto finish; 90 90 } else { … … 136 136 list_foreach(text_parse.errors, link, text_parse_error_t, err) { 137 137 sysman_log(LVL_WARN, 138 "Error (%i) when parsing '%s' on line % i.",138 "Error (%i) when parsing '%s' on line %lu.", 139 139 err->parse_errno, fn, err->lineno); 140 140 } … … 151 151 } 152 152 153 static int cfg_load_configuration(const char *path)153 static errno_t cfg_load_configuration(const char *path) 154 154 { 155 155 DIR *dir; … … 167 167 while ((de = readdir(dir))) { 168 168 unit_t *unit = NULL; 169 int rc = cfg_parse_file(path, de->d_name, &unit);169 errno_t rc = cfg_parse_file(path, de->d_name, &unit); 170 170 if (rc != EOK) { 171 171 sysman_log(LVL_WARN, "Cannot load unit from file %s/%s", … … 183 183 closedir(dir); 184 184 185 int rc = repo_resolve_references();185 errno_t rc = repo_resolve_references(); 186 186 if (rc != EOK) { 187 187 repo_rollback(); … … 207 207 } 208 208 209 static int unit_cfg_load(unit_t *unit, ini_configuration_t *ini_conf,209 static errno_t unit_cfg_load(unit_t *unit, ini_configuration_t *ini_conf, 210 210 text_parse_t *text_parse) 211 211 { … … 225 225 } 226 226 227 static int unit_cfg_start(unit_t *unit)228 { 229 unit_cfg_t *u_cfg = CAST_CFG(unit); 230 assert(u_cfg); 231 232 int rc = cfg_load_configuration(u_cfg->path);227 static errno_t unit_cfg_start(unit_t *unit) 228 { 229 unit_cfg_t *u_cfg = CAST_CFG(unit); 230 assert(u_cfg); 231 232 errno_t rc = cfg_load_configuration(u_cfg->path); 233 233 234 234 if (rc == EOK) { … … 241 241 } 242 242 243 static int unit_cfg_stop(unit_t *unit)243 static errno_t unit_cfg_stop(unit_t *unit) 244 244 { 245 245 unit_cfg_t *u_cfg = CAST_CFG(unit); -
uspace/srv/sysman/units/unit_mnt.c
rf92b315 r241f1985 130 130 } 131 131 132 static int unit_mnt_load(unit_t *unit, ini_configuration_t *ini_conf,132 static errno_t unit_mnt_load(unit_t *unit, ini_configuration_t *ini_conf, 133 133 text_parse_t *text_parse) 134 134 { … … 148 148 } 149 149 150 static int mount_exec(void *arg)150 static errno_t mount_exec(void *arg) 151 151 { 152 152 mount_data_t *mnt_data = arg; … … 156 156 mnt_data->flags, mnt_data->instance); 157 157 158 int rc = mount(mnt_data->type, mnt_data->mountpoint, mnt_data->device,158 errno_t rc = vfs_mount_path(mnt_data->type, mnt_data->mountpoint, mnt_data->device, 159 159 mnt_data->options ? mnt_data->options : "", 160 160 mnt_data->flags, mnt_data->instance); … … 188 188 } 189 189 190 static int unit_mnt_start(unit_t *unit)190 static errno_t unit_mnt_start(unit_t *unit) 191 191 { 192 192 unit_mnt_t *u_mnt = CAST_MNT(unit); … … 228 228 } 229 229 230 static int unit_mnt_stop(unit_t *unit)230 static errno_t unit_mnt_stop(unit_t *unit) 231 231 { 232 232 unit_mnt_t *u_mnt = CAST_MNT(unit); … … 245 245 * unmount synchronously in the event loop fibril. 246 246 */ 247 int rc = unmount(u_mnt->mountpoint);247 errno_t rc = vfs_unmount_path(u_mnt->mountpoint); 248 248 249 249 if (rc == EOK) { -
uspace/srv/sysman/units/unit_svc.c
rf92b315 r241f1985 32 32 #include <stdlib.h> 33 33 #include <task.h> 34 #include <str.h> 34 35 35 36 #include "log.h" … … 58 59 } 59 60 60 static int unit_svc_load(unit_t *unit, ini_configuration_t *ini_conf,61 static errno_t unit_svc_load(unit_t *unit, ini_configuration_t *ini_conf, 61 62 text_parse_t *text_parse) 62 63 { … … 76 77 } 77 78 78 static int unit_svc_start(unit_t *unit)79 static errno_t unit_svc_start(unit_t *unit) 79 80 { 80 81 unit_svc_t *u_svc = CAST_SVC(unit); … … 84 85 assert(unit->state == STATE_STOPPED); 85 86 86 int rc = task_spawnv(&u_svc->main_task_id, NULL, u_svc->exec_start.path,87 errno_t rc = task_spawnv(&u_svc->main_task_id, NULL, u_svc->exec_start.path, 87 88 u_svc->exec_start.argv); 88 89 … … 100 101 */ 101 102 if (str_cmp(unit->name, "devman.svc") == 0) { 102 async_usleep(100000);103 fibril_usleep(100000); 103 104 if (console_kcon()) { 104 105 sysman_log(LVL_DEBUG2, "%s: Kconsole grabbed.", __func__); … … 111 112 } 112 113 113 static int unit_svc_stop(unit_t *unit)114 static errno_t unit_svc_stop(unit_t *unit) 114 115 { 115 116 unit_svc_t *u_svc = CAST_SVC(unit); … … 129 130 } 130 131 131 int rc = task_kill(u_svc->main_task_id);132 errno_t rc = task_kill(u_svc->main_task_id); 132 133 133 134 if (rc != EOK) {
Note:
See TracChangeset
for help on using the changeset viewer.
