Changeset 50ad3f3 in mainline for uspace/srv/devman/main.c
- Timestamp:
- 2012-06-01T19:17:07Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1b054a6f
- Parents:
- b16e77d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/main.c
rb16e77d r50ad3f3 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 274 275 /* 275 276 * Try to find a suitable driver and assign it to the device. We do … … 288 289 } 289 290 fibril_add_ready(assign_fibril); 290 } else {291 } else 291 292 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 1151 1152 fwd_h = dev->pfun->handle; 1152 1153 } else if (dev->state == DEVICE_USABLE) { … … 1154 1155 driver = dev->drv; 1155 1156 assert(driver != NULL); 1156 1157 1157 1158 fwd_h = handle; 1158 1159 } … … 1181 1182 1182 1183 if (fun != NULL) { 1183 log_msg(LVL_DEBUG, 1184 log_msg(LVL_DEBUG, 1184 1185 "Forwarding request for `%s' function to driver `%s'.", 1185 1186 fun->pathname, driver->name); 1186 1187 } else { 1187 log_msg(LVL_DEBUG, 1188 log_msg(LVL_DEBUG, 1188 1189 "Forwarding request for `%s' device to driver `%s'.", 1189 1190 dev->pfun->pathname, driver->name); … … 1193 1194 async_forward_fast(iid, exch, method, fwd_h, 0, IPC_FF_NONE); 1194 1195 async_exchange_end(exch); 1195 1196 1196 1197 cleanup: 1197 1198 if (dev != NULL) 1198 1199 dev_del_ref(dev); 1200 1199 1201 if (fun != NULL) 1200 1202 fun_del_ref(fun); … … 1299 1301 return false; 1300 1302 } 1301 1303 1302 1304 log_msg(LVL_DEBUG, "devman_init - list of drivers has been initialized."); 1303 1305 1304 1306 /* Create root device node. */ 1305 1307 if (!init_device_tree(&device_tree, &drivers_list)) { … … 1307 1309 return false; 1308 1310 } 1309 1311 1310 1312 /* 1311 1313 * Caution: As the device manager is not a real loc … … 1322 1324 int main(int argc, char *argv[]) 1323 1325 { 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; 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; 1329 1332 } 1330 1333 … … 1333 1336 async_set_client_data_destructor(devman_client_data_destroy); 1334 1337 async_set_client_connection(devman_connection); 1335 1338 1336 1339 if (!devman_init()) { 1337 1340 log_msg(LVL_ERROR, "Error while initializing service."); 1338 1341 return -1; 1339 1342 } 1340 1343 1341 1344 /* Register device manager at naming service. */ 1342 if (service_register(SERVICE_DEVMAN) != EOK) { 1345 rc = service_register(SERVICE_DEVMAN); 1346 if (rc != EOK) { 1343 1347 log_msg(LVL_ERROR, "Failed registering as a service."); 1344 return -1;1345 } 1346 1347 printf( NAME ": Accepting connections.\n");1348 return rc; 1349 } 1350 1351 printf("%s: Accepting connections.\n", NAME); 1348 1352 task_retval(0); 1349 1353 async_manager(); 1350 1354 1351 1355 /* Never reached. */ 1352 1356 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.