Changeset 7e1f9b7 in mainline for uspace/lib/c
- Timestamp:
- 2010-11-20T17:10:35Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 32eceb4f, 8b3bff5
- Parents:
- 0b4a67a (diff), dd5046dd (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/lib/c
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/net/packet.c
r0b4a67a r7e1f9b7 62 62 63 63 /** Type definition of the packet map page. */ 64 typedef packet_t packet_map_t[PACKET_MAP_SIZE];64 typedef packet_t *packet_map_t[PACKET_MAP_SIZE]; 65 65 66 66 /** Packet map. … … 104 104 * @return NULL if the mapping does not exist. 105 105 */ 106 packet_t pm_find(packet_id_t packet_id)106 packet_t *pm_find(packet_id_t packet_id) 107 107 { 108 108 packet_map_t *map; 109 packet_t packet;109 packet_t *packet; 110 110 111 111 if (!packet_id) … … 135 135 * @return ENOMEM if there is not enough memory left. 136 136 */ 137 int pm_add(packet_t packet)137 int pm_add(packet_t *packet) 138 138 { 139 139 packet_map_t *map; … … 178 178 int index; 179 179 packet_map_t *map; 180 packet_t packet;180 packet_t *packet; 181 181 182 182 fibril_rwlock_write_lock(&pm_globals.lock); … … 209 209 * @return EINVAL if the packet is not valid. 210 210 */ 211 int pq_add(packet_t * first, packet_tpacket, size_t order, size_t metric)212 { 213 packet_t item;211 int pq_add(packet_t **first, packet_t *packet, size_t order, size_t metric) 212 { 213 packet_t *item; 214 214 215 215 if (!first || !packet_is_valid(packet)) … … 253 253 * @return NULL if the packet is not found. 254 254 */ 255 packet_t pq_find(packet_tpacket, size_t order)256 { 257 packet_t item;255 packet_t *pq_find(packet_t *packet, size_t order) 256 { 257 packet_t *item; 258 258 259 259 if (!packet_is_valid(packet)) … … 278 278 * @return EINVAL if etiher of the packets is invalid. 279 279 */ 280 int pq_insert_after(packet_t packet, packet_tnew_packet)281 { 282 packet_t item;280 int pq_insert_after(packet_t *packet, packet_t *new_packet) 281 { 282 packet_t *item; 283 283 284 284 if (!packet_is_valid(packet) || !packet_is_valid(new_packet)) … … 303 303 * @return NULL if the packet is not valid. 304 304 */ 305 packet_t pq_detach(packet_tpacket)306 { 307 packet_t next;308 packet_t previous;305 packet_t *pq_detach(packet_t *packet) 306 { 307 packet_t *next; 308 packet_t *previous; 309 309 310 310 if (!packet_is_valid(packet)) … … 331 331 * @return EINVAL if the packet is invalid. 332 332 */ 333 int pq_set_order(packet_t packet, size_t order, size_t metric)333 int pq_set_order(packet_t *packet, size_t order, size_t metric) 334 334 { 335 335 if (!packet_is_valid(packet)) … … 349 349 * @return EINVAL if the packet is invalid. 350 350 */ 351 int pq_get_order(packet_t packet, size_t *order, size_t *metric)351 int pq_get_order(packet_t *packet, size_t *order, size_t *metric) 352 352 { 353 353 if (!packet_is_valid(packet)) … … 372 372 * packets after its detachment. 373 373 */ 374 void pq_destroy(packet_t first, void (*packet_release)(packet_tpacket))375 { 376 packet_t actual;377 packet_t next;374 void pq_destroy(packet_t *first, void (*packet_release)(packet_t *packet)) 375 { 376 packet_t *actual; 377 packet_t *next; 378 378 379 379 actual = first; … … 395 395 * @return NULL if the packet is not valid. 396 396 */ 397 packet_t pq_next(packet_tpacket)397 packet_t *pq_next(packet_t *packet) 398 398 { 399 399 if (!packet_is_valid(packet)) … … 410 410 * @return NULL if the packet is not valid. 411 411 */ 412 packet_t pq_previous(packet_tpacket)412 packet_t *pq_previous(packet_t *packet) 413 413 { 414 414 if (!packet_is_valid(packet)) -
uspace/lib/c/include/net/packet.h
r0b4a67a r7e1f9b7 46 46 * @see packet 47 47 */ 48 typedef struct packet *packet_t;48 typedef struct packet packet_t; 49 49 50 50 /** Type definition of the packet dimension. … … 69 69 /*@{*/ 70 70 71 extern packet_t pm_find(packet_id_t);72 extern int pm_add(packet_t );71 extern packet_t *pm_find(packet_id_t); 72 extern int pm_add(packet_t *); 73 73 extern int pm_init(void); 74 74 extern void pm_destroy(void); 75 75 76 extern int pq_add(packet_t * , packet_t, size_t, size_t);77 extern packet_t pq_find(packet_t, size_t);78 extern int pq_insert_after(packet_t , packet_t);79 extern packet_t pq_detach(packet_t);80 extern int pq_set_order(packet_t , size_t, size_t);81 extern int pq_get_order(packet_t , size_t *, size_t *);82 extern void pq_destroy(packet_t , void (*)(packet_t));83 extern packet_t pq_next(packet_t);84 extern packet_t pq_previous(packet_t);76 extern int pq_add(packet_t **, packet_t *, size_t, size_t); 77 extern packet_t *pq_find(packet_t *, size_t); 78 extern int pq_insert_after(packet_t *, packet_t *); 79 extern packet_t *pq_detach(packet_t *); 80 extern int pq_set_order(packet_t *, size_t, size_t); 81 extern int pq_get_order(packet_t *, size_t *, size_t *); 82 extern void pq_destroy(packet_t *, void (*)(packet_t *)); 83 extern packet_t *pq_next(packet_t *); 84 extern packet_t *pq_previous(packet_t *); 85 85 86 86 /*@}*/ -
uspace/lib/c/include/net/packet_header.h
r0b4a67a r7e1f9b7 128 128 * @return False otherwise. 129 129 */ 130 static inline int packet_is_valid(const packet_t packet)130 static inline int packet_is_valid(const packet_t *packet) 131 131 { 132 132 return packet && (packet->magic_value == PACKET_MAGIC_VALUE);
Note:
See TracChangeset
for help on using the changeset viewer.