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/drv/generic/remote_ieee80211.c

    r36f0738 rb7fd2a0  
    6262 *
    6363 */
    64 int ieee80211_get_scan_results(async_sess_t *dev_sess,
     64errno_t ieee80211_get_scan_results(async_sess_t *dev_sess,
    6565    ieee80211_scan_results_t *results, bool now)
    6666{
     
    7171        aid_t aid = async_send_2(exch, DEV_IFACE_ID(IEEE80211_DEV_IFACE),
    7272            IEEE80211_GET_SCAN_RESULTS, now, NULL);
    73         int rc = async_data_read_start(exch, results,
     73        errno_t rc = async_data_read_start(exch, results,
    7474            sizeof(ieee80211_scan_results_t));
    7575        async_exchange_end(exch);
    7676       
    77         int res;
     77        errno_t res;
    7878        async_wait_for(aid, &res);
    7979       
    8080        if(res != EOK)
    81                 return (int) res;
     81                return (errno_t) res;
    8282       
    8383        return rc;
     
    100100        size_t count;
    101101       
    102         int rc = inetcfg_get_link_list(&link_list, &count);
     102        errno_t rc = inetcfg_get_link_list(&link_list, &count);
    103103        if (rc != EOK)
    104104                return -1;
     
    126126 *
    127127 */
    128 int ieee80211_connect(async_sess_t *dev_sess, char *ssid_start, char *password)
     128errno_t ieee80211_connect(async_sess_t *dev_sess, char *ssid_start, char *password)
    129129{
    130130        assert(ssid_start);
    131131       
    132         int rc_orig;
     132        errno_t rc_orig;
    133133       
    134134        async_exch_t *exch = async_exchange_begin(dev_sess);
     
    137137            IEEE80211_CONNECT, NULL);
    138138       
    139         int rc = async_data_write_start(exch, ssid_start,
     139        errno_t rc = async_data_write_start(exch, ssid_start,
    140140            str_size(ssid_start) + 1);
    141141        if (rc != EOK) {
     
    144144               
    145145                if (rc_orig == EOK)
    146                         return (int) rc;
    147                
    148                 return (int) rc_orig;
     146                        return (errno_t) rc;
     147               
     148                return (errno_t) rc_orig;
    149149        }
    150150       
     
    159159               
    160160                if (rc_orig == EOK)
    161                         return (int) rc;
    162                
    163                 return (int) rc_orig;
     161                        return (errno_t) rc;
     162               
     163                return (errno_t) rc_orig;
    164164        }
    165165       
     
    182182        rc = dhcp_discover(link_id);
    183183       
    184         return (int) rc;
     184        return (errno_t) rc;
    185185}
    186186
     
    193193 *
    194194 */
    195 int ieee80211_disconnect(async_sess_t *dev_sess)
     195errno_t ieee80211_disconnect(async_sess_t *dev_sess)
    196196{
    197197        async_exch_t *exch = async_exchange_begin(dev_sess);
    198         int rc = async_req_1_0(exch, DEV_IFACE_ID(IEEE80211_DEV_IFACE),
     198        errno_t rc = async_req_1_0(exch, DEV_IFACE_ID(IEEE80211_DEV_IFACE),
    199199            IEEE80211_DISCONNECT);
    200200        async_exchange_end(exch);
     
    278278        bool now = IPC_GET_ARG2(*call);
    279279       
    280         int rc = ieee80211_iface->get_scan_results(fun, &scan_results, now);
     280        errno_t rc = ieee80211_iface->get_scan_results(fun, &scan_results, now);
    281281        if (rc == EOK) {
    282282                ipc_callid_t data_callid;
     
    324324        }
    325325       
    326         int rc = async_data_write_finalize(data_callid, ssid_start, len);
     326        errno_t rc = async_data_write_finalize(data_callid, ssid_start, len);
    327327        if (rc != EOK) {
    328328                async_answer_0(data_callid, EINVAL);
     
    360360        ieee80211_iface_t *ieee80211_iface = (ieee80211_iface_t *) iface;
    361361        assert(ieee80211_iface->disconnect);
    362         int rc = ieee80211_iface->disconnect(fun);
     362        errno_t rc = ieee80211_iface->disconnect(fun);
    363363        async_answer_0(callid, rc);
    364364}
Note: See TracChangeset for help on using the changeset viewer.