Changeset b7fd2a0 in mainline for uspace/lib/graph/graph.c


Ignore:
Timestamp:
2018-01-13T03:10:29Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a53ed3a
Parents:
36f0738
Message:

Use errno_t in all uspace and kernel code.

Change type of every variable, parameter and return value that holds an
<errno.h> constant to either errno_t (the usual case), or sys_errno_t
(some places in kernel). This is for the purpose of self-documentation,
as well as for type-checking with a bit of type definition hackery.

Although this is a massive commit, it is a simple text replacement, and thus
is very easy to verify. Simply do the following:

`
git checkout <this commit's hash>
git reset HEAD
git add .
tools/srepl '\berrno_t\b' int
git add .
tools/srepl '\bsys_errno_t\b' sysarg_t
git reset
git diff
`

While this doesn't ensure that the replacements are correct, it does ensure
that the commit doesn't do anything except those replacements. Since errno_t
is typedef'd to int in the usual case (and sys_errno_t to sysarg_t), even if
incorrect, this commit cannot change behavior.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/graph/graph.c

    r36f0738 rb7fd2a0  
    8686}
    8787
    88 int graph_register_visualizer(visualizer_t *vs)
     88errno_t graph_register_visualizer(visualizer_t *vs)
    8989{
    9090        char node[LOC_NAME_MAXLEN + 1];
     
    9393       
    9494        category_id_t cat;
    95         int rc = loc_category_get_id("visualizer", &cat, 0);
     95        errno_t rc = loc_category_get_id("visualizer", &cat, 0);
    9696        if (rc != EOK)
    9797                return rc;
     
    114114}
    115115
    116 int graph_register_renderer(renderer_t *rnd)
     116errno_t graph_register_renderer(renderer_t *rnd)
    117117{
    118118        char node[LOC_NAME_MAXLEN + 1];
     
    121121       
    122122        category_id_t cat;
    123         int rc = loc_category_get_id("renderer", &cat, 0);
     123        errno_t rc = loc_category_get_id("renderer", &cat, 0);
    124124        if (rc != EOK)
    125125                return rc;
     
    178178}
    179179
    180 int graph_unregister_visualizer(visualizer_t *vs)
     180errno_t graph_unregister_visualizer(visualizer_t *vs)
    181181{
    182182        fibril_mutex_lock(&visualizer_list_mtx);
    183         int rc = loc_service_unregister(vs->reg_svc_handle);
     183        errno_t rc = loc_service_unregister(vs->reg_svc_handle);
    184184        list_remove(&vs->link);
    185185        fibril_mutex_unlock(&visualizer_list_mtx);
     
    188188}
    189189
    190 int graph_unregister_renderer(renderer_t *rnd)
     190errno_t graph_unregister_renderer(renderer_t *rnd)
    191191{
    192192        fibril_mutex_lock(&renderer_list_mtx);
    193         int rc = loc_service_unregister(rnd->reg_svc_handle);
     193        errno_t rc = loc_service_unregister(rnd->reg_svc_handle);
    194194        list_remove(&rnd->link);
    195195        fibril_mutex_unlock(&renderer_list_mtx);
     
    219219}
    220220
    221 int graph_notify_mode_change(async_sess_t *sess, sysarg_t handle, sysarg_t mode_idx)
     221errno_t graph_notify_mode_change(async_sess_t *sess, sysarg_t handle, sysarg_t mode_idx)
    222222{
    223223        async_exch_t *exch = async_exchange_begin(sess);
    224         int ret = async_req_2_0(exch, VISUALIZER_MODE_CHANGE, handle, mode_idx);
     224        errno_t ret = async_req_2_0(exch, VISUALIZER_MODE_CHANGE, handle, mode_idx);
    225225        async_exchange_end(exch);
    226226       
     
    228228}
    229229
    230 int graph_notify_disconnect(async_sess_t *sess, sysarg_t handle)
     230errno_t graph_notify_disconnect(async_sess_t *sess, sysarg_t handle)
    231231{
    232232        async_exch_t *exch = async_exchange_begin(sess);
    233         int ret = async_req_1_0(exch, VISUALIZER_DISCONNECT, handle);
     233        errno_t ret = async_req_1_0(exch, VISUALIZER_DISCONNECT, handle);
    234234        async_exchange_end(exch);
    235235       
     
    242242{
    243243        vs->client_side_handle = IPC_GET_ARG1(*icall);
    244         int rc = vs->ops.claim(vs);
     244        errno_t rc = vs->ops.claim(vs);
    245245        async_answer_0(iid, rc);
    246246}
     
    257257       
    258258        /* Driver might also deallocate resources for the current mode. */
    259         int rc = vs->ops.yield(vs);
     259        errno_t rc = vs->ops.yield(vs);
    260260       
    261261        /* Now that the driver was given a chance to deallocate resources,
     
    285285                    list_get_instance(link, vslmode_list_element_t, link);
    286286               
    287                 int rc = async_data_read_finalize(callid, &mode_elem->mode, len);
     287                errno_t rc = async_data_read_finalize(callid, &mode_elem->mode, len);
    288288                async_answer_0(iid, rc);
    289289        } else {
     
    317317       
    318318        if (mode_elem != NULL) {
    319                 int rc = async_data_read_finalize(callid, &mode_elem->mode, len);
     319                errno_t rc = async_data_read_finalize(callid, &mode_elem->mode, len);
    320320                async_answer_0(iid, rc);
    321321        } else {
     
    340340       
    341341        if (vs->mode_set) {
    342                 int rc = async_data_read_finalize(callid, &vs->cur_mode, len);
     342                errno_t rc = async_data_read_finalize(callid, &vs->cur_mode, len);
    343343                async_answer_0(iid, rc);
    344344        } else {
     
    372372       
    373373        if (mode_elem != NULL) {
    374                 int rc = async_data_read_finalize(callid, &mode_elem->mode, len);
     374                errno_t rc = async_data_read_finalize(callid, &mode_elem->mode, len);
    375375                async_answer_0(iid, rc);
    376376        } else {
     
    429429       
    430430        void *new_cell_storage;
    431         int rc = async_share_out_finalize(callid, &new_cell_storage);
     431        errno_t rc = async_share_out_finalize(callid, &new_cell_storage);
    432432        if ((rc != EOK) || (new_cell_storage == AS_MAP_FAILED)) {
    433433                async_answer_0(iid, ENOMEM);
     
    472472        sysarg_t y_offset = (IPC_GET_ARG5(*icall) & 0x0000ffff);
    473473       
    474         int rc = vs->ops.handle_damage(vs,
     474        errno_t rc = vs->ops.handle_damage(vs,
    475475            IPC_GET_ARG1(*icall), IPC_GET_ARG2(*icall),
    476476            IPC_GET_ARG3(*icall), IPC_GET_ARG4(*icall),
     
    481481static void vs_suspend(visualizer_t *vs, ipc_callid_t iid, ipc_call_t *icall)
    482482{
    483         int rc = vs->ops.suspend(vs);
     483        errno_t rc = vs->ops.suspend(vs);
    484484        async_answer_0(iid, rc);
    485485}
     
    487487static void vs_wakeup(visualizer_t *vs, ipc_callid_t iid, ipc_call_t *icall)
    488488{
    489         int rc = vs->ops.wakeup(vs);
     489        errno_t rc = vs->ops.wakeup(vs);
    490490        async_answer_0(iid, rc);
    491491}
Note: See TracChangeset for help on using the changeset viewer.