Changeset b7fd2a0 in mainline for uspace/srv/hid/input/input.c


Ignore:
Timestamp:
2018-01-13T03:10:29Z (6 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/srv/hid/input/input.c

    r36f0738 rb7fd2a0  
    473473        kdev->ctl_ops = &kbdev_ctl;
    474474       
    475         int rc = loc_service_get_name(service_id, &kdev->svc_name);
     475        errno_t rc = loc_service_get_name(service_id, &kdev->svc_name);
    476476        if (rc != EOK) {
    477477                kdev->svc_name = NULL;
     
    510510        mdev->proto_ops = &mousedev_proto;
    511511       
    512         int rc = loc_service_get_name(service_id, &mdev->svc_name);
     512        errno_t rc = loc_service_get_name(service_id, &mdev->svc_name);
    513513        if (rc != EOK) {
    514514                mdev->svc_name = NULL;
     
    530530}
    531531
    532 static int serial_consumer(void *arg)
     532static errno_t serial_consumer(void *arg)
    533533{
    534534        serial_dev_t *sdev = (serial_dev_t *) arg;
     
    554554{
    555555        bool match = false;
    556         int rc;
     556        errno_t rc;
    557557
    558558        serial_dev_t *sdev = serial_dev_new();
     
    633633}
    634634
    635 static int dev_check_new_kbdevs(void)
     635static errno_t dev_check_new_kbdevs(void)
    636636{
    637637        category_id_t keyboard_cat;
     
    639639        size_t count, i;
    640640        bool already_known;
    641         int rc;
     641        errno_t rc;
    642642       
    643643        rc = loc_category_get_id("keyboard", &keyboard_cat, IPC_FLAG_BLOCKING);
     
    684684}
    685685
    686 static int dev_check_new_mousedevs(void)
     686static errno_t dev_check_new_mousedevs(void)
    687687{
    688688        category_id_t mouse_cat;
     
    690690        size_t count, i;
    691691        bool already_known;
    692         int rc;
     692        errno_t rc;
    693693       
    694694        rc = loc_category_get_id("mouse", &mouse_cat, IPC_FLAG_BLOCKING);
     
    735735}
    736736
    737 static int dev_check_new_serialdevs(void)
     737static errno_t dev_check_new_serialdevs(void)
    738738{
    739739        category_id_t serial_cat;
     
    741741        size_t count, i;
    742742        bool already_known;
    743         int rc;
     743        errno_t rc;
    744744       
    745745        rc = loc_category_get_id("serial", &serial_cat, IPC_FLAG_BLOCKING);
     
    786786}
    787787
    788 static int dev_check_new(void)
    789 {
    790         int rc;
     788static errno_t dev_check_new(void)
     789{
     790        errno_t rc;
    791791       
    792792        fibril_mutex_lock(&discovery_lock);
     
    823823
    824824/** Start listening for new devices. */
    825 static int input_start_dev_discovery(void)
    826 {
    827         int rc = loc_register_cat_change_cb(cat_change_cb);
     825static errno_t input_start_dev_discovery(void)
     826{
     827        errno_t rc = loc_register_cat_change_cb(cat_change_cb);
    828828        if (rc != EOK) {
    829829                printf("%s: Failed registering callback for device discovery: "
     
    842842int main(int argc, char **argv)
    843843{
    844         int rc;
     844        errno_t rc;
    845845
    846846        if (argc < 2) {
Note: See TracChangeset for help on using the changeset viewer.