openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/libnl/1_3.4.0-r0/libnl-3.4.0/lib/cache_mngt.c
void nl_cache_mngt_provide(struct nl_cache* cache)
{
    struct nl_cache_ops* ops;

    nl_write_lock(&cache_ops_lock);

    ops = cache_ops_lookup_for_obj(cache->c_ops->co_obj_ops);
    if (!ops)
        BUG();
    else
    {
        nl_cache_get(cache);

        /*
         * Hold a reference to the cache operations to ensure the
         * ops don't go away while we use it to store the cache pointer.
         */
        if (!ops->co_major_cache)
            nl_cache_ops_get(ops);

        ops->co_major_cache = cache;
    }

    nl_write_unlock(&cache_ops_lock);
}
/**
 * Provide a cache for global use
 * @arg cache		cache to provide
 *
 * Offers the specified cache to be used by other modules.
 * Only one cache per type may be shared at a time,
 * a previsouly provided caches will be overwritten.
 */
Provide a cache for global use
@arg cache           cache to provide

Offers the specified cache to be used by other modules.
Only one cache per type may be shared at a time,
a previsouly provided caches will be overwritten.
Provide a cache for global use @arg cache cache to provide Offers the specified cache to be used by other modules . Only one cache per type may be shared at a time a previsouly provided caches will be overwritten .
void nl_cache_mngt_provide(struct nl_cache* cache)
{
    struct nl_cache_ops* ops;
    nl_write_lock(&cache_ops_lock);
    ops = cache_ops_lookup_for_obj(cache->c_ops->co_obj_ops);
    if (!ops)
        BUG();
    else
    {
        nl_cache_get(cache);
        if (!ops->co_major_cache)
            nl_cache_ops_get(ops);
        ops->co_major_cache = cache;
    }
    nl_write_unlock(&cache_ops_lock);
}
void nl_cache_mngt_provide ( struct nl_cache * cache ) { struct nl_cache_ops * ops ; nl_write_lock ( & cache_ops_lock ) ; ops = cache_ops_lookup_for_obj ( cache -> c_ops -> co_obj_ops ) ; if ( ! ops ) BUG ( ) ; else { nl_cache_get ( cache ) ; if ( ! ops -> co_major_cache ) nl_cache_ops_get ( ops ) ; ops -> co_major_cache = cache ; } nl_write_unlock ( & cache_ops_lock ) ; }
Provide a cache for global use
 @arg cache           cache to provide
Provide a cache for global use @arg cache cache to provide
/*
         * Hold a reference to the cache operations to ensure the
         * ops don't go away while we use it to store the cache pointer.
         */