Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/volsrv/part.c

    r4285f384 r9e45a41  
    11/*
    2  * Copyright (c) 2025 Jiri Svoboda
     2 * Copyright (c) 2015 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    3636
    3737#include <adt/list.h>
    38 #include <bd.h>
    3938#include <errno.h>
    4039#include <fibril_synch.h>
     
    5352#include "types/part.h"
    5453#include "volume.h"
    55 #include "volsrv.h"
    5654
    5755static errno_t vol_part_add_locked(vol_parts_t *, service_id_t);
     
    405403        part->cur_mp_auto = mp_auto;
    406404
    407         if (str_cmp(mp, "/w") == 0) {
    408                 log_msg(LOG_DEFAULT, LVL_NOTE, "Mounted system volume - "
    409                     "loading additional configuration.");
    410                 rc = vol_volumes_merge_to(part->parts->volumes,
    411                     vol_cfg_file);
    412                 if (rc != EOK) {
    413                         log_msg(LOG_DEFAULT, LVL_ERROR, "Error loading "
    414                             "additional configuration.");
    415                         return rc;
    416                 }
    417         }
    418 
    419405        return rc;
    420406}
     
    643629}
    644630
    645 static errno_t vol_part_eject_device(service_id_t svcid)
    646 {
    647         async_sess_t *sess;
    648         errno_t rc;
    649         bd_t *bd;
    650 
    651         log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_eject_device(%zu)",
    652             (size_t)svcid);
    653 
    654         sess = loc_service_connect(svcid, INTERFACE_BLOCK, 0);
    655         if (sess == NULL)
    656                 return EIO;
    657 
    658         rc = bd_open(sess, &bd);
    659         if (rc != EOK) {
    660                 async_hangup(sess);
    661                 return EIO;
    662         }
    663 
    664         rc = bd_eject(bd);
    665         if (rc != EOK) {
    666                 log_msg(LOG_DEFAULT, LVL_WARN, "vol_part_eject_device(): "
    667                     "eject fail");
    668                 bd_close(bd);
    669                 async_hangup(sess);
    670                 return EIO;
    671         }
    672 
    673         bd_close(bd);
    674         async_hangup(sess);
    675         return EOK;
    676 }
    677 
    678 errno_t vol_part_eject_part(vol_part_t *part, vol_eject_flags_t flags)
     631errno_t vol_part_eject_part(vol_part_t *part)
    679632{
    680633        int rc;
     
    683636
    684637        if (part->cur_mp == NULL) {
    685                 /* Partition is not mounted, nothing to do. */
    686                 log_msg(LOG_DEFAULT, LVL_DEBUG, "Partition not mounted, "
    687                     "nothing to do.");
    688                 goto done;
     638                log_msg(LOG_DEFAULT, LVL_DEBUG, "Attempt to mount unmounted "
     639                    "partition.");
     640                return EINVAL;
    689641        }
    690642
     
    704656        }
    705657
    706         if ((flags & vef_physical) != 0) {
    707                 rc = vol_part_eject_device(part->svc_id);
    708                 if (rc != EOK) {
    709                         log_msg(LOG_DEFAULT, LVL_ERROR, "Failed physically "
    710                             "ejecting device %s.", part->svc_name);
    711                 }
    712         }
    713 
    714658        free(part->cur_mp);
    715659        part->cur_mp = NULL;
    716660        part->cur_mp_auto = false;
    717 done:
     661
    718662        return EOK;
    719663}
     
    861805
    862806        if (part->cur_mp != NULL) {
    863                 rc = vol_part_eject_part(part, vef_none);
     807                rc = vol_part_eject_part(part);
    864808                if (rc != EOK)
    865809                        return rc;
Note: See TracChangeset for help on using the changeset viewer.