Changeset a46e56b in mainline for uspace/srv/hid/compositor


Ignore:
Timestamp:
2018-03-22T06:49:35Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
77f0a1d
Parents:
3e242d2
git-author:
Jakub Jermar <jakub@…> (2018-03-21 23:29:06)
git-committer:
Jakub Jermar <jakub@…> (2018-03-22 06:49:35)
Message:

Prefer handle over ID in naming handle variables

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/compositor/compositor.c

    r3e242d2 ra46e56b  
    589589}
    590590
    591 static void comp_window_get_event(window_t *win, cap_call_handle_t iid, ipc_call_t *icall)
     591static void comp_window_get_event(window_t *win, cap_call_handle_t icall_handle, ipc_call_t *icall)
    592592{
    593593        window_event_t *event = (window_event_t *) prodcons_consume(&win->queue);
    594594
    595         cap_call_handle_t callid;
     595        cap_call_handle_t chandle;
    596596        size_t len;
    597597
    598         if (!async_data_read_receive(&callid, &len)) {
    599                 async_answer_0(iid, EINVAL);
     598        if (!async_data_read_receive(&chandle, &len)) {
     599                async_answer_0(icall_handle, EINVAL);
    600600                free(event);
    601601                return;
    602602        }
    603603
    604         errno_t rc = async_data_read_finalize(callid, event, len);
     604        errno_t rc = async_data_read_finalize(chandle, event, len);
    605605        if (rc != EOK) {
    606                 async_answer_0(iid, ENOMEM);
     606                async_answer_0(icall_handle, ENOMEM);
    607607                free(event);
    608608                return;
    609609        }
    610610
    611         async_answer_0(iid, EOK);
     611        async_answer_0(icall_handle, EOK);
    612612        free(event);
    613613}
    614614
    615 static void comp_window_damage(window_t *win, cap_call_handle_t iid, ipc_call_t *icall)
     615static void comp_window_damage(window_t *win, cap_call_handle_t icall_handle, ipc_call_t *icall)
    616616{
    617617        double x = IPC_GET_ARG1(*icall);
     
    631631        }
    632632
    633         async_answer_0(iid, EOK);
    634 }
    635 
    636 static void comp_window_grab(window_t *win, cap_call_handle_t iid, ipc_call_t *icall)
     633        async_answer_0(icall_handle, EOK);
     634}
     635
     636static void comp_window_grab(window_t *win, cap_call_handle_t icall_handle, ipc_call_t *icall)
    637637{
    638638        sysarg_t pos_id = IPC_GET_ARG1(*icall);
     
    661661        }
    662662
    663         async_answer_0(iid, EOK);
     663        async_answer_0(icall_handle, EOK);
    664664}
    665665
     
    693693}
    694694
    695 static void comp_window_resize(window_t *win, cap_call_handle_t iid, ipc_call_t *icall)
    696 {
    697         cap_call_handle_t callid;
     695static void comp_window_resize(window_t *win, cap_call_handle_t icall_handle, ipc_call_t *icall)
     696{
     697        cap_call_handle_t chandle;
    698698        size_t size;
    699699        unsigned int flags;
    700700
    701701        /* Start sharing resized window with client. */
    702         if (!async_share_out_receive(&callid, &size, &flags)) {
    703                 async_answer_0(iid, EINVAL);
     702        if (!async_share_out_receive(&chandle, &size, &flags)) {
     703                async_answer_0(icall_handle, EINVAL);
    704704                return;
    705705        }
    706706
    707707        void *new_cell_storage;
    708         errno_t rc = async_share_out_finalize(callid, &new_cell_storage);
     708        errno_t rc = async_share_out_finalize(chandle, &new_cell_storage);
    709709        if ((rc != EOK) || (new_cell_storage == AS_MAP_FAILED)) {
    710                 async_answer_0(iid, ENOMEM);
     710                async_answer_0(icall_handle, ENOMEM);
    711711                return;
    712712        }
     
    717717        if (!new_surface) {
    718718                as_area_destroy(new_cell_storage);
    719                 async_answer_0(iid, ENOMEM);
     719                async_answer_0(icall_handle, ENOMEM);
    720720                return;
    721721        }
     
    804804        comp_damage(x, y, width, height);
    805805
    806         async_answer_0(iid, EOK);
     806        async_answer_0(icall_handle, EOK);
    807807}
    808808
     
    836836}
    837837
    838 static void comp_window_close(window_t *win, cap_call_handle_t iid, ipc_call_t *icall)
     838static void comp_window_close(window_t *win, cap_call_handle_t icall_handle, ipc_call_t *icall)
    839839{
    840840        /* Stop managing the window. */
     
    876876
    877877        comp_damage(x, y, width, height);
    878         async_answer_0(iid, EOK);
    879 }
    880 
    881 static void comp_window_close_request(window_t *win, cap_call_handle_t iid, ipc_call_t *icall)
     878        async_answer_0(icall_handle, EOK);
     879}
     880
     881static void comp_window_close_request(window_t *win, cap_call_handle_t icall_handle, ipc_call_t *icall)
    882882{
    883883        window_event_t *event = (window_event_t *) malloc(sizeof(window_event_t));
    884884        if (event == NULL) {
    885                 async_answer_0(iid, ENOMEM);
     885                async_answer_0(icall_handle, ENOMEM);
    886886                return;
    887887        }
     
    891891
    892892        prodcons_produce(&win->queue, &event->link);
    893         async_answer_0(iid, EOK);
    894 }
    895 
    896 static void client_connection(cap_call_handle_t iid, ipc_call_t *icall, void *arg)
     893        async_answer_0(icall_handle, EOK);
     894}
     895
     896static void client_connection(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg)
    897897{
    898898        ipc_call_t call;
    899         cap_call_handle_t callid;
     899        cap_call_handle_t chandle;
    900900        service_id_t service_id = (service_id_t) IPC_GET_ARG2(*icall);
    901901
    902902        /* Allocate resources for new window and register it to the location service. */
    903903        if (service_id == winreg_id) {
    904                 async_answer_0(iid, EOK);
    905 
    906                 callid = async_get_call(&call);
     904                async_answer_0(icall_handle, EOK);
     905
     906                chandle = async_get_call(&call);
    907907                if (IPC_GET_IMETHOD(call) == WINDOW_REGISTER) {
    908908                        fibril_mutex_lock(&window_list_mtx);
     
    910910                        window_t *win = window_create();
    911911                        if (!win) {
    912                                 async_answer_2(callid, ENOMEM, 0, 0);
     912                                async_answer_2(chandle, ENOMEM, 0, 0);
    913913                                fibril_mutex_unlock(&window_list_mtx);
    914914                                return;
     
    929929                        if (loc_service_register(name_in, &win->in_dsid) != EOK) {
    930930                                window_destroy(win);
    931                                 async_answer_2(callid, EINVAL, 0, 0);
     931                                async_answer_2(chandle, EINVAL, 0, 0);
    932932                                fibril_mutex_unlock(&window_list_mtx);
    933933                                return;
     
    937937                                loc_service_unregister(win->in_dsid);
    938938                                window_destroy(win);
    939                                 async_answer_2(callid, EINVAL, 0, 0);
     939                                async_answer_2(chandle, EINVAL, 0, 0);
    940940                                fibril_mutex_unlock(&window_list_mtx);
    941941                                return;
     
    951951                        }
    952952
    953                         async_answer_2(callid, EOK, win->in_dsid, win->out_dsid);
     953                        async_answer_2(chandle, EOK, win->in_dsid, win->out_dsid);
    954954                        fibril_mutex_unlock(&window_list_mtx);
    955955
     
    960960                        return;
    961961                } else {
    962                         async_answer_0(callid, EINVAL);
     962                        async_answer_0(chandle, EINVAL);
    963963                        return;
    964964                }
     
    978978        if (win) {
    979979                atomic_inc(&win->ref_cnt);
    980                 async_answer_0(iid, EOK);
     980                async_answer_0(icall_handle, EOK);
    981981        } else {
    982                 async_answer_0(iid, EINVAL);
     982                async_answer_0(icall_handle, EINVAL);
    983983                return;
    984984        }
     
    987987        if (win->in_dsid == service_id) {
    988988                while (true) {
    989                         callid = async_get_call(&call);
     989                        chandle = async_get_call(&call);
    990990
    991991                        if (!IPC_GET_IMETHOD(call)) {
    992                                 async_answer_0(callid, EOK);
     992                                async_answer_0(chandle, EOK);
    993993                                atomic_dec(&win->ref_cnt);
    994994                                window_destroy(win);
     
    998998                        switch (IPC_GET_IMETHOD(call)) {
    999999                        case WINDOW_GET_EVENT:
    1000                                 comp_window_get_event(win, callid, &call);
     1000                                comp_window_get_event(win, chandle, &call);
    10011001                                break;
    10021002                        default:
    1003                                 async_answer_0(callid, EINVAL);
     1003                                async_answer_0(chandle, EINVAL);
    10041004                        }
    10051005                }
    10061006        } else if (win->out_dsid == service_id) {
    10071007                while (true) {
    1008                         callid = async_get_call(&call);
     1008                        chandle = async_get_call(&call);
    10091009
    10101010                        if (!IPC_GET_IMETHOD(call)) {
    1011                                 comp_window_close(win, callid, &call);
     1011                                comp_window_close(win, chandle, &call);
    10121012                                atomic_dec(&win->ref_cnt);
    10131013                                window_destroy(win);
     
    10171017                        switch (IPC_GET_IMETHOD(call)) {
    10181018                        case WINDOW_DAMAGE:
    1019                                 comp_window_damage(win, callid, &call);
     1019                                comp_window_damage(win, chandle, &call);
    10201020                                break;
    10211021                        case WINDOW_GRAB:
    1022                                 comp_window_grab(win, callid, &call);
     1022                                comp_window_grab(win, chandle, &call);
    10231023                                break;
    10241024                        case WINDOW_RESIZE:
    1025                                 comp_window_resize(win, callid, &call);
     1025                                comp_window_resize(win, chandle, &call);
    10261026                                break;
    10271027                        case WINDOW_CLOSE:
     
    10301030                                 * the case when the client is killed abruptly.
    10311031                                 */
    1032                                 async_answer_0(callid, EOK);
     1032                                async_answer_0(chandle, EOK);
    10331033                                break;
    10341034                        case WINDOW_CLOSE_REQUEST:
    1035                                 comp_window_close_request(win, callid, &call);
     1035                                comp_window_close_request(win, chandle, &call);
    10361036                                break;
    10371037                        default:
    1038                                 async_answer_0(callid, EINVAL);
    1039                         }
    1040                 }
    1041         }
    1042 }
    1043 
    1044 static void comp_mode_change(viewport_t *vp, cap_call_handle_t iid, ipc_call_t *icall)
     1038                                async_answer_0(chandle, EINVAL);
     1039                        }
     1040                }
     1041        }
     1042}
     1043
     1044static void comp_mode_change(viewport_t *vp, cap_call_handle_t icall_handle, ipc_call_t *icall)
    10451045{
    10461046        sysarg_t mode_idx = IPC_GET_ARG2(*icall);
     
    10521052        if (rc != EOK) {
    10531053                fibril_mutex_unlock(&viewport_list_mtx);
    1054                 async_answer_0(iid, EINVAL);
     1054                async_answer_0(icall_handle, EINVAL);
    10551055                return;
    10561056        }
     
    10611061        if (!new_surface) {
    10621062                fibril_mutex_unlock(&viewport_list_mtx);
    1063                 async_answer_0(iid, ENOMEM);
     1063                async_answer_0(icall_handle, ENOMEM);
    10641064                return;
    10651065        }
     
    10711071                surface_destroy(new_surface);
    10721072                fibril_mutex_unlock(&viewport_list_mtx);
    1073                 async_answer_0(iid, rc);
     1073                async_answer_0(icall_handle, rc);
    10741074                return;
    10751075        }
     
    10811081
    10821082        fibril_mutex_unlock(&viewport_list_mtx);
    1083         async_answer_0(iid, EOK);
     1083        async_answer_0(icall_handle, EOK);
    10841084
    10851085        comp_restrict_pointers();
     
    11151115        fibril_mutex_unlock(&window_list_mtx);
    11161116
    1117         async_answer_0(iid, EOK);
     1117        async_answer_0(icall_handle, EOK);
    11181118
    11191119        /* All fibrils of the compositor will terminate soon. */
     
    11211121#endif
    11221122
    1123 static void comp_visualizer_disconnect(viewport_t *vp, cap_call_handle_t iid, ipc_call_t *icall)
     1123static void comp_visualizer_disconnect(viewport_t *vp, cap_call_handle_t icall_handle, ipc_call_t *icall)
    11241124{
    11251125        /* Release viewport resources. */
     
    11311131        fibril_mutex_unlock(&viewport_list_mtx);
    11321132
    1133         async_answer_0(iid, EOK);
     1133        async_answer_0(icall_handle, EOK);
    11341134
    11351135        comp_restrict_pointers();
     
    11371137}
    11381138
    1139 static void vsl_notifications(cap_call_handle_t iid, ipc_call_t *icall, void *arg)
     1139static void vsl_notifications(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg)
    11401140{
    11411141        viewport_t *vp = NULL;
     
    11551155        while (true) {
    11561156                ipc_call_t call;
    1157                 cap_call_handle_t callid = async_get_call(&call);
     1157                cap_call_handle_t chandle = async_get_call(&call);
    11581158
    11591159                if (!IPC_GET_IMETHOD(call)) {
     
    11641164                switch (IPC_GET_IMETHOD(call)) {
    11651165                case VISUALIZER_MODE_CHANGE:
    1166                         comp_mode_change(vp, callid, &call);
     1166                        comp_mode_change(vp, chandle, &call);
    11671167                        break;
    11681168                case VISUALIZER_DISCONNECT:
    1169                         comp_visualizer_disconnect(vp, callid, &call);
     1169                        comp_visualizer_disconnect(vp, chandle, &call);
    11701170                        return;
    11711171                default:
    1172                         async_answer_0(callid, EINVAL);
     1172                        async_answer_0(chandle, EINVAL);
    11731173                }
    11741174        }
Note: See TracChangeset for help on using the changeset viewer.