Changeset b7fd2a0 in mainline for uspace/lib/c/generic/io/logctl.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/c/generic/io/logctl.c

    r36f0738 rb7fd2a0  
    4343static async_sess_t *logger_session = NULL;
    4444
    45 static int start_logger_exchange(async_exch_t **exchange_out)
     45static errno_t start_logger_exchange(async_exch_t **exchange_out)
    4646{
    4747        assert(exchange_out != NULL);
     
    7878 * @return Error code of the conversion or EOK on success.
    7979 */
    80 int logctl_set_default_level(log_level_t new_level)
     80errno_t logctl_set_default_level(log_level_t new_level)
    8181{
    8282        async_exch_t *exchange = NULL;
    83         int rc = start_logger_exchange(&exchange);
     83        errno_t rc = start_logger_exchange(&exchange);
    8484        if (rc != EOK)
    8585                return rc;
    8686
    87         rc = (int) async_req_1_0(exchange,
     87        rc = (errno_t) async_req_1_0(exchange,
    8888            LOGGER_CONTROL_SET_DEFAULT_LEVEL, new_level);
    8989
     
    101101 * @return Error code of the conversion or EOK on success.
    102102 */
    103 int logctl_set_log_level(const char *logname, log_level_t new_level)
     103errno_t logctl_set_log_level(const char *logname, log_level_t new_level)
    104104{
    105105        async_exch_t *exchange = NULL;
    106         int rc = start_logger_exchange(&exchange);
     106        errno_t rc = start_logger_exchange(&exchange);
    107107        if (rc != EOK)
    108108                return rc;
     
    111111            new_level, NULL);
    112112        rc = async_data_write_start(exchange, logname, str_size(logname));
    113         int reg_msg_rc;
     113        errno_t reg_msg_rc;
    114114        async_wait_for(reg_msg, &reg_msg_rc);
    115115
     
    119119                return rc;
    120120
    121         return (int) reg_msg_rc;
     121        return (errno_t) reg_msg_rc;
    122122}
    123123
     
    126126 * @return Error code or EOK on success.
    127127 */
    128 int logctl_set_root(void)
     128errno_t logctl_set_root(void)
    129129{
    130130        async_exch_t *exchange = NULL;
    131         int rc = start_logger_exchange(&exchange);
     131        errno_t rc = start_logger_exchange(&exchange);
    132132        if (rc != EOK)
    133133                return rc;
     
    137137        rc = vfs_pass_handle(vfs_exch, vfs_root(), exchange);
    138138        vfs_exchange_end(vfs_exch);
    139         int reg_msg_rc;
     139        errno_t reg_msg_rc;
    140140        async_wait_for(reg_msg, &reg_msg_rc);
    141141
     
    145145                return rc;
    146146
    147         return (int) reg_msg_rc;
     147        return (errno_t) reg_msg_rc;
    148148}
    149149
Note: See TracChangeset for help on using the changeset viewer.