Changeset b7fd2a0 in mainline for uspace/app/fdisk/fdisk.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/app/fdisk/fdisk.c

    r36f0738 rb7fd2a0  
    6868} devac_t;
    6969
    70 static int fdsk_pcnt_fs_format(vol_part_cnt_t pcnt, vol_fstype_t fstype,
     70static errno_t fdsk_pcnt_fs_format(vol_part_cnt_t pcnt, vol_fstype_t fstype,
    7171    char **rstr)
    7272{
    73         int rc;
     73        errno_t rc;
    7474        char *s;
    7575
     
    9797
    9898/** Confirm user selection. */
    99 static int fdsk_confirm(const char *msg, bool *rconfirm)
     99static errno_t fdsk_confirm(const char *msg, bool *rconfirm)
    100100{
    101101        tinput_t *tinput = NULL;
    102102        char *answer;
    103         int rc;
     103        errno_t rc;
    104104
    105105        tinput = tinput_new();
     
    146146
    147147/** Device selection */
    148 static int fdsk_dev_sel_choice(service_id_t *rsvcid)
     148static errno_t fdsk_dev_sel_choice(service_id_t *rsvcid)
    149149{
    150150        fdisk_dev_list_t *devlist = NULL;
     
    159159        void *sel;
    160160        int ndevs;
    161         int rc;
     161        errno_t rc;
    162162
    163163        rc = nchoice_create(&choice);
     
    281281}
    282282
    283 static int fdsk_create_label(fdisk_dev_t *dev)
     283static errno_t fdsk_create_label(fdisk_dev_t *dev)
    284284{
    285285        nchoice_t *choice = NULL;
     
    287287        char *sltype = NULL;
    288288        int i;
    289         int rc;
     289        errno_t rc;
    290290
    291291        rc = nchoice_create(&choice);
     
    341341}
    342342
    343 static int fdsk_delete_label(fdisk_dev_t *dev)
     343static errno_t fdsk_delete_label(fdisk_dev_t *dev)
    344344{
    345345        bool confirm;
    346         int rc;
     346        errno_t rc;
    347347
    348348        rc = fdsk_confirm("Warning. Any data on disk will be lost. "
     
    365365}
    366366
    367 static int fdsk_erase_disk(fdisk_dev_t *dev)
     367static errno_t fdsk_erase_disk(fdisk_dev_t *dev)
    368368{
    369369        bool confirm;
    370         int rc;
     370        errno_t rc;
    371371
    372372        rc = fdsk_confirm("Warning. Any data on disk will be lost. "
     
    389389}
    390390
    391 static int fdsk_select_fstype(vol_fstype_t *fstype)
     391static errno_t fdsk_select_fstype(vol_fstype_t *fstype)
    392392{
    393393        nchoice_t *choice = NULL;
     
    395395        char *sfstype;
    396396        int i;
    397         int rc;
     397        errno_t rc;
    398398
    399399        rc = nchoice_create(&choice);
     
    444444}
    445445
    446 static int fdsk_create_part(fdisk_dev_t *dev, label_pkind_t pkind)
     446static errno_t fdsk_create_part(fdisk_dev_t *dev, label_pkind_t pkind)
    447447{
    448         int rc;
     448        errno_t rc;
    449449        fdisk_part_spec_t pspec;
    450450        cap_spec_t cap;
     
    553553}
    554554
    555 static int fdsk_delete_part(fdisk_dev_t *dev)
     555static errno_t fdsk_delete_part(fdisk_dev_t *dev)
    556556{
    557557        nchoice_t *choice = NULL;
     
    565565        bool confirm;
    566566        void *sel;
    567         int rc;
     567        errno_t rc;
    568568
    569569        rc = nchoice_create(&choice);
     
    700700
    701701/** Device menu */
    702 static int fdsk_dev_menu(fdisk_dev_t *dev)
     702static errno_t fdsk_dev_menu(fdisk_dev_t *dev)
    703703{
    704704        nchoice_t *choice = NULL;
     
    717717        char *spkind;
    718718        const char *label;
    719         int rc;
     719        errno_t rc;
    720720        int npart;
    721721        void *sel;
     
    10791079        service_id_t svcid;
    10801080        fdisk_dev_t *dev;
    1081         int rc;
     1081        errno_t rc;
    10821082
    10831083        rc = fdisk_create(&fdisk);
Note: See TracChangeset for help on using the changeset viewer.