Changeset 8436590 in mainline for uspace/srv
- Timestamp:
- 2011-04-07T21:38:17Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 033cbf82
- Parents:
- 3acb285a (diff), ccca251 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/srv
- Files:
-
- 25 edited
-
bd/ata_bd/ata_bd.c (modified) (5 diffs)
-
bd/ata_bd/ata_hw.h (modified) (1 diff)
-
devman/devman.c (modified) (22 diffs)
-
devman/devman.h (modified) (2 diffs)
-
devman/main.c (modified) (27 diffs)
-
devmap/devmap.c (modified) (1 diff)
-
hw/bus/cuda_adb/cuda_adb.c (modified) (2 diffs)
-
hw/netif/ne2000/dp8390.c (modified) (1 diff)
-
loader/arch/abs32le/_link.ld.in (modified) (1 diff)
-
loader/arch/amd64/_link.ld.in (modified) (1 diff)
-
loader/arch/arm32/_link.ld.in (modified) (1 diff)
-
loader/arch/ia32/_link.ld.in (modified) (1 diff)
-
loader/arch/ia64/_link.ld.in (modified) (2 diffs)
-
loader/arch/mips32/_link.ld.in (modified) (1 diff)
-
loader/arch/ppc32/_link.ld.in (modified) (1 diff)
-
loader/arch/sparc64/_link.ld.in (modified) (1 diff)
-
loader/main.c (modified) (1 diff)
-
net/il/arp/arp.c (modified) (13 diffs)
-
net/il/ip/ip.c (modified) (43 diffs)
-
net/net/net.c (modified) (5 diffs)
-
net/nil/eth/eth.c (modified) (2 diffs)
-
net/tl/tcp/tcp.c (modified) (4 diffs)
-
net/tl/tcp/tcp.h (modified) (1 diff)
-
net/tl/udp/udp.c (modified) (6 diffs)
-
vfs/vfs_file.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/ata_bd/ata_bd.c
r3acb285a r8436590 372 372 uint16_t w; 373 373 uint8_t c; 374 uint16_t bc; 374 375 size_t pos, len; 375 376 int rc; … … 387 388 } else if (rc == EIO) { 388 389 /* 389 * There is something, but not a register device. 390 * It could be a packet device. 390 * There is something, but not a register device. Check to see 391 * whether the IDENTIFY command left the packet signature in 392 * the registers in case this is a packet device. 393 * 394 * According to the ATA specification, the LBA low and 395 * interrupt reason registers should be set to 0x01. However, 396 * there are many devices that do not follow this and only set 397 * the byte count registers. So, only check these. 391 398 */ 392 rc = identify_pkt_dev(disk_id, &idata); 393 if (rc == EOK) { 394 /* We have a packet device. */ 395 d->dev_type = ata_pkt_dev; 399 bc = ((uint16_t)pio_read_8(&cmd->cylinder_high) << 8) | 400 pio_read_8(&cmd->cylinder_low); 401 402 if (bc == PDEV_SIGNATURE_BC) { 403 rc = identify_pkt_dev(disk_id, &idata); 404 if (rc == EOK) { 405 /* We have a packet device. */ 406 d->dev_type = ata_pkt_dev; 407 } else { 408 return EIO; 409 } 396 410 } else { 397 411 /* Nope. Something's there, but not recognized. */ … … 403 417 } 404 418 405 printf("device caps: 0x%04x\n", idata.caps);406 419 if (d->dev_type == ata_pkt_dev) { 407 420 /* Packet device */ … … 566 579 567 580 /* 568 * This is where we would most likely expect a non-existing device to 569 * show up by not setting SR_DRDY. 581 * Do not wait for DRDY to be set in case this is a packet device. 582 * We determine whether the device is present by waiting for DRQ to be 583 * set after issuing the command. 570 584 */ 571 if (wait_status( SR_DRDY, ~SR_BSY, NULL, TIMEOUT_PROBE) != EOK)585 if (wait_status(0, ~SR_BSY, NULL, TIMEOUT_PROBE) != EOK) 572 586 return ETIMEOUT; 573 587 … … 577 591 return ETIMEOUT; 578 592 593 /* 594 * If ERR is set, this may be a packet device, so return EIO to cause 595 * the caller to check for one. 596 */ 597 if ((status & SR_ERR) != 0) { 598 return EIO; 599 } 600 601 if (wait_status(SR_DRQ, ~SR_BSY, &status, TIMEOUT_PROBE) != EOK) 602 return ETIMEOUT; 603 579 604 /* Read data from the disk buffer. */ 580 605 581 if ((status & SR_DRQ) != 0) { 582 for (i = 0; i < identify_data_size / 2; i++) { 583 data = pio_read_16(&cmd->data_port); 584 ((uint16_t *) buf)[i] = data; 585 } 586 } 587 588 if ((status & SR_ERR) != 0) { 589 return EIO; 606 for (i = 0; i < identify_data_size / 2; i++) { 607 data = pio_read_16(&cmd->data_port); 608 ((uint16_t *) buf)[i] = data; 590 609 } 591 610 -
uspace/srv/bd/ata_bd/ata_hw.h
r3acb285a r8436590 293 293 }; 294 294 295 enum ata_pdev_signature { 296 /** 297 * Signature put by a packet device in byte count register 298 * in response to Identify command. 299 */ 300 PDEV_SIGNATURE_BC = 0xEB14 301 }; 302 295 303 #endif 296 304 -
uspace/srv/devman/devman.c
r3acb285a r8436590 148 148 149 149 log_msg(LVL_NOTE, "Driver `%s' was added to the list of available " 150 "drivers. \n", drv->name);150 "drivers.", drv->name); 151 151 } 152 152 … … 238 238 bool read_match_ids(const char *conf_path, match_id_list_t *ids) 239 239 { 240 log_msg(LVL_DEBUG, "read_match_ids(conf_path=\"%s\") \n", conf_path);240 log_msg(LVL_DEBUG, "read_match_ids(conf_path=\"%s\")", conf_path); 241 241 242 242 bool suc = false; … … 248 248 fd = open(conf_path, O_RDONLY); 249 249 if (fd < 0) { 250 log_msg(LVL_ERROR, "Unable to open `%s' for reading: %s. \n",250 log_msg(LVL_ERROR, "Unable to open `%s' for reading: %s.", 251 251 conf_path, str_error(fd)); 252 252 goto cleanup; … … 257 257 lseek(fd, 0, SEEK_SET); 258 258 if (len == 0) { 259 log_msg(LVL_ERROR, "Configuration file '%s' is empty. \n",259 log_msg(LVL_ERROR, "Configuration file '%s' is empty.", 260 260 conf_path); 261 261 goto cleanup; … … 265 265 if (buf == NULL) { 266 266 log_msg(LVL_ERROR, "Memory allocation failed when parsing file " 267 "'%s'. \n", conf_path);267 "'%s'.", conf_path); 268 268 goto cleanup; 269 269 } … … 271 271 ssize_t read_bytes = safe_read(fd, buf, len); 272 272 if (read_bytes <= 0) { 273 log_msg(LVL_ERROR, "Unable to read file '%s'. \n", conf_path);273 log_msg(LVL_ERROR, "Unable to read file '%s'.", conf_path); 274 274 goto cleanup; 275 275 } … … 309 309 bool get_driver_info(const char *base_path, const char *name, driver_t *drv) 310 310 { 311 log_msg(LVL_DEBUG, "get_driver_info(base_path=\"%s\", name=\"%s\") \n",311 log_msg(LVL_DEBUG, "get_driver_info(base_path=\"%s\", name=\"%s\")", 312 312 base_path, name); 313 313 … … 369 369 int lookup_available_drivers(driver_list_t *drivers_list, const char *dir_path) 370 370 { 371 log_msg(LVL_DEBUG, "lookup_available_drivers(dir=\"%s\") \n", dir_path);371 log_msg(LVL_DEBUG, "lookup_available_drivers(dir=\"%s\")", dir_path); 372 372 373 373 int drv_cnt = 0; … … 403 403 dev_node_t *dev; 404 404 405 log_msg(LVL_DEBUG, "create_root_nodes() \n");405 log_msg(LVL_DEBUG, "create_root_nodes()"); 406 406 407 407 fibril_rwlock_write_lock(&tree->rwlock); … … 488 488 void attach_driver(dev_node_t *dev, driver_t *drv) 489 489 { 490 log_msg(LVL_DEBUG, "attach_driver(dev=\"%s\",drv=\"%s\") \n",490 log_msg(LVL_DEBUG, "attach_driver(dev=\"%s\",drv=\"%s\")", 491 491 dev->pfun->pathname, drv->name); 492 492 … … 511 511 assert(fibril_mutex_is_locked(&drv->driver_mutex)); 512 512 513 log_msg(LVL_DEBUG, "start_driver(drv=\"%s\") \n", drv->name);513 log_msg(LVL_DEBUG, "start_driver(drv=\"%s\")", drv->name); 514 514 515 515 rc = task_spawnl(NULL, drv->binary_path, drv->binary_path, NULL); 516 516 if (rc != EOK) { 517 log_msg(LVL_ERROR, "Spawning driver `%s' (%s) failed: %s. \n",517 log_msg(LVL_ERROR, "Spawning driver `%s' (%s) failed: %s.", 518 518 drv->name, drv->binary_path, str_error(rc)); 519 519 return false; … … 578 578 int phone; 579 579 580 log_msg(LVL_DEBUG, "pass_devices_to_driver(driver=\"%s\") \n",580 log_msg(LVL_DEBUG, "pass_devices_to_driver(driver=\"%s\")", 581 581 driver->name); 582 582 … … 646 646 * immediately and possibly started here as well. 647 647 */ 648 log_msg(LVL_DEBUG, "Driver `%s' enters running state. \n", driver->name);648 log_msg(LVL_DEBUG, "Driver `%s' enters running state.", driver->name); 649 649 driver->state = DRIVER_RUNNING; 650 650 … … 663 663 void initialize_running_driver(driver_t *driver, dev_tree_t *tree) 664 664 { 665 log_msg(LVL_DEBUG, "initialize_running_driver(driver=\"%s\") \n",665 log_msg(LVL_DEBUG, "initialize_running_driver(driver=\"%s\")", 666 666 driver->name); 667 667 … … 754 754 * access any structures that would affect driver_t. 755 755 */ 756 log_msg(LVL_DEBUG, "add_device(drv=\"%s\", dev=\"%s\") \n",756 log_msg(LVL_DEBUG, "add_device(drv=\"%s\", dev=\"%s\")", 757 757 drv->name, dev->pfun->name); 758 758 … … 816 816 driver_t *drv = find_best_match_driver(drivers_list, dev); 817 817 if (drv == NULL) { 818 log_msg(LVL_ERROR, "No driver found for device `%s'. \n",818 log_msg(LVL_ERROR, "No driver found for device `%s'.", 819 819 dev->pfun->pathname); 820 820 return false; … … 854 854 bool init_device_tree(dev_tree_t *tree, driver_list_t *drivers_list) 855 855 { 856 log_msg(LVL_DEBUG, "init_device_tree() \n");856 log_msg(LVL_DEBUG, "init_device_tree()"); 857 857 858 858 tree->current_handle = 0; … … 1033 1033 fun->pathname = (char *) malloc(pathsize); 1034 1034 if (fun->pathname == NULL) { 1035 log_msg(LVL_ERROR, "Failed to allocate device path. \n");1035 log_msg(LVL_ERROR, "Failed to allocate device path."); 1036 1036 return false; 1037 1037 } … … 1064 1064 assert(fibril_rwlock_is_write_locked(&tree->rwlock)); 1065 1065 1066 log_msg(LVL_DEBUG, "insert_dev_node(dev=%p, pfun=%p [\"%s\"]) \n",1066 log_msg(LVL_DEBUG, "insert_dev_node(dev=%p, pfun=%p [\"%s\"])", 1067 1067 dev, pfun, pfun->pathname); 1068 1068 … … 1173 1173 } 1174 1174 1175 /** Find function with a specified name belonging to given device. 1176 * 1177 * Device tree rwlock should be held at least for reading. 1178 * 1179 * @param dev Device the function belongs to. 1180 * @param name Function name (not path). 1181 * @return Function node. 1182 * @retval NULL No function with given name. 1183 */ 1184 fun_node_t *find_fun_node_in_device(dev_node_t *dev, const char *name) 1185 { 1186 assert(dev != NULL); 1187 assert(name != NULL); 1188 1189 fun_node_t *fun; 1190 link_t *link; 1191 1192 for (link = dev->functions.next; 1193 link != &dev->functions; 1194 link = link->next) { 1195 fun = list_get_instance(link, fun_node_t, dev_functions); 1196 1197 if (str_cmp(name, fun->name) == 0) 1198 return fun; 1199 } 1200 1201 return NULL; 1202 } 1203 1204 /** Find function node by its class name and index. */ 1205 fun_node_t *find_fun_node_by_class(class_list_t *class_list, 1206 const char *class_name, const char *dev_name) 1207 { 1208 assert(class_list != NULL); 1209 assert(class_name != NULL); 1210 assert(dev_name != NULL); 1211 1212 fibril_rwlock_read_lock(&class_list->rwlock); 1213 1214 dev_class_t *cl = find_dev_class_no_lock(class_list, class_name); 1215 if (cl == NULL) { 1216 fibril_rwlock_read_unlock(&class_list->rwlock); 1217 return NULL; 1218 } 1219 1220 dev_class_info_t *dev = find_dev_in_class(cl, dev_name); 1221 if (dev == NULL) { 1222 fibril_rwlock_read_unlock(&class_list->rwlock); 1223 return NULL; 1224 } 1225 1226 fun_node_t *fun = dev->fun; 1227 1228 fibril_rwlock_read_unlock(&class_list->rwlock); 1229 1230 return fun; 1231 } 1232 1233 1175 1234 /** Find child function node with a specified name. 1176 1235 * … … 1183 1242 fun_node_t *find_node_child(fun_node_t *pfun, const char *name) 1184 1243 { 1185 fun_node_t *fun; 1186 link_t *link; 1187 1188 link = pfun->child->functions.next; 1189 1190 while (link != &pfun->child->functions) { 1191 fun = list_get_instance(link, fun_node_t, dev_functions); 1192 1193 if (str_cmp(name, fun->name) == 0) 1194 return fun; 1195 1196 link = link->next; 1197 } 1198 1199 return NULL; 1244 return find_fun_node_in_device(pfun->child, name); 1200 1245 } 1201 1246 … … 1359 1404 } 1360 1405 1406 dev_class_info_t *find_dev_in_class(dev_class_t *dev_class, const char *dev_name) 1407 { 1408 assert(dev_class != NULL); 1409 assert(dev_name != NULL); 1410 1411 link_t *link; 1412 for (link = dev_class->devices.next; 1413 link != &dev_class->devices; 1414 link = link->next) { 1415 dev_class_info_t *dev = list_get_instance(link, 1416 dev_class_info_t, link); 1417 1418 if (str_cmp(dev->dev_name, dev_name) == 0) { 1419 return dev; 1420 } 1421 } 1422 1423 return NULL; 1424 } 1425 1361 1426 void init_class_list(class_list_t *class_list) 1362 1427 { -
uspace/srv/devman/devman.h
r3acb285a r8436590 338 338 extern fun_node_t *find_fun_node(dev_tree_t *tree, devman_handle_t handle); 339 339 extern fun_node_t *find_fun_node_by_path(dev_tree_t *, char *); 340 extern fun_node_t *find_fun_node_in_device(dev_node_t *, const char *); 341 extern fun_node_t *find_fun_node_by_class(class_list_t *, const char *, const char *); 340 342 341 343 /* Device tree */ … … 359 361 extern dev_class_t *get_dev_class(class_list_t *, char *); 360 362 extern dev_class_t *find_dev_class_no_lock(class_list_t *, const char *); 363 extern dev_class_info_t *find_dev_in_class(dev_class_t *, const char *); 361 364 extern void add_dev_class_no_lock(class_list_t *, dev_class_t *); 362 365 -
uspace/srv/devman/main.c
r3acb285a r8436590 73 73 driver_t *driver = NULL; 74 74 75 log_msg(LVL_DEBUG, "devman_driver_register \n");75 log_msg(LVL_DEBUG, "devman_driver_register"); 76 76 77 77 iid = async_get_call(&icall); … … 90 90 } 91 91 92 log_msg(LVL_DEBUG, "The `%s' driver is trying to register. \n",92 log_msg(LVL_DEBUG, "The `%s' driver is trying to register.", 93 93 drv_name); 94 94 … … 97 97 98 98 if (driver == NULL) { 99 log_msg(LVL_ERROR, "No driver named `%s' was found. \n", drv_name);99 log_msg(LVL_ERROR, "No driver named `%s' was found.", drv_name); 100 100 free(drv_name); 101 101 drv_name = NULL; … … 108 108 109 109 /* Create connection to the driver. */ 110 log_msg(LVL_DEBUG, "Creating connection to the `%s' driver. \n",110 log_msg(LVL_DEBUG, "Creating connection to the `%s' driver.", 111 111 driver->name); 112 112 ipc_call_t call; … … 122 122 123 123 log_msg(LVL_NOTE, 124 "The `%s' driver was successfully registered as running. \n",124 "The `%s' driver was successfully registered as running.", 125 125 driver->name); 126 126 … … 147 147 if (DEVMAN_ADD_MATCH_ID != IPC_GET_IMETHOD(call)) { 148 148 log_msg(LVL_ERROR, 149 "Invalid protocol when trying to receive match id. \n");149 "Invalid protocol when trying to receive match id."); 150 150 async_answer_0(callid, EINVAL); 151 151 delete_match_id(match_id); … … 154 154 155 155 if (match_id == NULL) { 156 log_msg(LVL_ERROR, "Failed to allocate match id. \n");156 log_msg(LVL_ERROR, "Failed to allocate match id."); 157 157 async_answer_0(callid, ENOMEM); 158 158 return ENOMEM; … … 168 168 if (rc != EOK) { 169 169 delete_match_id(match_id); 170 log_msg(LVL_ERROR, "Failed to receive match id string: %s. \n",170 log_msg(LVL_ERROR, "Failed to receive match id string: %s.", 171 171 str_error(rc)); 172 172 return rc; … … 175 175 list_append(&match_id->link, &match_ids->ids); 176 176 177 log_msg(LVL_DEBUG, "Received match id `%s', score %d. \n",177 log_msg(LVL_DEBUG, "Received match id `%s', score %d.", 178 178 match_id->id, match_id->score); 179 179 return rc; … … 232 232 /* Unknown function type */ 233 233 log_msg(LVL_ERROR, 234 "Unknown function type %d provided by driver. \n",234 "Unknown function type %d provided by driver.", 235 235 (int) ftype); 236 236 … … 248 248 } 249 249 250 /* Check that function with same name is not there already. */ 251 if (find_fun_node_in_device(pdev, fun_name) != NULL) { 252 fibril_rwlock_write_unlock(&tree->rwlock); 253 async_answer_0(callid, EEXISTS); 254 printf(NAME ": Warning, driver tried to register `%s' twice.\n", 255 fun_name); 256 free(fun_name); 257 return; 258 } 259 250 260 fun_node_t *fun = create_fun_node(); 251 261 if (!insert_fun_node(&device_tree, fun, fun_name, pdev)) { … … 270 280 fibril_rwlock_write_unlock(&tree->rwlock); 271 281 272 log_msg(LVL_DEBUG, "devman_add_function(fun=\"%s\") \n", fun->pathname);282 log_msg(LVL_DEBUG, "devman_add_function(fun=\"%s\")", fun->pathname); 273 283 274 284 devman_receive_match_ids(match_count, &fun->match_ids); … … 352 362 devmap_register_class_dev(class_info); 353 363 354 log_msg(LVL_NOTE, "Function `%s' added to class `%s' as `%s'. \n",364 log_msg(LVL_NOTE, "Function `%s' added to class `%s' as `%s'.", 355 365 fun->pathname, class_name, class_info->dev_name); 356 366 … … 368 378 369 379 initialize_running_driver(driver, &device_tree); 370 log_msg(LVL_DEBUG, "The `%s` driver was successfully initialized. \n",380 log_msg(LVL_DEBUG, "The `%s` driver was successfully initialized.", 371 381 driver->name); 372 382 return 0; … … 391 401 if (fid == 0) { 392 402 log_msg(LVL_ERROR, "Failed to create initialization fibril " \ 393 "for driver `%s' .\n", driver->name);403 "for driver `%s'.", driver->name); 394 404 return; 395 405 } … … 443 453 } 444 454 455 /** Find handle for the device instance identified by device class name. */ 456 static void devman_function_get_handle_by_class(ipc_callid_t iid, 457 ipc_call_t *icall) 458 { 459 char *classname; 460 char *devname; 461 462 int rc = async_data_write_accept((void **) &classname, true, 0, 0, 0, 0); 463 if (rc != EOK) { 464 async_answer_0(iid, rc); 465 return; 466 } 467 rc = async_data_write_accept((void **) &devname, true, 0, 0, 0, 0); 468 if (rc != EOK) { 469 free(classname); 470 async_answer_0(iid, rc); 471 return; 472 } 473 474 475 fun_node_t *fun = find_fun_node_by_class(&class_list, 476 classname, devname); 477 478 free(classname); 479 free(devname); 480 481 if (fun == NULL) { 482 async_answer_0(iid, ENOENT); 483 return; 484 } 485 486 async_answer_1(iid, EOK, fun->handle); 487 } 488 445 489 446 490 /** Function for handling connections from a client to the device manager. */ … … 462 506 devman_function_get_handle(callid, &call); 463 507 break; 508 case DEVMAN_DEVICE_GET_HANDLE_BY_CLASS: 509 devman_function_get_handle_by_class(callid, &call); 510 break; 464 511 default: 465 512 async_answer_0(callid, ENOENT); … … 490 537 if (dev == NULL) { 491 538 log_msg(LVL_ERROR, "IPC forwarding failed - no device or " 492 "function with handle %" PRIun " was found. \n", handle);539 "function with handle %" PRIun " was found.", handle); 493 540 async_answer_0(iid, ENOENT); 494 541 return; … … 497 544 if (fun == NULL && !drv_to_parent) { 498 545 log_msg(LVL_ERROR, NAME ": devman_forward error - cannot " 499 "connect to handle %" PRIun ", refers to a device. \n",546 "connect to handle %" PRIun ", refers to a device.", 500 547 handle); 501 548 async_answer_0(iid, ENOENT); … … 520 567 if (driver == NULL) { 521 568 log_msg(LVL_ERROR, "IPC forwarding refused - " \ 522 "the device %" PRIun " is not in usable state. \n", handle);569 "the device %" PRIun " is not in usable state.", handle); 523 570 async_answer_0(iid, ENOENT); 524 571 return; … … 533 580 if (driver->phone <= 0) { 534 581 log_msg(LVL_ERROR, 535 "Could not forward to driver `%s' (phone is %d). \n",582 "Could not forward to driver `%s' (phone is %d).", 536 583 driver->name, (int) driver->phone); 537 584 async_answer_0(iid, EINVAL); … … 541 588 if (fun != NULL) { 542 589 log_msg(LVL_DEBUG, 543 "Forwarding request for `%s' function to driver `%s'. \n",590 "Forwarding request for `%s' function to driver `%s'.", 544 591 fun->pathname, driver->name); 545 592 } else { 546 593 log_msg(LVL_DEBUG, 547 "Forwarding request for `%s' device to driver `%s'. \n",594 "Forwarding request for `%s' device to driver `%s'.", 548 595 dev->pfun->pathname, driver->name); 549 596 } … … 579 626 IPC_FF_NONE); 580 627 log_msg(LVL_DEBUG, 581 "Forwarding devmapper request for `%s' function to driver `%s'. \n",628 "Forwarding devmapper request for `%s' function to driver `%s'.", 582 629 fun->pathname, dev->drv->name); 583 630 } … … 615 662 static bool devman_init(void) 616 663 { 617 log_msg(LVL_DEBUG, "devman_init - looking for available drivers. \n");664 log_msg(LVL_DEBUG, "devman_init - looking for available drivers."); 618 665 619 666 /* Initialize list of available drivers. */ … … 621 668 if (lookup_available_drivers(&drivers_list, 622 669 DRIVER_DEFAULT_STORE) == 0) { 623 log_msg(LVL_FATAL, " no drivers found.");670 log_msg(LVL_FATAL, "No drivers found."); 624 671 return false; 625 672 } 626 673 627 log_msg(LVL_DEBUG, "devman_init - list of drivers has been initialized. \n");674 log_msg(LVL_DEBUG, "devman_init - list of drivers has been initialized."); 628 675 629 676 /* Create root device node. */ … … 656 703 657 704 if (!devman_init()) { 658 log_msg(LVL_ERROR, "Error while initializing service. \n");705 log_msg(LVL_ERROR, "Error while initializing service."); 659 706 return -1; 660 707 } … … 665 712 /* Register device manager at naming service. */ 666 713 if (service_register(SERVICE_DEVMAN) != EOK) { 667 log_msg(LVL_ERROR, "Failed registering as a service. \n");714 log_msg(LVL_ERROR, "Failed registering as a service."); 668 715 return -1; 669 716 } -
uspace/srv/devmap/devmap.c
r3acb285a r8436590 551 551 if (devmap_device_find_name(namespace->name, device->name) != NULL) { 552 552 printf("%s: Device '%s/%s' already registered\n", NAME, 553 device->namespace->name, device->name);553 namespace->name, device->name); 554 554 devmap_namespace_destroy(namespace); 555 555 fibril_mutex_unlock(&devices_list_mutex); -
uspace/srv/hw/bus/cuda_adb/cuda_adb.c
r3acb285a r8436590 367 367 static void cuda_irq_rcv_end(void *buf, size_t *len) 368 368 { 369 uint8_t data,b;370 369 uint8_t b; 370 371 371 b = pio_read_8(&dev->b); 372 data =pio_read_8(&dev->sr);373 372 pio_read_8(&dev->sr); 373 374 374 if ((b & TREQ) == 0) { 375 375 instance->xstate = cx_receive; … … 379 379 cuda_send_start(); 380 380 } 381 382 memcpy(buf, instance->rcv_buf, instance->bidx);383 *len = instance->bidx;381 382 memcpy(buf, instance->rcv_buf, instance->bidx); 383 *len = instance->bidx; 384 384 instance->bidx = 0; 385 385 } -
uspace/srv/hw/netif/ne2000/dp8390.c
r3acb285a r8436590 391 391 392 392 if ((size < ETH_MIN_PACK_SIZE) || (size > ETH_MAX_PACK_SIZE_TAGGED)) { 393 fibril_mutex_unlock(&ne2k->sq_mutex); 393 394 fprintf(stderr, "%s: Frame dropped (invalid size %zu bytes)\n", 394 395 NAME, size); -
uspace/srv/loader/arch/abs32le/_link.ld.in
r3acb285a r8436590 21 21 22 22 .text : { 23 *(.text );24 *(.rodata *);23 *(.text .text.*); 24 *(.rodata .rodata.*); 25 25 } :text 26 26 -
uspace/srv/loader/arch/amd64/_link.ld.in
r3acb285a r8436590 27 27 28 28 .text : { 29 *(.text );30 *(.rodata *);29 *(.text .text.*); 30 *(.rodata .rodata.*); 31 31 } :text 32 32 -
uspace/srv/loader/arch/arm32/_link.ld.in
r3acb285a r8436590 25 25 26 26 .text : { 27 *(.text );28 *(.rodata *);27 *(.text .text.*); 28 *(.rodata .rodata.*); 29 29 } :text 30 30 -
uspace/srv/loader/arch/ia32/_link.ld.in
r3acb285a r8436590 26 26 27 27 .text : { 28 *(.text );29 *(.rodata *);28 *(.text .text.*); 29 *(.rodata .rodata.*); 30 30 } :text 31 31 -
uspace/srv/loader/arch/ia64/_link.ld.in
r3acb285a r8436590 21 21 22 22 .text : { 23 *(.text );24 *(.rodata *);23 *(.text .text.*); 24 *(.rodata .rodata.*); 25 25 } :text 26 26 … … 29 29 .got : { 30 30 _gp = .; 31 *(.got *);31 *(.got .got.*); 32 32 } :data 33 33 -
uspace/srv/loader/arch/mips32/_link.ld.in
r3acb285a r8436590 25 25 26 26 .text : { 27 *(.text );28 *(.rodata *);27 *(.text .text.*); 28 *(.rodata .rodata.*); 29 29 } :text 30 30 -
uspace/srv/loader/arch/ppc32/_link.ld.in
r3acb285a r8436590 25 25 26 26 .text : { 27 *(.text );28 *(.rodata *);27 *(.text .text.*); 28 *(.rodata .rodata.*); 29 29 } :text 30 30 -
uspace/srv/loader/arch/sparc64/_link.ld.in
r3acb285a r8436590 20 20 21 21 .text : { 22 *(.text );23 *(.rodata *);22 *(.text .text.*); 23 *(.rodata .rodata.*); 24 24 } :text 25 25 -
uspace/srv/loader/main.c
r3acb285a r8436590 407 407 /* Not reached */ 408 408 default: 409 retval = E NOENT;409 retval = EINVAL; 410 410 break; 411 411 } 412 if (IPC_GET_IMETHOD(call) != IPC_M_PHONE_HUNGUP) { 413 DPRINTF("Responding EINVAL to method %d.\n", 414 IPC_GET_IMETHOD(call)); 415 async_answer_0(callid, EINVAL); 416 } 412 413 if (IPC_GET_IMETHOD(call) != IPC_M_PHONE_HUNGUP) 414 async_answer_0(callid, retval); 417 415 } 418 416 } -
uspace/srv/net/il/arp/arp.c
r3acb285a r8436590 157 157 158 158 arp_clear_addr(&proto->addresses); 159 arp_addr_destroy(&proto->addresses );160 } 161 } 162 163 arp_protos_clear(&device->protos );159 arp_addr_destroy(&proto->addresses, free); 160 } 161 } 162 163 arp_protos_clear(&device->protos, free); 164 164 } 165 165 … … 184 184 } 185 185 186 arp_cache_clear(&arp_globals.cache );186 arp_cache_clear(&arp_globals.cache, free); 187 187 fibril_mutex_unlock(&arp_globals.lock); 188 188 … … 212 212 arp_clear_trans(trans); 213 213 214 arp_addr_exclude(&proto->addresses, address->value, address->length );214 arp_addr_exclude(&proto->addresses, address->value, address->length, free); 215 215 216 216 fibril_mutex_unlock(&arp_globals.lock); … … 345 345 header->protocol_length, trans); 346 346 if (rc != EOK) { 347 /* The generic char map has already freed trans! */347 free(trans); 348 348 return rc; 349 349 } … … 556 556 if (index < 0) { 557 557 fibril_mutex_unlock(&arp_globals.lock); 558 arp_protos_destroy(&device->protos );558 arp_protos_destroy(&device->protos, free); 559 559 free(device); 560 560 return index; … … 569 569 if (device->phone < 0) { 570 570 fibril_mutex_unlock(&arp_globals.lock); 571 arp_protos_destroy(&device->protos );571 arp_protos_destroy(&device->protos, free); 572 572 free(device); 573 573 return EREFUSED; … … 579 579 if (rc != EOK) { 580 580 fibril_mutex_unlock(&arp_globals.lock); 581 arp_protos_destroy(&device->protos );581 arp_protos_destroy(&device->protos, free); 582 582 free(device); 583 583 return rc; … … 589 589 if (rc != EOK) { 590 590 fibril_mutex_unlock(&arp_globals.lock); 591 arp_protos_destroy(&device->protos );591 arp_protos_destroy(&device->protos, free); 592 592 free(device); 593 593 return rc; … … 601 601 free(device->addr); 602 602 free(device->addr_data); 603 arp_protos_destroy(&device->protos );603 arp_protos_destroy(&device->protos, free); 604 604 free(device); 605 605 return rc; … … 614 614 free(device->broadcast_addr); 615 615 free(device->broadcast_data); 616 arp_protos_destroy(&device->protos );616 arp_protos_destroy(&device->protos, free); 617 617 free(device); 618 618 return rc; … … 746 746 arp_clear_trans(trans); 747 747 arp_addr_exclude(&proto->addresses, target->value, 748 target->length );748 target->length, free); 749 749 return EAGAIN; 750 750 } … … 794 794 trans); 795 795 if (rc != EOK) { 796 /* The generic char map has already freed trans! */796 free(trans); 797 797 return rc; 798 798 } … … 807 807 arp_clear_trans(trans); 808 808 arp_addr_exclude(&proto->addresses, target->value, 809 target->length );809 target->length, free); 810 810 return ENOENT; 811 811 } -
uspace/srv/net/il/ip/ip.c
r3acb285a r8436590 176 176 socklen_t addrlen; 177 177 178 / / detach the first packet and release the others178 /* Detach the first packet and release the others */ 179 179 next = pq_detach(packet); 180 180 if (next) … … 185 185 return ENOMEM; 186 186 187 / / get header187 /* Get header */ 188 188 header = (ip_header_t *) packet_get_data(packet); 189 189 if (!header) … … 192 192 } 193 193 194 / / only for the first fragment194 /* Only for the first fragment */ 195 195 if (IP_FRAGMENT_OFFSET(header)) 196 196 return EINVAL; 197 197 198 / / not for the ICMP protocol198 /* Not for the ICMP protocol */ 199 199 if (header->protocol == IPPROTO_ICMP) 200 200 return EPERM; 201 201 202 / / set the destination address202 /* Set the destination address */ 203 203 switch (header->version) { 204 204 case IPVERSION: … … 351 351 configuration = &names[0]; 352 352 353 / / get configuration353 /* Get configuration */ 354 354 rc = net_get_device_conf_req(ip_globals.net_phone, ip_netif->device_id, 355 355 &configuration, count, &data); … … 419 419 } 420 420 421 / / binds the netif service which also initializes the device421 /* Bind netif service which also initializes the device */ 422 422 ip_netif->phone = nil_bind_service(ip_netif->service, 423 423 (sysarg_t) ip_netif->device_id, SERVICE_IP, … … 429 429 } 430 430 431 / / has to be after the device netif module initialization431 /* Has to be after the device netif module initialization */ 432 432 if (ip_netif->arp) { 433 433 if (route) { … … 445 445 } 446 446 447 / / get packet dimensions447 /* Get packet dimensions */ 448 448 rc = nil_packet_size_req(ip_netif->phone, ip_netif->device_id, 449 449 &ip_netif->packet_dimension); … … 463 463 464 464 if (gateway.s_addr) { 465 / / the default gateway465 /* The default gateway */ 466 466 ip_globals.gateway.address.s_addr = 0; 467 467 ip_globals.gateway.netmask.s_addr = 0; … … 505 505 if (rc != EOK) { 506 506 fibril_rwlock_write_unlock(&ip_globals.netifs_lock); 507 ip_routes_destroy(&ip_netif->routes );507 ip_routes_destroy(&ip_netif->routes, free); 508 508 free(ip_netif); 509 509 return rc; … … 512 512 ip_netif->arp->usage++; 513 513 514 / / print the settings514 /* Print the settings */ 515 515 printf("%s: Device registered (id: %d, phone: %d, ipv: %d, conf: %s)\n", 516 516 NAME, ip_netif->device_id, ip_netif->phone, ip_netif->ipv, … … 587 587 ip_netif_t *netif; 588 588 589 / / start with the last netif - the newest one589 /* Start with the last netif - the newest one */ 590 590 index = ip_netifs_count(&ip_globals.netifs) - 1; 591 591 while (index >= 0) { … … 629 629 size_t length; 630 630 631 / / copy first itself631 /* Copy first itself */ 632 632 memcpy(last, first, sizeof(ip_header_t)); 633 633 length = sizeof(ip_header_t); 634 634 next = sizeof(ip_header_t); 635 635 636 / / process all ip options636 /* Process all IP options */ 637 637 while (next < first->header_length) { 638 638 option = (ip_option_t *) (((uint8_t *) first) + next); 639 / / skip end or noop639 /* Skip end or noop */ 640 640 if ((option->type == IPOPT_END) || 641 641 (option->type == IPOPT_NOOP)) { 642 642 next++; 643 643 } else { 644 / / copy if told so or skip644 /* Copy if told so or skip */ 645 645 if (IPOPT_COPIED(option->type)) { 646 646 memcpy(((uint8_t *) last) + length, … … 648 648 length += option->length; 649 649 } 650 / / next option650 /* Next option */ 651 651 next += option->length; 652 652 } 653 653 } 654 654 655 / / align 4 byte boundary655 /* Align 4 byte boundary */ 656 656 if (length % 4) { 657 657 bzero(((uint8_t *) last) + length, 4 - (length % 4)); … … 789 789 790 790 header->total_length = htons(length); 791 / / unnecessary for all protocols791 /* Unnecessary for all protocols */ 792 792 header->header_checksum = IP_HEADER_CHECKSUM(header); 793 793 … … 916 916 return ENOMEM; 917 917 918 / / get header918 /* Get header */ 919 919 header = (ip_header_t *) packet_get_data(packet); 920 920 if (!header) 921 921 return EINVAL; 922 922 923 / / fragmentation forbidden?923 /* Fragmentation forbidden? */ 924 924 if(header->flags & IPFLAG_DONT_FRAGMENT) 925 925 return EPERM; 926 926 927 / / create the last fragment927 /* Create the last fragment */ 928 928 new_packet = packet_get_4_remote(ip_globals.net_phone, prefix, length, 929 929 suffix, ((addrlen > addr_len) ? addrlen : addr_len)); … … 931 931 return ENOMEM; 932 932 933 / / allocate as much as originally933 /* Allocate as much as originally */ 934 934 last_header = (ip_header_t *) packet_suffix(new_packet, 935 935 IP_HEADER_LENGTH(header)); … … 939 939 ip_create_last_header(last_header, header); 940 940 941 / / trim the unused space941 /* Trim the unused space */ 942 942 rc = packet_trim(new_packet, 0, 943 943 IP_HEADER_LENGTH(header) - IP_HEADER_LENGTH(last_header)); … … 945 945 return ip_release_and_return(packet, rc); 946 946 947 / / biggest multiple of 8 lower than content947 /* Greatest multiple of 8 lower than content */ 948 948 // TODO even fragmentation? 949 949 length = length & ~0x7; … … 957 957 return ip_release_and_return(packet, rc); 958 958 959 / / mark the first as fragmented959 /* Mark the first as fragmented */ 960 960 header->flags |= IPFLAG_MORE_FRAGMENTS; 961 961 962 / / create middle framgents962 /* Create middle fragments */ 963 963 while (IP_TOTAL_LENGTH(header) > length) { 964 964 new_packet = packet_get_4_remote(ip_globals.net_phone, prefix, … … 981 981 } 982 982 983 / / finish the first fragment983 /* Finish the first fragment */ 984 984 header->header_checksum = IP_HEADER_CHECKSUM(header); 985 985 … … 1012 1012 1013 1013 next = packet; 1014 / / check all packets1014 /* Check all packets */ 1015 1015 while (next) { 1016 1016 length = packet_get_data_length(next); … … 1021 1021 } 1022 1022 1023 / / too long1023 /* Too long */ 1024 1024 result = ip_fragment_packet(next, content, prefix, 1025 1025 suffix, addr_len); … … 1027 1027 new_packet = pq_detach(next); 1028 1028 if (next == packet) { 1029 / / the new first packet of the queue1029 /* The new first packet of the queue */ 1030 1030 packet = new_packet; 1031 1031 } 1032 / / fragmentation needed?1032 /* Fragmentation needed? */ 1033 1033 if (result == EPERM) { 1034 1034 phone = ip_prepare_icmp_and_get_phone( 1035 1035 error, next, NULL); 1036 1036 if (phone >= 0) { 1037 / / fragmentation necessary ICMP1037 /* Fragmentation necessary ICMP */ 1038 1038 icmp_destination_unreachable_msg(phone, 1039 1039 ICMP_FRAG_NEEDED, content, next); … … 1080 1080 int rc; 1081 1081 1082 / / get destination hardware address1082 /* Get destination hardware address */ 1083 1083 if (netif->arp && (route->address.s_addr != dest.s_addr)) { 1084 1084 destination.value = route->gateway.s_addr ? … … 1102 1102 NULL); 1103 1103 if (phone >= 0) { 1104 / / unreachable ICMP if no routing1104 /* Unreachable ICMP if no routing */ 1105 1105 icmp_destination_unreachable_msg(phone, 1106 1106 ICMP_HOST_UNREACH, 0, packet); … … 1148 1148 int rc; 1149 1149 1150 // addresses in the host byte order 1151 // should be the next hop address or the target destination address 1150 /* 1151 * Addresses in the host byte order 1152 * Should be the next hop address or the target destination address 1153 */ 1152 1154 addrlen = packet_get_addr(packet, NULL, (uint8_t **) &addr); 1153 1155 if (addrlen < 0) … … 1174 1176 fibril_rwlock_read_lock(&ip_globals.netifs_lock); 1175 1177 1176 / / device specified?1178 /* Device specified? */ 1177 1179 if (device_id > 0) { 1178 1180 netif = ip_netifs_find(&ip_globals.netifs, device_id); … … 1190 1192 phone = ip_prepare_icmp_and_get_phone(error, packet, NULL); 1191 1193 if (phone >= 0) { 1192 / / unreachable ICMP if no routing1194 /* Unreachable ICMP if no routing */ 1193 1195 icmp_destination_unreachable_msg(phone, 1194 1196 ICMP_NET_UNREACH, 0, packet); … … 1198 1200 1199 1201 if (error) { 1200 // do not send for broadcast, anycast packets or network 1201 // broadcast 1202 /* 1203 * Do not send for broadcast, anycast packets or network 1204 * broadcast. 1205 */ 1202 1206 if (!dest->s_addr || !(~dest->s_addr) || 1203 1207 !(~((dest->s_addr & ~route->netmask.s_addr) | … … 1208 1212 } 1209 1213 1210 / / if the local host is the destination1214 /* If the local host is the destination */ 1211 1215 if ((route->address.s_addr == dest->s_addr) && 1212 1216 (dest->s_addr != IPV4_LOCALHOST_ADDRESS)) { 1213 / / find the loopback device to deliver1217 /* Find the loopback device to deliver */ 1214 1218 dest->s_addr = IPV4_LOCALHOST_ADDRESS; 1215 1219 route = ip_find_route(*dest); … … 1220 1224 NULL); 1221 1225 if (phone >= 0) { 1222 / / unreachable ICMP if no routing1226 /* Unreachable ICMP if no routing */ 1223 1227 icmp_destination_unreachable_msg(phone, 1224 1228 ICMP_HOST_UNREACH, 0, packet); … … 1252 1256 1253 1257 fibril_rwlock_write_lock(&ip_globals.netifs_lock); 1254 / / find the device1258 /* Find the device */ 1255 1259 netif = ip_netifs_find(&ip_globals.netifs, device_id); 1256 1260 if (!netif) { … … 1344 1348 return ip_release_and_return(packet, rc); 1345 1349 1346 / / trim padding if present1350 /* Trim padding if present */ 1347 1351 if (!error && 1348 1352 (IP_TOTAL_LENGTH(header) < packet_get_data_length(packet))) { … … 1360 1364 phone = ip_prepare_icmp_and_get_phone(error, packet, header); 1361 1365 if (phone >= 0) { 1362 / / unreachable ICMP1366 /* Unreachable ICMP */ 1363 1367 icmp_destination_unreachable_msg(phone, 1364 1368 ICMP_PROT_UNREACH, 0, packet); … … 1417 1421 return ip_release_and_return(packet, ENOMEM); 1418 1422 1419 / / checksum1423 /* Checksum */ 1420 1424 if ((header->header_checksum) && 1421 1425 (IP_HEADER_CHECKSUM(header) != IP_CHECKSUM_ZERO)) { 1422 1426 phone = ip_prepare_icmp_and_get_phone(0, packet, header); 1423 1427 if (phone >= 0) { 1424 / / checksum error ICMP1428 /* Checksum error ICMP */ 1425 1429 icmp_parameter_problem_msg(phone, ICMP_PARAM_POINTER, 1426 1430 ((size_t) ((void *) &header->header_checksum)) - … … 1433 1437 phone = ip_prepare_icmp_and_get_phone(0, packet, header); 1434 1438 if (phone >= 0) { 1435 / / ttl exceeded ICMP1439 /* TTL exceeded ICMP */ 1436 1440 icmp_time_exceeded_msg(phone, ICMP_EXC_TTL, packet); 1437 1441 } … … 1439 1443 } 1440 1444 1441 / / process ipopt and get destination1445 /* Process ipopt and get destination */ 1442 1446 dest = ip_get_destination(header); 1443 1447 1444 / / set the addrination address1448 /* Set the destination address */ 1445 1449 switch (header->version) { 1446 1450 case IPVERSION: … … 1464 1468 phone = ip_prepare_icmp_and_get_phone(0, packet, header); 1465 1469 if (phone >= 0) { 1466 / / unreachable ICMP1470 /* Unreachable ICMP */ 1467 1471 icmp_destination_unreachable_msg(phone, 1468 1472 ICMP_HOST_UNREACH, 0, packet); … … 1472 1476 1473 1477 if (route->address.s_addr == dest.s_addr) { 1474 / / local delivery1478 /* Local delivery */ 1475 1479 return ip_deliver_local(device_id, packet, header, 0); 1476 1480 } … … 1484 1488 phone = ip_prepare_icmp_and_get_phone(0, packet, header); 1485 1489 if (phone >= 0) { 1486 / / unreachable ICMP if no routing1490 /* Unreachable ICMP if no routing */ 1487 1491 icmp_destination_unreachable_msg(phone, ICMP_HOST_UNREACH, 0, 1488 1492 packet); … … 1770 1774 header = (ip_header_t *)(data + offset); 1771 1775 1772 / / destination host unreachable?1776 /* Destination host unreachable? */ 1773 1777 if ((type != ICMP_DEST_UNREACH) || 1774 1778 (code != ICMP_HOST_UNREACH)) { 1775 // no, something else1779 /* No, something else */ 1776 1780 break; 1777 1781 } … … 1787 1791 route = ip_routes_get_index(&netif->routes, 0); 1788 1792 1789 / / from the same network?1793 /* From the same network? */ 1790 1794 if (route && ((route->address.s_addr & route->netmask.s_addr) == 1791 1795 (header->destination_address & route->netmask.s_addr))) { 1792 / / clear the ARP mapping if any1796 /* Clear the ARP mapping if any */ 1793 1797 address.value = (uint8_t *) &header->destination_address; 1794 1798 address.length = sizeof(header->destination_address); … … 1844 1848 fibril_rwlock_read_lock(&ip_globals.lock); 1845 1849 route = ip_find_route(*dest); 1846 / / if the local host is the destination1850 /* If the local host is the destination */ 1847 1851 if (route && (route->address.s_addr == dest->s_addr) && 1848 1852 (dest->s_addr != IPV4_LOCALHOST_ADDRESS)) { 1849 / / find the loopback device to deliver1853 /* Find the loopback device to deliver */ 1850 1854 dest->s_addr = IPV4_LOCALHOST_ADDRESS; 1851 1855 route = ip_find_route(*dest); -
uspace/srv/net/net/net.c
r3acb285a r8436590 555 555 rc = read_netif_configuration(conf_files[i], netif); 556 556 if (rc != EOK) { 557 measured_strings_destroy(&netif->configuration );557 measured_strings_destroy(&netif->configuration, free); 558 558 free(netif); 559 559 return rc; … … 565 565 if (!setting) { 566 566 fprintf(stderr, "%s: Network interface name is missing\n", NAME); 567 measured_strings_destroy(&netif->configuration );567 measured_strings_destroy(&netif->configuration, free); 568 568 free(netif); 569 569 return EINVAL; … … 574 574 int index = netifs_add(&net_globals.netifs, netif->id, netif); 575 575 if (index < 0) { 576 measured_strings_destroy(&netif->configuration );576 measured_strings_destroy(&netif->configuration, free); 577 577 free(netif); 578 578 return index; … … 586 586 index); 587 587 if (rc != EOK) { 588 measured_strings_destroy(&netif->configuration );589 netifs_exclude_index(&net_globals.netifs, index );588 measured_strings_destroy(&netif->configuration, free); 589 netifs_exclude_index(&net_globals.netifs, index, free); 590 590 return rc; 591 591 } … … 595 595 printf("%s: Ignoring failed interface %s (%s)\n", NAME, 596 596 netif->name, str_error(rc)); 597 measured_strings_destroy(&netif->configuration );598 netifs_exclude_index(&net_globals.netifs, index );597 measured_strings_destroy(&netif->configuration, free); 598 netifs_exclude_index(&net_globals.netifs, index, free); 599 599 continue; 600 600 } -
uspace/srv/net/nil/eth/eth.c
r3acb285a r8436590 214 214 if (rc != EOK) { 215 215 free(eth_globals.broadcast_addr); 216 eth_devices_destroy(ð_globals.devices );216 eth_devices_destroy(ð_globals.devices, free); 217 217 } 218 218 out: … … 531 531 proto->service); 532 532 } else { 533 / / drop invalid/unknown533 /* Drop invalid/unknown */ 534 534 pq_release_remote(eth_globals.net_phone, 535 535 packet_get_id(packet)); -
uspace/srv/net/tl/tcp/tcp.c
r3acb285a r8436590 299 299 return tcp_release_and_return(packet, NO_DATA); 300 300 301 // printf("header len %d, port %d \n", TCP_HEADER_LENGTH(header), 302 // ntohs(header->destination_port)); 303 301 #if 0 302 printf("header len %d, port %d \n", TCP_HEADER_LENGTH(header), 303 ntohs(header->destination_port)); 304 #endif 304 305 result = packet_get_addr(packet, (uint8_t **) &src, (uint8_t **) &dest); 305 306 if (result <= 0) … … 1062 1063 tcp_process_acknowledgement(socket, socket_data, header); 1063 1064 1064 socket_data->next_incoming = ntohl(header->sequence_number); // + 1;1065 socket_data->next_incoming = ntohl(header->sequence_number); /* + 1; */ 1065 1066 pq_release_remote(tcp_globals.net_phone, packet_get_id(packet)); 1066 1067 socket_data->state = TCP_SOCKET_ESTABLISHED; … … 1707 1708 if (socket->port > 0) { 1708 1709 socket_ports_exclude(&tcp_globals.sockets, 1709 socket->port );1710 socket->port, free); 1710 1711 socket->port = 0; 1711 1712 } … … 2492 2493 rc = packet_dimensions_initialize(&tcp_globals.dimensions); 2493 2494 if (rc != EOK) { 2494 socket_ports_destroy(&tcp_globals.sockets );2495 socket_ports_destroy(&tcp_globals.sockets, free); 2495 2496 goto out; 2496 2497 } -
uspace/srv/net/tl/tcp/tcp.h
r3acb285a r8436590 190 190 int backlog; 191 191 192 // /** Segment size. */193 // size_t segment_size;194 195 192 /** 196 193 * Parent listening socket identifier. -
uspace/srv/net/tl/udp/udp.c
r3acb285a r8436590 417 417 rc = packet_dimensions_initialize(&udp_globals.dimensions); 418 418 if (rc != EOK) { 419 socket_ports_destroy(&udp_globals.sockets );419 socket_ports_destroy(&udp_globals.sockets, free); 420 420 fibril_rwlock_write_unlock(&udp_globals.lock); 421 421 return rc; … … 434 434 &data); 435 435 if (rc != EOK) { 436 socket_ports_destroy(&udp_globals.sockets );436 socket_ports_destroy(&udp_globals.sockets, free); 437 437 fibril_rwlock_write_unlock(&udp_globals.lock); 438 438 return rc; … … 499 499 device_id_t device_id; 500 500 packet_dimension_t *packet_dimension; 501 size_t size; 501 502 int rc; 503 504 /* In case of error, do not update the data fragment size. */ 505 *data_fragment_size = 0; 502 506 503 507 rc = tl_get_address_port(addr, addrlen, &dest_port); … … 539 543 packet_dimension = &udp_globals.packet_dimension; 540 544 // } 545 546 /* 547 * Update the data fragment size based on what the lower layers can 548 * handle without fragmentation, but not more than the maximum allowed 549 * for UDP. 550 */ 551 size = MAX_UDP_FRAGMENT_SIZE; 552 if (packet_dimension->content < size) 553 size = packet_dimension->content; 554 *data_fragment_size = size; 541 555 542 556 /* Read the first packet fragment */ … … 740 754 int socket_id; 741 755 size_t addrlen; 742 size_t size = 0;756 size_t size; 743 757 ipc_call_t answer; 744 758 size_t answer_count; … … 786 800 break; 787 801 802 size = MAX_UDP_FRAGMENT_SIZE; 788 803 if (tl_get_ip_packet_dimension(udp_globals.ip_phone, 789 804 &udp_globals.dimensions, DEVICE_INVALID_ID, 790 805 &packet_dimension) == EOK) { 791 SOCKET_SET_DATA_FRAGMENT_SIZE(answer,792 packet_dimension->content);806 if (packet_dimension->content < size) 807 size = packet_dimension->content; 793 808 } 794 795 // SOCKET_SET_DATA_FRAGMENT_SIZE(answer, 796 // MAX_UDP_FRAGMENT_SIZE); 809 SOCKET_SET_DATA_FRAGMENT_SIZE(answer, size); 797 810 SOCKET_SET_HEADER_SIZE(answer, UDP_HEADER_SIZE); 798 811 answer_count = 3; -
uspace/srv/vfs/vfs_file.c
r3acb285a r8436590 258 258 if ((fd >= 0) && (fd < MAX_OPEN_FILES)) { 259 259 vfs_file_t *file = FILES[fd]; 260 vfs_file_addref(file); 261 fibril_mutex_unlock(&VFS_DATA->lock); 262 return file; 260 if (file != NULL) { 261 vfs_file_addref(file); 262 fibril_mutex_unlock(&VFS_DATA->lock); 263 return file; 264 } 263 265 } 264 266 fibril_mutex_unlock(&VFS_DATA->lock);
Note:
See TracChangeset
for help on using the changeset viewer.
