Changeset e417b96 in mainline for uspace/srv/net/il


Ignore:
Timestamp:
2010-03-23T22:58:44Z (16 years ago)
Author:
Lukas Mejdrech <lukasmejdrech@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5814ef7
Parents:
76ca3f7
Message:

IPC_[SG]ET_ARG macros refactored to be more explicit and safer

Location:
uspace/srv/net/il
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/il/arp/arp_messages.h

    r76ca3f7 re417b96  
    7575 *  @param[in] call The message call structure.
    7676 */
    77 #define ARP_GET_NETIF(call)             (services_t) IPC_GET_ARG2(*call)
     77#define ARP_GET_NETIF(call) \
     78        ({services_t service = (services_t) IPC_GET_ARG2(*call); service;})
    7879
    7980/*@}*/
  • uspace/srv/net/il/ip/ip.c

    r76ca3f7 re417b96  
    893893        struct sockaddr * addr;
    894894        size_t addrlen;
     895        size_t prefix;
     896        size_t suffix;
     897        size_t content;
    895898        ip_pseudo_header_ref header;
    896899        size_t headerlen;
     
    924927                        ERROR_PROPAGATE(ip_get_route_req(0, IP_GET_PROTOCOL(call), addr, (socklen_t) addrlen,
    925928                            &device_id, &header, &headerlen));
    926                         *IPC_SET_DEVICE(answer) = device_id;
    927                         *IP_SET_HEADERLEN(answer) = headerlen;
     929                        IPC_SET_DEVICE(answer, device_id);
     930                        IP_SET_HEADERLEN(answer, headerlen);
    928931                        *answer_count = 2;
    929932                        if(! ERROR_OCCURRED(data_reply(&headerlen, sizeof(headerlen)))){
     
    933936                        return ERROR_CODE;
    934937                case NET_IL_PACKET_SPACE:
    935                         ERROR_PROPAGATE(ip_packet_size_message(IPC_GET_DEVICE(call), IPC_SET_ADDR(answer), IPC_SET_PREFIX(answer), IPC_SET_CONTENT(answer), IPC_SET_SUFFIX(answer)));
    936                         *answer_count = 3;
     938                        ERROR_PROPAGATE(ip_packet_size_message(IPC_GET_DEVICE(call), &addrlen, &prefix, &content, &suffix));
     939                        IPC_SET_ADDR(answer, addrlen);
     940                        IPC_SET_PREFIX(answer, prefix);
     941                        IPC_SET_CONTENT(answer, content);
     942                        IPC_SET_SUFFIX(answer, suffix);
     943                        *answer_count = 4;
    937944                        return EOK;
    938945                case NET_IL_MTU_CHANGED:
  • uspace/srv/net/il/ip/ip_messages.h

    r76ca3f7 re417b96  
    7272 *  @param[in] call The message call structure.
    7373 */
    74 #define IP_GET_ADDRESS(call)            ({in_addr_t addr; addr.s_addr = IPC_GET_ARG3(*call); addr;})
     74#define IP_GET_ADDRESS(call) \
     75        ({in_addr_t addr; addr.s_addr = IPC_GET_ARG3(*call); addr;})
    7576
    7677/** Returns the gateway message parameter.
    7778 *  @param[in] call The message call structure.
    7879 */
    79 #define IP_GET_GATEWAY(call)            ({in_addr_t addr; addr.s_addr = IPC_GET_ARG2(*call); addr;})
     80#define IP_GET_GATEWAY(call) \
     81        ({in_addr_t addr; addr.s_addr = IPC_GET_ARG2(*call); addr;})
    8082
    8183/** Sets the header length in the message answer.
    8284 *  @param[out] answer The message answer structure.
    8385 */
    84 #define IP_SET_HEADERLEN(answer)        (&IPC_GET_ARG2(*answer))
     86#define IP_SET_HEADERLEN(answer, value) \
     87        {ipcarg_t argument = (value); IPC_SET_ARG2(*answer, argument);}
    8588
    8689/** Returns the network mask message parameter.
    8790 *  @param[in] call The message call structure.
    8891 */
    89 #define IP_GET_NETMASK(call)            ({in_addr_t addr; addr.s_addr = IPC_GET_ARG4(*call); addr;})
     92#define IP_GET_NETMASK(call) \
     93        ({in_addr_t addr; addr.s_addr = IPC_GET_ARG4(*call); addr;})
    9094
    9195/** Returns the protocol message parameter.
    9296 *  @param[in] call The message call structure.
    9397 */
    94 #define IP_GET_PROTOCOL(call)           ((ip_protocol_t) IPC_GET_ARG1(*call))
     98#define IP_GET_PROTOCOL(call) \
     99        ({ip_protocol_t protocol = (ip_protocol_t) IPC_GET_ARG1(*call); protocol;})
    95100
    96101/*@}*/
Note: See TracChangeset for help on using the changeset viewer.