Lines Matching full:vec

158  * @vec: vector of profiles to compare (NOT NULL)
159 * @n: length of @vec
161 * Returns: <0 if a < vec
162 * ==0 if a == vec
163 * >0 if a > vec
186 static bool vec_is_stale(struct aa_profile **vec, int n) in vec_is_stale() argument
190 AA_BUG(!vec); in vec_is_stale()
193 if (profile_is_stale(vec[i])) in vec_is_stale()
200 static bool vec_unconfined(struct aa_profile **vec, int n) in vec_unconfined() argument
204 AA_BUG(!vec); in vec_unconfined()
207 if (!profile_unconfined(vec[i])) in vec_unconfined()
220 * assumes vec is sorted
221 * Assumes @vec has null terminator at vec[n], and will null terminate
222 * vec[n - dups]
224 static inline int unique(struct aa_profile **vec, int n) in unique() argument
229 AA_BUG(!vec); in unique()
233 int res = profile_cmp(vec[pos], vec[i]); in unique()
235 AA_BUG(res > 0, "vec not sorted"); in unique()
238 aa_put_profile(vec[i]); in unique()
244 vec[pos] = vec[i]; in unique()
255 * @vec: list of profiles to sort and merge
259 * If @flags & VEC_FLAG_TERMINATE @vec has null terminator at vec[n], and will
260 * null terminate vec[n - dups]
262 int aa_vec_unique(struct aa_profile **vec, int n, int flags) in aa_vec_unique() argument
267 AA_BUG(!vec); in aa_vec_unique()
271 sort(vec, n, sizeof(struct aa_profile *), sort_cmp, NULL); in aa_vec_unique()
272 dups = unique(vec, n); in aa_vec_unique()
278 struct aa_profile *tmp = vec[i]; in aa_vec_unique()
282 int res = profile_cmp(vec[pos], tmp); in aa_vec_unique()
296 vec[j] = vec[j - 1]; in aa_vec_unique()
297 vec[pos] = tmp; in aa_vec_unique()
306 vec[n - dups] = NULL; in aa_vec_unique()
324 label->vec[i.i] = (struct aa_profile *) in aa_label_destroy()
379 on_list_rcu(&label->vec[0]->base.profiles)); in aa_label_kref()
381 on_list_rcu(&label->vec[0]->base.list)); in aa_label_kref()
405 label->vec[size] = NULL; /* null terminate */ in aa_label_init()
427 /* + 1 for null terminator entry on vec */ in aa_label_alloc()
471 return vec_cmp(a->vec, a->size, b->vec, b->size); in label_cmp()
481 if (!profile_unconfined(label->vec[i])) in aa_label_next_confined()
510 int res = profile_cmp(sub->vec[I->j], set->vec[I->i]); in __aa_label_next_not_in_set()
518 return sub->vec[(I->j)++]; in __aa_label_next_not_in_set()
522 return sub->vec[(I->j)++]; in __aa_label_next_not_in_set()
709 * __vec_find - find label that matches @vec in label set
710 * @vec: vec of profiles to find matching label for (NOT NULL)
711 * @n: length of @vec
713 * Requires: @vec_labelset(vec) lock held
718 * else NULL if @vec equiv is not in tree
720 static struct aa_label *__vec_find(struct aa_profile **vec, int n) in __vec_find() argument
724 AA_BUG(!vec); in __vec_find()
725 AA_BUG(!*vec); in __vec_find()
728 node = vec_labelset(vec, n)->root.rb_node; in __vec_find()
731 int result = vec_cmp(this->vec, this->size, vec, n); in __vec_find()
759 return __vec_find(label->vec, label->size); in __label_find()
828 * @vec: array of profiles to find equiv label for (NOT NULL)
829 * @n: length of @vec
831 * Returns: refcounted label if @vec equiv is in tree
832 * else NULL if @vec equiv is not in tree
834 static struct aa_label *vec_find(struct aa_profile **vec, int n) in vec_find() argument
840 AA_BUG(!vec); in vec_find()
841 AA_BUG(!*vec); in vec_find()
844 ls = vec_labelset(vec, n); in vec_find()
846 label = __vec_find(vec, n); in vec_find()
853 static struct aa_label *vec_create_and_insert_label(struct aa_profile **vec, in vec_create_and_insert_label() argument
862 AA_BUG(!vec); in vec_create_and_insert_label()
865 return aa_get_label(&vec[0]->label); in vec_create_and_insert_label()
867 ls = labels_set(&vec[len - 1]->label); in vec_create_and_insert_label()
877 new->vec[i] = aa_get_profile(vec[i]); in vec_create_and_insert_label()
887 struct aa_label *aa_vec_find_or_create_label(struct aa_profile **vec, int len, in aa_vec_find_or_create_label() argument
890 struct aa_label *label = vec_find(vec, len); in aa_vec_find_or_create_label()
895 return vec_create_and_insert_label(vec, len, gfp); in aa_vec_find_or_create_label()
912 return vec_find(label->vec, label->size); in aa_label_find()
974 int res = profile_cmp(a->vec[I->i], b->vec[I->j]); in aa_label_next_in_merge()
977 return b->vec[(I->j)++]; in aa_label_next_in_merge()
982 return a->vec[(I->i)++]; in aa_label_next_in_merge()
986 return b->vec[(I->j)++]; in aa_label_next_in_merge()
1017 int res = profile_cmp(p, z->vec[k]); in label_merge_cmp()
1069 new->vec[k] = aa_get_newest_profile(next); in label_merge_insert()
1070 AA_BUG(!new->vec[k]->label.proxy); in label_merge_insert()
1071 AA_BUG(!new->vec[k]->label.proxy->label); in label_merge_insert()
1072 if (next->label.proxy != new->vec[k]->label.proxy) in label_merge_insert()
1077 new->vec[k++] = aa_get_profile(next); in label_merge_insert()
1081 new->vec[k] = NULL; in label_merge_insert()
1084 new->size -= aa_vec_unique(&new->vec[0], new->size, in label_merge_insert()
1088 label = aa_get_label(&new->vec[0]->label); in label_merge_insert()
1101 if (vec_unconfined(new->vec, new->size)) in label_merge_insert()
1889 DEFINE_VEC(profile, vec); in aa_label_strn_parse()
1911 error = vec_setup(profile, vec, len, gfp); in aa_label_strn_parse()
1916 vec[i] = aa_get_profile(base->vec[i]); in aa_label_strn_parse()
1920 vec[i] = fqlookupn_profile(base, currbase, str, split - str); in aa_label_strn_parse()
1921 if (!vec[i]) in aa_label_strn_parse()
1927 if (vec[i]->ns != labels_ns(currbase)) in aa_label_strn_parse()
1928 currbase = &vec[i]->label; in aa_label_strn_parse()
1934 vec[i] = fqlookupn_profile(base, currbase, str, end - str); in aa_label_strn_parse()
1935 if (!vec[i]) in aa_label_strn_parse()
1939 /* no need to free vec as len < LOCAL_VEC_ENTRIES */ in aa_label_strn_parse()
1940 return &vec[0]->label; in aa_label_strn_parse()
1942 len -= aa_vec_unique(vec, len, VEC_FLAG_TERMINATE); in aa_label_strn_parse()
1945 label = aa_get_label(&vec[0]->label); in aa_label_strn_parse()
1950 label = aa_vec_find_or_create_label(vec, len, gfp); in aa_label_strn_parse()
1952 label = vec_find(vec, len); in aa_label_strn_parse()
1958 vec_cleanup(profile, vec, len); in aa_label_strn_parse()
2024 vec_is_stale(label->vec, label->size)) && in labelset_next_stale()
2070 AA_BUG(!label->vec[i]); in __label_update()
2071 new->vec[i] = aa_get_newest_profile(label->vec[i]); in __label_update()
2072 AA_BUG(!new->vec[i]); in __label_update()
2073 AA_BUG(!new->vec[i]->label.proxy); in __label_update()
2074 AA_BUG(!new->vec[i]->label.proxy->label); in __label_update()
2075 if (new->vec[i]->label.proxy != label->vec[i]->label.proxy) in __label_update()
2081 new->size -= aa_vec_unique(&new->vec[0], new->size, in __label_update()
2085 tmp = aa_get_label(&new->vec[0]->label); in __label_update()