libnl  3.2.21
Caching System

Related sections in the development guide: More...

Modules

 Cache
 Manager
 Manager keeping caches up to date automatically.

Cache Operations Sets

struct nl_cache_ops * __nl_cache_ops_lookup (const char *name)
void nl_cache_ops_get (struct nl_cache_ops *ops)
 Increment reference counter.
void nl_cache_ops_put (struct nl_cache_ops *ops)
 Decrement reference counter.
struct nl_cache_ops * nl_cache_ops_lookup (const char *name)
 Lookup cache operations by name.
struct nl_cache_ops * nl_cache_ops_lookup_safe (const char *name)
 Lookup cache operations by name.
struct nl_cache_ops * nl_cache_ops_associate (int protocol, int msgtype)
 Associate protocol and message type to cache operations.
struct nl_cache_ops * nl_cache_ops_associate_safe (int protocol, int msgtype)
 Associate protocol and message type to cache operations.
struct nl_msgtype * nl_msgtype_lookup (struct nl_cache_ops *ops, int msgtype)
 Lookup message type cache association.
void nl_cache_ops_foreach (void(*cb)(struct nl_cache_ops *, void *), void *arg)
 Call a function for each registered cache operation.
void nl_cache_ops_set_flags (struct nl_cache_ops *ops, unsigned int flags)
 Set default flags for caches of this type.
int nl_cache_mngt_register (struct nl_cache_ops *ops)
 Register a set of cache operations.
int nl_cache_mngt_unregister (struct nl_cache_ops *ops)
 Unregister a set of cache operations.

Global Cache Provisioning/Requiring

void nl_cache_mngt_provide (struct nl_cache *cache)
 Provide a cache for global use.
void nl_cache_mngt_unprovide (struct nl_cache *cache)
 Unprovide a cache for global use.
struct nl_cache * __nl_cache_mngt_require (const char *name)
struct nl_cache * nl_cache_mngt_require (const char *name)
 Return cache previously provided via nl_cache_mngt_provide()
struct nl_cache * nl_cache_mngt_require_safe (const char *name)
 Return cache previously provided via nl_cache_mngt_provide()

Detailed Description

Related sections in the development guide:

Header

#include <netlink/cache.h>

Function Documentation

void nl_cache_ops_get ( struct nl_cache_ops *  ops)

Increment reference counter.

Parameters:
opsCache operations

Definition at line 56 of file cache_mngt.c.

Referenced by nl_cache_mngt_provide(), nl_cache_ops_associate_safe(), and nl_cache_ops_lookup_safe().

+ Here is the caller graph for this function:

void nl_cache_ops_put ( struct nl_cache_ops *  ops)

Decrement reference counter.

Parameters:
opsCache operations

Definition at line 65 of file cache_mngt.c.

Referenced by nl_cache_alloc_name(), nl_cache_mngr_add(), nl_cache_mngt_unprovide(), nl_msg_dump(), and nl_object_alloc_name().

+ Here is the caller graph for this function:

struct nl_cache_ops* nl_cache_ops_lookup ( const char *  name)
read

Lookup cache operations by name.

Parameters:
namename of the cache type
Attention:
This function is not safe, it does not increment the reference counter. Please use nl_cache_ops_lookup_safe().
Returns:
The cache operations or NULL if not found.

Definition at line 79 of file cache_mngt.c.

struct nl_cache_ops* nl_cache_ops_lookup_safe ( const char *  name)
read

Lookup cache operations by name.

Parameters:
namename of the cache type
Note:
The reference counter of the returned cache operation is incremented and must be decremented after use with nl_cache_ops_put().
Returns:
The cache operations or NULL if not found.

Definition at line 99 of file cache_mngt.c.

References nl_cache_ops_get().

Referenced by nl_cache_alloc_name(), nl_cache_mngr_add(), and nl_object_alloc_name().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

struct nl_cache_ops* nl_cache_ops_associate ( int  protocol,
int  msgtype 
)
read

Associate protocol and message type to cache operations.

Parameters:
protocolnetlink protocol
msgtypenetlink message type
Attention:
This function is not safe, it does not increment the reference counter. Please use nl_cache_ops_associate_safe().
See also:
nl_cache_ops_associate_safe()
Returns:
The cache operations or NULL if no match found.

