Changeset e89a06a in mainline for uspace/lib/c/generic/loc.c


Ignore:
Timestamp:
2018-07-06T22:13:20Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
be0f5e4
Parents:
6419c6e
Message:

Encapsulate partitions list in volume server. (Global state is not good coding practice.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/loc.c

    r6419c6e re89a06a  
    4848static bool loc_callback_created = false;
    4949static loc_cat_change_cb_t cat_change_cb = NULL;
     50static void *cat_change_arg = NULL;
    5051
    5152static async_sess_t *loc_supp_block_sess = NULL;
     
    7071                        fibril_mutex_lock(&loc_callback_mutex);
    7172                        loc_cat_change_cb_t cb_fun = cat_change_cb;
     73                        void *cb_arg = cat_change_arg;
    7274                        fibril_mutex_unlock(&loc_callback_mutex);
    7375
     
    7577
    7678                        if (cb_fun != NULL)
    77                                 (*cb_fun)();
     79                                (*cb_fun)(cb_arg);
    7880
    7981                        break;
     
    859861}
    860862
    861 errno_t loc_register_cat_change_cb(loc_cat_change_cb_t cb_fun)
     863errno_t loc_register_cat_change_cb(loc_cat_change_cb_t cb_fun, void *cb_arg)
    862864{
    863865        fibril_mutex_lock(&loc_callback_mutex);
     866        if (cat_change_cb != NULL) {
     867                fibril_mutex_unlock(&loc_callback_mutex);
     868                return EEXIST;
     869        }
     870
    864871        if (loc_callback_create() != EOK) {
    865872                fibril_mutex_unlock(&loc_callback_mutex);
     
    868875
    869876        cat_change_cb = cb_fun;
     877        cat_change_arg = cb_arg;
    870878        fibril_mutex_unlock(&loc_callback_mutex);
    871879
Note: See TracChangeset for help on using the changeset viewer.