Changeset 498ced1 in mainline for uspace/srv/bd


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/bd/vbd
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/bd/vbd/disk.c

    rb13d80b r498ced1  
    244244{
    245245        log_msg(LOG_DEFAULT, LVL_DEBUG2, "vbds_part_add_ref");
    246         atomic_inc(&part->refcnt);
     246        refcount_up(&part->refcnt);
    247247}
    248248
     
    250250{
    251251        log_msg(LOG_DEFAULT, LVL_DEBUG2, "vbds_part_del_ref");
    252         if (atomic_predec(&part->refcnt) == 0) {
     252        if (refcount_down(&part->refcnt)) {
    253253                log_msg(LOG_DEFAULT, LVL_DEBUG2, " - free part");
    254254                free(part);
     
    328328        part->block0 = lpinfo.block0;
    329329        part->nblocks = lpinfo.nblocks;
    330         atomic_set(&part->refcnt, 1);
     330        refcount_init(&part->refcnt);
    331331
    332332        bd_srvs_init(&part->bds);
  • uspace/srv/bd/vbd/types/vbd.h

    rb13d80b r498ced1  
    3939
    4040#include <adt/list.h>
    41 #include <atomic.h>
    4241#include <bd_srv.h>
    4342#include <label/label.h>
    4443#include <loc.h>
     44#include <refcount.h>
    4545#include <stdbool.h>
    4646#include <stddef.h>
     
    8383        aoff64_t nblocks;
    8484        /** Reference count */
    85         atomic_t refcnt;
     85        atomic_refcount_t refcnt;
    8686} vbds_part_t;
    8787
Note: See TracChangeset for help on using the changeset viewer.