Changeset b7fd2a0 in mainline for uspace/lib/label/src/dummy.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/label/src/dummy.c

    r36f0738 rb7fd2a0  
    4040#include "dummy.h"
    4141
    42 static int dummy_open(label_bd_t *, label_t **);
    43 static int dummy_create(label_bd_t *, label_t **);
     42static errno_t dummy_open(label_bd_t *, label_t **);
     43static errno_t dummy_create(label_bd_t *, label_t **);
    4444static void dummy_close(label_t *);
    45 static int dummy_destroy(label_t *);
    46 static int dummy_get_info(label_t *, label_info_t *);
     45static errno_t dummy_destroy(label_t *);
     46static errno_t dummy_get_info(label_t *, label_info_t *);
    4747static label_part_t *dummy_part_first(label_t *);
    4848static label_part_t *dummy_part_next(label_part_t *);
    4949static void dummy_part_get_info(label_part_t *, label_part_info_t *);
    50 static int dummy_part_create(label_t *, label_part_spec_t *, label_part_t **);
    51 static int dummy_part_destroy(label_part_t *);
    52 static int dummy_suggest_ptype(label_t *, label_pcnt_t, label_ptype_t *);
     50static errno_t dummy_part_create(label_t *, label_part_spec_t *, label_part_t **);
     51static errno_t dummy_part_destroy(label_part_t *);
     52static errno_t dummy_suggest_ptype(label_t *, label_pcnt_t, label_ptype_t *);
    5353
    5454label_ops_t dummy_label_ops = {
     
    6666};
    6767
    68 static int dummy_open(label_bd_t *bd, label_t **rlabel)
     68static errno_t dummy_open(label_bd_t *bd, label_t **rlabel)
    6969{
    7070        label_t *label = NULL;
     
    7373        aoff64_t nblocks;
    7474        uint64_t ba_min, ba_max;
    75         int rc;
     75        errno_t rc;
    7676
    7777        rc = bd->ops->get_bsize(bd->arg, &bsize);
     
    128128}
    129129
    130 static int dummy_create(label_bd_t *bd, label_t **rlabel)
     130static errno_t dummy_create(label_bd_t *bd, label_t **rlabel)
    131131{
    132132        return ENOTSUP;
     
    148148}
    149149
    150 static int dummy_destroy(label_t *label)
    151 {
    152         return ENOTSUP;
    153 }
    154 
    155 static int dummy_get_info(label_t *label, label_info_t *linfo)
     150static errno_t dummy_destroy(label_t *label)
     151{
     152        return ENOTSUP;
     153}
     154
     155static errno_t dummy_get_info(label_t *label, label_info_t *linfo)
    156156{
    157157        memset(linfo, 0, sizeof(label_info_t));
     
    193193}
    194194
    195 static int dummy_part_create(label_t *label, label_part_spec_t *pspec,
     195static errno_t dummy_part_create(label_t *label, label_part_spec_t *pspec,
    196196    label_part_t **rpart)
    197197{
     
    199199}
    200200
    201 static int dummy_part_destroy(label_part_t *part)
    202 {
    203         return ENOTSUP;
    204 }
    205 
    206 static int dummy_suggest_ptype(label_t *label, label_pcnt_t pcnt,
     201static errno_t dummy_part_destroy(label_part_t *part)
     202{
     203        return ENOTSUP;
     204}
     205
     206static errno_t dummy_suggest_ptype(label_t *label, label_pcnt_t pcnt,
    207207    label_ptype_t *ptype)
    208208{
Note: See TracChangeset for help on using the changeset viewer.