Changeset 49bd793b in mainline for uspace/lib/c
- Timestamp:
- 2011-10-07T21:42:14Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 80099c19
- Parents:
- 00d7e1b
- Location:
- uspace/lib/c
- Files:
-
- 2 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 } -
uspace/lib/c/include/net/packet.h
r00d7e1b r49bd793b 38 38 #define LIBC_PACKET_H_ 39 39 40 #include <sys/types.h> 41 40 42 /** Packet identifier type. 41 43 * Value zero is used as an invalid identifier. 42 44 */ 43 typedef unsigned longpacket_id_t;45 typedef sysarg_t packet_id_t; 44 46 45 47 /** Type definition of the packet. … … 51 53 * @see packet_dimension 52 54 */ 53 typedef struct packet_dimension 55 typedef struct packet_dimension packet_dimension_t; 54 56 55 57 /** Packet dimension. */
Note:
See TracChangeset
for help on using the changeset viewer.