Changeset a40dea3 in mainline


Ignore:
Timestamp:
2011-06-20T20:04:39Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6a0ff7f4
Parents:
5203e256
Message:

Eliminate devmap_obsolete API.

Location:
uspace
Files:
2 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/Makefile

    r5203e256 ra40dea3  
    6868        generic/clipboard.c \
    6969        generic/devmap.c \
    70         generic/devmap_obsolete.c \
    7170        generic/devman.c \
    7271        generic/devman_obsolete.c \
  • uspace/srv/hid/adb_mouse/adb_dev.c

    r5203e256 ra40dea3  
    4040#include <errno.h>
    4141#include <devmap.h>
    42 #include <devmap_obsolete.h>
    4342#include <async.h>
    44 #include <async_obsolete.h>
    4543#include <kernel/ipc/ipc_methods.h>
    4644
     
    5351{
    5452        devmap_handle_t handle;
    55         int rc = devmap_device_get_handle("adb/mouse", &handle,
     53        async_exch_t *exch;
     54        int rc;
     55       
     56        rc = devmap_device_get_handle("adb/mouse", &handle,
    5657            IPC_FLAG_BLOCKING);
    57        
    5858        if (rc != EOK) {
    5959                printf("%s: Failed resolving ADB\n", NAME);
     
    6161        }
    6262       
    63         int dev_phone = devmap_obsolete_device_connect(handle, IPC_FLAG_BLOCKING);
    64         if (dev_phone < 0) {
     63        async_sess_t *dev_sess = devmap_device_connect(EXCHANGE_ATOMIC, handle,
     64            IPC_FLAG_BLOCKING);
     65        if (dev_sess == NULL) {
    6566                printf("%s: Failed connecting to ADB\n", NAME);
    6667                return ENOENT;
    6768        }
    6869       
     70        exch = async_exchange_begin(dev_sess);
     71        if (exch == NULL) {
     72                printf("%s: Failed starting exchange with ADB\n", NAME);
     73                async_hangup(dev_sess);
     74                return ENOMEM;
     75        }
     76       
    6977        /* NB: The callback connection is slotted for removal */
    70         if (async_obsolete_connect_to_me(dev_phone, 0, 0, 0, adb_dev_events,
    71             NULL) != 0) {
     78        rc = async_connect_to_me(exch, 0, 0, 0, adb_dev_events, NULL);
     79        async_exchange_end(exch);
     80       
     81        if (rc != 0) {
    7282                printf(NAME ": Failed to create callback from device\n");
    73                 return false;
     83                async_hangup(dev_sess);
     84                return ENOENT;
    7485        }
    7586       
  • uspace/srv/hid/char_mouse/chardev.c

    r5203e256 ra40dea3  
    3636#include <ipc/char.h>
    3737#include <async.h>
    38 #include <async_obsolete.h>
    3938#include <vfs/vfs.h>
    4039#include <fcntl.h>
    4140#include <errno.h>
    4241#include <devmap.h>
    43 #include <devmap_obsolete.h>
    4442#include <char_mouse.h>
    4543#include <mouse_port.h>
     
    4745static void chardev_events(ipc_callid_t iid, ipc_call_t *icall, void *arg);
    4846
    49 static int dev_phone;
     47static async_sess_t *dev_sess;
    5048
    5149#define NAME "char_mouse"
     
    5452{
    5553        devmap_handle_t handle;
    56         int rc = devmap_device_get_handle("char/ps2b", &handle,
     54        async_exch_t *exch;
     55        int rc;
     56       
     57        rc = devmap_device_get_handle("char/ps2b", &handle,
    5758            IPC_FLAG_BLOCKING);
    5859       
     
    6263        }
    6364       
    64         dev_phone = devmap_obsolete_device_connect(handle, IPC_FLAG_BLOCKING);
    65         if (dev_phone < 0) {
     65        dev_sess = devmap_device_connect(EXCHANGE_ATOMIC, handle,
     66            IPC_FLAG_BLOCKING);
     67        if (dev_sess == NULL) {
    6668                printf("%s: Failed connecting to PS/2\n", NAME);
    6769                return ENOENT;
    6870        }
    6971       
     72        exch = async_exchange_begin(dev_sess);
     73        if (exch == NULL) {
     74                printf("%s: Failed starting exchange with PS/2\n", NAME);
     75                async_hangup(dev_sess);
     76                return ENOMEM;
     77        }
     78       
    7079        /* NB: The callback connection is slotted for removal */
    71         if (async_obsolete_connect_to_me(dev_phone, 0, 0, 0, chardev_events,
    72             NULL) != 0) {
     80        rc = async_connect_to_me(exch, 0, 0, 0, chardev_events, NULL);
     81        async_exchange_end(exch);
     82       
     83        if (rc != 0) {
    7384                printf(NAME ": Failed to create callback from device\n");
     85                async_hangup(dev_sess);
    7486                return false;
    7587        }
     
    88100void mouse_port_write(uint8_t data)
    89101{
    90         async_obsolete_msg_1(dev_phone, CHAR_WRITE_BYTE, data);
     102        async_exch_t *exch = async_exchange_begin(dev_sess);
     103        if (exch == NULL) {
     104                printf("%s: Failed starting exchange with PS/2\n", NAME);
     105                return;
     106        }
     107       
     108        async_msg_1(exch, CHAR_WRITE_BYTE, data);
     109       
     110        async_exchange_end(exch);
    91111}
    92112
  • uspace/srv/hid/console/console.c

    r5203e256 ra40dea3  
    5454#include <event.h>
    5555#include <devmap.h>
    56 #include <devmap_obsolete.h>
    5756#include <fcntl.h>
    5857#include <vfs/vfs.h>
     
    6867#define NAMESPACE  "term"
    6968
    70 /** Phone to the input server. */
    71 static int input_phone;
     69/** Session with the input server. */
     70static async_sess_t *input_sess;
    7271
    7372/** Information about framebuffer */
     
    109108static FIBRIL_CONDVAR_INITIALIZE(input_cv);
    110109
     110static FIBRIL_MUTEX_INITIALIZE(big_console_lock);
     111
     112static void console_serialize_start(void)
     113{
     114        fibril_mutex_lock(&big_console_lock);
     115}
     116
     117static void console_serialize_end(void)
     118{
     119        fibril_mutex_unlock(&big_console_lock);
     120}
     121
    111122static void curs_visibility(bool visible)
    112123{
     
    141152static void input_yield(void)
    142153{
    143         async_obsolete_req_0_0(input_phone, INPUT_YIELD);
     154        async_exch_t *exch = async_exchange_begin(input_sess);
     155        if (exch == NULL) {
     156                printf("%s: Failed starting exchange with input device.\n",
     157                    NAME);
     158                return;
     159        }
     160       
     161        async_req_0_0(exch, INPUT_YIELD);
     162        async_exchange_end(exch);
    144163}
    145164
    146165static void input_reclaim(void)
    147166{
    148         async_obsolete_req_0_0(input_phone, INPUT_RECLAIM);
     167        async_exch_t *exch = async_exchange_begin(input_sess);
     168        if (exch == NULL) {
     169                printf("%s: Failed starting exchange with input device.\n",
     170                    NAME);
     171                return;
     172        }
     173       
     174        async_req_0_0(exch, INPUT_RECLAIM);
     175        async_exchange_end(exch);
    149176}
    150177
     
    323350       
    324351        if (cons == kernel_console) {
    325                 async_obsolete_serialize_start();
     352                console_serialize_start();
    326353                curs_hide_sync();
    327354                gcons_in_kernel();
    328355                screen_yield();
    329356                input_yield();
    330                 async_obsolete_serialize_end();
     357                console_serialize_end();
    331358               
    332359                if (__SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE)) {
     
    338365       
    339366        if (cons != kernel_console) {
    340                 async_obsolete_serialize_start();
     367                console_serialize_start();
    341368               
    342369                if (active_console == kernel_console) {
     
    393420                curs_visibility(cons->scr.is_cursor_visible);
    394421               
    395                 async_obsolete_serialize_end();
     422                console_serialize_end();
    396423        }
    397424}
     
    410437                if (!IPC_GET_IMETHOD(call)) {
    411438                        /* TODO: Handle hangup */
    412                         async_obsolete_hangup(input_phone);
     439                        async_hangup(input_sess);
    413440                        return;
    414441                }
     
    470497        }
    471498       
    472         async_obsolete_serialize_start();
     499        console_serialize_start();
    473500       
    474501        size_t off = 0;
     
    478505        }
    479506       
    480         async_obsolete_serialize_end();
     507        console_serialize_end();
    481508       
    482509        gcons_notify_char(cons->index);
     
    573600        int rc;
    574601       
    575         async_obsolete_serialize_start();
     602        console_serialize_start();
    576603        if (cons->refcount == 0)
    577604                gcons_notify_connect(cons->index);
     
    583610       
    584611        while (true) {
    585                 async_obsolete_serialize_end();
     612                console_serialize_end();
    586613                callid = async_get_call(&call);
    587                 async_obsolete_serialize_start();
     614                console_serialize_start();
    588615               
    589616                arg1 = 0;
     
    595622                        if (cons->refcount == 0)
    596623                                gcons_notify_disconnect(cons->index);
     624                        console_serialize_end();
    597625                        return;
    598626                }
     
    600628                switch (IPC_GET_IMETHOD(call)) {
    601629                case VFS_OUT_READ:
    602                         async_obsolete_serialize_end();
     630                        console_serialize_end();
    603631                        cons_read(cons, callid, &call);
    604                         async_obsolete_serialize_start();
     632                        console_serialize_start();
    605633                        continue;
    606634                case VFS_OUT_WRITE:
    607                         async_obsolete_serialize_end();
     635                        console_serialize_end();
    608636                        cons_write(cons, callid, &call);
    609                         async_obsolete_serialize_start();
     637                        console_serialize_start();
    610638                        continue;
    611639                case VFS_OUT_SYNC:
     
    678706                        break;
    679707                case CONSOLE_GET_EVENT:
    680                         async_obsolete_serialize_end();
     708                        console_serialize_end();
    681709                        cons_get_event(cons, callid, &call);
    682                         async_obsolete_serialize_start();
     710                        console_serialize_start();
    683711                        continue;
    684712                case CONSOLE_KCON_ENABLE:
     
    695723}
    696724
    697 static int connect_input(const char *dev_path)
    698 {
    699         int phone;
     725static async_sess_t *connect_input(const char *dev_path)
     726{
     727        async_sess_t *sess;
     728        async_exch_t *exch;
    700729        devmap_handle_t handle;
    701730       
    702731        int rc = devmap_device_get_handle(dev_path, &handle, 0);
    703732        if (rc == EOK) {
    704                 phone = devmap_obsolete_device_connect(handle, 0);
    705                 if (phone < 0) {
    706                         printf("%s: Failed to connect to input device\n", NAME);
    707                         return phone;
     733                sess = devmap_device_connect(EXCHANGE_ATOMIC, handle, 0);
     734                if (sess == NULL) {
     735                        printf("%s: Failed to connect to input server\n", NAME);
     736                        return NULL;
    708737                }
    709738        } else {
    710                 return rc;
     739                return NULL;
     740        }
     741       
     742        exch = async_exchange_begin(sess);
     743        if (exch == NULL) {
     744                printf("%s: Failed to create callback from input server.\n", NAME);
     745                return NULL;
    711746        }
    712747       
    713748        /* NB: The callback connection is slotted for removal */
    714         rc = async_obsolete_connect_to_me(phone, SERVICE_CONSOLE, 0, 0,
    715             input_events, NULL);
     749        rc = async_connect_to_me(exch, SERVICE_CONSOLE, 0, 0, input_events,
     750            NULL);
     751
     752        async_exchange_end(exch);
    716753
    717754        if (rc != EOK) {
    718                 async_obsolete_hangup(phone);
    719                 printf("%s: Failed to create callback from input device (%s).\n",
     755                async_hangup(sess);
     756                printf("%s: Failed to create callback from input server (%s).\n",
    720757                    NAME, str_error(rc));
    721                 return rc;
    722         }
    723        
    724         return phone;
     758                return NULL;
     759        }
     760       
     761        return sess;
    725762}
    726763
     
    728765{
    729766        /* Connect to input server */
    730         input_phone = connect_input(input_dev);
    731         if (input_phone < 0)
     767        input_sess = connect_input(input_dev);
     768        if (input_sess == NULL)
    732769                return false;
    733770       
     
    800837       
    801838        /* Initialize the screen */
    802         async_obsolete_serialize_start();
     839        console_serialize_start();
    803840        gcons_redraw_console();
    804841        set_style(STYLE_NORMAL);
     
    806843        curs_goto(0, 0);
    807844        curs_visibility(active_console->scr.is_cursor_visible);
    808         async_obsolete_serialize_end();
     845        console_serialize_end();
    809846       
    810847        /* Receive kernel notifications */
  • uspace/srv/hid/input/port/adb.c

    r5203e256 ra40dea3  
    3737#include <ipc/adb.h>
    3838#include <async.h>
    39 #include <async_obsolete.h>
    4039#include <input.h>
    4140#include <kbd_port.h>
     
    4544#include <errno.h>
    4645#include <devmap.h>
    47 #include <devmap_obsolete.h>
    4846
    4947static void kbd_port_events(ipc_callid_t iid, ipc_call_t *icall, void *arg);
     
    6361
    6462static kbd_dev_t *kbd_dev;
    65 static int dev_phone;
     63static async_sess_t *dev_sess;
    6664
    6765static int adb_port_init(kbd_dev_t *kdev)
     
    6967        const char *dev = "adb/kbd";
    7068        devmap_handle_t handle;
    71 
     69        async_exch_t *exch;
     70        int rc;
     71       
    7272        kbd_dev = kdev;
    7373       
    74         int rc = devmap_device_get_handle(dev, &handle, 0);
    75         if (rc == EOK) {
    76                 dev_phone = devmap_obsolete_device_connect(handle, 0);
    77                 if (dev_phone < 0) {
    78                         printf("%s: Failed to connect to device\n", NAME);
    79                         return dev_phone;
    80                 }
    81         } else
     74        rc = devmap_device_get_handle(dev, &handle, 0);
     75        if (rc != EOK)
    8276                return rc;
    8377       
     78        dev_sess = devmap_device_connect(EXCHANGE_ATOMIC, handle, 0);
     79        if (dev_sess == NULL) {
     80                printf("%s: Failed to connect to device\n", NAME);
     81                return ENOENT;
     82        }
     83       
     84        exch = async_exchange_begin(dev_sess);
     85        if (exch == NULL) {
     86                printf("%s: Failed starting exchange with device\n", NAME);
     87                async_hangup(dev_sess);
     88                return ENOMEM;
     89        }
     90       
    8491        /* NB: The callback connection is slotted for removal */
    85         rc = async_obsolete_connect_to_me(dev_phone, 0, 0, 0, kbd_port_events,
    86             NULL);
     92        rc = async_connect_to_me(exch, 0, 0, 0, kbd_port_events, NULL);
     93        async_exchange_end(exch);
    8794        if (rc != EOK) {
    8895                printf(NAME ": Failed to create callback from device\n");
     96                async_hangup(dev_sess);
    8997                return rc;
    9098        }
  • uspace/srv/hid/input/port/chardev.c

    r5203e256 ra40dea3  
    3737#include <ipc/char.h>
    3838#include <async.h>
    39 #include <async_obsolete.h>
    4039#include <input.h>
    4140#include <kbd_port.h>
    4241#include <kbd.h>
    4342#include <devmap.h>
    44 #include <devmap_obsolete.h>
    4543#include <errno.h>
    4644#include <stdio.h>
     
    6159
    6260static kbd_dev_t *kbd_dev;
    63 static int dev_phone;
     61static async_sess_t *dev_sess;
    6462
    6563/** List of devices to try connecting to. */
     
    7472{
    7573        devmap_handle_t handle;
     74        async_exch_t *exch;
    7675        unsigned int i;
    7776        int rc;
     
    9089        }
    9190       
    92         dev_phone = devmap_obsolete_device_connect(handle, IPC_FLAG_BLOCKING);
    93         if (dev_phone < 0) {
     91        dev_sess = devmap_device_connect(EXCHANGE_ATOMIC, handle,
     92            IPC_FLAG_BLOCKING);
     93        if (dev_sess == NULL) {
    9494                printf("%s: Failed connecting to device\n", NAME);
    9595                return ENOENT;
    9696        }
    9797       
     98        exch = async_exchange_begin(dev_sess);
     99        if (exch == NULL) {
     100                printf("%s: Failed starting exchange with device\n", NAME);
     101                async_hangup(dev_sess);
     102                return ENOMEM;
     103        }
     104       
    98105        /* NB: The callback connection is slotted for removal */
    99         if (async_obsolete_connect_to_me(dev_phone, 0, 0, 0, kbd_port_events,
    100             NULL) != 0) {
     106        rc = async_connect_to_me(exch, 0, 0, 0, kbd_port_events, NULL);
     107        async_exchange_end(exch);
     108       
     109        if (rc != 0) {
    101110                printf(NAME ": Failed to create callback from device\n");
     111                async_hangup(dev_sess);
    102112                return -1;
    103113        }
    104 
     114       
    105115        return 0;
    106116}
     
    116126static void chardev_port_write(uint8_t data)
    117127{
    118         async_obsolete_msg_1(dev_phone, CHAR_WRITE_BYTE, data);
     128        async_exch_t *exch = async_exchange_begin(dev_sess);
     129        if (exch == NULL) {
     130                printf("%s: Failed starting exchange with device\n", NAME);
     131                return;
     132        }
     133
     134        async_msg_1(exch, CHAR_WRITE_BYTE, data);
     135        async_exchange_end(exch);
    119136}
    120137
Note: See TracChangeset for help on using the changeset viewer.