Changeset f4f866c in mainline for uspace/lib/socket
- Timestamp:
- 2010-04-23T21:42:26Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6c39a907
- Parents:
- 38aaacc2 (diff), 80badbe (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/socket
- Files:
-
- 2 added
- 10 edited
-
Makefile (modified) (1 diff)
-
generic/net_modules.c (modified) (2 diffs)
-
generic/socket_client.c (modified) (1 diff)
-
generic/socket_core.c (modified) (1 diff)
-
generic/socket_parse.c (added)
-
include/net_err.h (modified) (2 diffs)
-
include/net_messages.h (modified) (2 diffs)
-
include/net_modules.h (modified) (1 diff)
-
include/packet/packet_client.h (modified) (5 diffs)
-
include/socket_parse.h (added)
-
packet/packet_client.c (modified) (3 diffs)
-
packet/packet_server.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/socket/Makefile
r38aaacc2 rf4f866c 35 35 generic/socket_client.c \ 36 36 generic/socket_core.c \ 37 generic/socket_parse.c \ 37 38 generic/inet.c \ 38 39 generic/net_modules.c \ -
uspace/lib/socket/generic/net_modules.c
r38aaacc2 rf4f866c 77 77 } 78 78 79 int bind_service(services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver){ 79 /** Create bidirectional connection with the needed module service and registers the message receiver. 80 * 81 * @param[in] need The needed module service. 82 * @param[in] arg1 The first parameter. 83 * @param[in] arg2 The second parameter. 84 * @param[in] arg3 The third parameter. 85 * @param[in] client_receiver The message receiver. 86 * 87 * @return The phone of the needed service. 88 * @return Other error codes as defined for the ipc_connect_to_me() function. 89 * 90 */ 91 int bind_service(services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, 92 async_client_conn_t client_receiver) 93 { 80 94 return bind_service_timeout(need, arg1, arg2, arg3, client_receiver, 0); 81 95 } 82 96 83 int bind_service_timeout(services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver, suseconds_t timeout){ 97 /** Create bidirectional connection with the needed module service and registers the message receiver. 98 * 99 * @param[in] need The needed module service. 100 * @param[in] arg1 The first parameter. 101 * @param[in] arg2 The second parameter. 102 * @param[in] arg3 The third parameter. 103 * @param[in] client_receiver The message receiver. 104 * @param[in] timeout The connection timeout in microseconds. 105 * No timeout if set to zero (0). 106 * 107 * @return The phone of the needed service. 108 * @return ETIMEOUT if the connection timeouted. 109 * @return Other error codes as defined for the ipc_connect_to_me() function. 110 * 111 */ 112 int bind_service_timeout(services_t need, ipcarg_t arg1, ipcarg_t arg2, 113 ipcarg_t arg3, async_client_conn_t client_receiver, suseconds_t timeout) 114 { 84 115 ERROR_DECLARE; 85 86 int phone; 87 ipcarg_t phonehash; 88 89 // connect to the needed service 90 phone = connect_to_service_timeout(need, timeout); 91 // if connected 92 if(phone >= 0){ 93 // request the bidirectional connection 94 if(ERROR_OCCURRED(ipc_connect_to_me(phone, arg1, arg2, arg3, &phonehash))){ 116 117 /* Connect to the needed service */ 118 int phone = connect_to_service_timeout(need, timeout); 119 if (phone >= 0) { 120 /* Request the bidirectional connection */ 121 ipcarg_t phonehash; 122 if (ERROR_OCCURRED(ipc_connect_to_me(phone, arg1, arg2, arg3, 123 &phonehash))) { 95 124 ipc_hangup(phone); 96 125 return ERROR_CODE; … … 98 127 async_new_connection(phonehash, 0, NULL, client_receiver); 99 128 } 129 100 130 return phone; 101 131 } -
uspace/lib/socket/generic/socket_client.c
r38aaacc2 rf4f866c 299 299 static int socket_generate_new_id(void){ 300 300 sockets_ref sockets; 301 int socket_id ;301 int socket_id = 0; 302 302 int count; 303 303 -
uspace/lib/socket/generic/socket_core.c
r38aaacc2 rf4f866c 90 90 // release all received packets 91 91 while((packet_id = dyn_fifo_pop(&socket->received)) >= 0){ 92 pq_release (packet_phone, packet_id);92 pq_release_local(packet_phone, packet_id); 93 93 } 94 94 dyn_fifo_destroy(&socket->received); -
uspace/lib/socket/include/net_err.h
r38aaacc2 rf4f866c 28 28 29 29 /** @addtogroup net 30 * @{30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * Common error processing codes and routines.34 * Common error processing codes and routines. 35 35 */ 36 36 … … 41 41 42 42 #ifdef CONFIG_DEBUG 43 #include <stdio.h> 44 #include <str_error.h> 45 #endif 43 46 44 #include <stdio.h> 47 /** An actual stored error code. 48 * 49 */ 50 #define ERROR_CODE error_check_return_value 51 52 /** An error processing routines declaration. 53 * 54 * This has to be declared in the block where the error processing 55 * is desired. 56 * 57 */ 58 #define ERROR_DECLARE int ERROR_CODE 59 60 /** Store the value as an error code and checks if an error occurred. 61 * 62 * @param[in] value The value to be checked. May be a function call. 63 * @return False if the value indicates success (EOK). 64 * @return True otherwise. 65 * 66 */ 67 #ifdef CONFIG_DEBUG 68 69 #define ERROR_OCCURRED(value) \ 70 (((ERROR_CODE = (value)) != EOK) \ 71 && ({ \ 72 fprintf(stderr, "libsocket error at %s:%d (%s)\n", \ 73 __FILE__, __LINE__, str_error(ERROR_CODE)); \ 74 1; \ 75 })) 76 77 #else 78 79 #define ERROR_OCCURRED(value) ((ERROR_CODE = (value)) != EOK) 45 80 46 81 #endif 47 82 48 /** An actual stored error code. 49 */ 50 #define ERROR_CODE error_check_return_value 51 52 /** An error processing routines declaration. 53 * This has to be declared in the block where the error processing is desired. 54 */ 55 #define ERROR_DECLARE int ERROR_CODE 56 57 /** Stores the value as an error code and checks if an error occurred. 58 * @param[in] value The value to be checked. May be a function call. 59 * @returns FALSE if the value indicates success (EOK). 60 * @returns TRUE otherwise. 61 */ 62 #ifdef CONFIG_DEBUG 63 64 #define ERROR_OCCURRED(value) \ 65 (((ERROR_CODE = (value)) != EOK) \ 66 && ({printf("error at %s:%d %d\n", __FILE__, __LINE__, ERROR_CODE); 1;})) 67 68 #else 69 70 #define ERROR_OCCURRED(value) ((ERROR_CODE = (value)) != EOK) 71 72 #endif 73 74 /** Checks if an error occurred and immediately exits the actual function returning the error code. 75 * @param[in] value The value to be checked. May be a function call. 83 /** Error propagation 84 * 85 * Check if an error occurred and immediately exit the actual 86 * function returning the error code. 87 * 88 * @param[in] value The value to be checked. May be a function call. 89 * 76 90 */ 77 91 78 #define ERROR_PROPAGATE(value) if(ERROR_OCCURRED(value)) return ERROR_CODE 92 #define ERROR_PROPAGATE(value) \ 93 if (ERROR_OCCURRED(value)) \ 94 return ERROR_CODE 79 95 80 96 #endif -
uspace/lib/socket/include/net_messages.h
r38aaacc2 rf4f866c 462 462 /*@}*/ 463 463 464 /** Notifies the module about the device state change. 465 * @param[in] phone The service module phone. 466 * @param[in] message The service specific message. 467 * @param[in] device_id The device identifier. 468 * @param[in] state The new device state. 469 * @param[in] target The target module service. 470 * @returns EOK on success. 471 */ 472 static inline int generic_device_state_msg(int phone, int message, device_id_t device_id, int state, services_t target){ 473 async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) state, target); 464 /** Notify the module about the device state change. 465 * 466 * @param[in] phone The service module phone. 467 * @param[in] message The service specific message. 468 * @param[in] device_id The device identifier. 469 * @param[in] state The new device state. 470 * @param[in] target The target module service. 471 * 472 * @return EOK on success. 473 * 474 */ 475 static inline int generic_device_state_msg_remote(int phone, int message, 476 device_id_t device_id, int state, services_t target) 477 { 478 async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id, 479 (ipcarg_t) state, target); 480 474 481 return EOK; 475 482 } 476 483 477 /** Notifies a module about the device. 478 * @param[in] phone The service module phone. 479 * @param[in] message The service specific message. 480 * @param[in] device_id The device identifier. 481 * @param[in] arg2 The second argument of the message. 482 * @param[in] service The device module service. 483 * @returns EOK on success. 484 * @returns Other error codes as defined for the specific service message. 485 */ 486 static inline int generic_device_req(int phone, int message, device_id_t device_id, int arg2, services_t service){ 487 return (int) async_req_3_0(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) arg2, (ipcarg_t) service); 484 /** Notify a module about the device. 485 * 486 * @param[in] phone The service module phone. 487 * @param[in] message The service specific message. 488 * @param[in] device_id The device identifier. 489 * @param[in] arg2 The second argument of the message. 490 * @param[in] service The device module service. 491 * 492 * @return EOK on success. 493 * @return Other error codes as defined for the specific service message. 494 * 495 */ 496 static inline int generic_device_req_remote(int phone, int message, 497 device_id_t device_id, int arg2, services_t service) 498 { 499 return (int) async_req_3_0(phone, (ipcarg_t) message, (ipcarg_t) device_id, 500 (ipcarg_t) arg2, (ipcarg_t) service); 488 501 } 489 502 … … 521 534 } 522 535 523 /** Returns the device packet dimension for sending. 524 * @param[in] phone The service module phone. 525 * @param[in] message The service specific message. 526 * @param[in] device_id The device identifier. 527 * @param[out] packet_dimension The packet dimension. 528 * @returns EOK on success. 529 * @returns EBADMEM if the packet_dimension parameter is NULL. 530 * @returns Other error codes as defined for the specific service message. 531 */ 532 static inline int generic_packet_size_req(int phone, int message, device_id_t device_id, packet_dimension_ref packet_dimension){ 533 ipcarg_t result; 536 /** Return the device packet dimension for sending. 537 * 538 * @param[in] phone The service module phone. 539 * @param[in] message The service specific message. 540 * @param[in] device_id The device identifier. 541 * @param[out] packet_dimension The packet dimension. 542 * 543 * @return EOK on success. 544 * @return EBADMEM if the packet_dimension parameter is NULL. 545 * @return Other error codes as defined for the specific service message. 546 * 547 */ 548 static inline int generic_packet_size_req_remote(int phone, int message, 549 device_id_t device_id, packet_dimension_ref packet_dimension) 550 { 551 if (!packet_dimension) 552 return EBADMEM; 553 554 ipcarg_t addr_len; 534 555 ipcarg_t prefix; 535 556 ipcarg_t content; 536 557 ipcarg_t suffix; 537 ipcarg_t addr_len; 538 539 if(! packet_dimension){ 540 return EBADMEM; 541 } 542 result = async_req_1_4(phone, (ipcarg_t) message, (ipcarg_t) device_id, &addr_len, &prefix, &content, &suffix); 558 559 ipcarg_t result = async_req_1_4(phone, (ipcarg_t) message, 560 (ipcarg_t) device_id, &addr_len, &prefix, &content, &suffix); 561 543 562 packet_dimension->prefix = (size_t) prefix; 544 563 packet_dimension->content = (size_t) content; 545 564 packet_dimension->suffix = (size_t) suffix; 546 565 packet_dimension->addr_len = (size_t) addr_len; 566 547 567 return (int) result; 548 568 } 549 569 550 /** Passes the packet queue to the module. 551 * @param[in] phone The service module phone. 552 * @param[in] message The service specific message. 553 * @param[in] device_id The device identifier. 554 * @param[in] packet_id The received packet or the received packet queue identifier. 555 * @param[in] target The target module service. 556 * @param[in] error The error module service. 557 * @returns EOK on success. 558 */ 559 static inline int generic_received_msg(int phone, int message, device_id_t device_id, packet_id_t packet_id, services_t target, services_t error){ 560 if(error){ 561 async_msg_4(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) packet_id, (ipcarg_t) target, (ipcarg_t) error); 562 }else{ 563 async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) packet_id, (ipcarg_t) target); 564 } 570 /** Pass the packet queue to the module. 571 * 572 * @param[in] phone The service module phone. 573 * @param[in] message The service specific message. 574 * @param[in] device_id The device identifier. 575 * @param[in] packet_id The received packet or the received packet queue 576 * identifier. 577 * @param[in] target The target module service. 578 * @param[in] error The error module service. 579 * 580 * @return EOK on success. 581 * 582 */ 583 static inline int generic_received_msg_remote(int phone, int message, 584 device_id_t device_id, packet_id_t packet_id, services_t target, 585 services_t error) 586 { 587 if (error) 588 async_msg_4(phone, (ipcarg_t) message, (ipcarg_t) device_id, 589 (ipcarg_t) packet_id, (ipcarg_t) target, (ipcarg_t) error); 590 else 591 async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id, 592 (ipcarg_t) packet_id, (ipcarg_t) target); 593 565 594 return EOK; 566 595 } 567 596 568 /** Sends the packet queue. 569 * @param[in] phone The service module phone. 570 * @param[in] message The service specific message. 571 * @param[in] device_id The device identifier. 572 * @param[in] packet_id The packet or the packet queue identifier. 573 * @param[in] sender The sending module service. 574 * @param[in] error The error module service. 575 * @returns EOK on success. 576 */ 577 static inline int generic_send_msg(int phone, int message, device_id_t device_id, packet_id_t packet_id, services_t sender, services_t error){ 578 if(error){ 579 async_msg_4(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) packet_id, (ipcarg_t) sender, (ipcarg_t) error); 580 }else{ 581 async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) packet_id, (ipcarg_t) sender); 582 } 597 /** Send the packet queue. 598 * 599 * @param[in] phone The service module phone. 600 * @param[in] message The service specific message. 601 * @param[in] device_id The device identifier. 602 * @param[in] packet_id The packet or the packet queue identifier. 603 * @param[in] sender The sending module service. 604 * @param[in] error The error module service. 605 * 606 * @return EOK on success. 607 * 608 */ 609 static inline int generic_send_msg_remote(int phone, int message, 610 device_id_t device_id, packet_id_t packet_id, services_t sender, 611 services_t error) 612 { 613 if (error) 614 async_msg_4(phone, (ipcarg_t) message, (ipcarg_t) device_id, 615 (ipcarg_t) packet_id, (ipcarg_t) sender, (ipcarg_t) error); 616 else 617 async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id, 618 (ipcarg_t) packet_id, (ipcarg_t) sender); 619 583 620 return EOK; 584 621 } -
uspace/lib/socket/include/net_modules.h
r38aaacc2 rf4f866c 72 72 extern void answer_call(ipc_callid_t callid, int result, ipc_call_t * answer, int answer_count); 73 73 74 /** Creates bidirectional connection with the needed module service and registers the message receiver. 75 * @param[in] need The needed module service. 76 * @param[in] arg1 The first parameter. 77 * @param[in] arg2 The second parameter. 78 * @param[in] arg3 The third parameter. 79 * @param[in] client_receiver The message receiver. 80 * @returns The phone of the needed service. 81 * @returns Other error codes as defined for the ipc_connect_to_me() function. 82 */ 83 extern int bind_service(services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver); 84 85 /** Creates bidirectional connection with the needed module service and registers the message receiver. 86 * @param[in] need The needed module service. 87 * @param[in] arg1 The first parameter. 88 * @param[in] arg2 The second parameter. 89 * @param[in] arg3 The third parameter. 90 * @param[in] client_receiver The message receiver. 91 * @param[in] timeout The connection timeout in microseconds. No timeout if set to zero (0). 92 * @returns The phone of the needed service. 93 * @returns ETIMEOUT if the connection timeouted. 94 * @returns Other error codes as defined for the ipc_connect_to_me() function. 95 */ 96 extern int bind_service_timeout(services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver, suseconds_t timeout); 74 extern int bind_service(services_t, ipcarg_t, ipcarg_t, ipcarg_t, 75 async_client_conn_t); 76 extern int bind_service_timeout(services_t, ipcarg_t, ipcarg_t, ipcarg_t, 77 async_client_conn_t, suseconds_t); 97 78 98 79 /** Connects to the needed module. -
uspace/lib/socket/include/packet/packet_client.h
r38aaacc2 rf4f866c 45 45 #define __NET_PACKET_CLIENT_H__ 46 46 47 #include "packet.h"47 #include <packet/packet.h> 48 48 49 49 /** @name Packet client interface … … 172 172 * @returns Other error codes as defined for the packet_return() function. 173 173 */ 174 extern int packet_translate (int phone, packet_ref packet, packet_id_t packet_id);174 extern int packet_translate_local(int phone, packet_ref packet, packet_id_t packet_id); 175 175 176 176 /** Obtains the packet of the given dimensions. … … 184 184 * @returns NULL on error. 185 185 */ 186 extern packet_t packet_get_4 (int phone, size_t max_content, size_t addr_len, size_t max_prefix, size_t max_suffix);186 extern packet_t packet_get_4_local(int phone, size_t max_content, size_t addr_len, size_t max_prefix, size_t max_suffix); 187 187 188 188 /** Obtains the packet of the given content size. … … 193 193 * @returns NULL on error. 194 194 */ 195 extern packet_t packet_get_1 (int phone, size_t content);195 extern packet_t packet_get_1_local(int phone, size_t content); 196 196 197 197 /** Releases the packet queue. … … 202 202 * @param[in] packet_id The packet identifier. 203 203 */ 204 extern void pq_release (int phone, packet_id_t packet_id);204 extern void pq_release_local(int phone, packet_id_t packet_id); 205 205 206 206 /** Returns the packet copy. -
uspace/lib/socket/packet/packet_client.c
r38aaacc2 rf4f866c 156 156 packet_t packet_get_copy(int phone, packet_t packet){ 157 157 packet_t copy; 158 uint8_t * src ;159 uint8_t * dest ;158 uint8_t * src = NULL; 159 uint8_t * dest = NULL; 160 160 size_t addrlen; 161 161 … … 164 164 } 165 165 // get a new packet 166 copy = packet_get_4 (phone, PACKET_DATA_LENGTH(packet), PACKET_MAX_ADDRESS_LENGTH(packet), packet->max_prefix, PACKET_MIN_SUFFIX(packet));166 copy = packet_get_4_local(phone, PACKET_DATA_LENGTH(packet), PACKET_MAX_ADDRESS_LENGTH(packet), packet->max_prefix, PACKET_MIN_SUFFIX(packet)); 167 167 if(! copy){ 168 168 return NULL; … … 178 178 return copy; 179 179 }else{ 180 pq_release (phone, copy->packet_id);180 pq_release_local(phone, copy->packet_id); 181 181 return NULL; 182 182 } -
uspace/lib/socket/packet/packet_server.c
r38aaacc2 rf4f866c 97 97 }; 98 98 99 int packet_translate(int phone, packet_ref packet, packet_id_t packet_id){ 100 if(! packet){ 99 int packet_translate_local(int phone, packet_ref packet, packet_id_t packet_id) 100 { 101 if (!packet) 101 102 return EINVAL; 102 }103 103 104 *packet = pm_find(packet_id); 104 105 return (*packet) ? EOK : ENOENT; … … 161 162 } 162 163 163 /** Returns the packet of dimensions at least as given. 164 * Tries to reuse free packets first. 165 * Creates a new packet aligned to the memory page size if none available. 166 * Locks the global data during its processing. 167 * @param[in] addr_len The source and destination addresses maximal length in bytes. 168 * @param[in] max_prefix The maximal prefix length in bytes. 169 * @param[in] max_content The maximal content length in bytes. 170 * @param[in] max_suffix The maximal suffix length in bytes. 171 * @returns The packet of dimensions at least as given. 172 * @returns NULL if there is not enough memory left. 173 */ 174 static packet_t packet_get(size_t addr_len, size_t max_prefix, size_t max_content, size_t max_suffix){ 175 int index; 164 /** Return the packet of dimensions at least as given. 165 * 166 * Try to reuse free packets first. 167 * Create a new packet aligned to the memory page size if none available. 168 * Lock the global data during its processing. 169 * 170 * @param[in] addr_len The source and destination addresses 171 * maximal length in bytes. 172 * @param[in] max_prefix The maximal prefix length in bytes. 173 * @param[in] max_content The maximal content length in bytes. 174 * @param[in] max_suffix The maximal suffix length in bytes. 175 * 176 * @return The packet of dimensions at least as given. 177 * @return NULL if there is not enough memory left. 178 * 179 */ 180 static packet_t packet_get_local(size_t addr_len, size_t max_prefix, 181 size_t max_content, size_t max_suffix) 182 { 183 size_t length = ALIGN_UP(sizeof(struct packet) + 2 * addr_len + max_prefix 184 + max_content + max_suffix, PAGE_SIZE); 185 186 fibril_mutex_lock(&ps_globals.lock); 187 176 188 packet_t packet; 177 size_t length; 178 179 length = ALIGN_UP(sizeof(struct packet) + 2 * addr_len + max_prefix + max_content + max_suffix, PAGE_SIZE); 180 fibril_mutex_lock(&ps_globals.lock); 181 for(index = 0; index < FREE_QUEUES_COUNT - 1; ++ index){ 182 if(length <= ps_globals.sizes[index]){ 189 unsigned int index; 190 191 for (index = 0; index < FREE_QUEUES_COUNT - 1; index++) { 192 if (length <= ps_globals.sizes[index]) { 183 193 packet = ps_globals.free[index]; 184 while(packet_is_valid(packet) && (packet->length < length)){ 194 195 while (packet_is_valid(packet) && (packet->length < length)) 185 196 packet = pm_find(packet->next); 186 }187 if (packet_is_valid(packet)){188 if (packet == ps_globals.free[index]){197 198 if (packet_is_valid(packet)) { 199 if (packet == ps_globals.free[index]) 189 200 ps_globals.free[index] = pq_detach(packet); 190 }else{201 else 191 202 pq_detach(packet); 192 } 193 packet_init(packet, addr_len, max_prefix, max_content, max_suffix); 203 204 packet_init(packet, addr_len, max_prefix, max_content, 205 max_suffix); 194 206 fibril_mutex_unlock(&ps_globals.lock); 195 // remove debug dump 196 // printf("packet %d got\n", packet->packet_id); 207 197 208 return packet; 198 209 } 199 210 } 200 211 } 201 packet = packet_create(length, addr_len, max_prefix, max_content, max_suffix); 212 213 packet = packet_create(length, addr_len, max_prefix, max_content, 214 max_suffix); 215 202 216 fibril_mutex_unlock(&ps_globals.lock); 203 // remove debug dump 204 // printf("packet %d created\n", packet->packet_id); 217 205 218 return packet; 206 219 } 207 220 208 packet_t packet_get_4(int phone, size_t max_content, size_t addr_len, size_t max_prefix, size_t max_suffix){ 209 return packet_get(addr_len, max_prefix, max_content, max_suffix); 210 } 211 212 packet_t packet_get_1(int phone, size_t content){ 213 return packet_get(DEFAULT_ADDR_LEN, DEFAULT_PREFIX, content, DEFAULT_SUFFIX); 214 } 215 216 /** Releases the packet and returns it to the appropriate free packet queue. 221 packet_t packet_get_4_local(int phone, size_t max_content, size_t addr_len, 222 size_t max_prefix, size_t max_suffix) 223 { 224 return packet_get_local(addr_len, max_prefix, max_content, max_suffix); 225 } 226 227 packet_t packet_get_1_local(int phone, size_t content) 228 { 229 return packet_get_local(DEFAULT_ADDR_LEN, DEFAULT_PREFIX, content, 230 DEFAULT_SUFFIX); 231 } 232 233 /** Release the packet and returns it to the appropriate free packet queue. 234 * 217 235 * Should be used only when the global data are locked. 236 * 218 237 * @param[in] packet The packet to be released. 238 * 219 239 */ 220 240 static void packet_release(packet_t packet){ … … 247 267 } 248 268 249 void pq_release(int phone, packet_id_t packet_id){ 269 void pq_release_local(int phone, packet_id_t packet_id) 270 { 250 271 (void) packet_release_wrapper(packet_id); 251 272 } … … 281 302 return EOK; 282 303 case NET_PACKET_CREATE_1: 283 packet = packet_get (DEFAULT_ADDR_LEN, DEFAULT_PREFIX, IPC_GET_CONTENT(call), DEFAULT_SUFFIX);304 packet = packet_get_local(DEFAULT_ADDR_LEN, DEFAULT_PREFIX, IPC_GET_CONTENT(call), DEFAULT_SUFFIX); 284 305 if(! packet){ 285 306 return ENOMEM; … … 290 311 return EOK; 291 312 case NET_PACKET_CREATE_4: 292 packet = packet_get (((DEFAULT_ADDR_LEN < IPC_GET_ADDR_LEN(call)) ? IPC_GET_ADDR_LEN(call) : DEFAULT_ADDR_LEN), DEFAULT_PREFIX + IPC_GET_PREFIX(call), IPC_GET_CONTENT(call), DEFAULT_SUFFIX + IPC_GET_SUFFIX(call));313 packet = packet_get_local(((DEFAULT_ADDR_LEN < IPC_GET_ADDR_LEN(call)) ? IPC_GET_ADDR_LEN(call) : DEFAULT_ADDR_LEN), DEFAULT_PREFIX + IPC_GET_PREFIX(call), IPC_GET_CONTENT(call), DEFAULT_SUFFIX + IPC_GET_SUFFIX(call)); 293 314 if(! packet){ 294 315 return ENOMEM;
Note:
See TracChangeset
for help on using the changeset viewer.
