]> Git Repo - J-linux.git/blob - include/linux/objagg.h
Merge tag 'riscv-for-linus-6.13-mw1' of git://git.kernel.org/pub/scm/linux/kernel...
[J-linux.git] / include / linux / objagg.h
1 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
2 /* Copyright (c) 2018 Mellanox Technologies. All rights reserved */
3
4 #ifndef _OBJAGG_H
5 #define _OBJAGG_H
6
7 struct objagg_ops {
8         size_t obj_size;
9         bool (*delta_check)(void *priv, const void *parent_obj,
10                             const void *obj);
11         void * (*delta_create)(void *priv, void *parent_obj, void *obj);
12         void (*delta_destroy)(void *priv, void *delta_priv);
13         void * (*root_create)(void *priv, void *obj, unsigned int root_id);
14 #define OBJAGG_OBJ_ROOT_ID_INVALID UINT_MAX
15         void (*root_destroy)(void *priv, void *root_priv);
16 };
17
18 struct objagg;
19 struct objagg_obj;
20 struct objagg_hints;
21
22 const void *objagg_obj_root_priv(const struct objagg_obj *objagg_obj);
23 const void *objagg_obj_delta_priv(const struct objagg_obj *objagg_obj);
24 const void *objagg_obj_raw(const struct objagg_obj *objagg_obj);
25
26 struct objagg_obj *objagg_obj_get(struct objagg *objagg, void *obj);
27 void objagg_obj_put(struct objagg *objagg, struct objagg_obj *objagg_obj);
28 struct objagg *objagg_create(const struct objagg_ops *ops,
29                              struct objagg_hints *hints, void *priv);
30 void objagg_destroy(struct objagg *objagg);
31
32 struct objagg_obj_stats {
33         unsigned int user_count;
34         unsigned int delta_user_count; /* includes delta object users */
35 };
36
37 struct objagg_obj_stats_info {
38         struct objagg_obj_stats stats;
39         struct objagg_obj *objagg_obj; /* associated object */
40         bool is_root;
41 };
42
43 struct objagg_stats {
44         unsigned int root_count;
45         unsigned int stats_info_count;
46         struct objagg_obj_stats_info stats_info[];
47 };
48
49 const struct objagg_stats *objagg_stats_get(struct objagg *objagg);
50 void objagg_stats_put(const struct objagg_stats *objagg_stats);
51
52 enum objagg_opt_algo_type {
53         OBJAGG_OPT_ALGO_SIMPLE_GREEDY,
54 };
55
56 struct objagg_hints *objagg_hints_get(struct objagg *objagg,
57                                       enum objagg_opt_algo_type opt_algo_type);
58 void objagg_hints_put(struct objagg_hints *objagg_hints);
59 const struct objagg_stats *
60 objagg_hints_stats_get(struct objagg_hints *objagg_hints);
61
62 #endif
This page took 0.030232 seconds and 4 git commands to generate.