Changeset 99b65d2 in mainline
- Timestamp:
- 2011-03-29T20:02:46Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e3a3e3ad
- Parents:
- a716a75 (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. - Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
defaults/arm32/gta02/Makefile.config
ra716a75 r99b65d2 4 4 # RAM disk format 5 5 RDFMT = tmpfs 6 7 # Support for userspace debuggers8 CONFIG_UDEBUG = n9 10 # Compile kernel tests11 CONFIG_TEST = n12 13 # Barebone build with essential binaries only14 CONFIG_BAREBONE = y -
uspace/lib/c/generic/net/packet.c
ra716a75 r99b65d2 190 190 } 191 191 } 192 gpm_destroy(&pm_globals.packet_map );192 gpm_destroy(&pm_globals.packet_map, free); 193 193 /* leave locked */ 194 194 } -
uspace/lib/c/generic/net/socket_client.c
ra716a75 r99b65d2 749 749 dyn_fifo_destroy(&socket->received); 750 750 dyn_fifo_destroy(&socket->accepted); 751 sockets_exclude(socket_get_sockets(), socket->socket_id );751 sockets_exclude(socket_get_sockets(), socket->socket_id, free); 752 752 } 753 753 -
uspace/lib/c/include/adt/generic_char_map.h
ra716a75 r99b65d2 47 47 #define GENERIC_CHAR_MAP_MAGIC_VALUE 0x12345622 48 48 49 /** Generic destructor function pointer. */ 50 #define DTOR_T(identifier) \ 51 void (*identifier)(const void *) 52 49 53 /** Character string to generic type map declaration. 50 54 * @param[in] name Name of the map. … … 64 68 int name##_add(name##_t *, const uint8_t *, const size_t, type *); \ 65 69 int name##_count(name##_t *); \ 66 void name##_destroy(name##_t * ); \67 void name##_exclude(name##_t *, const uint8_t *, const size_t ); \70 void name##_destroy(name##_t *, DTOR_T()); \ 71 void name##_exclude(name##_t *, const uint8_t *, const size_t, DTOR_T()); \ 68 72 type *name##_find(name##_t *, const uint8_t *, const size_t); \ 69 73 int name##_initialize(name##_t *); \ … … 84 88 type *value) \ 85 89 { \ 86 int rc; \87 90 int index; \ 88 91 if (!name##_is_valid(map)) \ … … 91 94 if (index < 0) \ 92 95 return index; \ 93 rc = char_map_add(&map->names, name, length, index); \ 94 if (rc != EOK) { \ 95 name##_items_exclude_index(&map->values, index); \ 96 return rc; \ 97 } \ 98 return EOK; \ 96 return char_map_add(&map->names, name, length, index); \ 99 97 } \ 100 98 \ … … 105 103 } \ 106 104 \ 107 void name##_destroy(name##_t *map ) \105 void name##_destroy(name##_t *map, DTOR_T(dtor)) \ 108 106 { \ 109 107 if (name##_is_valid(map)) { \ 110 108 char_map_destroy(&map->names); \ 111 name##_items_destroy(&map->values ); \109 name##_items_destroy(&map->values, dtor); \ 112 110 } \ 113 111 } \ 114 112 \ 115 113 void name##_exclude(name##_t *map, const uint8_t *name, \ 116 const size_t length ) \114 const size_t length, DTOR_T(dtor)) \ 117 115 { \ 118 116 if (name##_is_valid(map)) { \ … … 121 119 if (index != CHAR_MAP_NULL) \ 122 120 name##_items_exclude_index(&map->values, \ 123 index ); \121 index, dtor); \ 124 122 } \ 125 123 } \ -
uspace/lib/c/include/adt/generic_field.h
ra716a75 r99b65d2 46 46 #define GENERIC_FIELD_MAGIC_VALUE 0x55667788 47 47 48 /** Generic destructor function pointer. */ 49 #define DTOR_T(identifier) \ 50 void (*identifier)(const void *) 51 48 52 /** Generic type field declaration. 49 53 * … … 63 67 int name##_add(name##_t *, type *); \ 64 68 int name##_count(name##_t *); \ 65 void name##_destroy(name##_t * ); \66 void name##_exclude_index(name##_t *, int ); \69 void name##_destroy(name##_t *, DTOR_T()); \ 70 void name##_exclude_index(name##_t *, int, DTOR_T()); \ 67 71 type **name##_get_field(name##_t *); \ 68 72 type *name##_get_index(name##_t *, int); \ … … 103 107 } \ 104 108 \ 105 void name##_destroy(name##_t *field ) \109 void name##_destroy(name##_t *field, DTOR_T(dtor)) \ 106 110 { \ 107 111 if (name##_is_valid(field)) { \ 108 112 int index; \ 109 113 field->magic = 0; \ 110 for (index = 0; index < field->next; index++) { \ 111 if (field->items[index]) \ 112 free(field->items[index]); \ 114 if (dtor) { \ 115 for (index = 0; index < field->next; index++) { \ 116 if (field->items[index]) \ 117 dtor(field->items[index]); \ 118 } \ 113 119 } \ 114 120 free(field->items); \ … … 116 122 } \ 117 123 \ 118 void name##_exclude_index(name##_t *field, int index ) \124 void name##_exclude_index(name##_t *field, int index, DTOR_T(dtor)) \ 119 125 { \ 120 126 if (name##_is_valid(field) && (index >= 0) && \ 121 127 (index < field->next) && (field->items[index])) { \ 122 free(field->items[index]); \ 128 if (dtor) \ 129 dtor(field->items[index]); \ 123 130 field->items[index] = NULL; \ 124 131 } \ -
uspace/lib/c/include/adt/int_map.h
ra716a75 r99b65d2 49 49 #define INT_MAP_ITEM_MAGIC_VALUE 0x55667788 50 50 51 /** Generic destructor function pointer. */ 52 #define DTOR_T(identifier) \ 53 void (*identifier)(const void *) 54 51 55 /** Integer to generic type map declaration. 52 56 * … … 72 76 \ 73 77 int name##_add(name##_t *, int, type *); \ 74 void name##_clear(name##_t * ); \78 void name##_clear(name##_t *, DTOR_T()); \ 75 79 int name##_count(name##_t *); \ 76 void name##_destroy(name##_t * ); \77 void name##_exclude(name##_t *, int ); \78 void name##_exclude_index(name##_t *, int ); \80 void name##_destroy(name##_t *, DTOR_T()); \ 81 void name##_exclude(name##_t *, int, DTOR_T()); \ 82 void name##_exclude_index(name##_t *, int, DTOR_T()); \ 79 83 type *name##_find(name##_t *, int); \ 80 84 int name##_update(name##_t *, int, int); \ … … 82 86 int name##_initialize(name##_t *); \ 83 87 int name##_is_valid(name##_t *); \ 84 void name##_item_destroy(name##_item_t * ); \88 void name##_item_destroy(name##_item_t *, DTOR_T()); \ 85 89 int name##_item_is_valid(name##_item_t *); 86 90 … … 115 119 } \ 116 120 \ 117 void name##_clear(name##_t *map ) \121 void name##_clear(name##_t *map, DTOR_T(dtor)) \ 118 122 { \ 119 123 if (name##_is_valid(map)) { \ … … 122 126 if (name##_item_is_valid(&map->items[index])) { \ 123 127 name##_item_destroy( \ 124 &map->items[index] ); \128 &map->items[index], dtor); \ 125 129 } \ 126 130 } \ … … 135 139 } \ 136 140 \ 137 void name##_destroy(name##_t *map ) \141 void name##_destroy(name##_t *map, DTOR_T(dtor)) \ 138 142 { \ 139 143 if (name##_is_valid(map)) { \ … … 143 147 if (name##_item_is_valid(&map->items[index])) { \ 144 148 name##_item_destroy( \ 145 &map->items[index] ); \149 &map->items[index], dtor); \ 146 150 } \ 147 151 } \ … … 150 154 } \ 151 155 \ 152 void name##_exclude(name##_t *map, int key ) \156 void name##_exclude(name##_t *map, int key, DTOR_T(dtor)) \ 153 157 { \ 154 158 if (name##_is_valid(map)) { \ … … 158 162 (map->items[index].key == key)) { \ 159 163 name##_item_destroy( \ 160 &map->items[index] ); \161 } \ 162 } \ 163 } \ 164 } \ 165 \ 166 void name##_exclude_index(name##_t *map, int index ) \164 &map->items[index], dtor); \ 165 } \ 166 } \ 167 } \ 168 } \ 169 \ 170 void name##_exclude_index(name##_t *map, int index, DTOR_T(dtor)) \ 167 171 { \ 168 172 if (name##_is_valid(map) && (index >= 0) && \ 169 173 (index < map->next) && \ 170 174 name##_item_is_valid(&map->items[index])) { \ 171 name##_item_destroy(&map->items[index] ); \175 name##_item_destroy(&map->items[index], dtor); \ 172 176 } \ 173 177 } \ … … 236 240 } \ 237 241 \ 238 void name##_item_destroy(name##_item_t *item ) \242 void name##_item_destroy(name##_item_t *item, DTOR_T(dtor)) \ 239 243 { \ 240 244 if (name##_item_is_valid(item)) { \ 241 245 item->magic = 0; \ 242 246 if (item->value) { \ 243 free(item->value); \ 247 if (dtor) \ 248 dtor(item->value); \ 244 249 item->value = NULL; \ 245 250 } \ -
uspace/lib/net/tl/socket_core.c
ra716a75 r99b65d2 107 107 socket_release(socket); 108 108 109 socket_cores_exclude(local_sockets, socket->socket_id );109 socket_cores_exclude(local_sockets, socket->socket_id, free); 110 110 } 111 111 … … 230 230 231 231 fail: 232 socket_port_map_destroy(&socket_port->map );232 socket_port_map_destroy(&socket_port->map, free); 233 233 free(socket_port); 234 234 return rc; … … 649 649 if (socket_port->count <= 0) { 650 650 // destroy the map 651 socket_port_map_destroy(&socket_port->map );651 socket_port_map_destroy(&socket_port->map, free); 652 652 // release the port 653 653 socket_ports_exclude(global_sockets, 654 socket->port );654 socket->port, free); 655 655 } else { 656 656 // remove 657 657 socket_port_map_exclude(&socket_port->map, 658 socket->key, socket->key_length );658 socket->key, socket->key_length, free); 659 659 } 660 660 } -
uspace/lib/net/tl/tl_common.c
ra716a75 r99b65d2 182 182 else 183 183 packet_dimensions_exclude(packet_dimensions, 184 DEVICE_INVALID_ID );184 DEVICE_INVALID_ID, free); 185 185 } 186 186 } -
uspace/srv/devman/devman.c
ra716a75 r99b65d2 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
ra716a75 r99b65d2 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
ra716a75 r99b65d2 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
ra716a75 r99b65d2 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/net/il/arp/arp.c
ra716a75 r99b65d2 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
ra716a75 r99b65d2 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
ra716a75 r99b65d2 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
ra716a75 r99b65d2 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
ra716a75 r99b65d2 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
ra716a75 r99b65d2 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; -
version
ra716a75 r99b65d2 37 37 VERSION = 0 38 38 PATCHLEVEL = 4 39 SUBLEVEL = 239 SUBLEVEL = 3 40 40 41 41 ifdef EXTRAVERSION … … 45 45 endif 46 46 47 NAME = S kewer47 NAME = Sashimi
Note:
See TracChangeset
for help on using the changeset viewer.