Changeset d011038 in mainline for uspace/srv
- Timestamp:
- 2011-03-29T20:12:44Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8f17503
- Parents:
- c4fb95d3 (diff), 93ebe4e (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:
-
- 1 deleted
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/devman.c
rc4fb95d3 rd011038 266 266 } 267 267 268 if (read(fd, buf, len) <= 0) { 268 ssize_t read_bytes = safe_read(fd, buf, len); 269 if (read_bytes <= 0) { 269 270 printf(NAME ": unable to read file '%s'.\n", conf_path); 270 271 goto cleanup; 271 272 } 272 buf[ len] = 0;273 buf[read_bytes] = 0; 273 274 274 275 suc = parse_match_ids(buf, ids); … … 1123 1124 fun_node_t *find_fun_node_by_path(dev_tree_t *tree, char *path) 1124 1125 { 1126 assert(path != NULL); 1127 1128 bool is_absolute = path[0] == '/'; 1129 if (!is_absolute) { 1130 return NULL; 1131 } 1132 1125 1133 fibril_rwlock_read_lock(&tree->rwlock); 1126 1134 … … 1132 1140 char *rel_path = path; 1133 1141 char *next_path_elem = NULL; 1134 bool cont = (rel_path[0] == '/');1142 bool cont = true; 1135 1143 1136 1144 while (cont && fun != NULL) { -
uspace/srv/devman/main.c
rc4fb95d3 rd011038 477 477 dev = fun->dev; 478 478 479 if (fun == NULL && dev == NULL) { 479 /* 480 * For a valid function to connect to we need a device. The root 481 * function, for example, has no device and cannot be connected to. 482 * This means @c dev needs to be valid regardless whether we are 483 * connecting to a device or to a function. 484 */ 485 if (dev == NULL) { 480 486 printf(NAME ": devman_forward error - no device or function with " 481 487 "handle %" PRIun " was found.\n", handle); … … 562 568 } 563 569 564 async_forward_fast(iid, dev->drv->phone, DRIVER_CLIENT, dev->handle, 0,570 async_forward_fast(iid, dev->drv->phone, DRIVER_CLIENT, fun->handle, 0, 565 571 IPC_FF_NONE); 566 572 printf(NAME ": devman_connection_devmapper: forwarded connection to " -
uspace/srv/devman/util.c
rc4fb95d3 rd011038 111 111 } 112 112 113 ssize_t safe_read(int fd, void *buffer, size_t size) 114 { 115 if (size == 0) { 116 return 0; 117 } 118 119 uint8_t *buf_ptr = (uint8_t *) buffer; 120 121 size_t total_read = 0; 122 while (total_read < size) { 123 ssize_t bytes_read = read(fd, buf_ptr, size - total_read); 124 if (bytes_read < 0) { 125 /* Error. */ 126 return bytes_read; 127 } else if (bytes_read == 0) { 128 /* Possibly end of file. */ 129 break; 130 } else { 131 /* Read at least something. */ 132 buf_ptr += bytes_read; 133 total_read += bytes_read; 134 } 135 } 136 137 return (ssize_t) total_read; 138 } 139 113 140 /** @} 114 141 */ -
uspace/srv/devman/util.h
rc4fb95d3 rd011038 47 47 extern void replace_char(char *, char, char); 48 48 49 extern ssize_t safe_read(int, void *, size_t); 50 49 51 #endif 50 52 -
uspace/srv/devmap/devmap.c
rc4fb95d3 rd011038 123 123 static devmap_handle_t last_handle = 0; 124 124 static devmap_device_t *null_devices[NULL_DEVICES]; 125 126 /* 127 * Dummy list for null devices. This is necessary so that null devices can 128 * be used just as any other devices, e.g. in devmap_device_unregister_core(). 129 */ 130 static LIST_INITIALIZE(dummy_null_driver_devices); 125 131 126 132 static devmap_handle_t devmap_create_handle(void) … … 953 959 device->name = dev_name; 954 960 955 /* Insert device into list of all devices 956 and into null devices array */ 961 /* 962 * Insert device into list of all devices and into null devices array. 963 * Insert device into a dummy list of null driver's devices so that it 964 * can be safely removed later. 965 */ 957 966 list_append(&device->devices, &devices_list); 967 list_append(&device->driver_devices, &dummy_null_driver_devices); 958 968 null_devices[i] = device; 959 969 -
uspace/srv/fs/fat/fat_ops.c
rc4fb95d3 rd011038 325 325 uint16_t_le2host(d->firstc)); 326 326 if (rc != EOK) { 327 (void) block_put(b); 327 328 (void) fat_node_put(FS_NODE(nodep)); 328 329 return rc; … … 811 812 fibril_mutex_unlock(&childp->idx->lock); 812 813 childp->lnkcnt = 0; 814 childp->refcnt++; /* keep the node in memory until destroyed */ 813 815 childp->dirty = true; 814 816 fibril_mutex_unlock(&childp->lock); … … 1488 1490 fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request); 1489 1491 fs_node_t *fn; 1492 fat_node_t *nodep; 1490 1493 int rc; 1491 1494 … … 1499 1502 return; 1500 1503 } 1504 1505 nodep = FAT_NODE(fn); 1506 /* 1507 * We should have exactly two references. One for the above 1508 * call to fat_node_get() and one from fat_unlink(). 1509 */ 1510 assert(nodep->refcnt == 2); 1501 1511 1502 1512 rc = fat_destroy_node(fn); -
uspace/srv/hid/console/gcons.c
rc4fb95d3 rd011038 285 285 ssize_t nx = (ssize_t) mouse_x + dx; 286 286 ssize_t ny = (ssize_t) mouse_y + dy; 287 288 if (!use_gcons) 287 288 /* Until gcons is initalized we don't have the screen resolution */ 289 if (xres == 0 || yres == 0) 289 290 return; 290 291 -
uspace/srv/hid/kbd/Makefile
rc4fb95d3 rd011038 78 78 SOURCES += \ 79 79 port/pl050.c \ 80 ctl/p l050.c80 ctl/pc.c 81 81 endif 82 82 endif -
uspace/srv/hid/kbd/generic/kbd.c
rc4fb95d3 rd011038 67 67 static unsigned lock_keys; 68 68 69 int cir_service = 0;70 int cir_phone = -1;69 bool irc_service = false; 70 int irc_phone = -1; 71 71 72 72 #define NUM_LAYOUTS 3 … … 216 216 sysarg_t obio; 217 217 218 if ((sysinfo_get_value("kbd.cir.fhc", &fhc) == EOK) && (fhc)) 219 cir_service = SERVICE_FHC; 220 else if ((sysinfo_get_value("kbd.cir.obio", &obio) == EOK) && (obio)) 221 cir_service = SERVICE_OBIO; 222 223 if (cir_service) { 224 while (cir_phone < 0) 225 cir_phone = service_connect_blocking(cir_service, 0, 0); 218 if (((sysinfo_get_value("kbd.cir.fhc", &fhc) == EOK) && (fhc)) 219 || ((sysinfo_get_value("kbd.cir.obio", &obio) == EOK) && (obio))) 220 irc_service = true; 221 222 if (irc_service) { 223 while (irc_phone < 0) 224 irc_phone = service_connect_blocking(SERVICE_IRC, 0, 0); 226 225 } 227 226 -
uspace/srv/hid/kbd/include/kbd.h
rc4fb95d3 rd011038 38 38 #define KBD_KBD_H_ 39 39 40 extern int cir_service; 41 extern int cir_phone; 40 #include <bool.h> 41 42 extern bool irc_service; 43 extern int irc_phone; 42 44 43 45 extern void kbd_push_scancode(int); -
uspace/srv/hid/kbd/port/ns16550.c
rc4fb95d3 rd011038 120 120 kbd_push_scancode(scan_code); 121 121 122 if ( cir_service)123 async_msg_1( cir_phone, IRC_CLEAR_INTERRUPT,122 if (irc_service) 123 async_msg_1(irc_phone, IRC_CLEAR_INTERRUPT, 124 124 IPC_GET_IMETHOD(*call)); 125 125 } -
uspace/srv/hid/kbd/port/z8530.c
rc4fb95d3 rd011038 108 108 kbd_push_scancode(scan_code); 109 109 110 if ( cir_service)111 async_msg_1( cir_phone, IRC_CLEAR_INTERRUPT,110 if (irc_service) 111 async_msg_1(irc_phone, IRC_CLEAR_INTERRUPT, 112 112 IPC_GET_IMETHOD(*call)); 113 113 } -
uspace/srv/hw/irc/apic/apic.c
rc4fb95d3 rd011038 107 107 108 108 async_set_client_connection(apic_connection); 109 service_register(SERVICE_ APIC);109 service_register(SERVICE_IRC); 110 110 111 111 return true; -
uspace/srv/hw/irc/fhc/fhc.c
rc4fb95d3 rd011038 136 136 137 137 async_set_client_connection(fhc_connection); 138 service_register(SERVICE_ FHC);138 service_register(SERVICE_IRC); 139 139 140 140 return true; -
uspace/srv/hw/irc/i8259/i8259.c
rc4fb95d3 rd011038 149 149 150 150 async_set_client_connection(i8259_connection); 151 service_register(SERVICE_I 8259);151 service_register(SERVICE_IRC); 152 152 153 153 return true; -
uspace/srv/hw/irc/obio/obio.c
rc4fb95d3 rd011038 137 137 138 138 async_set_client_connection(obio_connection); 139 service_register(SERVICE_ OBIO);139 service_register(SERVICE_IRC); 140 140 141 141 return true; -
uspace/srv/hw/netif/ne2000/ne2000.c
rc4fb95d3 rd011038 75 75 #define IRQ_GET_TSR(call) ((int) IPC_GET_ARG3(call)) 76 76 77 static int irc_service = 0;77 static bool irc_service = false; 78 78 static int irc_phone = -1; 79 79 … … 383 383 sysarg_t i8259; 384 384 385 if ((sysinfo_get_value("apic", &apic) == EOK) && (apic)) 386 irc_service = SERVICE_APIC; 387 else if ((sysinfo_get_value("i8259", &i8259) == EOK) && (i8259)) 388 irc_service = SERVICE_I8259; 385 if (((sysinfo_get_value("apic", &apic) == EOK) && (apic)) 386 || ((sysinfo_get_value("i8259", &i8259) == EOK) && (i8259))) 387 irc_service = true; 389 388 390 389 if (irc_service) { 391 390 while (irc_phone < 0) 392 irc_phone = service_connect_blocking( irc_service, 0, 0);391 irc_phone = service_connect_blocking(SERVICE_IRC, 0, 0); 393 392 } 394 393 -
uspace/srv/net/il/arp/arp.c
rc4fb95d3 rd011038 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
rc4fb95d3 rd011038 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; -
uspace/srv/net/net/net.c
rc4fb95d3 rd011038 289 289 if (rc != EOK) 290 290 return rc; 291 291 292 rc = add_module(NULL, &net_globals.modules, (uint8_t *) NE2000_NAME, 292 293 (uint8_t *) NE2000_FILENAME, SERVICE_NE2000, 0, connect_to_service); 293 294 if (rc != EOK) 294 295 return rc; 296 295 297 rc = add_module(NULL, &net_globals.modules, (uint8_t *) ETHERNET_NAME, 296 298 (uint8_t *) ETHERNET_FILENAME, SERVICE_ETHERNET, 0, connect_to_service); 297 299 if (rc != EOK) 298 300 return rc; 301 299 302 rc = add_module(NULL, &net_globals.modules, (uint8_t *) NILDUMMY_NAME, 300 303 (uint8_t *) NILDUMMY_FILENAME, SERVICE_NILDUMMY, 0, connect_to_service); … … 552 555 rc = read_netif_configuration(conf_files[i], netif); 553 556 if (rc != EOK) { 554 measured_strings_destroy(&netif->configuration );557 measured_strings_destroy(&netif->configuration, free); 555 558 free(netif); 556 559 return rc; … … 562 565 if (!setting) { 563 566 fprintf(stderr, "%s: Network interface name is missing\n", NAME); 564 measured_strings_destroy(&netif->configuration );567 measured_strings_destroy(&netif->configuration, free); 565 568 free(netif); 566 569 return EINVAL; … … 571 574 int index = netifs_add(&net_globals.netifs, netif->id, netif); 572 575 if (index < 0) { 573 measured_strings_destroy(&netif->configuration );576 measured_strings_destroy(&netif->configuration, free); 574 577 free(netif); 575 578 return index; … … 583 586 index); 584 587 if (rc != EOK) { 585 measured_strings_destroy(&netif->configuration );586 netifs_exclude_index(&net_globals.netifs, index );588 measured_strings_destroy(&netif->configuration, free); 589 netifs_exclude_index(&net_globals.netifs, index, free); 587 590 return rc; 588 591 } … … 590 593 rc = start_device(netif); 591 594 if (rc != EOK) { 592 printf("%s: Error startinginterface %s (%s)\n", NAME,595 printf("%s: Ignoring failed interface %s (%s)\n", NAME, 593 596 netif->name, str_error(rc)); 594 measured_strings_destroy(&netif->configuration); 595 netifs_exclude_index(&net_globals.netifs, index); 596 597 return rc; 597 measured_strings_destroy(&netif->configuration, free); 598 netifs_exclude_index(&net_globals.netifs, index, free); 599 continue; 598 600 } 599 601 -
uspace/srv/net/nil/eth/eth.c
rc4fb95d3 rd011038 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: -
uspace/srv/net/tl/tcp/tcp.c
rc4fb95d3 rd011038 1707 1707 if (socket->port > 0) { 1708 1708 socket_ports_exclude(&tcp_globals.sockets, 1709 socket->port );1709 socket->port, free); 1710 1710 socket->port = 0; 1711 1711 } … … 2492 2492 rc = packet_dimensions_initialize(&tcp_globals.dimensions); 2493 2493 if (rc != EOK) { 2494 socket_ports_destroy(&tcp_globals.sockets );2494 socket_ports_destroy(&tcp_globals.sockets, free); 2495 2495 goto out; 2496 2496 } -
uspace/srv/net/tl/udp/udp.c
rc4fb95d3 rd011038 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; … … 740 740 int socket_id; 741 741 size_t addrlen; 742 size_t size ;742 size_t size = 0; 743 743 ipc_call_t answer; 744 744 size_t answer_count; -
uspace/srv/vfs/vfs_ops.c
rc4fb95d3 rd011038 1234 1234 if (!parentc) { 1235 1235 fibril_rwlock_write_unlock(&namespace_rwlock); 1236 vfs_node_put(old_node); 1236 1237 async_answer_0(rid, rc); 1237 1238 free(old); … … 1251 1252 if (rc != EOK) { 1252 1253 fibril_rwlock_write_unlock(&namespace_rwlock); 1254 vfs_node_put(old_node); 1253 1255 async_answer_0(rid, rc); 1254 1256 free(old); … … 1261 1263 (old_node->devmap_handle != new_par_lr.triplet.devmap_handle)) { 1262 1264 fibril_rwlock_write_unlock(&namespace_rwlock); 1265 vfs_node_put(old_node); 1263 1266 async_answer_0(rid, EXDEV); /* different file systems */ 1264 1267 free(old); … … 1279 1282 if (!new_node) { 1280 1283 fibril_rwlock_write_unlock(&namespace_rwlock); 1284 vfs_node_put(old_node); 1281 1285 async_answer_0(rid, ENOMEM); 1282 1286 free(old); … … 1290 1294 default: 1291 1295 fibril_rwlock_write_unlock(&namespace_rwlock); 1296 vfs_node_put(old_node); 1292 1297 async_answer_0(rid, ENOTEMPTY); 1293 1298 free(old); … … 1300 1305 if (rc != EOK) { 1301 1306 fibril_rwlock_write_unlock(&namespace_rwlock); 1307 vfs_node_put(old_node); 1302 1308 if (new_node) 1303 1309 vfs_node_put(new_node);
Note:
See TracChangeset
for help on using the changeset viewer.