Changeset 49bd793b in mainline for uspace/lib/c/generic/net/packet.c
- Timestamp:
- 2011-10-07T21:42:14Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 80099c19
- Parents:
- 00d7e1b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/net/packet.c
r00d7e1b r49bd793b 139 139 packet_t *pm_find(packet_id_t packet_id) 140 140 { 141 packet_t *packet;142 141 if (!packet_id) 143 142 return NULL; 144 143 145 144 fibril_rwlock_read_lock(&pm_globals.lock); 146 link_t *link = 147 hash_table_find(&pm_globals.packet_map, &packet_id); 145 146 unsigned long key = packet_id; 147 link_t *link = hash_table_find(&pm_globals.packet_map, &key); 148 149 packet_t *packet; 148 150 if (link != NULL) { 149 151 pm_entry_t *entry = … … 172 174 173 175 fibril_rwlock_write_lock(&pm_globals.lock); 174 pm_entry_t *entry = malloc(sizeof (pm_entry_t)); 176 177 pm_entry_t *entry = malloc(sizeof(pm_entry_t)); 175 178 if (entry == NULL) { 176 179 fibril_rwlock_write_unlock(&pm_globals.lock); … … 179 182 180 183 entry->packet = packet; 181 hash_table_insert(&pm_globals.packet_map, &packet->packet_id, 182 &entry->link); 184 185 unsigned long key = packet->packet_id; 186 hash_table_insert(&pm_globals.packet_map, &key, &entry->link); 187 183 188 fibril_rwlock_write_unlock(&pm_globals.lock); 189 184 190 return EOK; 185 191 } … … 195 201 196 202 fibril_rwlock_write_lock(&pm_globals.lock); 197 hash_table_remove(&pm_globals.packet_map, &packet->packet_id, 1); 203 204 unsigned long key = packet->packet_id; 205 hash_table_remove(&pm_globals.packet_map, &key, 1); 206 198 207 fibril_rwlock_write_unlock(&pm_globals.lock); 199 208 }
Note:
See TracChangeset
for help on using the changeset viewer.