Lines Matching refs:spec
66 struct spec *curr_spec, *spec_arr = data->spec_arr;
298 struct spec *spec;
306 spec = &data->spec_arr[data->nspec];
307 spec->from_mmap = 1;
332 spec->lr.ctx_raw = str_buf;
334 if (strcmp(spec->lr.ctx_raw, "<<none>>") && rec->validating) {
335 if (selabel_validate(rec, &spec->lr) < 0) {
338 path, spec->lr.ctx_raw);
350 spec->regex_str = (char *)mmap_area->next_addr;
355 if (spec->regex_str[entry_len - 1] != '\0') {
368 spec->mode = mode;
376 spec->stem_id = -1;
378 spec->stem_id = stem_map[stem_id];
385 spec->hasMetaChars = meta_chars;
393 spec->prefix_len = prefix_len;
396 rc = regex_load_mmap(mmap_area, &spec->regex, reg_arch_matches,
397 &spec->regex_compiled);
401 __pthread_mutex_init(&spec->regex_lock, NULL);
835 * The do detailed validation of the input and fill the spec array
878 struct spec *spec;
886 spec = &data->spec_arr[i];
887 free(spec->lr.ctx_trans);
888 free(spec->lr.ctx_raw);
889 regex_data_free(spec->regex);
890 __pthread_mutex_destroy(&spec->regex_lock);
891 if (spec->from_mmap)
893 free(spec->regex_str);
894 free(spec->type_str);
922 static struct spec **lookup_all(struct selabel_handle *rec,
929 struct spec *spec_arr = data->spec_arr;
938 struct spec **result = NULL;
941 result = calloc(data->nspec, sizeof(struct spec*));
943 result = calloc(1, sizeof(struct spec*));
947 data->nspec * sizeof(struct spec*));
1005 struct spec *spec = &spec_arr[i];
1006 /* if the spec in question matches no stem or has the same
1007 * stem as the file AND if the spec in question has no mode
1010 bool stem_matches = spec->stem_id == -1 || spec->stem_id == file_stem;
1015 (!mode || !spec->mode || mode == spec->mode)) {
1016 if (compile_regex(spec, NULL) < 0)
1018 rc = regex_match(spec->regex, key, partial);
1022 __atomic_store_n(&spec->any_matches,
1035 result[*match_count] = spec;
1040 result[0] = spec;
1065 static struct spec *lookup_common(struct selabel_handle *rec,
1069 struct spec **matches = lookup_all(rec, key, type, partial, NULL);
1073 struct spec *result = matches[0];
1136 struct spec **matches = lookup_all(rec, key, 0, true, &total_matches);
1165 struct spec *spec;
1167 spec = lookup_common(rec, key, type, false);
1168 if (spec)
1169 return &spec->lr;
1185 struct spec **specs;
1195 specs = calloc(n+1, sizeof(struct spec *));
1235 static enum selabel_cmp_result incomp(struct spec *spec1, struct spec *spec2, const char *reason, int i, int j)
1251 struct spec *spec_arr1 = data1->spec_arr, *spec_arr2 = data2->spec_arr;
1258 struct spec *spec1 = &spec_arr1[i];
1259 struct spec *spec2 = &spec_arr2[j];
1323 struct spec *spec_arr = data->spec_arr;