Lines Matching refs:role
189 struct role_datum *role; in roles_init() local
191 role = kzalloc(sizeof(*role), GFP_KERNEL); in roles_init()
192 if (!role) in roles_init()
196 role->value = ++p->p_roles.nprim; in roles_init()
197 if (role->value != OBJECT_R_VAL) in roles_init()
205 rc = hashtab_insert(p->p_roles.table, key, role); in roles_init()
212 kfree(role); in roles_init()
383 struct role_datum *role; in role_index() local
386 role = datum; in role_index()
388 if (!role->value in role_index()
389 || role->value > p->p_roles.nprim in role_index()
390 || role->bounds > p->p_roles.nprim) in role_index()
394 if (flex_array_put_ptr(fa, role->value - 1, key, in role_index()
397 p->role_val_to_struct[role->value - 1] = role; in role_index()
695 struct role_datum *role; in role_destroy() local
699 role = datum; in role_destroy()
700 ebitmap_destroy(&role->dominates); in role_destroy()
701 ebitmap_destroy(&role->types); in role_destroy()
937 int policydb_role_isvalid(struct policydb *p, unsigned int role) in policydb_role_isvalid() argument
939 if (!role || role > p->p_roles.nprim) in policydb_role_isvalid()
957 struct role_datum *role; in policydb_context_isvalid() local
960 if (!c->role || c->role > p->p_roles.nprim) in policydb_context_isvalid()
969 if (c->role != OBJECT_R_VAL) { in policydb_context_isvalid()
973 role = p->role_val_to_struct[c->role - 1]; in policydb_context_isvalid()
974 if (!role || !ebitmap_get_bit(&role->types, c->type - 1)) in policydb_context_isvalid()
985 if (!ebitmap_get_bit(&usrdatum->roles, c->role - 1)) in policydb_context_isvalid()
1072 c->role = le32_to_cpu(buf[1]); in context_read_and_validate()
1416 struct role_datum *role; in role_read() local
1421 role = kzalloc(sizeof(*role), GFP_KERNEL); in role_read()
1422 if (!role) in role_read()
1433 role->value = le32_to_cpu(buf[1]); in role_read()
1435 role->bounds = le32_to_cpu(buf[2]); in role_read()
1441 rc = ebitmap_read(&role->dominates, fp); in role_read()
1445 rc = ebitmap_read(&role->types, fp); in role_read()
1451 if (role->value != OBJECT_R_VAL) { in role_read()
1453 OBJECT_R, role->value); in role_read()
1460 rc = hashtab_insert(h, key, role); in role_read()
1465 role_destroy(key, role, NULL); in role_read()
1718 struct role_datum *upper, *role; in role_bounds_sanity_check() local
1722 upper = role = datum; in role_bounds_sanity_check()
1735 ebitmap_for_each_positive_bit(&role->types, node, bit) { in role_bounds_sanity_check()
1742 sym_name(p, SYM_ROLES, role->value - 1), in role_bounds_sanity_check()
2472 tr->role = le32_to_cpu(buf[0]); in policydb_read()
2484 if (!policydb_role_isvalid(p, tr->role) || in policydb_read()
2511 ra->role = le32_to_cpu(buf[0]); in policydb_read()
2513 if (!policydb_role_isvalid(p, ra->role) || in policydb_read()
2715 buf[0] = cpu_to_le32(tr->role); in role_trans_write()
2747 buf[0] = cpu_to_le32(ra->role); in role_allow_write()
2767 buf[1] = cpu_to_le32(c->role); in context_write()
2995 struct role_datum *role = datum; in role_write() local
3006 buf[items++] = cpu_to_le32(role->value); in role_write()
3008 buf[items++] = cpu_to_le32(role->bounds); in role_write()
3020 rc = ebitmap_write(&role->dominates, fp); in role_write()
3024 rc = ebitmap_write(&role->types, fp); in role_write()