* Remove limits for a rules matching the filter and release * the refcounts for the rules, possibly freeing them. Returns * the number of limit structures removed. */
| 927 | * the number of limit structures removed. |
| 928 | */ |
| 929 | static int |
| 930 | rctl_racct_remove_rules(struct racct *racct, |
| 931 | const struct rctl_rule *filter) |
| 932 | { |
| 933 | struct rctl_rule_link *link, *linktmp; |
| 934 | int removed = 0; |
| 935 | |
| 936 | ASSERT_RACCT_ENABLED(); |
| 937 | RACCT_LOCK_ASSERT(); |
| 938 | |
| 939 | LIST_FOREACH_SAFE(link, &racct->r_rule_links, rrl_next, linktmp) { |
| 940 | if (!rctl_rule_matches(link->rrl_rule, filter)) |
| 941 | continue; |
| 942 | |
| 943 | LIST_REMOVE(link, rrl_next); |
| 944 | rctl_rule_release(link->rrl_rule); |
| 945 | uma_zfree(rctl_rule_link_zone, link); |
| 946 | removed++; |
| 947 | } |
| 948 | return (removed); |
| 949 | } |
| 950 | |
| 951 | static void |
| 952 | rctl_rule_acquire_subject(struct rctl_rule *rule) |
no test coverage detected