Changeset b7fd2a0 in mainline for uspace/lib/usbvirt/src/ipc_hc.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/usbvirt/src/ipc_hc.c

    r36f0738 rb7fd2a0  
    5555 *
    5656 */
    57 int usbvirt_ipc_send_control_read(async_sess_t *sess, void *setup_buffer,
     57errno_t usbvirt_ipc_send_control_read(async_sess_t *sess, void *setup_buffer,
    5858    size_t setup_buffer_size, void *data_buffer, size_t data_buffer_size,
    5959    size_t *data_transfered_size)
     
    7777        }
    7878       
    79         int rc = async_data_write_start(exch, setup_buffer, setup_buffer_size);
     79        errno_t rc = async_data_write_start(exch, setup_buffer, setup_buffer_size);
    8080        if (rc != EOK) {
    8181                async_exchange_end(exch);
     
    9595        }
    9696       
    97         int data_request_rc;
    98         int opening_request_rc;
     97        errno_t data_request_rc;
     98        errno_t opening_request_rc;
    9999        async_wait_for(data_request, &data_request_rc);
    100100        async_wait_for(opening_request, &opening_request_rc);
     
    103103                /* Prefer the return code of the opening request. */
    104104                if (opening_request_rc != EOK)
    105                         return (int) opening_request_rc;
     105                        return (errno_t) opening_request_rc;
    106106                else
    107                         return (int) data_request_rc;
     107                        return (errno_t) data_request_rc;
    108108        }
    109109       
    110110        if (opening_request_rc != EOK)
    111                 return (int) opening_request_rc;
     111                return (errno_t) opening_request_rc;
    112112       
    113113        if (data_transfered_size != NULL)
     
    129129 *
    130130 */
    131 int usbvirt_ipc_send_control_write(async_sess_t *sess, void *setup_buffer,
     131errno_t usbvirt_ipc_send_control_write(async_sess_t *sess, void *setup_buffer,
    132132    size_t setup_buffer_size, void *data_buffer, size_t data_buffer_size)
    133133{
     
    150150        }
    151151       
    152         int rc = async_data_write_start(exch, setup_buffer, setup_buffer_size);
     152        errno_t rc = async_data_write_start(exch, setup_buffer, setup_buffer_size);
    153153        if (rc != EOK) {
    154154                async_exchange_end(exch);
     
    168168        async_exchange_end(exch);
    169169       
    170         int opening_request_rc;
     170        errno_t opening_request_rc;
    171171        async_wait_for(opening_request, &opening_request_rc);
    172172       
    173         return (int) opening_request_rc;
     173        return (errno_t) opening_request_rc;
    174174}
    175175
     
    186186 *
    187187 */
    188 int usbvirt_ipc_send_data_in(async_sess_t *sess, usb_endpoint_t ep,
     188errno_t usbvirt_ipc_send_data_in(async_sess_t *sess, usb_endpoint_t ep,
    189189    usb_transfer_type_t tr_type, void *data, size_t data_size, size_t *act_size)
    190190{
     
    230230        }
    231231       
    232         int data_request_rc;
    233         int opening_request_rc;
     232        errno_t data_request_rc;
     233        errno_t opening_request_rc;
    234234        async_wait_for(data_request, &data_request_rc);
    235235        async_wait_for(opening_request, &opening_request_rc);
     
    238238                /* Prefer the return code of the opening request. */
    239239                if (opening_request_rc != EOK)
    240                         return (int) opening_request_rc;
     240                        return (errno_t) opening_request_rc;
    241241                else
    242                         return (int) data_request_rc;
     242                        return (errno_t) data_request_rc;
    243243        }
    244244       
    245245        if (opening_request_rc != EOK)
    246                 return (int) opening_request_rc;
     246                return (errno_t) opening_request_rc;
    247247       
    248248        if (act_size != NULL)
     
    263263 *
    264264 */
    265 int usbvirt_ipc_send_data_out(async_sess_t *sess, usb_endpoint_t ep,
     265errno_t usbvirt_ipc_send_data_out(async_sess_t *sess, usb_endpoint_t ep,
    266266    usb_transfer_type_t tr_type, void *data, size_t data_size)
    267267{
     
    296296        }
    297297       
    298         int rc = async_data_write_start(exch, data, data_size);
     298        errno_t rc = async_data_write_start(exch, data, data_size);
    299299       
    300300        async_exchange_end(exch);
     
    305305        }
    306306       
    307         int opening_request_rc;
     307        errno_t opening_request_rc;
    308308        async_wait_for(opening_request, &opening_request_rc);
    309309       
    310         return (int) opening_request_rc;
     310        return (errno_t) opening_request_rc;
    311311}
    312312
Note: See TracChangeset for help on using the changeset viewer.