Changeset c9ce6d22 in mainline for uspace/srv/bd/hr/util.c


Ignore:
Timestamp:
2025-05-15T19:24:51Z (3 weeks ago)
Author:
Miroslav Cimerman <mc@…>
Children:
a2281efc
Parents:
9a3eec1
Message:

hr: refactor volume removal

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/bd/hr/util.c

    r9a3eec1 rc9ce6d22  
    215215                }
    216216        }
    217 
    218217        fibril_rwlock_read_unlock(&hr_volumes_lock);
     218
    219219        return rvol;
    220220}
    221221
    222 errno_t hr_remove_volume(hr_volume_t *vol)
    223 {
    224         HR_DEBUG("%s()", __func__);
     222errno_t hr_remove_volume(service_id_t svc_id)
     223{
     224        HR_DEBUG("%s()", __func__);
     225
     226        hr_volume_t *vol = hr_get_volume(svc_id);
     227        if (vol == NULL)
     228                return ENOENT;
    225229
    226230        fibril_rwlock_write_lock(&hr_volumes_lock);
     
    228232        int open_cnt = atomic_load_explicit(&vol->open_cnt,
    229233            memory_order_relaxed);
     234
    230235        /*
    231236         * The atomicity of this if condition (and this whole
     
    246251        /* save metadata, but we don't care about states anymore */
    247252        (void)vol->meta_ops->save(vol, NO_STATE_CALLBACK);
    248 
    249         service_id_t svc_id = vol->svc_id;
    250253
    251254        HR_NOTE("deactivating volume \"%s\"\n", vol->devname);
Note: See TracChangeset for help on using the changeset viewer.