Changeset 87b52c9 in mainline for uspace/srv
- Timestamp:
- 2011-04-01T11:34:41Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 66a54cc
- Parents:
- df3ad97 (diff), 27bdfa5 (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
- 32 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/devman.c
rdf3ad97 r87b52c9 274 274 } 275 275 276 if (read(fd, buf, len) <= 0) { 276 ssize_t read_bytes = safe_read(fd, buf, len); 277 if (read_bytes <= 0) { 277 278 printf(NAME ": unable to read file '%s'.\n", conf_path); 278 279 goto cleanup; 279 280 } 280 buf[ len] = 0;281 buf[read_bytes] = 0; 281 282 282 283 suc = parse_match_ids(buf, ids); … … 1131 1132 fun_node_t *find_fun_node_by_path(dev_tree_t *tree, char *path) 1132 1133 { 1134 assert(path != NULL); 1135 1136 bool is_absolute = path[0] == '/'; 1137 if (!is_absolute) { 1138 return NULL; 1139 } 1140 1133 1141 fibril_rwlock_read_lock(&tree->rwlock); 1134 1142 … … 1140 1148 char *rel_path = path; 1141 1149 char *next_path_elem = NULL; 1142 bool cont = (rel_path[0] == '/');1150 bool cont = true; 1143 1151 1144 1152 while (cont && fun != NULL) { -
uspace/srv/devman/main.c
rdf3ad97 r87b52c9 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); -
uspace/srv/devman/util.c
rdf3ad97 r87b52c9 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
rdf3ad97 r87b52c9 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/hid/kbd/Makefile
rdf3ad97 r87b52c9 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
rdf3ad97 r87b52c9 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
rdf3ad97 r87b52c9 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
rdf3ad97 r87b52c9 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
rdf3ad97 r87b52c9 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/bus/cuda_adb/cuda_adb.c
rdf3ad97 r87b52c9 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 383 381 382 memcpy(buf, instance->rcv_buf, instance->bidx); 383 *len = instance->bidx; 384 384 instance->bidx = 0; 385 385 } -
uspace/srv/hw/irc/apic/apic.c
rdf3ad97 r87b52c9 54 54 #define NAME "apic" 55 55 56 static bool apic_found = false;57 58 56 static int apic_enable_irq(sysarg_t irq) 59 57 { … … 81 79 callid = async_get_call(&call); 82 80 83 sysarg_t method = IPC_GET_IMETHOD(call); 84 if (method == IPC_M_PHONE_HUNGUP) { 85 return; 86 } 87 88 if (!apic_found) { 89 async_answer_0(callid, ENOTSUP); 90 break; 91 } 92 93 switch (method) { 81 switch (IPC_GET_IMETHOD(call)) { 94 82 case IRC_ENABLE_INTERRUPT: 95 83 async_answer_0(callid, apic_enable_irq(IPC_GET_ARG1(call))); … … 109 97 * 110 98 */ 111 static voidapic_init(void)99 static bool apic_init(void) 112 100 { 113 101 sysarg_t apic; 114 102 115 apic_found = sysinfo_get_value("apic", &apic) && apic;116 if (!apic_found) {117 printf(NAME ": Warning: no APIC found\n");103 if ((sysinfo_get_value("apic", &apic) != EOK) || (!apic)) { 104 printf(NAME ": No APIC found\n"); 105 return false; 118 106 } 119 107 120 108 async_set_client_connection(apic_connection); 121 service_register(SERVICE_APIC); 109 service_register(SERVICE_IRC); 110 111 return true; 122 112 } 123 113 … … 126 116 printf(NAME ": HelenOS APIC driver\n"); 127 117 128 apic_init(); 129 118 if (!apic_init()) 119 return -1; 120 130 121 printf(NAME ": Accepting connections\n"); 131 122 async_manager(); -
uspace/srv/hw/irc/fhc/fhc.c
rdf3ad97 r87b52c9 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
rdf3ad97 r87b52c9 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
rdf3ad97 r87b52c9 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/dp8390.c
rdf3ad97 r87b52c9 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/hw/netif/ne2000/ne2000.c
rdf3ad97 r87b52c9 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/loader/arch/abs32le/_link.ld.in
rdf3ad97 r87b52c9 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
rdf3ad97 r87b52c9 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
rdf3ad97 r87b52c9 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
rdf3ad97 r87b52c9 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
rdf3ad97 r87b52c9 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
rdf3ad97 r87b52c9 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
rdf3ad97 r87b52c9 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
rdf3ad97 r87b52c9 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
rdf3ad97 r87b52c9 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
rdf3ad97 r87b52c9 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
rdf3ad97 r87b52c9 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
rdf3ad97 r87b52c9 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
rdf3ad97 r87b52c9 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
rdf3ad97 r87b52c9 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
rdf3ad97 r87b52c9 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; -
uspace/srv/vfs/vfs_ops.c
rdf3ad97 r87b52c9 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.