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

struct nl_cache* rtnl_link_alloc_cache ( struct nl_handle *  handle  )  [read]

Allocate link cache and fill in all configured links.

  • handle Netlink handle.
Allocates a new link cache, initializes it properly and updates it to include all links currently configured in the kernel.

Note:
Free the memory after usage using nl_cache_destroy_and_free().
Returns:
Newly allocated cache or NULL if an error occured.

Definition at line 648 of file link.c.

References nl_cache_alloc_from_ops(), nl_cache_destroy_and_free(), and nl_cache_update().

{
      struct nl_cache * cache;
      
      cache = nl_cache_alloc_from_ops(&rtnl_link_ops);
      if (cache == NULL)
            return NULL;
      
      if (nl_cache_update(handle, cache) < 0) {
            nl_cache_destroy_and_free(cache);
            return NULL;
      }

      return cache;
}


Generated by  Doxygen 1.6.0   Back to index