Ignore:
Timestamp:
2018-01-13T03:10:29Z (8 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/drv/generic/remote_audio_mixer.c

    r36f0738 rb7fd2a0  
    9494 * @return Error code.
    9595 */
    96 int audio_mixer_get_info(async_exch_t *exch, const char **name, unsigned *items)
     96errno_t audio_mixer_get_info(async_exch_t *exch, const char **name, unsigned *items)
    9797{
    9898        if (!exch)
    9999                return EINVAL;
    100100        sysarg_t name_size, itemc;
    101         const int ret = async_req_1_2(exch, DEV_IFACE_ID(AUDIO_MIXER_IFACE),
     101        const errno_t ret = async_req_1_2(exch, DEV_IFACE_ID(AUDIO_MIXER_IFACE),
    102102            IPC_M_AUDIO_MIXER_GET_INFO, &name_size, &itemc);
    103103        if (ret == EOK && name) {
     
    109109                        return ENOMEM;
    110110                }
    111                 const int ret =
     111                const errno_t ret =
    112112                    async_data_read_start(exch, name_place, name_size);
    113113                if (ret != EOK) {
     
    130130 * @return Error code.
    131131 */
    132 int audio_mixer_get_item_info(async_exch_t *exch, unsigned item,
     132errno_t audio_mixer_get_item_info(async_exch_t *exch, unsigned item,
    133133    const char **name, unsigned *levels)
    134134{
     
    136136                return EINVAL;
    137137        sysarg_t name_size, lvls;
    138         const int ret = async_req_2_2(exch, DEV_IFACE_ID(AUDIO_MIXER_IFACE),
     138        const errno_t ret = async_req_2_2(exch, DEV_IFACE_ID(AUDIO_MIXER_IFACE),
    139139            IPC_M_AUDIO_MIXER_GET_ITEM_INFO, item, &name_size, &lvls);
    140140        if (ret == EOK && name) {
     
    146146                        return ENOMEM;
    147147                }
    148                 const int ret =
     148                const errno_t ret =
    149149                    async_data_read_start(exch, name_place, name_size);
    150150                if (ret != EOK) {
     
    166166 * @return Error code.
    167167 */
    168 int audio_mixer_set_item_level(async_exch_t *exch, unsigned item,
     168errno_t audio_mixer_set_item_level(async_exch_t *exch, unsigned item,
    169169    unsigned level)
    170170{
     
    183183 * @return Error code.
    184184 */
    185 int audio_mixer_get_item_level(async_exch_t *exch, unsigned item,
     185errno_t audio_mixer_get_item_level(async_exch_t *exch, unsigned item,
    186186    unsigned *level)
    187187{
     
    189189                return EINVAL;
    190190        sysarg_t current;
    191         const int ret = async_req_2_1(exch, DEV_IFACE_ID(AUDIO_MIXER_IFACE),
     191        const errno_t ret = async_req_2_1(exch, DEV_IFACE_ID(AUDIO_MIXER_IFACE),
    192192            IPC_M_AUDIO_MIXER_GET_ITEM_LEVEL, item, &current);
    193193        if (ret == EOK && level)
     
    229229        const char *name = NULL;
    230230        unsigned items = 0;
    231         const int ret = mixer_iface->get_info(fun, &name, &items);
     231        const errno_t ret = mixer_iface->get_info(fun, &name, &items);
    232232        const size_t name_size = name ? str_size(name) + 1 : 0;
    233233        async_answer_2(callid, ret, name_size, items);
     
    261261        const char *name = NULL;
    262262        unsigned values = 0;
    263         const int ret = mixer_iface->get_item_info(fun, item, &name, &values);
     263        const errno_t ret = mixer_iface->get_item_info(fun, item, &name, &values);
    264264        const size_t name_size = name ? str_size(name) + 1 : 0;
    265265        async_answer_2(callid, ret, name_size, values);
     
    291291        const unsigned item = DEV_IPC_GET_ARG1(*call);
    292292        const unsigned value = DEV_IPC_GET_ARG2(*call);
    293         const int ret = mixer_iface->set_item_level(fun, item, value);
     293        const errno_t ret = mixer_iface->set_item_level(fun, item, value);
    294294        async_answer_0(callid, ret);
    295295}
     
    306306        const unsigned item = DEV_IPC_GET_ARG1(*call);
    307307        unsigned current = 0;
    308         const int ret =
     308        const errno_t ret =
    309309            mixer_iface->get_item_level(fun, item, &current);
    310310        async_answer_1(callid, ret, current);
Note: See TracChangeset for help on using the changeset viewer.