Changeset eadaeae8 in mainline for uspace/app/trace/trace.c


Ignore:
Timestamp:
2018-03-21T20:58:49Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3be9d10
Parents:
874381a
Message:

Make capability handles type-safe

Define distinct pointer types for the handles of the supported
capability types and use them instead of integer handles. This makes it
virtually impossible to pass a non-handle or a handle of different type
instead of the proper handle. Also turn cap_handle_t into an "untyped"
capability handle that can be assigned to and from the "typed" handles.

This commit also fixes a bug in msim-con driver, which wrongly used the
IRQ number instead of the IRQ capability handle to unregister the IRQ.

This commit also fixes the wrong use of the capability handle instead
of error code in libusbhost.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/trace/trace.c

    r874381a readaeae8  
    282282{
    283283        ipc_call_t call;
    284         sysarg_t phoneid;
     284        cap_phone_handle_t phandle;
    285285
    286286        if (sc_rc != EOK)
    287287                return;
    288288
    289         phoneid = sc_args[0];
     289        phandle = (cap_phone_handle_t) sc_args[0];
    290290
    291291        IPC_SET_IMETHOD(call, sc_args[1]);
     
    296296        IPC_SET_ARG5(call, 0);
    297297
    298         ipcp_call_out(phoneid, &call, 0);
     298        ipcp_call_out(phandle, &call, 0);
    299299}
    300300
     
    311311
    312312        if (rc == EOK) {
    313                 ipcp_call_out(sc_args[0], &call, 0);
    314         }
    315 }
    316 
    317 static void sc_ipc_wait(sysarg_t *sc_args, int sc_rc)
     313                ipcp_call_out((cap_phone_handle_t) sc_args[0], &call, 0);
     314        }
     315}
     316
     317static void sc_ipc_wait(sysarg_t *sc_args, cap_call_handle_t sc_rc)
    318318{
    319319        ipc_call_t call;
     
    390390                break;
    391391        case SYS_IPC_WAIT:
    392                 sc_ipc_wait(sc_args, sc_rc);
     392                sc_ipc_wait(sc_args, (cap_call_handle_t) sc_rc);
    393393                break;
    394394        default:
Note: See TracChangeset for help on using the changeset viewer.