Lines Matching refs:rule

16  * The rule section consists of four null-terminated strings per
23 * Type of the kABI rule. Must be one of the tags defined below.
82 struct rule {
89 /* { type, target } -> struct rule */
98 static inline unsigned int rule_hash(const struct rule *rule)
100 return rule_values_hash(rule->type, rule->target);
202 error("kABI rule section too small: %zd bytes", left);
210 struct rule *rule;
216 error("unsupported kABI rule version: '%s'", field);
229 error("unsupported kABI rule type: '%s'", field);
231 rule = xmalloc(sizeof(*rule));
233 rule->type = type;
234 rule->target = xstrdup(get_rule_field(&rule_str, &left));
235 rule->value = xstrdup(get_rule_field(&rule_str, &left));
237 hash_add(rules, &rule->hash, rule_hash(rule));
239 debug("kABI rule: type: '%s', target: '%s', value: '%s'", field,
240 rule->target, rule->value);
259 static struct rule *find_rule(enum kabi_rule_type type, const char *target)
261 struct rule *rule;
268 hash_for_each_possible(rules, rule, hash,
270 if (rule->type == type && !strcmp(target, rule->target))
271 return rule;
277 static struct rule *find_enumerator_rule(enum kabi_rule_type type,
280 struct rule *rule;
289 rule = find_rule(type, target);
292 return rule;
323 struct rule *rule;
325 rule = find_enumerator_rule(KABI_RULE_TYPE_ENUMERATOR_VALUE, fqn,
327 if (rule) {
328 *value = get_ulong_value(rule->value);
337 struct rule *rule;
339 rule = find_rule(KABI_RULE_TYPE_BYTE_SIZE, fqn);
340 if (rule) {
341 *value = get_ulong_value(rule->value);
350 struct rule *rule;
352 rule = find_rule(KABI_RULE_TYPE_TYPE_STRING, type);
353 if (rule) {
354 *str = rule->value;
364 struct rule *rule;
366 hash_for_each_safe(rules, rule, tmp, hash) {
367 free((void *)rule->target);
368 free((void *)rule->value);
369 free(rule);