Changeset eadaeae8 in mainline for uspace/lib/hound/src/protocol.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
  • TabularUnified uspace/lib/hound/src/protocol.c

    r874381a readaeae8  
    153153 * @return Error code.
    154154 */
    155 errno_t hound_service_unregister_context(hound_sess_t *sess, hound_context_id_t id)
     155errno_t hound_service_unregister_context(hound_sess_t *sess,
     156    hound_context_id_t id)
    156157{
    157158        assert(sess);
    158159        async_exch_t *exch = async_exchange_begin(sess);
    159         const errno_t ret =
    160             async_req_1_0(exch, IPC_M_HOUND_CONTEXT_UNREGISTER, id);
     160        const errno_t ret = async_req_1_0(exch, IPC_M_HOUND_CONTEXT_UNREGISTER,
     161            CAP_HANDLE_RAW(id));
    161162        async_exchange_end(exch);
    162163        return ret;
     
    312313                .format = format.sample_format,
    313314        }};
    314         return async_req_4_0(exch, IPC_M_HOUND_STREAM_ENTER, id, flags,
    315             c.arg, bsize);
     315        return async_req_4_0(exch, IPC_M_HOUND_STREAM_ENTER, CAP_HANDLE_RAW(id),
     316            flags, c.arg, bsize);
    316317}
    317318
     
    427428                                async_answer_0(callid, ret);
    428429                        } else {
    429                                 async_answer_1(callid, EOK, id);
     430                                async_answer_1(callid, EOK, CAP_HANDLE_RAW(id));
    430431                        }
    431432                        break;
     
    438439
    439440                        /* get id, 1st param */
    440                         id = IPC_GET_ARG1(call);
     441                        id = (cap_handle_t) IPC_GET_ARG1(call);
    441442                        ret = server_iface->rem_context(server_iface->server,
    442443                            id);
     
    564565
    565566                        /* get parameters */
    566                         id = IPC_GET_ARG1(call);
     567                        id = (cap_handle_t) IPC_GET_ARG1(call);
    567568                        flags = IPC_GET_ARG2(call);
    568569                        const format_convert_t c = {.arg = IPC_GET_ARG3(call)};
Note: See TracChangeset for help on using the changeset viewer.