Changeset b7fd2a0 in mainline for uspace/drv/char/msim-con/msim-con.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/drv/char/msim-con/msim-con.c

    r36f0738 rb7fd2a0  
    4343static void msim_con_connection(ipc_callid_t, ipc_call_t *, void *);
    4444
    45 static int msim_con_read(chardev_srv_t *, void *, size_t, size_t *);
    46 static int msim_con_write(chardev_srv_t *, const void *, size_t, size_t *);
     45static errno_t msim_con_read(chardev_srv_t *, void *, size_t, size_t *);
     46static errno_t msim_con_write(chardev_srv_t *, const void *, size_t, size_t *);
    4747
    4848static chardev_ops_t msim_con_chardev_ops = {
     
    6666        msim_con_t *con = (msim_con_t *) arg;
    6767        uint8_t c;
    68         int rc;
     68        errno_t rc;
    6969
    7070        fibril_mutex_lock(&con->buf_lock);
     
    8080
    8181/** Add msim console device. */
    82 int msim_con_add(msim_con_t *con, msim_con_res_t *res)
     82errno_t msim_con_add(msim_con_t *con, msim_con_res_t *res)
    8383{
    8484        ddf_fun_t *fun = NULL;
    8585        bool subscribed = false;
    8686        irq_cmd_t *msim_cmds = NULL;
    87         int rc;
     87        errno_t rc;
    8888
    8989        circ_buf_init(&con->cbuf, con->buf, msim_con_buf_size, 1);
     
    152152
    153153/** Remove msim console device */
    154 int msim_con_remove(msim_con_t *con)
     154errno_t msim_con_remove(msim_con_t *con)
    155155{
    156156        return ENOTSUP;
     
    158158
    159159/** Msim console device gone */
    160 int msim_con_gone(msim_con_t *con)
     160errno_t msim_con_gone(msim_con_t *con)
    161161{
    162162        return ENOTSUP;
     
    169169
    170170/** Read from msim console device */
    171 static int msim_con_read(chardev_srv_t *srv, void *buf, size_t size,
     171static errno_t msim_con_read(chardev_srv_t *srv, void *buf, size_t size,
    172172    size_t *nread)
    173173{
     
    175175        size_t p;
    176176        uint8_t *bp = (uint8_t *) buf;
    177         int rc;
     177        errno_t rc;
    178178
    179179        fibril_mutex_lock(&con->buf_lock);
     
    197197
    198198/** Write to msim console device */
    199 static int msim_con_write(chardev_srv_t *srv, const void *data, size_t size,
     199static errno_t msim_con_write(chardev_srv_t *srv, const void *data, size_t size,
    200200    size_t *nwr)
    201201{
Note: See TracChangeset for help on using the changeset viewer.