Changeset b1490d2 in mainline for uspace/srv/system/system.c


Ignore:
Timestamp:
2025-02-03T16:04:17Z (16 hours ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Parents:
c3d9aaf5
Message:

Explicit wait for system volume is no longer needed.

Now it is guaranteed that, if the volume was inserted at power-on time,
it is mounted at this point. This is because (1) srv_start(devman)
only returns once all devices have been enumerated and
(2) srv_start(volsrv) only returns once all volumes have been mounted.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/system/system.c

    rc3d9aaf5 rb1490d2  
    11/*
    2  * Copyright (c) 2024 Jiri Svoboda
     2 * Copyright (c) 2025 Jiri Svoboda
    33 * Copyright (c) 2005 Martin Decky
    44 * All rights reserved.
     
    382382                printf("%s: System volume is configured.\n", NAME);
    383383
    384                 /* Wait until system volume is mounted */
     384                /* Verify that system volume is mounted */
    385385                sv_mounted = false;
    386386
    387                 while (true) {
    388                         rc = vol_get_parts(vol, &part_ids, &nparts);
     387                rc = vol_get_parts(vol, &part_ids, &nparts);
     388                if (rc != EOK) {
     389                        printf("Error getting list of volumes.\n");
     390                        goto error;
     391                }
     392
     393                for (i = 0; i < nparts; i++) {
     394                        rc = vol_part_info(vol, part_ids[i], &pinfo);
    389395                        if (rc != EOK) {
    390                                 printf("Error getting list of volumes.\n");
     396                                printf("Error getting partition "
     397                                    "information.\n");
     398                                rc = EIO;
    391399                                goto error;
    392400                        }
    393401
    394                         for (i = 0; i < nparts; i++) {
    395                                 rc = vol_part_info(vol, part_ids[i], &pinfo);
    396                                 if (rc != EOK) {
    397                                         printf("Error getting partition "
    398                                             "information.\n");
    399                                         rc = EIO;
    400                                         goto error;
    401                                 }
    402 
    403                                 if (str_cmp(pinfo.cur_mp, "/w") == 0) {
    404                                         sv_mounted = true;
    405                                         break;
    406                                 }
     402                        if (str_cmp(pinfo.cur_mp, "/w") == 0) {
     403                                sv_mounted = true;
     404                                break;
    407405                        }
    408 
    409                         if (sv_mounted)
    410                                 break;
    411 
    412                         free(part_ids);
    413                         part_ids = NULL;
    414 
    415                         fibril_sleep(1);
    416                         printf("Sleeping(1) for system volume.\n");
    417                 }
     406                }
     407
     408                if (sv_mounted == false) {
     409                        printf("System volume not found.\n");
     410                        rc = EIO;
     411                        goto error;
     412                }
     413
     414                free(part_ids);
     415                part_ids = NULL;
     416
    418417        }
    419418
Note: See TracChangeset for help on using the changeset viewer.