Changeset 498ced1 in mainline for uspace/srv/volsrv


Ignore:
Timestamp:
2018-08-11T02:43:32Z (7 years ago)
Author:
Jiří Zárevúcky <jiri.zarevucky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
05882233
Parents:
b13d80b
git-author:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-08-11 02:29:02)
git-committer:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-08-11 02:43:32)
Message:

Unify reference counting and remove some unnecessary instances of <atomic.h>

Location:
uspace/srv/volsrv
Files:
4 edited

Legend:

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

    rb13d80b r498ced1  
    179179        }
    180180
    181         atomic_set(&part->refcnt, 1);
     181        refcount_init(&part->refcnt);
    182182        link_initialize(&part->lparts);
    183183        part->parts = NULL;
     
    524524                if (part->svc_id == sid) {
    525525                        /* Add reference */
    526                         atomic_inc(&part->refcnt);
     526                        refcount_up(&part->refcnt);
    527527                        *rpart = part;
    528528                        return EOK;
     
    547547void vol_part_del_ref(vol_part_t *part)
    548548{
    549         if (atomic_predec(&part->refcnt) == 0)
     549        if (refcount_down(&part->refcnt))
    550550                vol_part_delete(part);
    551551}
  • uspace/srv/volsrv/types/part.h

    rb13d80b r498ced1  
    3939
    4040#include <adt/list.h>
    41 #include <atomic.h>
     41#include <refcount.h>
    4242#include <fibril_synch.h>
    4343#include <stdbool.h>
     
    5151        link_t lparts;
    5252        /** Reference count */
    53         atomic_t refcnt;
     53        atomic_refcount_t refcnt;
    5454        /** Service ID */
    5555        service_id_t svc_id;
  • uspace/srv/volsrv/types/volume.h

    rb13d80b r498ced1  
    3939
    4040#include <adt/list.h>
    41 #include <atomic.h>
     41#include <refcount.h>
    4242#include <fibril_synch.h>
    4343#include <sif.h>
     
    5050        link_t lvolumes;
    5151        /** Reference count */
    52         atomic_t refcnt;
     52        atomic_refcount_t refcnt;
    5353        /** Volume label */
    5454        char *label;
  • uspace/srv/volsrv/volume.c

    rb13d80b r498ced1  
    8383        }
    8484
    85         atomic_set(&volume->refcnt, 1);
     85        refcount_init(&volume->refcnt);
    8686        link_initialize(&volume->lvolumes);
    8787        volume->volumes = NULL;
     
    245245                    str_size(label) > 0) {
    246246                        /* Add reference */
    247                         atomic_inc(&volume->refcnt);
     247                        refcount_up(&volume->refcnt);
    248248                        *rvolume = volume;
    249249                        return EOK;
     
    309309void vol_volume_del_ref(vol_volume_t *volume)
    310310{
    311         if (atomic_predec(&volume->refcnt) == 0) {
     311        if (refcount_down(&volume->refcnt)) {
    312312                /* No more references. Check if volume is persistent. */
    313313                if (!vol_volume_is_persist(volume)) {
Note: See TracChangeset for help on using the changeset viewer.