+/* Same as cls_rule_init() for initialization from a "struct minimatch". */
+void
+cls_rule_init_from_minimatch(struct cls_rule *rule,
+ const struct minimatch *match,
+ unsigned int priority)
+{
+ minimatch_clone(&rule->match, match);
+ rule->priority = priority;
+}
+
+/* Initializes 'dst' as a copy of 'src'.
+ *
+ * The caller must eventually destroy 'rule' with cls_rule_destroy(). */
+void
+cls_rule_clone(struct cls_rule *dst, const struct cls_rule *src)
+{
+ minimatch_clone(&dst->match, &src->match);
+ dst->priority = src->priority;
+}
+
+/* Frees memory referenced by 'rule'. Doesn't free 'rule' itself (it's
+ * normally embedded into a larger structure).
+ *
+ * ('rule' must not currently be in a classifier.) */
+void
+cls_rule_destroy(struct cls_rule *rule)
+{
+ minimatch_destroy(&rule->match);
+}
+