Changeset 3f7e1f24 in mainline for uspace/srv/sysman/units
- Timestamp:
- 2019-08-03T08:28:26Z (7 years ago)
- Children:
- 095d03c
- Parents:
- d7c5fc0
- git-author:
- Michal Koutný <xm.koutny+hos@…> (2015-04-22 17:54:08)
- git-committer:
- Matthieu Riolo <matthieu.riolo@…> (2019-08-03 08:28:26)
- Location:
- uspace/srv/sysman/units
- Files:
-
- 3 edited
-
unit_cfg.c (modified) (3 diffs)
-
unit_mnt.c (modified) (1 diff)
-
unit_tgt.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/sysman/units/unit_cfg.c
rd7c5fc0 r3f7e1f24 176 176 } 177 177 178 assert(unit->state = STATE_EMBRYO);178 assert(unit->state == STATE_EMBRYO); 179 179 configuration_add_unit(unit); 180 180 } … … 232 232 assert(u_cfg); 233 233 234 /*235 * Skip starting state and hold state lock during whole configuration236 * load.237 */238 fibril_mutex_lock(&unit->state_mtx);239 234 int rc = cfg_load_configuration(u_cfg->path); 240 235 … … 244 239 unit->state = STATE_FAILED; 245 240 } 246 fibril_condvar_broadcast(&unit->state_cv);247 fibril_mutex_unlock(&unit->state_mtx);248 241 249 242 return rc; -
uspace/srv/sysman/units/unit_mnt.c
rd7c5fc0 r3f7e1f24 87 87 static int unit_mnt_start(unit_t *unit) 88 88 { 89 // TODO replace with non-blocking 90 const bool blocking = true; 89 91 unit_mnt_t *u_mnt = CAST_MNT(unit); 90 92 assert(u_mnt); 91 93 92 fibril_mutex_lock(&unit->state_mtx);93 94 94 95 // TODO think about unit's lifecycle (is STOPPED only acceptable?) 95 96 assert(unit->state == STATE_STOPPED); 96 unit->state = STATE_STARTING;97 98 fibril_condvar_broadcast(&unit->state_cv);99 fibril_mutex_unlock(&unit->state_mtx);100 97 101 98 102 99 // TODO use other mount parameters 103 100 int rc = mount(u_mnt->type, u_mnt->mountpoint, u_mnt->device, "", 104 IPC_FLAG_BLOCKING, 0);101 blocking ? IPC_FLAG_BLOCKING : 0, 0); 105 102 106 if (rc == EOK) { 107 sysman_log(LVL_NOTE, "Mount ('%s') mounted", unit_name(unit)); 108 unit_set_state(unit, STATE_STARTED); 103 if (blocking) { 104 if (rc == EOK) { 105 sysman_log(LVL_DEBUG, "Mount ('%s') mounted", unit_name(unit)); 106 unit->state = STATE_STARTED; 107 } else { 108 sysman_log(LVL_ERROR, "Mount ('%s') failed (%i)", 109 unit_name(unit), rc); 110 unit->state = STATE_FAILED; 111 } 109 112 } else { 110 sysman_log(LVL_ERROR, "Mount ('%s') failed (%i)", 111 unit_name(unit), rc); 112 unit_set_state(unit, STATE_FAILED); 113 if (rc == EOK) { 114 sysman_log(LVL_DEBUG, "Mount ('%s') requested", unit_name(unit)); 115 unit->state = STATE_STARTING; 116 } else { 117 sysman_log(LVL_ERROR, "Mount ('%s') request failed (%i)", 118 unit_name(unit), rc); 119 unit->state = STATE_FAILED; 120 } 113 121 } 114 122 -
uspace/srv/sysman/units/unit_tgt.c
rd7c5fc0 r3f7e1f24 59 59 assert(u_tgt); 60 60 61 unit->state = STATE_STARTED; 61 62 return EOK; 62 63 }
Note:
See TracChangeset
for help on using the changeset viewer.
