* Connect the rule to the racct, increasing refcount for the rule. */
| 883 | * Connect the rule to the racct, increasing refcount for the rule. |
| 884 | */ |
| 885 | static void |
| 886 | rctl_racct_add_rule(struct racct *racct, struct rctl_rule *rule) |
| 887 | { |
| 888 | struct rctl_rule_link *link; |
| 889 | |
| 890 | ASSERT_RACCT_ENABLED(); |
| 891 | KASSERT(rctl_rule_fully_specified(rule), ("rule not fully specified")); |
| 892 | |
| 893 | rctl_rule_acquire(rule); |
| 894 | link = uma_zalloc(rctl_rule_link_zone, M_WAITOK); |
| 895 | link->rrl_rule = rule; |
| 896 | link->rrl_exceeded = 0; |
| 897 | |
| 898 | RACCT_LOCK(); |
| 899 | LIST_INSERT_HEAD(&racct->r_rule_links, link, rrl_next); |
| 900 | RACCT_UNLOCK(); |
| 901 | } |
| 902 | |
| 903 | static int |
| 904 | rctl_racct_add_rule_locked(struct racct *racct, struct rctl_rule *rule) |
no test coverage detected