Lines Matching full:rc
382 int rc; in roles_init() local
389 rc = -EINVAL; in roles_init()
394 rc = -ENOMEM; in roles_init()
399 rc = symtab_insert(&p->p_roles, key, role); in roles_init()
400 if (rc) in roles_init()
407 return rc; in roles_init()
714 int i, rc; in policydb_index() local
753 rc = cond_init_bool_indexes(p); in policydb_index()
754 if (rc) in policydb_index()
763 rc = hashtab_map(&p->symtab[i].table, index_f[i], p); in policydb_index()
764 if (rc) in policydb_index()
767 rc = 0; in policydb_index()
769 return rc; in policydb_index()
862 int rc; in policydb_load_isids() local
864 rc = sidtab_init(s); in policydb_load_isids()
865 if (rc) { in policydb_load_isids()
867 return rc; in policydb_load_isids()
895 rc = sidtab_set_initial(s, sid, &c->context[0]); in policydb_load_isids()
896 if (rc) { in policydb_load_isids()
900 return rc; in policydb_load_isids()
912 rc = sidtab_set_initial(s, SECINITSID_INIT, in policydb_load_isids()
914 if (rc) { in policydb_load_isids()
918 return rc; in policydb_load_isids()
999 int rc; in mls_read_range_helper() local
1001 rc = next_entry(buf, fp, sizeof(u32)); in mls_read_range_helper()
1002 if (rc) in mls_read_range_helper()
1005 rc = -EINVAL; in mls_read_range_helper()
1012 rc = next_entry(buf, fp, sizeof(u32) * items); in mls_read_range_helper()
1013 if (rc) { in mls_read_range_helper()
1024 rc = ebitmap_read(&r->level[0].cat, fp); in mls_read_range_helper()
1025 if (rc) { in mls_read_range_helper()
1030 rc = ebitmap_read(&r->level[1].cat, fp); in mls_read_range_helper()
1031 if (rc) { in mls_read_range_helper()
1036 rc = ebitmap_cpy(&r->level[1].cat, &r->level[0].cat); in mls_read_range_helper()
1037 if (rc) { in mls_read_range_helper()
1047 return rc; in mls_read_range_helper()
1058 int rc; in context_read_and_validate() local
1060 rc = next_entry(buf, fp, sizeof buf); in context_read_and_validate()
1061 if (rc) { in context_read_and_validate()
1069 rc = mls_read_range_helper(&c->range, fp); in context_read_and_validate()
1070 if (rc) { in context_read_and_validate()
1076 rc = -EINVAL; in context_read_and_validate()
1082 rc = 0; in context_read_and_validate()
1084 return rc; in context_read_and_validate()
1095 int rc; in str_read() local
1105 rc = next_entry(str, fp, len); in str_read()
1106 if (rc) { in str_read()
1108 return rc; in str_read()
1120 int rc; in perm_read() local
1128 rc = next_entry(buf, fp, sizeof buf); in perm_read()
1129 if (rc) in perm_read()
1135 rc = str_read(&key, GFP_KERNEL, fp, len); in perm_read()
1136 if (rc) in perm_read()
1139 rc = symtab_insert(s, key, perdatum); in perm_read()
1140 if (rc) in perm_read()
1146 return rc; in perm_read()
1155 int rc; in common_read() local
1161 rc = next_entry(buf, fp, sizeof buf); in common_read()
1162 if (rc) in common_read()
1169 rc = symtab_init(&comdatum->permissions, nel); in common_read()
1170 if (rc) in common_read()
1174 rc = str_read(&key, GFP_KERNEL, fp, len); in common_read()
1175 if (rc) in common_read()
1179 rc = perm_read(p, &comdatum->permissions, fp); in common_read()
1180 if (rc) in common_read()
1186 rc = symtab_insert(s, key, comdatum); in common_read()
1187 if (rc) in common_read()
1192 return rc; in common_read()
1204 int rc; in type_set_read() local
1211 rc = next_entry(buf, fp, sizeof(u32)); in type_set_read()
1212 if (rc < 0) in type_set_read()
1226 int rc, depth; in read_cons_helper() local
1239 rc = next_entry(buf, fp, (sizeof(u32) * 2)); in read_cons_helper()
1240 if (rc) in read_cons_helper()
1241 return rc; in read_cons_helper()
1256 rc = next_entry(buf, fp, (sizeof(u32) * 3)); in read_cons_helper()
1257 if (rc) in read_cons_helper()
1258 return rc; in read_cons_helper()
1285 rc = ebitmap_read(&e->names, fp); in read_cons_helper()
1286 if (rc) in read_cons_helper()
1287 return rc; in read_cons_helper()
1296 rc = type_set_read(e->type_names, fp); in read_cons_helper()
1297 if (rc) in read_cons_helper()
1298 return rc; in read_cons_helper()
1320 int rc; in class_read() local
1326 rc = next_entry(buf, fp, sizeof(u32) * 6); in class_read()
1327 if (rc) in class_read()
1335 rc = symtab_init(&cladatum->permissions, nel); in class_read()
1336 if (rc) in class_read()
1342 rc = str_read(&key, GFP_KERNEL, fp, len); in class_read()
1343 if (rc) in class_read()
1347 rc = str_read(&cladatum->comkey, GFP_KERNEL, fp, len2); in class_read()
1348 if (rc) in class_read()
1351 rc = -EINVAL; in class_read()
1361 rc = perm_read(p, &cladatum->permissions, fp); in class_read()
1362 if (rc) in class_read()
1368 rc = read_cons_helper(p, &cladatum->constraints, ncons, 0, fp); in class_read()
1369 if (rc) in class_read()
1374 rc = next_entry(buf, fp, sizeof(u32)); in class_read()
1375 if (rc) in class_read()
1378 rc = read_cons_helper(p, &cladatum->validatetrans, ncons, 1, in class_read()
1380 if (rc) in class_read()
1385 rc = next_entry(buf, fp, sizeof(u32) * 3); in class_read()
1386 if (rc) in class_read()
1395 rc = next_entry(buf, fp, sizeof(u32) * 1); in class_read()
1396 if (rc) in class_read()
1401 rc = symtab_insert(s, key, cladatum); in class_read()
1402 if (rc) in class_read()
1408 return rc; in class_read()
1415 int rc; in role_read() local
1427 rc = next_entry(buf, fp, sizeof(buf[0]) * to_read); in role_read()
1428 if (rc) in role_read()
1436 rc = str_read(&key, GFP_KERNEL, fp, len); in role_read()
1437 if (rc) in role_read()
1440 rc = ebitmap_read(&role->dominates, fp); in role_read()
1441 if (rc) in role_read()
1444 rc = ebitmap_read(&role->types, fp); in role_read()
1445 if (rc) in role_read()
1449 rc = -EINVAL; in role_read()
1455 rc = 0; in role_read()
1459 rc = symtab_insert(s, key, role); in role_read()
1460 if (rc) in role_read()
1465 return rc; in role_read()
1472 int rc; in type_read() local
1484 rc = next_entry(buf, fp, sizeof(buf[0]) * to_read); in type_read()
1485 if (rc) in type_read()
1503 rc = str_read(&key, GFP_KERNEL, fp, len); in type_read()
1504 if (rc) in type_read()
1507 rc = symtab_insert(s, key, typdatum); in type_read()
1508 if (rc) in type_read()
1513 return rc; in type_read()
1523 int rc; in mls_read_level() local
1527 rc = next_entry(buf, fp, sizeof buf); in mls_read_level()
1528 if (rc) { in mls_read_level()
1530 return rc; in mls_read_level()
1534 rc = ebitmap_read(&lp->cat, fp); in mls_read_level()
1535 if (rc) { in mls_read_level()
1537 return rc; in mls_read_level()
1546 int rc; in user_read() local
1558 rc = next_entry(buf, fp, sizeof(buf[0]) * to_read); in user_read()
1559 if (rc) in user_read()
1567 rc = str_read(&key, GFP_KERNEL, fp, len); in user_read()
1568 if (rc) in user_read()
1571 rc = ebitmap_read(&usrdatum->roles, fp); in user_read()
1572 if (rc) in user_read()
1576 rc = mls_read_range_helper(&usrdatum->range, fp); in user_read()
1577 if (rc) in user_read()
1579 rc = mls_read_level(&usrdatum->dfltlevel, fp); in user_read()
1580 if (rc) in user_read()
1584 rc = symtab_insert(s, key, usrdatum); in user_read()
1585 if (rc) in user_read()
1590 return rc; in user_read()
1597 int rc; in sens_read() local
1605 rc = next_entry(buf, fp, sizeof buf); in sens_read()
1606 if (rc) in sens_read()
1612 rc = str_read(&key, GFP_KERNEL, fp, len); in sens_read()
1613 if (rc) in sens_read()
1616 rc = -ENOMEM; in sens_read()
1621 rc = mls_read_level(levdatum->level, fp); in sens_read()
1622 if (rc) in sens_read()
1625 rc = symtab_insert(s, key, levdatum); in sens_read()
1626 if (rc) in sens_read()
1631 return rc; in sens_read()
1638 int rc; in cat_read() local
1646 rc = next_entry(buf, fp, sizeof buf); in cat_read()
1647 if (rc) in cat_read()
1654 rc = str_read(&key, GFP_KERNEL, fp, len); in cat_read()
1655 if (rc) in cat_read()
1658 rc = symtab_insert(s, key, catdatum); in cat_read()
1659 if (rc) in cat_read()
1664 return rc; in cat_read()
1787 int rc; in policydb_bounds_sanity_check() local
1792 rc = hashtab_map(&p->p_users.table, user_bounds_sanity_check, p); in policydb_bounds_sanity_check()
1793 if (rc) in policydb_bounds_sanity_check()
1794 return rc; in policydb_bounds_sanity_check()
1796 rc = hashtab_map(&p->p_roles.table, role_bounds_sanity_check, p); in policydb_bounds_sanity_check()
1797 if (rc) in policydb_bounds_sanity_check()
1798 return rc; in policydb_bounds_sanity_check()
1800 rc = hashtab_map(&p->p_types.table, type_bounds_sanity_check, p); in policydb_bounds_sanity_check()
1801 if (rc) in policydb_bounds_sanity_check()
1802 return rc; in policydb_bounds_sanity_check()
1843 int rc; in range_read() local
1850 rc = next_entry(buf, fp, sizeof(u32)); in range_read()
1851 if (rc) in range_read()
1852 return rc; in range_read()
1856 rc = hashtab_init(&p->range_tr, nel); in range_read()
1857 if (rc) in range_read()
1858 return rc; in range_read()
1861 rc = -ENOMEM; in range_read()
1866 rc = next_entry(buf, fp, (sizeof(u32) * 2)); in range_read()
1867 if (rc) in range_read()
1873 rc = next_entry(buf, fp, sizeof(u32)); in range_read()
1874 if (rc) in range_read()
1880 rc = -EINVAL; in range_read()
1886 rc = -ENOMEM; in range_read()
1891 rc = mls_read_range_helper(r, fp); in range_read()
1892 if (rc) in range_read()
1895 rc = -EINVAL; in range_read()
1901 rc = hashtab_insert(&p->range_tr, rt, r, rangetr_key_params); in range_read()
1902 if (rc) in range_read()
1909 rc = 0; in range_read()
1913 return rc; in range_read()
1923 int rc; in filename_trans_read_helper_compat() local
1926 rc = next_entry(buf, fp, sizeof(u32)); in filename_trans_read_helper_compat()
1927 if (rc) in filename_trans_read_helper_compat()
1928 return rc; in filename_trans_read_helper_compat()
1932 rc = str_read(&name, GFP_KERNEL, fp, len); in filename_trans_read_helper_compat()
1933 if (rc) in filename_trans_read_helper_compat()
1934 return rc; in filename_trans_read_helper_compat()
1936 rc = next_entry(buf, fp, sizeof(u32) * 4); in filename_trans_read_helper_compat()
1937 if (rc) in filename_trans_read_helper_compat()
1953 rc = 0; in filename_trans_read_helper_compat()
1962 rc = -ENOMEM; in filename_trans_read_helper_compat()
1974 rc = -ENOMEM; in filename_trans_read_helper_compat()
1979 rc = hashtab_insert(&p->filename_trans, ft, datum, in filename_trans_read_helper_compat()
1981 if (rc) in filename_trans_read_helper_compat()
1985 rc = ebitmap_set_bit(&p->filename_trans_ttypes, in filename_trans_read_helper_compat()
1987 if (rc) in filename_trans_read_helper_compat()
1988 return rc; in filename_trans_read_helper_compat()
1998 return rc; in filename_trans_read_helper_compat()
2008 int rc; in filename_trans_read_helper() local
2011 rc = next_entry(buf, fp, sizeof(u32)); in filename_trans_read_helper()
2012 if (rc) in filename_trans_read_helper()
2013 return rc; in filename_trans_read_helper()
2017 rc = str_read(&name, GFP_KERNEL, fp, len); in filename_trans_read_helper()
2018 if (rc) in filename_trans_read_helper()
2019 return rc; in filename_trans_read_helper()
2021 rc = next_entry(buf, fp, sizeof(u32) * 3); in filename_trans_read_helper()
2022 if (rc) in filename_trans_read_helper()
2031 rc = -ENOENT; in filename_trans_read_helper()
2037 rc = -ENOMEM; in filename_trans_read_helper()
2046 rc = ebitmap_read(&datum->stypes, fp); in filename_trans_read_helper()
2047 if (rc) in filename_trans_read_helper()
2050 rc = next_entry(buf, fp, sizeof(u32)); in filename_trans_read_helper()
2051 if (rc) in filename_trans_read_helper()
2059 rc = -ENOMEM; in filename_trans_read_helper()
2068 rc = hashtab_insert(&p->filename_trans, ft, first, in filename_trans_read_helper()
2070 if (rc == -EEXIST) in filename_trans_read_helper()
2072 if (rc) in filename_trans_read_helper()
2087 return rc; in filename_trans_read_helper()
2094 int rc; in filename_trans_read() local
2099 rc = next_entry(buf, fp, sizeof(u32)); in filename_trans_read()
2100 if (rc) in filename_trans_read()
2101 return rc; in filename_trans_read()
2107 rc = hashtab_init(&p->filename_trans, (1 << 11)); in filename_trans_read()
2108 if (rc) in filename_trans_read()
2109 return rc; in filename_trans_read()
2112 rc = filename_trans_read_helper_compat(p, fp); in filename_trans_read()
2113 if (rc) in filename_trans_read()
2114 return rc; in filename_trans_read()
2117 rc = hashtab_init(&p->filename_trans, nel); in filename_trans_read()
2118 if (rc) in filename_trans_read()
2119 return rc; in filename_trans_read()
2122 rc = filename_trans_read_helper(p, fp); in filename_trans_read()
2123 if (rc) in filename_trans_read()
2124 return rc; in filename_trans_read()
2133 int rc; in genfs_read() local
2141 rc = next_entry(buf, fp, sizeof(u32)); in genfs_read()
2142 if (rc) in genfs_read()
2143 return rc; in genfs_read()
2147 rc = next_entry(buf, fp, sizeof(u32)); in genfs_read()
2148 if (rc) in genfs_read()
2152 rc = -ENOMEM; in genfs_read()
2157 rc = str_read(&newgenfs->fstype, GFP_KERNEL, fp, len); in genfs_read()
2158 if (rc) in genfs_read()
2163 rc = -EINVAL; in genfs_read()
2180 rc = next_entry(buf, fp, sizeof(u32)); in genfs_read()
2181 if (rc) in genfs_read()
2186 rc = next_entry(buf, fp, sizeof(u32)); in genfs_read()
2187 if (rc) in genfs_read()
2191 rc = -ENOMEM; in genfs_read()
2196 rc = str_read(&newc->u.name, GFP_KERNEL, fp, len); in genfs_read()
2197 if (rc) in genfs_read()
2200 rc = next_entry(buf, fp, sizeof(u32)); in genfs_read()
2201 if (rc) in genfs_read()
2205 rc = context_read_and_validate(&newc->context[0], p, in genfs_read()
2207 if (rc) in genfs_read()
2211 rc = -EINVAL; in genfs_read()
2233 rc = 0; in genfs_read()
2241 return rc; in genfs_read()
2247 int rc; in ocontext_read() local
2256 rc = next_entry(buf, fp, sizeof(u32)); in ocontext_read()
2257 if (rc) in ocontext_read()
2263 rc = -ENOMEM; in ocontext_read()
2275 rc = next_entry(buf, fp, sizeof(u32)); in ocontext_read()
2276 if (rc) in ocontext_read()
2280 rc = context_read_and_validate(&c->context[0], in ocontext_read()
2282 if (rc) in ocontext_read()
2287 rc = next_entry(buf, fp, sizeof(u32)); in ocontext_read()
2288 if (rc) in ocontext_read()
2292 rc = str_read(&c->u.name, GFP_KERNEL, fp, len); in ocontext_read()
2293 if (rc) in ocontext_read()
2300 rc = context_read_and_validate(&c->context[0], in ocontext_read()
2302 if (rc) in ocontext_read()
2304 rc = context_read_and_validate(&c->context[1], in ocontext_read()
2306 if (rc) in ocontext_read()
2310 rc = next_entry(buf, fp, sizeof(u32) * 3); in ocontext_read()
2311 if (rc) in ocontext_read()
2316 rc = context_read_and_validate(&c->context[0], in ocontext_read()
2318 if (rc) in ocontext_read()
2322 rc = next_entry(nodebuf, fp, sizeof(u32) * 2); in ocontext_read()
2323 if (rc) in ocontext_read()
2327 rc = context_read_and_validate(&c->context[0], in ocontext_read()
2329 if (rc) in ocontext_read()
2333 rc = next_entry(buf, fp, sizeof(u32) * 2); in ocontext_read()
2334 if (rc) in ocontext_read()
2337 rc = -EINVAL; in ocontext_read()
2346 rc = str_read(&c->u.name, GFP_KERNEL, fp, len); in ocontext_read()
2347 if (rc) in ocontext_read()
2350 rc = context_read_and_validate(&c->context[0], in ocontext_read()
2352 if (rc) in ocontext_read()
2358 rc = next_entry(nodebuf, fp, sizeof(u32) * 8); in ocontext_read()
2359 if (rc) in ocontext_read()
2365 rc = context_read_and_validate(&c->context[0], in ocontext_read()
2367 if (rc) in ocontext_read()
2374 rc = next_entry(prefixbuf, fp, sizeof(u64)); in ocontext_read()
2375 if (rc) in ocontext_read()
2382 rc = next_entry(buf, fp, sizeof(u32) * 2); in ocontext_read()
2383 if (rc) in ocontext_read()
2390 rc = -EINVAL; in ocontext_read()
2397 rc = context_read_and_validate(&c->context[0], in ocontext_read()
2399 if (rc) in ocontext_read()
2406 rc = next_entry(buf, fp, sizeof(u32) * 2); in ocontext_read()
2407 if (rc) in ocontext_read()
2411 rc = str_read(&c->u.ibendport.dev_name, in ocontext_read()
2413 if (rc) in ocontext_read()
2418 rc = -EINVAL; in ocontext_read()
2424 rc = context_read_and_validate(&c->context[0], in ocontext_read()
2426 if (rc) in ocontext_read()
2433 rc = 0; in ocontext_read()
2435 return rc; in ocontext_read()
2447 int rc; in policydb_read() local
2457 rc = next_entry(buf, fp, sizeof(u32) * 2); in policydb_read()
2458 if (rc) in policydb_read()
2461 rc = -EINVAL; in policydb_read()
2469 rc = -EINVAL; in policydb_read()
2478 rc = -ENOMEM; in policydb_read()
2487 rc = next_entry(policydb_str, fp, len); in policydb_read()
2488 if (rc) { in policydb_read()
2494 rc = -EINVAL; in policydb_read()
2508 rc = next_entry(buf, fp, sizeof(u32) * 4); in policydb_read()
2509 if (rc) in policydb_read()
2512 rc = -EINVAL; in policydb_read()
2526 rc = -EINVAL; in policydb_read()
2538 rc = ebitmap_read(&p->policycaps, fp); in policydb_read()
2539 if (rc) in policydb_read()
2544 rc = ebitmap_read(&p->permissive_map, fp); in policydb_read()
2545 if (rc) in policydb_read()
2549 rc = -EINVAL; in policydb_read()
2558 rc = -EINVAL; in policydb_read()
2569 rc = next_entry(buf, fp, sizeof(u32) * 2); in policydb_read()
2570 if (rc) in policydb_read()
2575 rc = symtab_init(&p->symtab[i], nel); in policydb_read()
2576 if (rc) in policydb_read()
2580 rc = roles_init(p); in policydb_read()
2581 if (rc) in policydb_read()
2586 rc = read_f[i](p, &p->symtab[i], fp); in policydb_read()
2587 if (rc) in policydb_read()
2594 rc = -EINVAL; in policydb_read()
2601 rc = avtab_read(&p->te_avtab, fp, p); in policydb_read()
2602 if (rc) in policydb_read()
2606 rc = cond_read_list(p, fp); in policydb_read()
2607 if (rc) in policydb_read()
2611 rc = next_entry(buf, fp, sizeof(u32)); in policydb_read()
2612 if (rc) in policydb_read()
2616 rc = hashtab_init(&p->role_tr, nel); in policydb_read()
2617 if (rc) in policydb_read()
2620 rc = -ENOMEM; in policydb_read()
2625 rc = -ENOMEM; in policydb_read()
2630 rc = next_entry(buf, fp, sizeof(u32) * 3); in policydb_read()
2631 if (rc) in policydb_read()
2638 rc = next_entry(buf, fp, sizeof(u32)); in policydb_read()
2639 if (rc) in policydb_read()
2645 rc = -EINVAL; in policydb_read()
2652 rc = hashtab_insert(&p->role_tr, rtk, rtd, roletr_key_params); in policydb_read()
2653 if (rc) in policydb_read()
2662 rc = next_entry(buf, fp, sizeof(u32)); in policydb_read()
2663 if (rc) in policydb_read()
2668 rc = -ENOMEM; in policydb_read()
2676 rc = next_entry(buf, fp, sizeof(u32) * 2); in policydb_read()
2677 if (rc) in policydb_read()
2680 rc = -EINVAL; in policydb_read()
2689 rc = filename_trans_read(p, fp); in policydb_read()
2690 if (rc) in policydb_read()
2693 rc = policydb_index(p); in policydb_read()
2694 if (rc) in policydb_read()
2697 rc = -EINVAL; in policydb_read()
2711 rc = ocontext_read(p, info, fp); in policydb_read()
2712 if (rc) in policydb_read()
2715 rc = genfs_read(p, fp); in policydb_read()
2716 if (rc) in policydb_read()
2719 rc = range_read(p, fp); in policydb_read()
2720 if (rc) in policydb_read()
2723 rc = -ENOMEM; in policydb_read()
2737 rc = ebitmap_read(e, fp); in policydb_read()
2738 if (rc) in policydb_read()
2742 rc = ebitmap_set_bit(e, i, 1); in policydb_read()
2743 if (rc) in policydb_read()
2747 rc = policydb_bounds_sanity_check(p); in policydb_read()
2748 if (rc) in policydb_read()
2751 rc = 0; in policydb_read()
2753 return rc; in policydb_read()
2768 int rc; in mls_write_level() local
2771 rc = put_entry(buf, sizeof(u32), 1, fp); in mls_write_level()
2772 if (rc) in mls_write_level()
2773 return rc; in mls_write_level()
2775 rc = ebitmap_write(&l->cat, fp); in mls_write_level()
2776 if (rc) in mls_write_level()
2777 return rc; in mls_write_level()
2790 int rc, eq; in mls_write_range_helper() local
2805 rc = put_entry(buf, sizeof(u32), items, fp); in mls_write_range_helper()
2806 if (rc) in mls_write_range_helper()
2807 return rc; in mls_write_range_helper()
2809 rc = ebitmap_write(&r->level[0].cat, fp); in mls_write_range_helper()
2810 if (rc) in mls_write_range_helper()
2811 return rc; in mls_write_range_helper()
2813 rc = ebitmap_write(&r->level[1].cat, fp); in mls_write_range_helper()
2814 if (rc) in mls_write_range_helper()
2815 return rc; in mls_write_range_helper()
2829 int rc; in sens_write() local
2834 rc = put_entry(buf, sizeof(u32), 2, fp); in sens_write()
2835 if (rc) in sens_write()
2836 return rc; in sens_write()
2838 rc = put_entry(key, 1, len, fp); in sens_write()
2839 if (rc) in sens_write()
2840 return rc; in sens_write()
2842 rc = mls_write_level(levdatum->level, fp); in sens_write()
2843 if (rc) in sens_write()
2844 return rc; in sens_write()
2857 int rc; in cat_write() local
2863 rc = put_entry(buf, sizeof(u32), 3, fp); in cat_write()
2864 if (rc) in cat_write()
2865 return rc; in cat_write()
2867 rc = put_entry(key, 1, len, fp); in cat_write()
2868 if (rc) in cat_write()
2869 return rc; in cat_write()
2882 int rc; in role_trans_write_one() local
2887 rc = put_entry(buf, sizeof(u32), 3, fp); in role_trans_write_one()
2888 if (rc) in role_trans_write_one()
2889 return rc; in role_trans_write_one()
2892 rc = put_entry(buf, sizeof(u32), 1, fp); in role_trans_write_one()
2893 if (rc) in role_trans_write_one()
2894 return rc; in role_trans_write_one()
2903 int rc; in role_trans_write() local
2906 rc = put_entry(buf, sizeof(u32), 1, fp); in role_trans_write()
2907 if (rc) in role_trans_write()
2908 return rc; in role_trans_write()
2918 int rc; in role_allow_write() local
2924 rc = put_entry(buf, sizeof(u32), 1, fp); in role_allow_write()
2925 if (rc) in role_allow_write()
2926 return rc; in role_allow_write()
2930 rc = put_entry(buf, sizeof(u32), 2, fp); in role_allow_write()
2931 if (rc) in role_allow_write()
2932 return rc; in role_allow_write()
2943 int rc; in context_write() local
2950 rc = put_entry(buf, sizeof(u32), 3, fp); in context_write()
2951 if (rc) in context_write()
2952 return rc; in context_write()
2954 rc = mls_write_range_helper(&c->range, fp); in context_write()
2955 if (rc) in context_write()
2956 return rc; in context_write()
2973 int rc; in perm_write() local
2978 rc = put_entry(buf, sizeof(u32), 2, fp); in perm_write()
2979 if (rc) in perm_write()
2980 return rc; in perm_write()
2982 rc = put_entry(key, 1, len, fp); in perm_write()
2983 if (rc) in perm_write()
2984 return rc; in perm_write()
2997 int rc; in common_write() local
3004 rc = put_entry(buf, sizeof(u32), 4, fp); in common_write()
3005 if (rc) in common_write()
3006 return rc; in common_write()
3008 rc = put_entry(key, 1, len, fp); in common_write()
3009 if (rc) in common_write()
3010 return rc; in common_write()
3012 rc = hashtab_map(&comdatum->permissions.table, perm_write, fp); in common_write()
3013 if (rc) in common_write()
3014 return rc; in common_write()
3021 int rc; in type_set_write() local
3030 rc = put_entry(buf, sizeof(u32), 1, fp); in type_set_write()
3031 if (rc) in type_set_write()
3044 int rc; in write_cons_helper() local
3052 rc = put_entry(buf, sizeof(u32), 2, fp); in write_cons_helper()
3053 if (rc) in write_cons_helper()
3054 return rc; in write_cons_helper()
3059 rc = put_entry(buf, sizeof(u32), 3, fp); in write_cons_helper()
3060 if (rc) in write_cons_helper()
3061 return rc; in write_cons_helper()
3065 rc = ebitmap_write(&e->names, fp); in write_cons_helper()
3066 if (rc) in write_cons_helper()
3067 return rc; in write_cons_helper()
3070 rc = type_set_write(e->type_names, fp); in write_cons_helper()
3071 if (rc) in write_cons_helper()
3072 return rc; in write_cons_helper()
3095 int rc; in class_write() local
3113 rc = put_entry(buf, sizeof(u32), 6, fp); in class_write()
3114 if (rc) in class_write()
3115 return rc; in class_write()
3117 rc = put_entry(key, 1, len, fp); in class_write()
3118 if (rc) in class_write()
3119 return rc; in class_write()
3122 rc = put_entry(cladatum->comkey, 1, len2, fp); in class_write()
3123 if (rc) in class_write()
3124 return rc; in class_write()
3127 rc = hashtab_map(&cladatum->permissions.table, perm_write, fp); in class_write()
3128 if (rc) in class_write()
3129 return rc; in class_write()
3131 rc = write_cons_helper(p, cladatum->constraints, fp); in class_write()
3132 if (rc) in class_write()
3133 return rc; in class_write()
3141 rc = put_entry(buf, sizeof(u32), 1, fp); in class_write()
3142 if (rc) in class_write()
3143 return rc; in class_write()
3145 rc = write_cons_helper(p, cladatum->validatetrans, fp); in class_write()
3146 if (rc) in class_write()
3147 return rc; in class_write()
3154 rc = put_entry(buf, sizeof(uint32_t), 3, fp); in class_write()
3155 if (rc) in class_write()
3156 return rc; in class_write()
3161 rc = put_entry(buf, sizeof(uint32_t), 1, fp); in class_write()
3162 if (rc) in class_write()
3163 return rc; in class_write()
3178 int rc; in role_write() local
3189 rc = put_entry(buf, sizeof(u32), items, fp); in role_write()
3190 if (rc) in role_write()
3191 return rc; in role_write()
3193 rc = put_entry(key, 1, len, fp); in role_write()
3194 if (rc) in role_write()
3195 return rc; in role_write()
3197 rc = ebitmap_write(&role->dominates, fp); in role_write()
3198 if (rc) in role_write()
3199 return rc; in role_write()
3201 rc = ebitmap_write(&role->types, fp); in role_write()
3202 if (rc) in role_write()
3203 return rc; in role_write()
3216 int rc; in type_write() local
3238 rc = put_entry(buf, sizeof(u32), items, fp); in type_write()
3239 if (rc) in type_write()
3240 return rc; in type_write()
3242 rc = put_entry(key, 1, len, fp); in type_write()
3243 if (rc) in type_write()
3244 return rc; in type_write()
3258 int rc; in user_write() local
3267 rc = put_entry(buf, sizeof(u32), items, fp); in user_write()
3268 if (rc) in user_write()
3269 return rc; in user_write()
3271 rc = put_entry(key, 1, len, fp); in user_write()
3272 if (rc) in user_write()
3273 return rc; in user_write()
3275 rc = ebitmap_write(&usrdatum->roles, fp); in user_write()
3276 if (rc) in user_write()
3277 return rc; in user_write()
3279 rc = mls_write_range_helper(&usrdatum->range, fp); in user_write()
3280 if (rc) in user_write()
3281 return rc; in user_write()
3283 rc = mls_write_level(&usrdatum->dfltlevel, fp); in user_write()
3284 if (rc) in user_write()
3285 return rc; in user_write()
3307 int rc; in ocontext_write() local
3318 rc = put_entry(buf, sizeof(u32), 1, fp); in ocontext_write()
3319 if (rc) in ocontext_write()
3320 return rc; in ocontext_write()
3325 rc = put_entry(buf, sizeof(u32), 1, fp); in ocontext_write()
3326 if (rc) in ocontext_write()
3327 return rc; in ocontext_write()
3328 rc = context_write(p, &c->context[0], fp); in ocontext_write()
3329 if (rc) in ocontext_write()
3330 return rc; in ocontext_write()
3336 rc = put_entry(buf, sizeof(u32), 1, fp); in ocontext_write()
3337 if (rc) in ocontext_write()
3338 return rc; in ocontext_write()
3339 rc = put_entry(c->u.name, 1, len, fp); in ocontext_write()
3340 if (rc) in ocontext_write()
3341 return rc; in ocontext_write()
3342 rc = context_write(p, &c->context[0], fp); in ocontext_write()
3343 if (rc) in ocontext_write()
3344 return rc; in ocontext_write()
3345 rc = context_write(p, &c->context[1], fp); in ocontext_write()
3346 if (rc) in ocontext_write()
3347 return rc; in ocontext_write()
3353 rc = put_entry(buf, sizeof(u32), 3, fp); in ocontext_write()
3354 if (rc) in ocontext_write()
3355 return rc; in ocontext_write()
3356 rc = context_write(p, &c->context[0], fp); in ocontext_write()
3357 if (rc) in ocontext_write()
3358 return rc; in ocontext_write()
3363 rc = put_entry(nodebuf, sizeof(u32), 2, fp); in ocontext_write()
3364 if (rc) in ocontext_write()
3365 return rc; in ocontext_write()
3366 rc = context_write(p, &c->context[0], fp); in ocontext_write()
3367 if (rc) in ocontext_write()
3368 return rc; in ocontext_write()
3374 rc = put_entry(buf, sizeof(u32), 2, fp); in ocontext_write()
3375 if (rc) in ocontext_write()
3376 return rc; in ocontext_write()
3377 rc = put_entry(c->u.name, 1, len, fp); in ocontext_write()
3378 if (rc) in ocontext_write()
3379 return rc; in ocontext_write()
3380 rc = context_write(p, &c->context[0], fp); in ocontext_write()
3381 if (rc) in ocontext_write()
3382 return rc; in ocontext_write()
3393 rc = put_entry(nodebuf, sizeof(u32), 8, fp); in ocontext_write()
3394 if (rc) in ocontext_write()
3395 return rc; in ocontext_write()
3396 rc = context_write(p, &c->context[0], fp); in ocontext_write()
3397 if (rc) in ocontext_write()
3398 return rc; in ocontext_write()
3405 rc = put_entry(prefixbuf, sizeof(u64), 1, fp); in ocontext_write()
3406 if (rc) in ocontext_write()
3407 return rc; in ocontext_write()
3412 rc = put_entry(buf, sizeof(u32), 2, fp); in ocontext_write()
3413 if (rc) in ocontext_write()
3414 return rc; in ocontext_write()
3415 rc = context_write(p, &c->context[0], fp); in ocontext_write()
3416 if (rc) in ocontext_write()
3417 return rc; in ocontext_write()
3423 rc = put_entry(buf, sizeof(u32), 2, fp); in ocontext_write()
3424 if (rc) in ocontext_write()
3425 return rc; in ocontext_write()
3426 rc = put_entry(c->u.ibendport.dev_name, 1, len, in ocontext_write()
3428 if (rc) in ocontext_write()
3429 return rc; in ocontext_write()
3430 rc = context_write(p, &c->context[0], fp); in ocontext_write()
3431 if (rc) in ocontext_write()
3432 return rc; in ocontext_write()
3446 int rc; in genfs_write() local
3452 rc = put_entry(buf, sizeof(u32), 1, fp); in genfs_write()
3453 if (rc) in genfs_write()
3454 return rc; in genfs_write()
3458 rc = put_entry(buf, sizeof(u32), 1, fp); in genfs_write()
3459 if (rc) in genfs_write()
3460 return rc; in genfs_write()
3461 rc = put_entry(genfs->fstype, 1, len, fp); in genfs_write()
3462 if (rc) in genfs_write()
3463 return rc; in genfs_write()
3468 rc = put_entry(buf, sizeof(u32), 1, fp); in genfs_write()
3469 if (rc) in genfs_write()
3470 return rc; in genfs_write()
3474 rc = put_entry(buf, sizeof(u32), 1, fp); in genfs_write()
3475 if (rc) in genfs_write()
3476 return rc; in genfs_write()
3477 rc = put_entry(c->u.name, 1, len, fp); in genfs_write()
3478 if (rc) in genfs_write()
3479 return rc; in genfs_write()
3481 rc = put_entry(buf, sizeof(u32), 1, fp); in genfs_write()
3482 if (rc) in genfs_write()
3483 return rc; in genfs_write()
3484 rc = context_write(p, &c->context[0], fp); in genfs_write()
3485 if (rc) in genfs_write()
3486 return rc; in genfs_write()
3500 int rc; in range_write_helper() local
3504 rc = put_entry(buf, sizeof(u32), 2, fp); in range_write_helper()
3505 if (rc) in range_write_helper()
3506 return rc; in range_write_helper()
3509 rc = put_entry(buf, sizeof(u32), 1, fp); in range_write_helper()
3510 if (rc) in range_write_helper()
3511 return rc; in range_write_helper()
3513 rc = mls_write_range_helper(r, fp); in range_write_helper()
3514 if (rc) in range_write_helper()
3515 return rc; in range_write_helper()
3523 int rc; in range_write() local
3530 rc = put_entry(buf, sizeof(u32), 1, fp); in range_write()
3531 if (rc) in range_write()
3532 return rc; in range_write()
3535 rc = hashtab_map(&p->range_tr, range_write_helper, &pd); in range_write()
3536 if (rc) in range_write()
3537 return rc; in range_write()
3549 int rc; in filename_write_helper_compat() local
3556 rc = put_entry(buf, sizeof(u32), 1, fp); in filename_write_helper_compat()
3557 if (rc) in filename_write_helper_compat()
3558 return rc; in filename_write_helper_compat()
3560 rc = put_entry(ft->name, sizeof(char), len, fp); in filename_write_helper_compat()
3561 if (rc) in filename_write_helper_compat()
3562 return rc; in filename_write_helper_compat()
3569 rc = put_entry(buf, sizeof(u32), 4, fp); in filename_write_helper_compat()
3570 if (rc) in filename_write_helper_compat()
3571 return rc; in filename_write_helper_compat()
3586 int rc; in filename_write_helper() local
3590 rc = put_entry(buf, sizeof(u32), 1, fp); in filename_write_helper()
3591 if (rc) in filename_write_helper()
3592 return rc; in filename_write_helper()
3594 rc = put_entry(ft->name, sizeof(char), len, fp); in filename_write_helper()
3595 if (rc) in filename_write_helper()
3596 return rc; in filename_write_helper()
3608 rc = put_entry(buf, sizeof(u32), 3, fp); in filename_write_helper()
3609 if (rc) in filename_write_helper()
3610 return rc; in filename_write_helper()
3614 rc = ebitmap_write(&datum->stypes, fp); in filename_write_helper()
3615 if (rc) in filename_write_helper()
3616 return rc; in filename_write_helper()
3619 rc = put_entry(buf, sizeof(u32), 1, fp); in filename_write_helper()
3620 if (rc) in filename_write_helper()
3621 return rc; in filename_write_helper()
3632 int rc; in filename_trans_write() local
3639 rc = put_entry(buf, sizeof(u32), 1, fp); in filename_trans_write()
3640 if (rc) in filename_trans_write()
3641 return rc; in filename_trans_write()
3643 rc = hashtab_map(&p->filename_trans, in filename_trans_write()
3647 rc = put_entry(buf, sizeof(u32), 1, fp); in filename_trans_write()
3648 if (rc) in filename_trans_write()
3649 return rc; in filename_trans_write()
3651 rc = hashtab_map(&p->filename_trans, filename_write_helper, fp); in filename_trans_write()
3653 return rc; in filename_trans_write()
3664 int rc; in policydb_write() local
3696 rc = put_entry(buf, sizeof(u32), 2, fp); in policydb_write()
3697 if (rc) in policydb_write()
3698 return rc; in policydb_write()
3699 rc = put_entry(POLICYDB_STRING, 1, len, fp); in policydb_write()
3700 if (rc) in policydb_write()
3701 return rc; in policydb_write()
3717 rc = put_entry(buf, sizeof(u32), 4, fp); in policydb_write()
3718 if (rc) in policydb_write()
3719 return rc; in policydb_write()
3722 rc = ebitmap_write(&p->policycaps, fp); in policydb_write()
3723 if (rc) in policydb_write()
3724 return rc; in policydb_write()
3728 rc = ebitmap_write(&p->permissive_map, fp); in policydb_write()
3729 if (rc) in policydb_write()
3730 return rc; in policydb_write()
3743 rc = put_entry(buf, sizeof(u32), 2, fp); in policydb_write()
3744 if (rc) in policydb_write()
3745 return rc; in policydb_write()
3746 rc = hashtab_map(&p->symtab[i].table, write_f[i], &pd); in policydb_write()
3747 if (rc) in policydb_write()
3748 return rc; in policydb_write()
3751 rc = avtab_write(p, &p->te_avtab, fp); in policydb_write()
3752 if (rc) in policydb_write()
3753 return rc; in policydb_write()
3755 rc = cond_write_list(p, fp); in policydb_write()
3756 if (rc) in policydb_write()
3757 return rc; in policydb_write()
3759 rc = role_trans_write(p, fp); in policydb_write()
3760 if (rc) in policydb_write()
3761 return rc; in policydb_write()
3763 rc = role_allow_write(p->role_allow, fp); in policydb_write()
3764 if (rc) in policydb_write()
3765 return rc; in policydb_write()
3767 rc = filename_trans_write(p, fp); in policydb_write()
3768 if (rc) in policydb_write()
3769 return rc; in policydb_write()
3771 rc = ocontext_write(p, info, fp); in policydb_write()
3772 if (rc) in policydb_write()
3773 return rc; in policydb_write()
3775 rc = genfs_write(p, fp); in policydb_write()
3776 if (rc) in policydb_write()
3777 return rc; in policydb_write()
3779 rc = range_write(p, fp); in policydb_write()
3780 if (rc) in policydb_write()
3781 return rc; in policydb_write()
3786 rc = ebitmap_write(e, fp); in policydb_write()
3787 if (rc) in policydb_write()
3788 return rc; in policydb_write()