Changes in uspace/srv/devman/main.c [50ad3f3:9d58539] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/main.c
r50ad3f3 r9d58539 245 245 246 246 fibril_rwlock_write_lock(&device_tree.rwlock); 247 247 248 248 if (fun->state == FUN_ON_LINE) { 249 249 fibril_rwlock_write_unlock(&device_tree.rwlock); … … 259 259 return ENOMEM; 260 260 } 261 261 262 262 insert_dev_node(&device_tree, dev, fun); 263 263 dev_add_ref(dev); … … 272 272 /* Give one reference over to assign_driver_fibril(). */ 273 273 dev_add_ref(dev); 274 275 274 /* 276 275 * Try to find a suitable driver and assign it to the device. We do … … 289 288 } 290 289 fibril_add_ready(assign_fibril); 291 } else 290 } else { 292 291 loc_register_tree_function(fun, &device_tree); 292 } 293 293 294 294 fibril_rwlock_write_unlock(&device_tree.rwlock); … … 1149 1149 if (dev->pfun->dev != NULL) 1150 1150 driver = dev->pfun->dev->drv; 1151 1152 1151 fwd_h = dev->pfun->handle; 1153 1152 } else if (dev->state == DEVICE_USABLE) { … … 1155 1154 driver = dev->drv; 1156 1155 assert(driver != NULL); 1157 1156 1158 1157 fwd_h = handle; 1159 1158 } … … 1182 1181 1183 1182 if (fun != NULL) { 1184 log_msg(LVL_DEBUG, 1183 log_msg(LVL_DEBUG, 1185 1184 "Forwarding request for `%s' function to driver `%s'.", 1186 1185 fun->pathname, driver->name); 1187 1186 } else { 1188 log_msg(LVL_DEBUG, 1187 log_msg(LVL_DEBUG, 1189 1188 "Forwarding request for `%s' device to driver `%s'.", 1190 1189 dev->pfun->pathname, driver->name); … … 1194 1193 async_forward_fast(iid, exch, method, fwd_h, 0, IPC_FF_NONE); 1195 1194 async_exchange_end(exch); 1196 1195 1197 1196 cleanup: 1198 1197 if (dev != NULL) 1199 1198 dev_del_ref(dev); 1200 1201 1199 if (fun != NULL) 1202 1200 fun_del_ref(fun); … … 1301 1299 return false; 1302 1300 } 1303 1301 1304 1302 log_msg(LVL_DEBUG, "devman_init - list of drivers has been initialized."); 1305 1303 1306 1304 /* Create root device node. */ 1307 1305 if (!init_device_tree(&device_tree, &drivers_list)) { … … 1309 1307 return false; 1310 1308 } 1311 1309 1312 1310 /* 1313 1311 * Caution: As the device manager is not a real loc … … 1324 1322 int main(int argc, char *argv[]) 1325 1323 { 1326 printf("%s: HelenOS Device Manager\n", NAME); 1327 1328 int rc = log_init(NAME, LVL_WARN); 1329 if (rc != EOK) { 1330 printf("%s: Error initializing logging subsystem.\n", NAME); 1331 return rc; 1324 printf(NAME ": HelenOS Device Manager\n"); 1325 1326 if (log_init(NAME, LVL_WARN) != EOK) { 1327 printf(NAME ": Error initializing logging subsystem.\n"); 1328 return -1; 1332 1329 } 1333 1330 … … 1336 1333 async_set_client_data_destructor(devman_client_data_destroy); 1337 1334 async_set_client_connection(devman_connection); 1338 1335 1339 1336 if (!devman_init()) { 1340 1337 log_msg(LVL_ERROR, "Error while initializing service."); 1341 1338 return -1; 1342 1339 } 1343 1340 1344 1341 /* Register device manager at naming service. */ 1345 rc = service_register(SERVICE_DEVMAN); 1346 if (rc != EOK) { 1342 if (service_register(SERVICE_DEVMAN) != EOK) { 1347 1343 log_msg(LVL_ERROR, "Failed registering as a service."); 1348 return rc;1349 } 1350 1351 printf( "%s: Accepting connections.\n", NAME);1344 return -1; 1345 } 1346 1347 printf(NAME ": Accepting connections.\n"); 1352 1348 task_retval(0); 1353 1349 async_manager(); 1354 1350 1355 1351 /* Never reached. */ 1356 1352 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.