Changeset b0f00a9 in mainline for uspace/srv/bd/gxe_bd/gxe_bd.c


Ignore:
Timestamp:
2011-11-06T22:21:05Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
898e847
Parents:
2bdf8313 (diff), 7b5f4c9 (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/bd/gxe_bd/gxe_bd.c

    r2bdf8313 rb0f00a9  
    4343#include <as.h>
    4444#include <fibril_synch.h>
    45 #include <devmap.h>
     45#include <loc.h>
    4646#include <sys/types.h>
    4747#include <errno.h>
     
    9292static gxe_bd_t *dev;
    9393
    94 static devmap_handle_t devmap_handle[MAX_DISKS];
     94static service_id_t service_id[MAX_DISKS];
    9595
    9696static fibril_mutex_t dev_lock[MAX_DISKS];
    9797
    9898static int gxe_bd_init(void);
    99 static void gxe_bd_connection(ipc_callid_t iid, ipc_call_t *icall);
     99static void gxe_bd_connection(ipc_callid_t iid, ipc_call_t *icall, void *);
    100100static int gxe_bd_read_blocks(int disk_id, uint64_t ba, unsigned cnt,
    101101    void *buf);
     
    126126        char name[16];
    127127
    128         rc = devmap_driver_register(NAME, gxe_bd_connection);
     128        rc = loc_server_register(NAME, gxe_bd_connection);
    129129        if (rc < 0) {
    130130                printf(NAME ": Unable to register driver.\n");
     
    142142        for (i = 0; i < MAX_DISKS; i++) {
    143143                snprintf(name, 16, "%s/disk%d", NAMESPACE, i);
    144                 rc = devmap_device_register(name, &devmap_handle[i]);
     144                rc = loc_service_register(name, &service_id[i]);
    145145                if (rc != EOK) {
    146146                        printf(NAME ": Unable to register device %s.\n", name);
     
    153153}
    154154
    155 static void gxe_bd_connection(ipc_callid_t iid, ipc_call_t *icall)
     155static void gxe_bd_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    156156{
    157157        void *fs_va = NULL;
     
    159159        ipc_call_t call;
    160160        sysarg_t method;
    161         devmap_handle_t dh;
     161        service_id_t dsid;
    162162        unsigned int flags;
    163163        int retval;
     
    167167
    168168        /* Get the device handle. */
    169         dh = IPC_GET_ARG1(*icall);
     169        dsid = IPC_GET_ARG1(*icall);
    170170
    171171        /* Determine which disk device is the client connecting to. */
    172172        disk_id = -1;
    173173        for (i = 0; i < MAX_DISKS; i++)
    174                 if (devmap_handle[i] == dh)
     174                if (service_id[i] == dsid)
    175175                        disk_id = i;
    176176
     
    201201        (void) async_share_out_finalize(callid, fs_va);
    202202
    203         while (1) {
     203        while (true) {
    204204                callid = async_get_call(&call);
    205205                method = IPC_GET_IMETHOD(call);
    206                 switch (method) {
    207                 case IPC_M_PHONE_HUNGUP:
     206               
     207                if (!method) {
    208208                        /* The other side has hung up. */
    209209                        async_answer_0(callid, EOK);
    210210                        return;
     211                }
     212               
     213                switch (method) {
    211214                case BD_READ_BLOCKS:
    212215                        ba = MERGE_LOUP32(IPC_GET_ARG1(call),
Note: See TracChangeset for help on using the changeset viewer.