Changeset 46d4d9f in mainline for uspace/lib/packet/generic/packet_server.c
- Timestamp:
- 2010-11-20T17:04:59Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- dd5046dd
- Parents:
- fdbc3ff
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/packet/generic/packet_server.c
rfdbc3ff r46d4d9f 69 69 fibril_mutex_t lock; 70 70 /** Free packet queues. */ 71 packet_t free[FREE_QUEUES_COUNT];71 packet_t *free[FREE_QUEUES_COUNT]; 72 72 73 73 /** … … 103 103 }; 104 104 105 int packet_translate_local(int phone, packet_t * packet, packet_id_t packet_id)105 int packet_translate_local(int phone, packet_t **packet, packet_id_t packet_id) 106 106 { 107 107 if (!packet) … … 122 122 */ 123 123 static void 124 packet_init(packet_t packet, size_t addr_len, size_t max_prefix,124 packet_init(packet_t *packet, size_t addr_len, size_t max_prefix, 125 125 size_t max_content, size_t max_suffix) 126 126 { 127 127 // clear the packet content 128 bzero(((void *) packet) + sizeof( struct packet),129 packet->length - sizeof( struct packet));128 bzero(((void *) packet) + sizeof(packet_t), 129 packet->length - sizeof(packet_t)); 130 130 131 131 // clear the packet header … … 135 135 packet->next = 0; 136 136 packet->addr_len = 0; 137 packet->src_addr = sizeof( struct packet);137 packet->src_addr = sizeof(packet_t); 138 138 packet->dest_addr = packet->src_addr + addr_len; 139 139 packet->max_prefix = max_prefix; … … 157 157 * @return NULL if there is not enough memory left. 158 158 */ 159 static packet_t 159 static packet_t * 160 160 packet_create(size_t length, size_t addr_len, size_t max_prefix, 161 161 size_t max_content, size_t max_suffix) 162 162 { 163 packet_t packet;163 packet_t *packet; 164 164 int rc; 165 165 166 166 // already locked 167 packet = (packet_t ) mmap(NULL, length, PROTO_READ | PROTO_WRITE,167 packet = (packet_t *) mmap(NULL, length, PROTO_READ | PROTO_WRITE, 168 168 MAP_SHARED | MAP_ANONYMOUS, 0, 0); 169 169 if (packet == MAP_FAILED) … … 198 198 * @return NULL if there is not enough memory left. 199 199 */ 200 static packet_t 200 static packet_t * 201 201 packet_get_local(size_t addr_len, size_t max_prefix, size_t max_content, 202 202 size_t max_suffix) 203 203 { 204 size_t length = ALIGN_UP(sizeof( struct packet) + 2 * addr_len +204 size_t length = ALIGN_UP(sizeof(packet_t) + 2 * addr_len + 205 205 max_prefix + max_content + max_suffix, PAGE_SIZE); 206 206 207 207 fibril_mutex_lock(&ps_globals.lock); 208 208 209 packet_t packet;209 packet_t *packet; 210 210 unsigned int index; 211 211 … … 241 241 } 242 242 243 packet_t packet_get_4_local(int phone, size_t max_content, size_t addr_len,243 packet_t *packet_get_4_local(int phone, size_t max_content, size_t addr_len, 244 244 size_t max_prefix, size_t max_suffix) 245 245 { … … 247 247 } 248 248 249 packet_t packet_get_1_local(int phone, size_t content)249 packet_t *packet_get_1_local(int phone, size_t content) 250 250 { 251 251 return packet_get_local(DEFAULT_ADDR_LEN, DEFAULT_PREFIX, content, … … 260 260 * 261 261 */ 262 static void packet_release(packet_t packet)262 static void packet_release(packet_t *packet) 263 263 { 264 264 int index; … … 283 283 static int packet_release_wrapper(packet_id_t packet_id) 284 284 { 285 packet_t packet;285 packet_t *packet; 286 286 287 287 packet = pm_find(packet_id); … … 310 310 * async_share_in_finalize() function. 311 311 */ 312 static int packet_reply( const packet_tpacket)312 static int packet_reply(packet_t *packet) 313 313 { 314 314 ipc_callid_t callid; … … 351 351 int *answer_count) 352 352 { 353 packet_t packet;353 packet_t *packet; 354 354 355 355 *answer_count = 0;
Note:
See TracChangeset
for help on using the changeset viewer.