Changeset 8b5690f in mainline for uspace/srv/net/net/net.c


Ignore:
Timestamp:
2011-02-03T05:11:01Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ba38f72c
Parents:
22027b6e (diff), 86d7bfa (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 mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/net/net.c

    r22027b6e r8b5690f  
    4545#include <stdio.h>
    4646#include <str.h>
    47 
    48 #include <ipc/ipc.h>
     47#include <str_error.h>
     48
    4949#include <ipc/services.h>
    5050#include <ipc/net.h>
    5151#include <ipc/net_net.h>
    5252#include <ipc/il.h>
     53#include <ipc/nil.h>
    5354
    5455#include <net/modules.h>
     
    6263
    6364#include <netif_remote.h>
    64 #include <nil_interface.h>
     65#include <nil_remote.h>
    6566#include <net_interface.h>
    6667#include <ip_interface.h>
     
    288289        if (rc != EOK)
    289290                return rc;
    290         rc = add_module(NULL, &net_globals.modules, (uint8_t *) DP8390_NAME,
    291             (uint8_t *) DP8390_FILENAME, SERVICE_DP8390, 0, connect_to_service);
     291        rc = add_module(NULL, &net_globals.modules, (uint8_t *) NE2000_NAME,
     292            (uint8_t *) NE2000_FILENAME, SERVICE_NE2000, 0, connect_to_service);
    292293        if (rc != EOK)
    293294                return rc;
     
    324325static int net_module_start(async_client_conn_t client_connection)
    325326{
    326         sysarg_t phonehash;
    327327        int rc;
    328328       
     
    332332                return rc;
    333333       
    334        
    335334        rc = net_initialize(client_connection);
    336335        if (rc != EOK)
    337336                goto out;
    338337       
    339         rc = ipc_connect_to_me(PHONE_NS, SERVICE_NETWORKING, 0, 0, &phonehash);
     338        rc = async_connect_to_me(PHONE_NS, SERVICE_NETWORKING, 0, 0, NULL);
    340339        if (rc != EOK)
    341340                goto out;
     
    474473       
    475474        setting = measured_strings_find(&netif->configuration, (uint8_t *) CONF_IO, 0);
    476         int io = setting ? strtol((char *) setting->value, NULL, 16) : 0;
    477        
    478         rc = netif_probe_req_remote(netif->driver->phone, netif->id, irq, io);
     475        uintptr_t io = setting ? strtol((char *) setting->value, NULL, 16) : 0;
     476       
     477        rc = netif_probe_req(netif->driver->phone, netif->id, irq, (void *) io);
    479478        if (rc != EOK)
    480479                return rc;
     
    511510        }
    512511       
    513         return netif_start_req_remote(netif->driver->phone, netif->id);
     512        return netif_start_req(netif->driver->phone, netif->id);
    514513}
    515514
     
    591590                rc = start_device(netif);
    592591                if (rc != EOK) {
     592                        printf("%s: Error starting interface %s (%s)\n", NAME,
     593                            netif->name, str_error(rc));
    593594                        measured_strings_destroy(&netif->configuration);
    594595                        netifs_exclude_index(&net_globals.netifs, index);
     596                       
    595597                        return rc;
    596598                }
     
    613615/** Process the networking message.
    614616 *
    615  * @param[in] callid        The message identifier.
    616  * @param[in] call          The message parameters.
     617 * @param[in]  callid       The message identifier.
     618 * @param[in]  call         The message parameters.
    617619 * @param[out] answer       The message answer parameters.
    618620 * @param[out] answer_count The last parameter for the actual answer
     
    627629 */
    628630int net_message(ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer,
    629     int *answer_count)
     631    size_t *answer_count)
    630632{
    631633        measured_string_t *strings;
     
    639641        case NET_NET_GET_DEVICE_CONF:
    640642                rc = measured_strings_receive(&strings, &data,
    641                     IPC_GET_COUNT(call));
     643                    IPC_GET_COUNT(*call));
    642644                if (rc != EOK)
    643645                        return rc;
    644                 net_get_device_conf_req(0, IPC_GET_DEVICE(call), &strings,
    645                     IPC_GET_COUNT(call), NULL);
     646                net_get_device_conf_req(0, IPC_GET_DEVICE(*call), &strings,
     647                    IPC_GET_COUNT(*call), NULL);
    646648               
    647649                /* Strings should not contain received data anymore */
    648650                free(data);
    649651               
    650                 rc = measured_strings_reply(strings, IPC_GET_COUNT(call));
     652                rc = measured_strings_reply(strings, IPC_GET_COUNT(*call));
    651653                free(strings);
    652654                return rc;
    653655        case NET_NET_GET_CONF:
    654656                rc = measured_strings_receive(&strings, &data,
    655                     IPC_GET_COUNT(call));
     657                    IPC_GET_COUNT(*call));
    656658                if (rc != EOK)
    657659                        return rc;
    658                 net_get_conf_req(0, &strings, IPC_GET_COUNT(call), NULL);
     660                net_get_conf_req(0, &strings, IPC_GET_COUNT(*call), NULL);
    659661               
    660662                /* Strings should not contain received data anymore */
    661663                free(data);
    662664               
    663                 rc = measured_strings_reply(strings, IPC_GET_COUNT(call));
     665                rc = measured_strings_reply(strings, IPC_GET_COUNT(*call));
    664666                free(strings);
    665667                return rc;
     
    683685         *  - Answer the first IPC_M_CONNECT_ME_TO call.
    684686         */
    685         ipc_answer_0(iid, EOK);
     687        async_answer_0(iid, EOK);
    686688       
    687689        while (true) {
    688690                /* Clear the answer structure */
    689691                ipc_call_t answer;
    690                 int answer_count;
     692                size_t answer_count;
    691693                refresh_answer(&answer, &answer_count);
    692694               
     
    709711int main(int argc, char *argv[])
    710712{
    711         int rc;
    712        
    713         rc = net_module_start(net_client_connection);
    714         if (rc != EOK) {
    715                 fprintf(stderr, "%s: net_module_start error %i\n", NAME, rc);
    716                 return rc;
    717         }
    718        
    719         return EOK;
     713        return net_module_start(net_client_connection);
    720714}
    721715
Note: See TracChangeset for help on using the changeset viewer.