Thread (22 messages) flat view 22 messages, 3 authors, 2015-08-06

Re: [PATCH v6 3/4] bpf: Implement function bpf_perf_event_read() that get the selected hardware PMU conuter

From: xiakaixu <hidden>
Date: 2015-08-05 02:09:50
Also in: lkml

于 2015/8/5 1:55, Alexei Starovoitov 写道:
On 8/4/15 1:58 AM, Kaixu Xia wrote:
quoted
+static int check_func_limit(struct bpf_map **mapp, int func_id)
how about 'check_map_func_compatibility' or 'check_map_func_affinity' ?
quoted
+{
+    struct bpf_map *map = *mapp;
why pass pointer to a pointer? single pointer would be be fine.
quoted
+    bool bool_map, bool_func;
+    int i;
+
+    if (!map)
+        return 0;
+
+    for (i = 0; i <= ARRAY_SIZE(func_limit); i++) {
+        bool_map = (map->map_type == func_limit[i].map_type);
+        bool_func = (func_id == func_limit[i].func_id);
+        /* only when map & func pair match it can continue.
+         * don't allow any other map type to be passed into
+         * the special func;
+         */
+        if (bool_map != bool_func)
+            return -EINVAL;
+    }
nice simplification!

the rest of the changes look good.
please respin your next set against net-next.
Thanks for your review! I will follow them in the next set.

.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help