Changeset b7fd2a0 in mainline for uspace/app/sysinst


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/app/sysinst
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/sysinst/futil.c

    r36f0738 rb7fd2a0  
    5454 * @return EOK on success, EIO on I/O error
    5555 */
    56 int futil_copy_file(const char *srcp, const char *destp)
     56errno_t futil_copy_file(const char *srcp, const char *destp)
    5757{
    5858        int sf, df;
    5959        size_t nr, nw;
    60         int rc;
     60        errno_t rc;
    6161        aoff64_t posr = 0, posw = 0;
    6262
     
    104104 * @return EOK on success, ENOMEM if out of memory, EIO on I/O error
    105105 */
    106 int futil_rcopy_contents(const char *srcdir, const char *destdir)
     106errno_t futil_rcopy_contents(const char *srcdir, const char *destdir)
    107107{
    108108        DIR *dir;
     
    110110        struct stat s;
    111111        char *srcp, *destp;
    112         int rc;
     112        errno_t rc;
    113113
    114114        dir = opendir(srcdir);
     
    158158 *         I/O error, ENOMEM if out of memory
    159159 */
    160 int futil_get_file(const char *srcp, void **rdata, size_t *rsize)
     160errno_t futil_get_file(const char *srcp, void **rdata, size_t *rsize)
    161161{
    162162        int sf;
    163163        size_t nr;
    164         int rc;
     164        errno_t rc;
    165165        size_t fsize;
    166166        char *data;
  • uspace/app/sysinst/futil.h

    r36f0738 rb7fd2a0  
    4141#include <stddef.h>
    4242
    43 extern int futil_copy_file(const char *, const char *);
    44 extern int futil_rcopy_contents(const char *, const char *);
    45 extern int futil_get_file(const char *, void **, size_t *);
     43extern errno_t futil_copy_file(const char *, const char *);
     44extern errno_t futil_rcopy_contents(const char *, const char *);
     45extern errno_t futil_get_file(const char *, void **, size_t *);
    4646
    4747#endif
  • uspace/app/sysinst/sysinst.c

    r36f0738 rb7fd2a0  
    8585 * @return EOK on success or an error code
    8686 */
    87 static int sysinst_label_dev(const char *dev, char **pdev)
     87static errno_t sysinst_label_dev(const char *dev, char **pdev)
    8888{
    8989        fdisk_t *fdisk;
     
    9393        cap_spec_t cap;
    9494        service_id_t sid;
    95         int rc;
     95        errno_t rc;
    9696
    9797        printf("sysinst_label_dev(): get service ID '%s'\n", dev);
     
    154154 * @return EOK on success or an error code
    155155 */
    156 static int sysinst_fs_mount(const char *dev)
     156static errno_t sysinst_fs_mount(const char *dev)
    157157{
    158158        task_wait_t twait;
    159159        task_exit_t texit;
    160         int rc;
     160        errno_t rc;
    161161        int trc;
    162162
     
    193193 * @return EOK on success or an error code
    194194 */
    195 static int sysinst_copy_boot_files(void)
     195static errno_t sysinst_copy_boot_files(void)
    196196{
    197197        task_wait_t twait;
    198198        task_exit_t texit;
    199         int rc;
     199        errno_t rc;
    200200        int trc;
    201201
     
    260260 * @return EOK on success or an error code
    261261 */
    262 static int sysinst_copy_boot_blocks(const char *devp)
     262static errno_t sysinst_copy_boot_blocks(const char *devp)
    263263{
    264264        void *boot_img;
     
    272272        aoff64_t core_blocks;
    273273        grub_boot_blocklist_t *first_bl, *bl;
    274         int rc;
     274        errno_t rc;
    275275
    276276        printf("sysinst_copy_boot_blocks: Read boot block image.\n");
     
    355355 * @return EOK on success or an error code
    356356 */
    357 static int sysinst_install(const char *dev)
    358 {
    359         int rc;
     357static errno_t sysinst_install(const char *dev)
     358{
     359        errno_t rc;
    360360        char *pdev;
    361361
Note: See TracChangeset for help on using the changeset viewer.