Lines Matching defs:fp
49 struct policy_file *fp;
53 static int avrule_write_list(avrule_t * avrules, struct policy_file *fp);
55 static int ebitmap_write(ebitmap_t * e, struct policy_file *fp)
70 items = put_entry(buf, sizeof(uint32_t), 3, fp);
76 items = put_entry(&bit, sizeof(uint32_t), 1, fp);
80 items = put_entry(&map, sizeof(uint64_t), 1, fp);
100 avtab_ptr_t cur, struct policy_file *fp,
154 ERR(fp->handle, "null entry");
158 ERR(fp->handle, "entry has both access "
184 ERR(fp->handle, "missing node");
200 ERR(fp->handle, "data count wrong");
208 items2 = put_entry(buf32, sizeof(uint32_t), items, fp);
221 items = put_entry(buf16, sizeof(uint16_t), 4, fp);
226 ERR(fp->handle, "policy version %u does not support ioctl extended"
233 ERR(fp->handle, "Target platform %s does not support ioctl "
241 items = put_entry(&buf8, sizeof(uint8_t),1,fp);
245 items = put_entry(&buf8, sizeof(uint8_t),1,fp);
250 items = put_entry(buf32, sizeof(uint32_t),8,fp);
255 items = put_entry(buf32, sizeof(uint32_t), 1, fp);
273 static int avtab_write(struct policydb *p, avtab_t * a, struct policy_file *fp)
301 items = put_entry(&nel, sizeof(uint32_t), 1, fp);
310 if (avtab_write_item(p, cur, fp, 1, !oldvers, &nel)) {
321 items = put_entry(&nel, sizeof(uint32_t), 1, fp);
329 if (avtab_write_item(p, cur, fp, 1, 1, NULL)) {
349 struct policy_file *fp)
360 items = put_entry(buf, sizeof(uint32_t), 2, fp);
367 items = put_entry(buf, sizeof(uint32_t), 2, fp);
380 struct policy_file *fp)
384 rc = mls_write_semantic_level_helper(&r->level[0], fp);
388 rc = mls_write_semantic_level_helper(&r->level[1], fp);
397 static int mls_write_level(mls_level_t * l, struct policy_file *fp)
403 items = put_entry(&sens, sizeof(uint32_t), 1, fp);
407 if (ebitmap_write(&l->cat, fp))
417 static int mls_write_range_helper(mls_range_t * r, struct policy_file *fp)
431 items2 = put_entry(buf, sizeof(uint32_t), items, fp);
435 if (ebitmap_write(&r->level[0].cat, fp))
438 if (ebitmap_write(&r->level[1].cat, fp))
450 struct policy_file *fp = pd->fp;
458 items2 = put_entry(buf, sizeof(uint32_t), items, fp);
462 items = put_entry(key, 1, len, fp);
466 if (mls_write_level(levdatum->level, fp))
478 struct policy_file *fp = pd->fp;
487 items2 = put_entry(buf, sizeof(uint32_t), items, fp);
491 items = put_entry(key, 1, len, fp);
498 static int role_trans_write(policydb_t *p, struct policy_file *fp)
514 items = put_entry(buf, sizeof(uint32_t), 1, fp);
520 WARN(fp->handle, "Discarding role_transition "
529 items = put_entry(buf, sizeof(uint32_t), 3, fp);
534 items = put_entry(buf, sizeof(uint32_t), 1, fp);
543 static int role_allow_write(role_allow_t * r, struct policy_file *fp)
553 items = put_entry(buf, sizeof(uint32_t), 1, fp);
559 items = put_entry(buf, sizeof(uint32_t), 2, fp);
566 static int filename_trans_write(filename_trans_t * r, struct policy_file *fp)
576 items = put_entry(buf, sizeof(uint32_t), 1, fp);
582 items = put_entry(buf, sizeof(uint32_t), 1, fp);
586 items = put_entry(ft->name, sizeof(char), len, fp);
594 items = put_entry(buf, sizeof(uint32_t), 4, fp);
602 static int role_set_write(role_set_t * x, struct policy_file *fp)
607 if (ebitmap_write(&x->roles, fp))
611 items = put_entry(buf, sizeof(uint32_t), 1, fp);
618 static int type_set_write(type_set_t * x, struct policy_file *fp)
623 if (ebitmap_write(&x->types, fp))
625 if (ebitmap_write(&x->negset, fp))
629 items = put_entry(buf, sizeof(uint32_t), 1, fp);
642 struct policy_file *fp = pd->fp;
652 items2 = put_entry(buf, sizeof(uint32_t), items, fp);
655 items = put_entry(key, 1, len, fp);
662 items = put_entry(buf, sizeof(uint32_t), 1, fp);
680 cond_av_list_t * list, struct policy_file *fp)
705 items = put_entry(buf, sizeof(uint32_t), 1, fp);
716 if (avtab_write_item(p, cur_list->node, fp, 0, 1, NULL))
731 cond_node_t * node, struct policy_file *fp)
738 items = put_entry(buf, sizeof(uint32_t), 1, fp);
748 items = put_entry(buf, sizeof(uint32_t), 1, fp);
756 items2 = put_entry(buf, sizeof(uint32_t), items, fp);
762 if (cond_write_av_list(p, node->true_list, fp) != 0)
764 if (cond_write_av_list(p, node->false_list, fp) != 0)
767 if (avrule_write_list(node->avtrue_list, fp))
769 if (avrule_write_list(node->avfalse_list, fp))
776 items = put_entry(buf, sizeof(uint32_t), 1, fp);
785 struct policy_file *fp)
795 items = put_entry(buf, sizeof(uint32_t), 1, fp);
800 if (cond_write_node(p, cur, fp) != 0)
811 struct policy_file *fp)
820 items2 = put_entry(buf, sizeof(uint32_t), items, fp);
827 if (mls_write_range_helper(&c->range, fp))
845 struct policy_file *fp = pd->fp;
853 items2 = put_entry(buf, sizeof(uint32_t), items, fp);
857 items = put_entry(key, 1, len, fp);
870 struct policy_file *fp = pd->fp;
880 items2 = put_entry(buf, sizeof(uint32_t), items, fp);
884 items = put_entry(key, 1, len, fp);
896 struct policy_file *fp)
910 items = put_entry(buf, sizeof(uint32_t), 2, fp);
918 items = put_entry(buf, sizeof(uint32_t), 3, fp);
926 if (ebitmap_write(&e->names, fp)) {
930 type_set_write(e->type_names, fp)) ||
933 type_set_write(e->type_names, fp))) {
953 struct policy_file *fp = pd->fp;
979 items2 = put_entry(buf, sizeof(uint32_t), items, fp);
983 items = put_entry(key, 1, len, fp);
988 items = put_entry(cladatum->comkey, 1, len2, fp);
995 if (write_cons_helper(p, cladatum->constraints, 0, fp))
1008 items = put_entry(buf, sizeof(uint32_t), 1, fp);
1011 if (write_cons_helper(p, cladatum->validatetrans, 1, fp))
1022 items = put_entry(buf, sizeof(uint32_t), 3, fp);
1032 items = put_entry(buf, sizeof(uint32_t), 1, fp);
1046 struct policy_file *fp = pd->fp;
1070 items2 = put_entry(buf, sizeof(uint32_t), items, fp);
1074 items = put_entry(key, 1, len, fp);
1078 if (ebitmap_write(&role->dominates, fp))
1081 if (ebitmap_write(&role->types.types, fp))
1084 if (type_set_write(&role->types, fp))
1091 items = put_entry(buf, sizeof(uint32_t), 1, fp);
1095 if (ebitmap_write(&role->roles, fp))
1108 struct policy_file *fp = pd->fp;
1158 WARN(fp->handle, "Warning! Module policy "
1164 items2 = put_entry(buf, sizeof(uint32_t), items, fp);
1169 if (ebitmap_write(&typdatum->types, fp))
1173 items = put_entry(key, 1, len, fp);
1186 struct policy_file *fp = pd->fp;
1197 items2 = put_entry(buf, sizeof(uint32_t), items, fp);
1201 items = put_entry(key, 1, len, fp);
1206 if (ebitmap_write(&usrdatum->roles.roles, fp))
1209 if (role_set_write(&usrdatum->roles, fp))
1221 if (mls_write_range_helper(&usrdatum->exp_range, fp))
1223 if (mls_write_level(&usrdatum->exp_dfltlevel, fp))
1229 if (mls_write_semantic_range_helper(&usrdatum->range, fp))
1231 if (mls_write_semantic_level_helper(&usrdatum->dfltlevel, fp))
1244 struct policy_file *fp)
1255 items = put_entry(buf, sizeof(uint32_t), 1, fp);
1262 fp);
1265 if (context_write(p, &c->context[0], fp))
1270 items = put_entry(buf, sizeof(uint32_t), 1, fp);
1273 if (context_write(p, &c->context[0], fp))
1281 items = put_entry(buf, sizeof(uint32_t), 2, fp);
1284 if (context_write(p, &c->context[0], fp))
1294 items = put_entry(b64, sizeof(uint64_t), 2, fp);
1299 ERR(fp->handle, "policy version %d"
1309 items = put_entry(buf, sizeof(uint32_t), 2, fp);
1313 if (context_write(p, &c->context[0], fp))
1318 items = put_entry(buf, sizeof(uint32_t), 1, fp);
1321 if (context_write(p, &c->context[0], fp))
1327 items = put_entry(buf, sizeof(uint32_t), 1, fp);
1330 items = put_entry(c->u.name, 1, len, fp);
1333 if (context_write(p, &c->context[0], fp))
1343 policydb_t *p, struct policy_file *fp)
1354 items = put_entry(buf, sizeof(uint32_t), 1, fp);
1361 items = put_entry(buf, sizeof(uint32_t), 1, fp);
1364 if (context_write(p, &c->context[0], fp))
1371 items = put_entry(buf, sizeof(uint32_t), 1, fp);
1374 items = put_entry(c->u.name, 1, len, fp);
1377 if (context_write(p, &c->context[0], fp))
1379 if (context_write(p, &c->context[1], fp))
1389 items = put_entry(buf, sizeof(uint32_t), 3, fp);
1392 if (context_write(p, &c->context[0], fp))
1398 items = put_entry(buf, sizeof(uint32_t), 2, fp);
1401 if (context_write(p, &c->context[0], fp))
1408 items = put_entry(buf, sizeof(uint32_t), 2, fp);
1411 items = put_entry(c->u.name, 1, len, fp);
1414 if (context_write(p, &c->context[0], fp))
1422 items = put_entry(buf, sizeof(uint32_t), 8, fp);
1425 if (context_write(p, &c->context[0], fp))
1435 struct policy_file *fp)
1440 rc = ocontext_write_selinux(info, p, fp);
1443 rc = ocontext_write_xen(info, p, fp);
1449 static int genfs_write(policydb_t * p, struct policy_file *fp)
1459 items = put_entry(buf, sizeof(uint32_t), 1, fp);
1465 items = put_entry(buf, sizeof(uint32_t), 1, fp);
1468 items = put_entry(genfs->fstype, 1, len, fp);
1475 items = put_entry(buf, sizeof(uint32_t), 1, fp);
1481 items = put_entry(buf, sizeof(uint32_t), 1, fp);
1484 items = put_entry(c->u.name, 1, len, fp);
1488 items = put_entry(buf, sizeof(uint32_t), 1, fp);
1491 if (context_write(p, &c->context[0], fp))
1498 static int range_write(policydb_t * p, struct policy_file *fp)
1516 items = put_entry(buf, sizeof(uint32_t), 1, fp);
1522 WARN(fp->handle, "Discarding range_transition "
1530 items = put_entry(buf, sizeof(uint32_t), 2, fp);
1535 items = put_entry(buf, sizeof(uint32_t), 1, fp);
1539 if (mls_write_range_helper(&rt->target_range, fp))
1547 static int avrule_write(avrule_t * avrule, struct policy_file *fp)
1554 ERR(fp->handle, "module policy does not support extended"
1562 items2 = put_entry(buf, sizeof(uint32_t), items, fp);
1566 if (type_set_write(&avrule->stypes, fp))
1569 if (type_set_write(&avrule->ttypes, fp))
1580 items2 = put_entry(buf, sizeof(uint32_t), items, fp);
1588 items2 = put_entry(buf, sizeof(uint32_t), items, fp);
1598 static int avrule_write_list(avrule_t * avrules, struct policy_file *fp)
1611 if (put_entry(buf, sizeof(uint32_t), 1, fp) != 1)
1616 if (avrule_write(avrule, fp))
1638 struct policy_file *fp)
1652 items = put_entry(buf, sizeof(uint32_t), 1, fp);
1658 WARN(fp->handle, "Discarding role_transition "
1664 if (role_set_write(&tr->roles, fp))
1666 if (type_set_write(&tr->types, fp))
1669 if (ebitmap_write(&tr->classes, fp))
1672 items = put_entry(buf, sizeof(uint32_t), 1, fp);
1679 static int role_allow_rule_write(role_allow_rule_t * r, struct policy_file *fp)
1689 items = put_entry(buf, sizeof(uint32_t), 1, fp);
1693 if (role_set_write(&ra->roles, fp))
1695 if (role_set_write(&ra->new_roles, fp))
1701 static int filename_trans_rule_write(filename_trans_rule_t * t, struct policy_file *fp)
1712 items = put_entry(buf, sizeof(uint32_t), 1, fp);
1719 items = put_entry(buf, sizeof(uint32_t), 1, fp);
1723 items = put_entry(ftr->name, sizeof(char), len, fp);
1727 if (type_set_write(&ftr->stypes, fp))
1729 if (type_set_write(&ftr->ttypes, fp))
1735 items = put_entry(buf, sizeof(uint32_t), 2, fp);
1743 struct policy_file *fp)
1753 items = put_entry(buf, sizeof(uint32_t), 1, fp);
1757 if (type_set_write(&rt->stypes, fp))
1759 if (type_set_write(&rt->ttypes, fp))
1761 if (ebitmap_write(&rt->tclasses, fp))
1763 if (mls_write_semantic_range_helper(&rt->trange, fp))
1771 struct policy_file *fp)
1776 if (ebitmap_write(scope_index->scope + i, fp) == -1) {
1781 if (put_entry(buf, sizeof(uint32_t), 1, fp) != 1) {
1785 if (ebitmap_write(scope_index->class_perms_map + i, fp) == -1) {
1793 policydb_t * p, struct policy_file *fp)
1800 if (put_entry(buf, sizeof(uint32_t), 2, fp) != 2) {
1803 if (cond_write_list(p, decl->cond_list, fp) == -1 ||
1804 avrule_write_list(decl->avrules, fp) == -1 ||
1805 role_trans_rule_write(p, decl->role_tr_rules, fp) == -1 ||
1806 role_allow_rule_write(decl->role_allow_rules, fp) == -1) {
1811 filename_trans_rule_write(decl->filename_trans_rules, fp))
1815 range_trans_rule_write(decl->range_tr_rules, fp) == -1) {
1818 if (scope_index_write(&decl->required, num_scope_syms, fp) == -1 ||
1819 scope_index_write(&decl->declared, num_scope_syms, fp) == -1) {
1822 pd.fp = fp;
1827 if (put_entry(buf, sizeof(uint32_t), 2, fp) != 2) {
1838 policydb_t * p, struct policy_file *fp)
1847 if (put_entry(buf, sizeof(uint32_t), 1, fp) != 1) {
1860 if (put_entry(buf, sizeof(uint32_t), 1, fp) != 1) {
1864 if (avrule_decl_write(decl, num_scope_syms, p, fp) ==
1877 struct policy_file *fp = pd->fp;
1897 if (put_entry(buf, sizeof(*buf), 1, fp) != 1 ||
1898 put_entry(key, 1, key_len, fp) != key_len)
1907 if (put_entry(buf, sizeof(*buf), items, fp) != items)
1946 int policydb_write(policydb_t * p, struct policy_file *fp)
1958 pd.fp = fp;
1969 ERR(fp->handle, "policy version %d cannot support MLS",
1990 items2 = put_entry(buf, sizeof(uint32_t), items, fp);
1993 items = put_entry(policydb_str, 1, len, fp);
2002 ERR(fp->handle, "compatibility lookup failed for policy "
2015 items2 = put_entry(buf, sizeof(uint32_t), items, fp);
2023 items = put_entry(buf, sizeof(uint32_t), 1, fp);
2026 items = put_entry(p->name, 1, len, fp);
2031 items = put_entry(buf, sizeof(uint32_t), 1, fp);
2034 items = put_entry(p->version, 1, len, fp);
2045 if (ebitmap_write(&p->policycaps, fp) == -1)
2055 WARN(fp->handle, "Warning! Policy version %d cannot "
2065 if (ebitmap_write(&p->permissive_map, fp) == -1)
2099 items = put_entry(buf, sizeof(uint32_t), 2, fp);
2107 if (avtab_write(p, &p->te_avtab, fp))
2111 WARN(fp->handle, "Discarding "
2114 if (cond_write_list(p, p->cond_list, fp))
2117 if (role_trans_write(p, fp))
2119 if (role_allow_write(p->role_allow, fp))
2122 if (filename_trans_write(p->filename_trans, fp))
2126 WARN(fp->handle, "Discarding filename type transition rules");
2129 if (avrule_block_write(p->global, num_syms, p, fp) == -1) {
2135 if (put_entry(buf, sizeof(uint32_t), 1, fp) != 1) {
2143 if (ocontext_write(info, p, fp) == -1 || genfs_write(p, fp) == -1) {
2152 if (range_write(p, fp)) {
2160 if (ebitmap_write(&p->type_attr_map[i], fp) == -1)