Ignore:
Timestamp:
2010-11-20T17:10:35Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
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.
Message:

Merge from lp:~jakub/helenos/net.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/packet/generic/packet_server.c

    r0b4a67a r7e1f9b7  
    3636
    3737#include <packet_server.h>
    38 #include <packet_local.h>
    3938
    4039#include <align.h>
     
    6968        fibril_mutex_t lock;
    7069        /** Free packet queues. */
    71         packet_t free[FREE_QUEUES_COUNT];
     70        packet_t *free[FREE_QUEUES_COUNT];
    7271       
    7372        /**
     
    103102};
    104103
    105 int packet_translate_local(int phone, packet_t *packet, packet_id_t packet_id)
    106 {
    107         if (!packet)
    108                 return EINVAL;
    109        
    110         *packet = pm_find(packet_id);
    111         return (*packet) ? EOK : ENOENT;
    112 }
    113 
    114104/** Clears and initializes the packet according to the given dimensions.
    115105 *
     
    122112 */
    123113static void
    124 packet_init(packet_t packet, size_t addr_len, size_t max_prefix,
     114packet_init(packet_t *packet, size_t addr_len, size_t max_prefix,
    125115    size_t max_content, size_t max_suffix)
    126116{
    127117        // clear the packet content
    128         bzero(((void *) packet) + sizeof(struct packet),
    129             packet->length - sizeof(struct packet));
     118        bzero(((void *) packet) + sizeof(packet_t),
     119            packet->length - sizeof(packet_t));
    130120       
    131121        // clear the packet header
     
    135125        packet->next = 0;
    136126        packet->addr_len = 0;
    137         packet->src_addr = sizeof(struct packet);
     127        packet->src_addr = sizeof(packet_t);
    138128        packet->dest_addr = packet->src_addr + addr_len;
    139129        packet->max_prefix = max_prefix;
     
    157147 * @return              NULL if there is not enough memory left.
    158148 */
    159 static packet_t
     149static packet_t *
    160150packet_create(size_t length, size_t addr_len, size_t max_prefix,
    161151    size_t max_content, size_t max_suffix)
    162152{
    163         packet_t packet;
     153        packet_t *packet;
    164154        int rc;
    165155
    166156        // already locked
    167         packet = (packet_t) mmap(NULL, length, PROTO_READ | PROTO_WRITE,
     157        packet = (packet_t *) mmap(NULL, length, PROTO_READ | PROTO_WRITE,
    168158            MAP_SHARED | MAP_ANONYMOUS, 0, 0);
    169159        if (packet == MAP_FAILED)
     
    198188 * @return              NULL if there is not enough memory left.
    199189 */
    200 static packet_t
     190static packet_t *
    201191packet_get_local(size_t addr_len, size_t max_prefix, size_t max_content,
    202192    size_t max_suffix)
    203193{
    204         size_t length = ALIGN_UP(sizeof(struct packet) + 2 * addr_len +
     194        size_t length = ALIGN_UP(sizeof(packet_t) + 2 * addr_len +
    205195            max_prefix + max_content + max_suffix, PAGE_SIZE);
    206196       
    207197        fibril_mutex_lock(&ps_globals.lock);
    208198       
    209         packet_t packet;
     199        packet_t *packet;
    210200        unsigned int index;
    211201       
     
    241231}
    242232
    243 packet_t packet_get_4_local(int phone, size_t max_content, size_t addr_len,
    244     size_t max_prefix, size_t max_suffix)
    245 {
    246         return packet_get_local(addr_len, max_prefix, max_content, max_suffix);
    247 }
    248 
    249 packet_t packet_get_1_local(int phone, size_t content)
    250 {
    251         return packet_get_local(DEFAULT_ADDR_LEN, DEFAULT_PREFIX, content,
    252             DEFAULT_SUFFIX);
    253 }
    254 
    255233/** Release the packet and returns it to the appropriate free packet queue.
    256234 *
     
    260238 *
    261239 */
    262 static void packet_release(packet_t packet)
     240static void packet_release(packet_t *packet)
    263241{
    264242        int index;
     
    283261static int packet_release_wrapper(packet_id_t packet_id)
    284262{
    285         packet_t packet;
     263        packet_t *packet;
    286264
    287265        packet = pm_find(packet_id);
     
    294272
    295273        return EOK;
    296 }
    297 
    298 void pq_release_local(int phone, packet_id_t packet_id)
    299 {
    300         (void) packet_release_wrapper(packet_id);
    301274}
    302275
     
    310283 *                      async_share_in_finalize() function.
    311284 */
    312 static int packet_reply(const packet_t packet)
     285static int packet_reply(packet_t *packet)
    313286{
    314287        ipc_callid_t callid;
     
    351324    int *answer_count)
    352325{
    353         packet_t packet;
     326        packet_t *packet;
    354327
    355328        *answer_count = 0;
Note: See TracChangeset for help on using the changeset viewer.