Lines Matching full:ops
43 struct nl_cache_ops *ops; in __nl_cache_ops_lookup() local
45 for (ops = cache_ops; ops; ops = ops->co_next) in __nl_cache_ops_lookup()
46 if (!strcmp(ops->co_name, name)) in __nl_cache_ops_lookup()
47 return ops; in __nl_cache_ops_lookup()
54 * @arg ops Cache operations
56 void nl_cache_ops_get(struct nl_cache_ops *ops) in nl_cache_ops_get() argument
58 ops->co_refcnt++; in nl_cache_ops_get()
63 * @arg ops Cache operations
65 void nl_cache_ops_put(struct nl_cache_ops *ops) in nl_cache_ops_put() argument
67 ops->co_refcnt--; in nl_cache_ops_put()
81 struct nl_cache_ops *ops; in nl_cache_ops_lookup() local
84 ops = __nl_cache_ops_lookup(name); in nl_cache_ops_lookup()
87 return ops; in nl_cache_ops_lookup()
101 struct nl_cache_ops *ops; in nl_cache_ops_lookup_safe() local
104 if ((ops = __nl_cache_ops_lookup(name))) in nl_cache_ops_lookup_safe()
105 nl_cache_ops_get(ops); in nl_cache_ops_lookup_safe()
108 return ops; in nl_cache_ops_lookup_safe()
114 struct nl_cache_ops *ops; in __cache_ops_associate() local
116 for (ops = cache_ops; ops; ops = ops->co_next) { in __cache_ops_associate()
117 if (ops->co_protocol != protocol) in __cache_ops_associate()
120 for (i = 0; ops->co_msgtypes[i].mt_id >= 0; i++) in __cache_ops_associate()
121 if (ops->co_msgtypes[i].mt_id == msgtype) in __cache_ops_associate()
122 return ops; in __cache_ops_associate()
142 struct nl_cache_ops *ops; in nl_cache_ops_associate() local
145 ops = __cache_ops_associate(protocol, msgtype); in nl_cache_ops_associate()
148 return ops; in nl_cache_ops_associate()
166 struct nl_cache_ops *ops; in nl_cache_ops_associate_safe() local
169 if ((ops = __cache_ops_associate(protocol, msgtype))) in nl_cache_ops_associate_safe()
170 nl_cache_ops_get(ops); in nl_cache_ops_associate_safe()
173 return ops; in nl_cache_ops_associate_safe()
178 * @arg ops cache operations
189 struct nl_msgtype *nl_msgtype_lookup(struct nl_cache_ops *ops, int msgtype) in nl_msgtype_lookup() argument
193 for (i = 0; ops->co_msgtypes[i].mt_id >= 0; i++) in nl_msgtype_lookup()
194 if (ops->co_msgtypes[i].mt_id == msgtype) in nl_msgtype_lookup()
195 return &ops->co_msgtypes[i]; in nl_msgtype_lookup()
203 struct nl_cache_ops *ops; in cache_ops_lookup_for_obj() local
205 for (ops = cache_ops; ops; ops = ops->co_next) in cache_ops_lookup_for_obj()
206 if (ops->co_obj_ops == obj_ops) in cache_ops_lookup_for_obj()
207 return ops; in cache_ops_lookup_for_obj()
220 struct nl_cache_ops *ops; in nl_cache_ops_foreach() local
223 for (ops = cache_ops; ops; ops = ops->co_next) in nl_cache_ops_foreach()
224 cb(ops, arg); in nl_cache_ops_foreach()
230 * @arg ops Cache ops
236 void nl_cache_ops_set_flags(struct nl_cache_ops *ops, unsigned int flags) in nl_cache_ops_set_flags() argument
239 ops->co_flags |= flags; in nl_cache_ops_set_flags()
245 * @arg ops cache operations
252 int nl_cache_mngt_register(struct nl_cache_ops *ops) in nl_cache_mngt_register() argument
254 if (!ops->co_name || !ops->co_obj_ops) in nl_cache_mngt_register()
258 BUG_ON (ops->co_obj_ops->oo_keygen && !ops->co_obj_ops->oo_compare); in nl_cache_mngt_register()
261 if (__nl_cache_ops_lookup(ops->co_name)) { in nl_cache_mngt_register()
266 ops->co_refcnt = 0; in nl_cache_mngt_register()
267 ops->co_next = cache_ops; in nl_cache_mngt_register()
268 cache_ops = ops; in nl_cache_mngt_register()
271 NL_DBG(1, "Registered cache operations %s\n", ops->co_name); in nl_cache_mngt_register()
278 * @arg ops cache operations
287 int nl_cache_mngt_unregister(struct nl_cache_ops *ops) in nl_cache_mngt_unregister() argument
294 if (ops->co_refcnt > 0) { in nl_cache_mngt_unregister()
300 if (t == ops) in nl_cache_mngt_unregister()
308 NL_DBG(1, "Unregistered cache operations %s\n", ops->co_name); in nl_cache_mngt_unregister()
334 struct nl_cache_ops *ops; in nl_cache_mngt_provide() local
338 ops = cache_ops_lookup_for_obj(cache->c_ops->co_obj_ops); in nl_cache_mngt_provide()
339 if (!ops) in nl_cache_mngt_provide()
346 * ops don't go away while we use it to store the cache pointer. in nl_cache_mngt_provide()
348 if (!ops->co_major_cache) in nl_cache_mngt_provide()
349 nl_cache_ops_get(ops); in nl_cache_mngt_provide()
351 ops->co_major_cache = cache; in nl_cache_mngt_provide()
367 struct nl_cache_ops *ops; in nl_cache_mngt_unprovide() local
371 ops = cache_ops_lookup_for_obj(cache->c_ops->co_obj_ops); in nl_cache_mngt_unprovide()
372 if (!ops) in nl_cache_mngt_unprovide()
374 else if (ops->co_major_cache == cache) { in nl_cache_mngt_unprovide()
375 nl_cache_free(ops->co_major_cache); in nl_cache_mngt_unprovide()
376 nl_cache_ops_put(ops); in nl_cache_mngt_unprovide()
377 ops->co_major_cache = NULL; in nl_cache_mngt_unprovide()
385 struct nl_cache_ops *ops; in __nl_cache_mngt_require() local
388 ops = nl_cache_ops_lookup_safe(name); in __nl_cache_mngt_require()
389 if (ops) { in __nl_cache_mngt_require()
390 cache = ops->co_major_cache; in __nl_cache_mngt_require()
391 nl_cache_ops_put(ops); in __nl_cache_mngt_require()