Changeset b7fd2a0 in mainline for uspace/drv/char/ski-con


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.

Location:
uspace/drv/char/ski-con
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/char/ski-con/main.c

    r36f0738 rb7fd2a0  
    4242#define NAME  "ski-con"
    4343
    44 static int ski_con_dev_add(ddf_dev_t *dev);
    45 static int ski_con_dev_remove(ddf_dev_t *dev);
    46 static int ski_con_dev_gone(ddf_dev_t *dev);
    47 static int ski_con_fun_online(ddf_fun_t *fun);
    48 static int ski_con_fun_offline(ddf_fun_t *fun);
     44static errno_t ski_con_dev_add(ddf_dev_t *dev);
     45static errno_t ski_con_dev_remove(ddf_dev_t *dev);
     46static errno_t ski_con_dev_gone(ddf_dev_t *dev);
     47static errno_t ski_con_fun_online(ddf_fun_t *fun);
     48static errno_t ski_con_fun_offline(ddf_fun_t *fun);
    4949
    5050static driver_ops_t driver_ops = {
     
    6161};
    6262
    63 static int ski_con_dev_add(ddf_dev_t *dev)
     63static errno_t ski_con_dev_add(ddf_dev_t *dev)
    6464{
    6565        ski_con_t *ski_con;
     
    7777}
    7878
    79 static int ski_con_dev_remove(ddf_dev_t *dev)
     79static errno_t ski_con_dev_remove(ddf_dev_t *dev)
    8080{
    8181        ski_con_t *ski_con = (ski_con_t *)ddf_dev_data_get(dev);
     
    8686}
    8787
    88 static int ski_con_dev_gone(ddf_dev_t *dev)
     88static errno_t ski_con_dev_gone(ddf_dev_t *dev)
    8989{
    9090        ski_con_t *ski_con = (ski_con_t *)ddf_dev_data_get(dev);
     
    9595}
    9696
    97 static int ski_con_fun_online(ddf_fun_t *fun)
     97static errno_t ski_con_fun_online(ddf_fun_t *fun)
    9898{
    9999        ddf_msg(LVL_DEBUG, "ski_con_fun_online()");
     
    101101}
    102102
    103 static int ski_con_fun_offline(ddf_fun_t *fun)
     103static errno_t ski_con_fun_offline(ddf_fun_t *fun)
    104104{
    105105        ddf_msg(LVL_DEBUG, "ski_con_fun_offline()");
  • uspace/drv/char/ski-con/ski-con.c

    r36f0738 rb7fd2a0  
    4848#define POLL_INTERVAL           10000
    4949
    50 static int ski_con_fibril(void *arg);
     50static errno_t ski_con_fibril(void *arg);
    5151static int32_t ski_con_getchar(void);
    5252static void ski_con_connection(ipc_callid_t, ipc_call_t *, void *);
    5353
    54 static int ski_con_read(chardev_srv_t *, void *, size_t, size_t *);
    55 static int ski_con_write(chardev_srv_t *, const void *, size_t, size_t *);
     54static errno_t ski_con_read(chardev_srv_t *, void *, size_t, size_t *);
     55static errno_t ski_con_write(chardev_srv_t *, const void *, size_t, size_t *);
    5656
    5757static chardev_ops_t ski_con_chardev_ops = {
     
    6363
    6464/** Add ski console device. */
    65 int ski_con_add(ski_con_t *con)
     65errno_t ski_con_add(ski_con_t *con)
    6666{
    6767        fid_t fid;
    6868        ddf_fun_t *fun = NULL;
    6969        bool bound = false;
    70         int rc;
     70        errno_t rc;
    7171
    7272        circ_buf_init(&con->cbuf, con->buf, ski_con_buf_size, 1);
     
    116116
    117117/** Remove ski console device */
    118 int ski_con_remove(ski_con_t *con)
     118errno_t ski_con_remove(ski_con_t *con)
    119119{
    120120        return ENOTSUP;
     
    122122
    123123/** Ski console device gone */
    124 int ski_con_gone(ski_con_t *con)
     124errno_t ski_con_gone(ski_con_t *con)
    125125{
    126126        return ENOTSUP;
     
    128128
    129129/** Poll Ski for keypresses. */
    130 static int ski_con_fibril(void *arg)
     130static errno_t ski_con_fibril(void *arg)
    131131{
    132132        int32_t c;
    133133        ski_con_t *con = (ski_con_t *) arg;
    134         int rc;
     134        errno_t rc;
    135135
    136136        while (1) {
     
    212212
    213213/** Read from Ski console device */
    214 static int ski_con_read(chardev_srv_t *srv, void *buf, size_t size,
     214static errno_t ski_con_read(chardev_srv_t *srv, void *buf, size_t size,
    215215    size_t *nread)
    216216{
     
    218218        size_t p;
    219219        uint8_t *bp = (uint8_t *) buf;
    220         int rc;
     220        errno_t rc;
    221221
    222222        fibril_mutex_lock(&con->buf_lock);
     
    240240
    241241/** Write to Ski console device */
    242 static int ski_con_write(chardev_srv_t *srv, const void *data, size_t size,
     242static errno_t ski_con_write(chardev_srv_t *srv, const void *data, size_t size,
    243243    size_t *nwr)
    244244{
  • uspace/drv/char/ski-con/ski-con.h

    r36f0738 rb7fd2a0  
    5858} ski_con_t;
    5959
    60 extern int ski_con_add(ski_con_t *);
    61 extern int ski_con_remove(ski_con_t *);
    62 extern int ski_con_gone(ski_con_t *);
     60extern errno_t ski_con_add(ski_con_t *);
     61extern errno_t ski_con_remove(ski_con_t *);
     62extern errno_t ski_con_gone(ski_con_t *);
    6363
    6464#endif
Note: See TracChangeset for help on using the changeset viewer.