Lines Matching full:rc

381 	int rc;  in roles_init()  local
388 rc = -EINVAL; in roles_init()
393 rc = -ENOMEM; in roles_init()
398 rc = symtab_insert(&p->p_roles, key, role); in roles_init()
399 if (rc) in roles_init()
406 return rc; in roles_init()
714 int i, rc; in policydb_index() local
757 rc = cond_init_bool_indexes(p); in policydb_index()
758 if (rc) in policydb_index()
768 rc = hashtab_map(&p->symtab[i].table, index_f[i], p); in policydb_index()
769 if (rc) in policydb_index()
772 rc = 0; in policydb_index()
774 return rc; in policydb_index()
866 int rc; in policydb_load_isids() local
868 rc = sidtab_init(s); in policydb_load_isids()
869 if (rc) { in policydb_load_isids()
871 return rc; in policydb_load_isids()
889 rc = sidtab_set_initial(s, sid, &c->context[0]); in policydb_load_isids()
890 if (rc) { in policydb_load_isids()
894 return rc; in policydb_load_isids()
974 int rc; in mls_read_range_helper() local
976 rc = next_entry(buf, fp, sizeof(u32)); in mls_read_range_helper()
977 if (rc) in mls_read_range_helper()
980 rc = -EINVAL; in mls_read_range_helper()
987 rc = next_entry(buf, fp, sizeof(u32) * items); in mls_read_range_helper()
988 if (rc) { in mls_read_range_helper()
999 rc = ebitmap_read(&r->level[0].cat, fp); in mls_read_range_helper()
1000 if (rc) { in mls_read_range_helper()
1005 rc = ebitmap_read(&r->level[1].cat, fp); in mls_read_range_helper()
1006 if (rc) { in mls_read_range_helper()
1011 rc = ebitmap_cpy(&r->level[1].cat, &r->level[0].cat); in mls_read_range_helper()
1012 if (rc) { in mls_read_range_helper()
1022 return rc; in mls_read_range_helper()
1034 int rc; in context_read_and_validate() local
1036 rc = next_entry(buf, fp, sizeof buf); in context_read_and_validate()
1037 if (rc) { in context_read_and_validate()
1045 rc = mls_read_range_helper(&c->range, fp); in context_read_and_validate()
1046 if (rc) { in context_read_and_validate()
1052 rc = -EINVAL; in context_read_and_validate()
1058 rc = 0; in context_read_and_validate()
1060 return rc; in context_read_and_validate()
1071 int rc; in str_read() local
1081 rc = next_entry(str, fp, len); in str_read()
1082 if (rc) { in str_read()
1084 return rc; in str_read()
1096 int rc; in perm_read() local
1104 rc = next_entry(buf, fp, sizeof buf); in perm_read()
1105 if (rc) in perm_read()
1111 rc = str_read(&key, GFP_KERNEL, fp, len); in perm_read()
1112 if (rc) in perm_read()
1115 rc = symtab_insert(s, key, perdatum); in perm_read()
1116 if (rc) in perm_read()
1122 return rc; in perm_read()
1131 int i, rc; in common_read() local
1137 rc = next_entry(buf, fp, sizeof buf); in common_read()
1138 if (rc) in common_read()
1145 rc = symtab_init(&comdatum->permissions, nel); in common_read()
1146 if (rc) in common_read()
1150 rc = str_read(&key, GFP_KERNEL, fp, len); in common_read()
1151 if (rc) in common_read()
1155 rc = perm_read(p, &comdatum->permissions, fp); in common_read()
1156 if (rc) in common_read()
1160 rc = symtab_insert(s, key, comdatum); in common_read()
1161 if (rc) in common_read()
1166 return rc; in common_read()
1178 int rc; in type_set_read() local
1185 rc = next_entry(buf, fp, sizeof(u32)); in type_set_read()
1186 if (rc < 0) in type_set_read()
1202 int rc, i, j, depth; in read_cons_helper() local
1215 rc = next_entry(buf, fp, (sizeof(u32) * 2)); in read_cons_helper()
1216 if (rc) in read_cons_helper()
1217 return rc; in read_cons_helper()
1232 rc = next_entry(buf, fp, (sizeof(u32) * 3)); in read_cons_helper()
1233 if (rc) in read_cons_helper()
1234 return rc; in read_cons_helper()
1261 rc = ebitmap_read(&e->names, fp); in read_cons_helper()
1262 if (rc) in read_cons_helper()
1263 return rc; in read_cons_helper()
1271 rc = type_set_read(e->type_names, fp); in read_cons_helper()
1272 if (rc) in read_cons_helper()
1273 return rc; in read_cons_helper()
1295 int i, rc; in class_read() local
1301 rc = next_entry(buf, fp, sizeof(u32)*6); in class_read()
1302 if (rc) in class_read()
1310 rc = symtab_init(&cladatum->permissions, nel); in class_read()
1311 if (rc) in class_read()
1317 rc = str_read(&key, GFP_KERNEL, fp, len); in class_read()
1318 if (rc) in class_read()
1322 rc = str_read(&cladatum->comkey, GFP_KERNEL, fp, len2); in class_read()
1323 if (rc) in class_read()
1326 rc = -EINVAL; in class_read()
1336 rc = perm_read(p, &cladatum->permissions, fp); in class_read()
1337 if (rc) in class_read()
1341 rc = read_cons_helper(p, &cladatum->constraints, ncons, 0, fp); in class_read()
1342 if (rc) in class_read()
1347 rc = next_entry(buf, fp, sizeof(u32)); in class_read()
1348 if (rc) in class_read()
1351 rc = read_cons_helper(p, &cladatum->validatetrans, in class_read()
1353 if (rc) in class_read()
1358 rc = next_entry(buf, fp, sizeof(u32) * 3); in class_read()
1359 if (rc) in class_read()
1368 rc = next_entry(buf, fp, sizeof(u32) * 1); in class_read()
1369 if (rc) in class_read()
1374 rc = symtab_insert(s, key, cladatum); in class_read()
1375 if (rc) in class_read()
1381 return rc; in class_read()
1388 int rc, to_read = 2; in role_read() local
1399 rc = next_entry(buf, fp, sizeof(buf[0]) * to_read); in role_read()
1400 if (rc) in role_read()
1408 rc = str_read(&key, GFP_KERNEL, fp, len); in role_read()
1409 if (rc) in role_read()
1412 rc = ebitmap_read(&role->dominates, fp); in role_read()
1413 if (rc) in role_read()
1416 rc = ebitmap_read(&role->types, fp); in role_read()
1417 if (rc) in role_read()
1421 rc = -EINVAL; in role_read()
1427 rc = 0; in role_read()
1431 rc = symtab_insert(s, key, role); in role_read()
1432 if (rc) in role_read()
1437 return rc; in role_read()
1444 int rc, to_read = 3; in type_read() local
1455 rc = next_entry(buf, fp, sizeof(buf[0]) * to_read); in type_read()
1456 if (rc) in type_read()
1474 rc = str_read(&key, GFP_KERNEL, fp, len); in type_read()
1475 if (rc) in type_read()
1478 rc = symtab_insert(s, key, typdatum); in type_read()
1479 if (rc) in type_read()
1484 return rc; in type_read()
1495 int rc; in mls_read_level() local
1499 rc = next_entry(buf, fp, sizeof buf); in mls_read_level()
1500 if (rc) { in mls_read_level()
1502 return rc; in mls_read_level()
1506 rc = ebitmap_read(&lp->cat, fp); in mls_read_level()
1507 if (rc) { in mls_read_level()
1509 return rc; in mls_read_level()
1518 int rc, to_read = 2; in user_read() local
1529 rc = next_entry(buf, fp, sizeof(buf[0]) * to_read); in user_read()
1530 if (rc) in user_read()
1538 rc = str_read(&key, GFP_KERNEL, fp, len); in user_read()
1539 if (rc) in user_read()
1542 rc = ebitmap_read(&usrdatum->roles, fp); in user_read()
1543 if (rc) in user_read()
1547 rc = mls_read_range_helper(&usrdatum->range, fp); in user_read()
1548 if (rc) in user_read()
1550 rc = mls_read_level(&usrdatum->dfltlevel, fp); in user_read()
1551 if (rc) in user_read()
1555 rc = symtab_insert(s, key, usrdatum); in user_read()
1556 if (rc) in user_read()
1561 return rc; in user_read()
1568 int rc; in sens_read() local
1576 rc = next_entry(buf, fp, sizeof buf); in sens_read()
1577 if (rc) in sens_read()
1583 rc = str_read(&key, GFP_ATOMIC, fp, len); in sens_read()
1584 if (rc) in sens_read()
1587 rc = -ENOMEM; in sens_read()
1592 rc = mls_read_level(levdatum->level, fp); in sens_read()
1593 if (rc) in sens_read()
1596 rc = symtab_insert(s, key, levdatum); in sens_read()
1597 if (rc) in sens_read()
1602 return rc; in sens_read()
1609 int rc; in cat_read() local
1617 rc = next_entry(buf, fp, sizeof buf); in cat_read()
1618 if (rc) in cat_read()
1625 rc = str_read(&key, GFP_ATOMIC, fp, len); in cat_read()
1626 if (rc) in cat_read()
1629 rc = symtab_insert(s, key, catdatum); in cat_read()
1630 if (rc) in cat_read()
1635 return rc; in cat_read()
1754 int rc; in policydb_bounds_sanity_check() local
1759 rc = hashtab_map(&p->p_users.table, user_bounds_sanity_check, p); in policydb_bounds_sanity_check()
1760 if (rc) in policydb_bounds_sanity_check()
1761 return rc; in policydb_bounds_sanity_check()
1763 rc = hashtab_map(&p->p_roles.table, role_bounds_sanity_check, p); in policydb_bounds_sanity_check()
1764 if (rc) in policydb_bounds_sanity_check()
1765 return rc; in policydb_bounds_sanity_check()
1767 rc = hashtab_map(&p->p_types.table, type_bounds_sanity_check, p); in policydb_bounds_sanity_check()
1768 if (rc) in policydb_bounds_sanity_check()
1769 return rc; in policydb_bounds_sanity_check()
1810 int i, rc; in range_read() local
1817 rc = next_entry(buf, fp, sizeof(u32)); in range_read()
1818 if (rc) in range_read()
1819 return rc; in range_read()
1823 rc = hashtab_init(&p->range_tr, nel); in range_read()
1824 if (rc) in range_read()
1825 return rc; in range_read()
1828 rc = -ENOMEM; in range_read()
1833 rc = next_entry(buf, fp, (sizeof(u32) * 2)); in range_read()
1834 if (rc) in range_read()
1840 rc = next_entry(buf, fp, sizeof(u32)); in range_read()
1841 if (rc) in range_read()
1847 rc = -EINVAL; in range_read()
1853 rc = -ENOMEM; in range_read()
1858 rc = mls_read_range_helper(r, fp); in range_read()
1859 if (rc) in range_read()
1862 rc = -EINVAL; in range_read()
1868 rc = hashtab_insert(&p->range_tr, rt, r, rangetr_key_params); in range_read()
1869 if (rc) in range_read()
1876 rc = 0; in range_read()
1880 return rc; in range_read()
1890 int rc; in filename_trans_read_helper_compat() local
1893 rc = next_entry(buf, fp, sizeof(u32)); in filename_trans_read_helper_compat()
1894 if (rc) in filename_trans_read_helper_compat()
1895 return rc; in filename_trans_read_helper_compat()
1899 rc = str_read(&name, GFP_KERNEL, fp, len); in filename_trans_read_helper_compat()
1900 if (rc) in filename_trans_read_helper_compat()
1901 return rc; in filename_trans_read_helper_compat()
1903 rc = next_entry(buf, fp, sizeof(u32) * 4); in filename_trans_read_helper_compat()
1904 if (rc) in filename_trans_read_helper_compat()
1928 rc = -ENOMEM; in filename_trans_read_helper_compat()
1940 rc = -ENOMEM; in filename_trans_read_helper_compat()
1945 rc = hashtab_insert(&p->filename_trans, ft, datum, in filename_trans_read_helper_compat()
1947 if (rc) in filename_trans_read_helper_compat()
1951 rc = ebitmap_set_bit(&p->filename_trans_ttypes, in filename_trans_read_helper_compat()
1953 if (rc) in filename_trans_read_helper_compat()
1954 return rc; in filename_trans_read_helper_compat()
1964 return rc; in filename_trans_read_helper_compat()
1974 int rc; in filename_trans_read_helper() local
1977 rc = next_entry(buf, fp, sizeof(u32)); in filename_trans_read_helper()
1978 if (rc) in filename_trans_read_helper()
1979 return rc; in filename_trans_read_helper()
1983 rc = str_read(&name, GFP_KERNEL, fp, len); in filename_trans_read_helper()
1984 if (rc) in filename_trans_read_helper()
1985 return rc; in filename_trans_read_helper()
1987 rc = next_entry(buf, fp, sizeof(u32) * 3); in filename_trans_read_helper()
1988 if (rc) in filename_trans_read_helper()
1997 rc = -ENOENT; in filename_trans_read_helper()
2003 rc = -ENOMEM; in filename_trans_read_helper()
2011 rc = ebitmap_read(&datum->stypes, fp); in filename_trans_read_helper()
2012 if (rc) in filename_trans_read_helper()
2015 rc = next_entry(buf, fp, sizeof(u32)); in filename_trans_read_helper()
2016 if (rc) in filename_trans_read_helper()
2025 rc = -ENOMEM; in filename_trans_read_helper()
2034 rc = hashtab_insert(&p->filename_trans, ft, first, in filename_trans_read_helper()
2036 if (rc == -EEXIST) in filename_trans_read_helper()
2038 if (rc) in filename_trans_read_helper()
2053 return rc; in filename_trans_read_helper()
2060 int rc, i; in filename_trans_read() local
2065 rc = next_entry(buf, fp, sizeof(u32)); in filename_trans_read()
2066 if (rc) in filename_trans_read()
2067 return rc; in filename_trans_read()
2073 rc = hashtab_init(&p->filename_trans, (1 << 11)); in filename_trans_read()
2074 if (rc) in filename_trans_read()
2075 return rc; in filename_trans_read()
2078 rc = filename_trans_read_helper_compat(p, fp); in filename_trans_read()
2079 if (rc) in filename_trans_read()
2080 return rc; in filename_trans_read()
2083 rc = hashtab_init(&p->filename_trans, nel); in filename_trans_read()
2084 if (rc) in filename_trans_read()
2085 return rc; in filename_trans_read()
2088 rc = filename_trans_read_helper(p, fp); in filename_trans_read()
2089 if (rc) in filename_trans_read()
2090 return rc; in filename_trans_read()
2099 int i, j, rc; in genfs_read() local
2107 rc = next_entry(buf, fp, sizeof(u32)); in genfs_read()
2108 if (rc) in genfs_read()
2109 return rc; in genfs_read()
2113 rc = next_entry(buf, fp, sizeof(u32)); in genfs_read()
2114 if (rc) in genfs_read()
2118 rc = -ENOMEM; in genfs_read()
2123 rc = str_read(&newgenfs->fstype, GFP_KERNEL, fp, len); in genfs_read()
2124 if (rc) in genfs_read()
2129 rc = -EINVAL; in genfs_read()
2146 rc = next_entry(buf, fp, sizeof(u32)); in genfs_read()
2147 if (rc) in genfs_read()
2152 rc = next_entry(buf, fp, sizeof(u32)); in genfs_read()
2153 if (rc) in genfs_read()
2157 rc = -ENOMEM; in genfs_read()
2162 rc = str_read(&newc->u.name, GFP_KERNEL, fp, len); in genfs_read()
2163 if (rc) in genfs_read()
2166 rc = next_entry(buf, fp, sizeof(u32)); in genfs_read()
2167 if (rc) in genfs_read()
2171 rc = context_read_and_validate(&newc->context[0], p, fp); in genfs_read()
2172 if (rc) in genfs_read()
2177 rc = -EINVAL; in genfs_read()
2199 rc = 0; in genfs_read()
2207 return rc; in genfs_read()
2213 int i, j, rc; in ocontext_read() local
2221 rc = next_entry(buf, fp, sizeof(u32)); in ocontext_read()
2222 if (rc) in ocontext_read()
2228 rc = -ENOMEM; in ocontext_read()
2240 rc = next_entry(buf, fp, sizeof(u32)); in ocontext_read()
2241 if (rc) in ocontext_read()
2245 rc = context_read_and_validate(&c->context[0], p, fp); in ocontext_read()
2246 if (rc) in ocontext_read()
2251 rc = next_entry(buf, fp, sizeof(u32)); in ocontext_read()
2252 if (rc) in ocontext_read()
2256 rc = str_read(&c->u.name, GFP_KERNEL, fp, len); in ocontext_read()
2257 if (rc) in ocontext_read()
2260 rc = context_read_and_validate(&c->context[0], p, fp); in ocontext_read()
2261 if (rc) in ocontext_read()
2263 rc = context_read_and_validate(&c->context[1], p, fp); in ocontext_read()
2264 if (rc) in ocontext_read()
2268 rc = next_entry(buf, fp, sizeof(u32)*3); in ocontext_read()
2269 if (rc) in ocontext_read()
2274 rc = context_read_and_validate(&c->context[0], p, fp); in ocontext_read()
2275 if (rc) in ocontext_read()
2279 rc = next_entry(nodebuf, fp, sizeof(u32) * 2); in ocontext_read()
2280 if (rc) in ocontext_read()
2284 rc = context_read_and_validate(&c->context[0], p, fp); in ocontext_read()
2285 if (rc) in ocontext_read()
2289 rc = next_entry(buf, fp, sizeof(u32)*2); in ocontext_read()
2290 if (rc) in ocontext_read()
2293 rc = -EINVAL; in ocontext_read()
2302 rc = str_read(&c->u.name, GFP_KERNEL, fp, len); in ocontext_read()
2303 if (rc) in ocontext_read()
2306 rc = context_read_and_validate(&c->context[0], p, fp); in ocontext_read()
2307 if (rc) in ocontext_read()
2313 rc = next_entry(nodebuf, fp, sizeof(u32) * 8); in ocontext_read()
2314 if (rc) in ocontext_read()
2320 rc = context_read_and_validate(&c->context[0], p, fp); in ocontext_read()
2321 if (rc) in ocontext_read()
2328 rc = next_entry(prefixbuf, fp, sizeof(u64)); in ocontext_read()
2329 if (rc) in ocontext_read()
2335 rc = next_entry(buf, fp, sizeof(u32) * 2); in ocontext_read()
2336 if (rc) in ocontext_read()
2343 rc = -EINVAL; in ocontext_read()
2350 rc = context_read_and_validate(&c->context[0], in ocontext_read()
2353 if (rc) in ocontext_read()
2360 rc = next_entry(buf, fp, sizeof(u32) * 2); in ocontext_read()
2361 if (rc) in ocontext_read()
2365 rc = str_read(&c->u.ibendport.dev_name, GFP_KERNEL, fp, len); in ocontext_read()
2366 if (rc) in ocontext_read()
2371 rc = -EINVAL; in ocontext_read()
2377 rc = context_read_and_validate(&c->context[0], in ocontext_read()
2380 if (rc) in ocontext_read()
2387 rc = 0; in ocontext_read()
2389 return rc; in ocontext_read()
2401 int i, j, rc; in policydb_read() local
2411 rc = next_entry(buf, fp, sizeof(u32) * 2); in policydb_read()
2412 if (rc) in policydb_read()
2415 rc = -EINVAL; in policydb_read()
2423 rc = -EINVAL; in policydb_read()
2432 rc = -ENOMEM; in policydb_read()
2440 rc = next_entry(policydb_str, fp, len); in policydb_read()
2441 if (rc) { in policydb_read()
2447 rc = -EINVAL; in policydb_read()
2460 rc = next_entry(buf, fp, sizeof(u32)*4); in policydb_read()
2461 if (rc) in policydb_read()
2464 rc = -EINVAL; in policydb_read()
2477 rc = -EINVAL; in policydb_read()
2489 rc = ebitmap_read(&p->policycaps, fp); in policydb_read()
2490 if (rc) in policydb_read()
2495 rc = ebitmap_read(&p->permissive_map, fp); in policydb_read()
2496 if (rc) in policydb_read()
2500 rc = -EINVAL; in policydb_read()
2508 rc = -EINVAL; in policydb_read()
2519 rc = next_entry(buf, fp, sizeof(u32)*2); in policydb_read()
2520 if (rc) in policydb_read()
2525 rc = symtab_init(&p->symtab[i], nel); in policydb_read()
2526 if (rc) in policydb_read()
2530 rc = roles_init(p); in policydb_read()
2531 if (rc) in policydb_read()
2536 rc = read_f[i](p, &p->symtab[i], fp); in policydb_read()
2537 if (rc) in policydb_read()
2544 rc = -EINVAL; in policydb_read()
2551 rc = avtab_read(&p->te_avtab, fp, p); in policydb_read()
2552 if (rc) in policydb_read()
2556 rc = cond_read_list(p, fp); in policydb_read()
2557 if (rc) in policydb_read()
2561 rc = next_entry(buf, fp, sizeof(u32)); in policydb_read()
2562 if (rc) in policydb_read()
2566 rc = hashtab_init(&p->role_tr, nel); in policydb_read()
2567 if (rc) in policydb_read()
2570 rc = -ENOMEM; in policydb_read()
2575 rc = -ENOMEM; in policydb_read()
2580 rc = next_entry(buf, fp, sizeof(u32)*3); in policydb_read()
2581 if (rc) in policydb_read()
2588 rc = next_entry(buf, fp, sizeof(u32)); in policydb_read()
2589 if (rc) in policydb_read()
2595 rc = -EINVAL; in policydb_read()
2602 rc = hashtab_insert(&p->role_tr, rtk, rtd, roletr_key_params); in policydb_read()
2603 if (rc) in policydb_read()
2610 rc = next_entry(buf, fp, sizeof(u32)); in policydb_read()
2611 if (rc) in policydb_read()
2616 rc = -ENOMEM; in policydb_read()
2624 rc = next_entry(buf, fp, sizeof(u32)*2); in policydb_read()
2625 if (rc) in policydb_read()
2628 rc = -EINVAL; in policydb_read()
2637 rc = filename_trans_read(p, fp); in policydb_read()
2638 if (rc) in policydb_read()
2641 rc = policydb_index(p); in policydb_read()
2642 if (rc) in policydb_read()
2645 rc = -EINVAL; in policydb_read()
2659 rc = ocontext_read(p, info, fp); in policydb_read()
2660 if (rc) in policydb_read()
2663 rc = genfs_read(p, fp); in policydb_read()
2664 if (rc) in policydb_read()
2667 rc = range_read(p, fp); in policydb_read()
2668 if (rc) in policydb_read()
2671 rc = -ENOMEM; in policydb_read()
2686 rc = ebitmap_read(e, fp); in policydb_read()
2687 if (rc) in policydb_read()
2691 rc = ebitmap_set_bit(e, i, 1); in policydb_read()
2692 if (rc) in policydb_read()
2696 rc = policydb_bounds_sanity_check(p); in policydb_read()
2697 if (rc) in policydb_read()
2700 rc = 0; in policydb_read()
2702 return rc; in policydb_read()
2717 int rc; in mls_write_level() local
2720 rc = put_entry(buf, sizeof(u32), 1, fp); in mls_write_level()
2721 if (rc) in mls_write_level()
2722 return rc; in mls_write_level()
2724 rc = ebitmap_write(&l->cat, fp); in mls_write_level()
2725 if (rc) in mls_write_level()
2726 return rc; in mls_write_level()
2739 int rc, eq; in mls_write_range_helper() local
2754 rc = put_entry(buf, sizeof(u32), items, fp); in mls_write_range_helper()
2755 if (rc) in mls_write_range_helper()
2756 return rc; in mls_write_range_helper()
2758 rc = ebitmap_write(&r->level[0].cat, fp); in mls_write_range_helper()
2759 if (rc) in mls_write_range_helper()
2760 return rc; in mls_write_range_helper()
2762 rc = ebitmap_write(&r->level[1].cat, fp); in mls_write_range_helper()
2763 if (rc) in mls_write_range_helper()
2764 return rc; in mls_write_range_helper()
2778 int rc; in sens_write() local
2783 rc = put_entry(buf, sizeof(u32), 2, fp); in sens_write()
2784 if (rc) in sens_write()
2785 return rc; in sens_write()
2787 rc = put_entry(key, 1, len, fp); in sens_write()
2788 if (rc) in sens_write()
2789 return rc; in sens_write()
2791 rc = mls_write_level(levdatum->level, fp); in sens_write()
2792 if (rc) in sens_write()
2793 return rc; in sens_write()
2806 int rc; in cat_write() local
2812 rc = put_entry(buf, sizeof(u32), 3, fp); in cat_write()
2813 if (rc) in cat_write()
2814 return rc; in cat_write()
2816 rc = put_entry(key, 1, len, fp); in cat_write()
2817 if (rc) in cat_write()
2818 return rc; in cat_write()
2831 int rc; in role_trans_write_one() local
2836 rc = put_entry(buf, sizeof(u32), 3, fp); in role_trans_write_one()
2837 if (rc) in role_trans_write_one()
2838 return rc; in role_trans_write_one()
2841 rc = put_entry(buf, sizeof(u32), 1, fp); in role_trans_write_one()
2842 if (rc) in role_trans_write_one()
2843 return rc; in role_trans_write_one()
2852 int rc; in role_trans_write() local
2855 rc = put_entry(buf, sizeof(u32), 1, fp); in role_trans_write()
2856 if (rc) in role_trans_write()
2857 return rc; in role_trans_write()
2867 int rc; in role_allow_write() local
2873 rc = put_entry(buf, sizeof(u32), 1, fp); in role_allow_write()
2874 if (rc) in role_allow_write()
2875 return rc; in role_allow_write()
2879 rc = put_entry(buf, sizeof(u32), 2, fp); in role_allow_write()
2880 if (rc) in role_allow_write()
2881 return rc; in role_allow_write()
2893 int rc; in context_write() local
2900 rc = put_entry(buf, sizeof(u32), 3, fp); in context_write()
2901 if (rc) in context_write()
2902 return rc; in context_write()
2904 rc = mls_write_range_helper(&c->range, fp); in context_write()
2905 if (rc) in context_write()
2906 return rc; in context_write()
2923 int rc; in perm_write() local
2928 rc = put_entry(buf, sizeof(u32), 2, fp); in perm_write()
2929 if (rc) in perm_write()
2930 return rc; in perm_write()
2932 rc = put_entry(key, 1, len, fp); in perm_write()
2933 if (rc) in perm_write()
2934 return rc; in perm_write()
2947 int rc; in common_write() local
2954 rc = put_entry(buf, sizeof(u32), 4, fp); in common_write()
2955 if (rc) in common_write()
2956 return rc; in common_write()
2958 rc = put_entry(key, 1, len, fp); in common_write()
2959 if (rc) in common_write()
2960 return rc; in common_write()
2962 rc = hashtab_map(&comdatum->permissions.table, perm_write, fp); in common_write()
2963 if (rc) in common_write()
2964 return rc; in common_write()
2971 int rc; in type_set_write() local
2980 rc = put_entry(buf, sizeof(u32), 1, fp); in type_set_write()
2981 if (rc) in type_set_write()
2994 int rc; in write_cons_helper() local
3002 rc = put_entry(buf, sizeof(u32), 2, fp); in write_cons_helper()
3003 if (rc) in write_cons_helper()
3004 return rc; in write_cons_helper()
3009 rc = put_entry(buf, sizeof(u32), 3, fp); in write_cons_helper()
3010 if (rc) in write_cons_helper()
3011 return rc; in write_cons_helper()
3015 rc = ebitmap_write(&e->names, fp); in write_cons_helper()
3016 if (rc) in write_cons_helper()
3017 return rc; in write_cons_helper()
3020 rc = type_set_write(e->type_names, fp); in write_cons_helper()
3021 if (rc) in write_cons_helper()
3022 return rc; in write_cons_helper()
3045 int rc; in class_write() local
3063 rc = put_entry(buf, sizeof(u32), 6, fp); in class_write()
3064 if (rc) in class_write()
3065 return rc; in class_write()
3067 rc = put_entry(key, 1, len, fp); in class_write()
3068 if (rc) in class_write()
3069 return rc; in class_write()
3072 rc = put_entry(cladatum->comkey, 1, len2, fp); in class_write()
3073 if (rc) in class_write()
3074 return rc; in class_write()
3077 rc = hashtab_map(&cladatum->permissions.table, perm_write, fp); in class_write()
3078 if (rc) in class_write()
3079 return rc; in class_write()
3081 rc = write_cons_helper(p, cladatum->constraints, fp); in class_write()
3082 if (rc) in class_write()
3083 return rc; in class_write()
3091 rc = put_entry(buf, sizeof(u32), 1, fp); in class_write()
3092 if (rc) in class_write()
3093 return rc; in class_write()
3095 rc = write_cons_helper(p, cladatum->validatetrans, fp); in class_write()
3096 if (rc) in class_write()
3097 return rc; in class_write()
3104 rc = put_entry(buf, sizeof(uint32_t), 3, fp); in class_write()
3105 if (rc) in class_write()
3106 return rc; in class_write()
3111 rc = put_entry(buf, sizeof(uint32_t), 1, fp); in class_write()
3112 if (rc) in class_write()
3113 return rc; in class_write()
3128 int rc; in role_write() local
3139 rc = put_entry(buf, sizeof(u32), items, fp); in role_write()
3140 if (rc) in role_write()
3141 return rc; in role_write()
3143 rc = put_entry(key, 1, len, fp); in role_write()
3144 if (rc) in role_write()
3145 return rc; in role_write()
3147 rc = ebitmap_write(&role->dominates, fp); in role_write()
3148 if (rc) in role_write()
3149 return rc; in role_write()
3151 rc = ebitmap_write(&role->types, fp); in role_write()
3152 if (rc) in role_write()
3153 return rc; in role_write()
3166 int rc; in type_write() local
3188 rc = put_entry(buf, sizeof(u32), items, fp); in type_write()
3189 if (rc) in type_write()
3190 return rc; in type_write()
3192 rc = put_entry(key, 1, len, fp); in type_write()
3193 if (rc) in type_write()
3194 return rc; in type_write()
3208 int rc; in user_write() local
3217 rc = put_entry(buf, sizeof(u32), items, fp); in user_write()
3218 if (rc) in user_write()
3219 return rc; in user_write()
3221 rc = put_entry(key, 1, len, fp); in user_write()
3222 if (rc) in user_write()
3223 return rc; in user_write()
3225 rc = ebitmap_write(&usrdatum->roles, fp); in user_write()
3226 if (rc) in user_write()
3227 return rc; in user_write()
3229 rc = mls_write_range_helper(&usrdatum->range, fp); in user_write()
3230 if (rc) in user_write()
3231 return rc; in user_write()
3233 rc = mls_write_level(&usrdatum->dfltlevel, fp); in user_write()
3234 if (rc) in user_write()
3235 return rc; in user_write()
3254 unsigned int i, j, rc; in ocontext_write() local
3265 rc = put_entry(buf, sizeof(u32), 1, fp); in ocontext_write()
3266 if (rc) in ocontext_write()
3267 return rc; in ocontext_write()
3272 rc = put_entry(buf, sizeof(u32), 1, fp); in ocontext_write()
3273 if (rc) in ocontext_write()
3274 return rc; in ocontext_write()
3275 rc = context_write(p, &c->context[0], fp); in ocontext_write()
3276 if (rc) in ocontext_write()
3277 return rc; in ocontext_write()
3283 rc = put_entry(buf, sizeof(u32), 1, fp); in ocontext_write()
3284 if (rc) in ocontext_write()
3285 return rc; in ocontext_write()
3286 rc = put_entry(c->u.name, 1, len, fp); in ocontext_write()
3287 if (rc) in ocontext_write()
3288 return rc; in ocontext_write()
3289 rc = context_write(p, &c->context[0], fp); in ocontext_write()
3290 if (rc) in ocontext_write()
3291 return rc; in ocontext_write()
3292 rc = context_write(p, &c->context[1], fp); in ocontext_write()
3293 if (rc) in ocontext_write()
3294 return rc; in ocontext_write()
3300 rc = put_entry(buf, sizeof(u32), 3, fp); in ocontext_write()
3301 if (rc) in ocontext_write()
3302 return rc; in ocontext_write()
3303 rc = context_write(p, &c->context[0], fp); in ocontext_write()
3304 if (rc) in ocontext_write()
3305 return rc; in ocontext_write()
3310 rc = put_entry(nodebuf, sizeof(u32), 2, fp); in ocontext_write()
3311 if (rc) in ocontext_write()
3312 return rc; in ocontext_write()
3313 rc = context_write(p, &c->context[0], fp); in ocontext_write()
3314 if (rc) in ocontext_write()
3315 return rc; in ocontext_write()
3321 rc = put_entry(buf, sizeof(u32), 2, fp); in ocontext_write()
3322 if (rc) in ocontext_write()
3323 return rc; in ocontext_write()
3324 rc = put_entry(c->u.name, 1, len, fp); in ocontext_write()
3325 if (rc) in ocontext_write()
3326 return rc; in ocontext_write()
3327 rc = context_write(p, &c->context[0], fp); in ocontext_write()
3328 if (rc) in ocontext_write()
3329 return rc; in ocontext_write()
3336 rc = put_entry(nodebuf, sizeof(u32), 8, fp); in ocontext_write()
3337 if (rc) in ocontext_write()
3338 return rc; in ocontext_write()
3339 rc = context_write(p, &c->context[0], fp); in ocontext_write()
3340 if (rc) in ocontext_write()
3341 return rc; in ocontext_write()
3347 rc = put_entry(prefixbuf, sizeof(u64), 1, fp); in ocontext_write()
3348 if (rc) in ocontext_write()
3349 return rc; in ocontext_write()
3354 rc = put_entry(buf, sizeof(u32), 2, fp); in ocontext_write()
3355 if (rc) in ocontext_write()
3356 return rc; in ocontext_write()
3357 rc = context_write(p, &c->context[0], fp); in ocontext_write()
3358 if (rc) in ocontext_write()
3359 return rc; in ocontext_write()
3365 rc = put_entry(buf, sizeof(u32), 2, fp); in ocontext_write()
3366 if (rc) in ocontext_write()
3367 return rc; in ocontext_write()
3368 rc = put_entry(c->u.ibendport.dev_name, 1, len, fp); in ocontext_write()
3369 if (rc) in ocontext_write()
3370 return rc; in ocontext_write()
3371 rc = context_write(p, &c->context[0], fp); in ocontext_write()
3372 if (rc) in ocontext_write()
3373 return rc; in ocontext_write()
3387 int rc; in genfs_write() local
3393 rc = put_entry(buf, sizeof(u32), 1, fp); in genfs_write()
3394 if (rc) in genfs_write()
3395 return rc; in genfs_write()
3399 rc = put_entry(buf, sizeof(u32), 1, fp); in genfs_write()
3400 if (rc) in genfs_write()
3401 return rc; in genfs_write()
3402 rc = put_entry(genfs->fstype, 1, len, fp); in genfs_write()
3403 if (rc) in genfs_write()
3404 return rc; in genfs_write()
3409 rc = put_entry(buf, sizeof(u32), 1, fp); in genfs_write()
3410 if (rc) in genfs_write()
3411 return rc; in genfs_write()
3415 rc = put_entry(buf, sizeof(u32), 1, fp); in genfs_write()
3416 if (rc) in genfs_write()
3417 return rc; in genfs_write()
3418 rc = put_entry(c->u.name, 1, len, fp); in genfs_write()
3419 if (rc) in genfs_write()
3420 return rc; in genfs_write()
3422 rc = put_entry(buf, sizeof(u32), 1, fp); in genfs_write()
3423 if (rc) in genfs_write()
3424 return rc; in genfs_write()
3425 rc = context_write(p, &c->context[0], fp); in genfs_write()
3426 if (rc) in genfs_write()
3427 return rc; in genfs_write()
3441 int rc; in range_write_helper() local
3445 rc = put_entry(buf, sizeof(u32), 2, fp); in range_write_helper()
3446 if (rc) in range_write_helper()
3447 return rc; in range_write_helper()
3450 rc = put_entry(buf, sizeof(u32), 1, fp); in range_write_helper()
3451 if (rc) in range_write_helper()
3452 return rc; in range_write_helper()
3454 rc = mls_write_range_helper(r, fp); in range_write_helper()
3455 if (rc) in range_write_helper()
3456 return rc; in range_write_helper()
3464 int rc; in range_write() local
3471 rc = put_entry(buf, sizeof(u32), 1, fp); in range_write()
3472 if (rc) in range_write()
3473 return rc; in range_write()
3476 rc = hashtab_map(&p->range_tr, range_write_helper, &pd); in range_write()
3477 if (rc) in range_write()
3478 return rc; in range_write()
3490 int rc; in filename_write_helper_compat() local
3496 rc = put_entry(buf, sizeof(u32), 1, fp); in filename_write_helper_compat()
3497 if (rc) in filename_write_helper_compat()
3498 return rc; in filename_write_helper_compat()
3500 rc = put_entry(ft->name, sizeof(char), len, fp); in filename_write_helper_compat()
3501 if (rc) in filename_write_helper_compat()
3502 return rc; in filename_write_helper_compat()
3509 rc = put_entry(buf, sizeof(u32), 4, fp); in filename_write_helper_compat()
3510 if (rc) in filename_write_helper_compat()
3511 return rc; in filename_write_helper_compat()
3526 int rc; in filename_write_helper() local
3530 rc = put_entry(buf, sizeof(u32), 1, fp); in filename_write_helper()
3531 if (rc) in filename_write_helper()
3532 return rc; in filename_write_helper()
3534 rc = put_entry(ft->name, sizeof(char), len, fp); in filename_write_helper()
3535 if (rc) in filename_write_helper()
3536 return rc; in filename_write_helper()
3548 rc = put_entry(buf, sizeof(u32), 3, fp); in filename_write_helper()
3549 if (rc) in filename_write_helper()
3550 return rc; in filename_write_helper()
3554 rc = ebitmap_write(&datum->stypes, fp); in filename_write_helper()
3555 if (rc) in filename_write_helper()
3556 return rc; in filename_write_helper()
3559 rc = put_entry(buf, sizeof(u32), 1, fp); in filename_write_helper()
3560 if (rc) in filename_write_helper()
3561 return rc; in filename_write_helper()
3572 int rc; in filename_trans_write() local
3579 rc = put_entry(buf, sizeof(u32), 1, fp); in filename_trans_write()
3580 if (rc) in filename_trans_write()
3581 return rc; in filename_trans_write()
3583 rc = hashtab_map(&p->filename_trans, in filename_trans_write()
3587 rc = put_entry(buf, sizeof(u32), 1, fp); in filename_trans_write()
3588 if (rc) in filename_trans_write()
3589 return rc; in filename_trans_write()
3591 rc = hashtab_map(&p->filename_trans, filename_write_helper, fp); in filename_trans_write()
3593 return rc; in filename_trans_write()
3604 int rc; in policydb_write() local
3636 rc = put_entry(buf, sizeof(u32), 2, fp); in policydb_write()
3637 if (rc) in policydb_write()
3638 return rc; in policydb_write()
3639 rc = put_entry(POLICYDB_STRING, 1, len, fp); in policydb_write()
3640 if (rc) in policydb_write()
3641 return rc; in policydb_write()
3656 rc = put_entry(buf, sizeof(u32), 4, fp); in policydb_write()
3657 if (rc) in policydb_write()
3658 return rc; in policydb_write()
3661 rc = ebitmap_write(&p->policycaps, fp); in policydb_write()
3662 if (rc) in policydb_write()
3663 return rc; in policydb_write()
3667 rc = ebitmap_write(&p->permissive_map, fp); in policydb_write()
3668 if (rc) in policydb_write()
3669 return rc; in policydb_write()
3682 rc = put_entry(buf, sizeof(u32), 2, fp); in policydb_write()
3683 if (rc) in policydb_write()
3684 return rc; in policydb_write()
3685 rc = hashtab_map(&p->symtab[i].table, write_f[i], &pd); in policydb_write()
3686 if (rc) in policydb_write()
3687 return rc; in policydb_write()
3690 rc = avtab_write(p, &p->te_avtab, fp); in policydb_write()
3691 if (rc) in policydb_write()
3692 return rc; in policydb_write()
3694 rc = cond_write_list(p, fp); in policydb_write()
3695 if (rc) in policydb_write()
3696 return rc; in policydb_write()
3698 rc = role_trans_write(p, fp); in policydb_write()
3699 if (rc) in policydb_write()
3700 return rc; in policydb_write()
3702 rc = role_allow_write(p->role_allow, fp); in policydb_write()
3703 if (rc) in policydb_write()
3704 return rc; in policydb_write()
3706 rc = filename_trans_write(p, fp); in policydb_write()
3707 if (rc) in policydb_write()
3708 return rc; in policydb_write()
3710 rc = ocontext_write(p, info, fp); in policydb_write()
3711 if (rc) in policydb_write()
3712 return rc; in policydb_write()
3714 rc = genfs_write(p, fp); in policydb_write()
3715 if (rc) in policydb_write()
3716 return rc; in policydb_write()
3718 rc = range_write(p, fp); in policydb_write()
3719 if (rc) in policydb_write()
3720 return rc; in policydb_write()
3725 rc = ebitmap_write(e, fp); in policydb_write()
3726 if (rc) in policydb_write()
3727 return rc; in policydb_write()