Logo Search packages:      
Sourcecode: libnl2 version File versions  Download package

int nl_cache_move ( struct nl_cache *  cache,
struct nl_object *  obj 
)

Move object from one cache to another

  • cache Cache to move object to.
  • obj Object subject to be moved
Removes the given object from its associated cache if needed and adds it to the new cache.

Returns:
0 on success or a negative error code.

Definition at line 353 of file cache.c.

References nl_cache_remove(), and nl_object_get().

{
      if (cache->c_ops->co_obj_ops != obj->ce_ops)
            return -NLE_OBJ_MISMATCH;

      NL_DBG(3, "Moving object %p to cache %p\n", obj, cache);
      
      /* Acquire reference, if already in a cache this will be
       * reverted during removal */
      nl_object_get(obj);

      if (!nl_list_empty(&obj->ce_list))
            nl_cache_remove(obj);

      return __cache_add(cache, obj);
}


Generated by  Doxygen 1.6.0   Back to index