Changeset 63c1dd5 in mainline for uspace/app/sysinst/sysinst.c


Ignore:
Timestamp:
2018-10-09T08:40:53Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
63a045c
Parents:
ee9c703
git-author:
Jiri Svoboda <jiri@…> (2018-10-08 18:38:16)
git-committer:
Jiri Svoboda <jiri@…> (2018-10-09 08:40:53)
Message:

Persistence of Tetris highscore table. Detect live mode and create directory structure in init task. Reading volume configuration, vol -c.

File:
1 edited

Legend:

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

    ree9c703 r63c1dd5  
    7979#define BOOT_BLOCK_IDX 0 /* MBR */
    8080
     81static const char *sys_dirs[] = {
     82        "/cfg",
     83        "/data"
     84};
     85
    8186/** Label the destination device.
    8287 *
     
    160165        *psvc_id = pinfo.svc_id;
    161166        return EOK;
     167}
     168
     169/** Set up system volume structure.
     170 *
     171 * @return EOK on success or an error code
     172 */
     173static errno_t sysinst_setup_sysvol(void)
     174{
     175        errno_t rc;
     176        char *path = NULL;
     177        const char **cp;
     178        int rv;
     179
     180        cp = sys_dirs;
     181        while (*cp != NULL) {
     182                rv = asprintf(&path, "%s%s", MOUNT_POINT, *cp);
     183                if (rv < 0) {
     184                        rc = ENOMEM;
     185                        goto error;
     186                }
     187
     188                rc = vfs_link_path(path, KIND_DIRECTORY, NULL);
     189                if (rc != EOK) {
     190                        printf("Error creating directory '%s'.\n", path);
     191                        goto error;
     192                }
     193
     194                free(path);
     195                path = NULL;
     196                ++cp;
     197        }
     198
     199        free(path);
     200        path = NULL;
     201
     202        return EOK;
     203error:
     204        if (path != NULL)
     205                free(path);
     206        return rc;
    162207}
    163208
     
    415460                return rc;
    416461
    417         printf("FS created and mounted. Copying boot files.\n");
     462        printf("FS created and mounted. Creating system directory structure.\n");
     463        rc = sysinst_setup_sysvol();
     464        if (rc != EOK)
     465                return rc;
     466
     467        printf("Directories created. Copying boot files.\n");
    418468        rc = sysinst_copy_boot_files();
    419469        if (rc != EOK)
Note: See TracChangeset for help on using the changeset viewer.