Changeset eadaeae8 in mainline for uspace/lib/c/generic/irq.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/lib/c/generic/irq.c

    r874381a readaeae8  
    6464 */
    6565errno_t ipc_irq_subscribe(int inr, sysarg_t method, const irq_code_t *ucode,
    66     cap_handle_t *out_handle)
     66    cap_irq_handle_t *out_handle)
    6767{
    6868        if (ucode == NULL)
    6969                ucode = &default_ucode;
    7070
    71         return (errno_t) __SYSCALL4(SYS_IPC_IRQ_SUBSCRIBE, inr, method, (sysarg_t) ucode,
    72             (sysarg_t) out_handle);
     71        return (errno_t) __SYSCALL4(SYS_IPC_IRQ_SUBSCRIBE, inr, method,
     72            (sysarg_t) ucode, (sysarg_t) out_handle);
    7373}
    7474
     
    8080 *
    8181 */
    82 errno_t ipc_irq_unsubscribe(cap_handle_t cap)
     82errno_t ipc_irq_unsubscribe(cap_irq_handle_t cap)
    8383{
    84         return (errno_t) __SYSCALL1(SYS_IPC_IRQ_UNSUBSCRIBE, cap);
     84        return (errno_t) __SYSCALL1(SYS_IPC_IRQ_UNSUBSCRIBE,
     85            CAP_HANDLE_RAW(cap));
    8586}
    8687
Note: See TracChangeset for help on using the changeset viewer.