Definition at line 140 of file cache_mngt.c.

struct nl_cache_ops* nl_cache_ops_associate_safe ( int  protocol,
int  msgtype 
)
read

Associate protocol and message type to cache operations.

Parameters:
protocolnetlink protocol
msgtypenetlink message type

Searches the registered cache operations for a matching protocol and message type.

Note:
The reference counter of the returned cache operation is incremented and must be decremented after use with nl_cache_ops_put().
Returns:
The cache operations or NULL if no no match was found.

Definition at line 164 of file cache_mngt.c.

References nl_cache_ops_get().

Referenced by nl_msg_dump().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

struct nl_msgtype* nl_msgtype_lookup ( struct nl_cache_ops *  ops,
int  msgtype 
)
read

Lookup message type cache association.

Parameters:
opscache operations
msgtypenetlink message type

Searches for a matching message type association ing the specified cache operations.

Attention:
The guranteed lifetime of the returned message type is bound to the lifetime of the underlying cache operations.
Returns:
A message type association or NULL.

Definition at line 189 of file cache_mngt.c.

void nl_cache_ops_foreach ( void(*)(struct nl_cache_ops *, void *)  cb,
void *  arg 
)

Call a function for each registered cache operation.

Parameters:
cbCallback function to be called
argUser specific argument.

Definition at line 218 of file cache_mngt.c.

void nl_cache_ops_set_flags ( struct nl_cache_ops *  ops,
unsigned int  flags 
)

Set default flags for caches of this type.

Parameters:
opsCache ops
flagsFlags to set

The cache operation flags will be derived to all caches allocates based on this set of cache operations.

Definition at line 236 of file cache_mngt.c.

int nl_cache_mngt_register ( struct nl_cache_ops *  ops)

Register a set of cache operations.

Parameters:
opscache operations

Called by users of caches to announce the avaibility of a certain cache type.

Returns:
0 on success or a negative error code.

Definition at line 252 of file cache_mngt.c.

Referenced by genl_register().

+ Here is the caller graph for this function:

int nl_cache_mngt_unregister ( struct nl_cache_ops *  ops)

Unregister a set of cache operations.

Parameters:
opscache operations

Called by users of caches to announce a set of cache operations is no longer available. The specified cache operations must have been registered previously using nl_cache_mngt_register()

Returns:
0 on success or a negative error code

Definition at line 284 of file cache_mngt.c.

Referenced by genl_unregister().

+ Here is the caller graph for this function:

void nl_cache_mngt_provide ( struct nl_cache *  cache)

Provide a cache for global use.

Parameters:
cachecache 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.

Definition at line 329 of file cache_mngt.c.

References nl_cache_get(), and nl_cache_ops_get().

Referenced by nl_cache_mngr_add_cache().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void nl_cache_mngt_unprovide ( struct nl_cache *  cache)

Unprovide a cache for global use.

Parameters:
cachecache to unprovide

Cancels the offer to use a cache globally. The cache will no longer be returned via lookups but may still be in use.

Definition at line 362 of file cache_mngt.c.

References nl_cache_free(), and nl_cache_ops_put().

Referenced by nl_cache_mngr_free().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

struct nl_cache* nl_cache_mngt_require ( const char *  name)
read

Return cache previously provided via nl_cache_mngt_provide()

Parameters:
nameName of cache to lookup
Attention:
This function is not safe, it does not increment the reference counter. Please use nl_cache_mngt_require_safe().
See also:
nl_cache_mngt_require_safe()
Returns:
Pointer to cache or NULL if none registered

Definition at line 405 of file cache_mngt.c.

Referenced by nl_cache_mngt_require_safe().

+ Here is the caller graph for this function:

struct nl_cache* nl_cache_mngt_require_safe ( const char *  name)
read

Return cache previously provided via nl_cache_mngt_provide()

Parameters:
nameName of cache to lookup
Note:
The reference counter of the returned cache is incremented and must be decremented after use with nl_cache_put().
Returns:
Pointer to cache or NULL if none registered

Definition at line 427 of file cache_mngt.c.

References nl_cache_get(), and nl_cache_mngt_require().

+ Here is the call graph for this function: