/usr/include/libisofs/libisofs.h is in libisofs-dev 1.1.6-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 | #ifndef LIBISO_LIBISOFS_H_
#define LIBISO_LIBISOFS_H_
/*
* Copyright (c) 2007-2008 Vreixo Formoso, Mario Danic
* Copyright (c) 2009-2011 Thomas Schmitt
*
* This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* or later as published by the Free Software Foundation.
* See COPYING file for details.
*/
/* Important: If you add a public API function then add its name to file
libisofs/libisofs.ver
*/
/*
*
* Applications must use 64 bit off_t.
* E.g. on 32-bit GNU/Linux by defining
* #define _LARGEFILE_SOURCE
* #define _FILE_OFFSET_BITS 64
* The minimum requirement is to interface with the library by 64 bit signed
* integers where libisofs.h or libisoburn.h prescribe off_t.
* Failure to do so may result in surprising malfunction or memory faults.
*
* Application files which include libisofs/libisofs.h must provide
* definitions for uint32_t and uint8_t.
* This can be achieved either:
* - by using autotools which will define HAVE_STDINT_H or HAVE_INTTYPES_H
* according to its ./configure tests,
* - or by defining the macros HAVE_STDINT_H resp. HAVE_INTTYPES_H according
* to the local situation,
* - or by appropriately defining uint32_t and uint8_t by other means,
* e.g. by including inttypes.h before including libisofs.h
*/
#ifdef HAVE_STDINT_H
#include <stdint.h>
#else
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#endif
/*
* Normally this API is operated via public functions and opaque object
* handles. But it also exposes several C structures which may be used to
* provide custom functionality for the objects of the API. The same
* structures are used for internal objects of libisofs, too.
* You are not supposed to manipulate the entrails of such objects if they
* are not your own custom extensions.
*
* See for an example IsoStream = struct iso_stream below.
*/
#include <sys/stat.h>
#include <stdlib.h>
/**
* The following two functions and three macros are utilities to help ensuring
* version match of application, compile time header, and runtime library.
*/
/**
* These three release version numbers tell the revision of this header file
* and of the API it describes. They are memorized by applications at
* compile time.
* They must show the same values as these symbols in ./configure.ac
* LIBISOFS_MAJOR_VERSION=...
* LIBISOFS_MINOR_VERSION=...
* LIBISOFS_MICRO_VERSION=...
* Note to anybody who does own work inside libisofs:
* Any change of configure.ac or libisofs.h has to keep up this equality !
*
* Before usage of these macros on your code, please read the usage discussion
* below.
*
* @since 0.6.2
*/
#define iso_lib_header_version_major 1
#define iso_lib_header_version_minor 1
#define iso_lib_header_version_micro 6
/**
* Get version of the libisofs library at runtime.
* NOTE: This function may be called before iso_init().
*
* @since 0.6.2
*/
void iso_lib_version(int *major, int *minor, int *micro);
/**
* Check at runtime if the library is ABI compatible with the given version.
* NOTE: This function may be called before iso_init().
*
* @return
* 1 lib is compatible, 0 is not.
*
* @since 0.6.2
*/
int iso_lib_is_compatible(int major, int minor, int micro);
/**
* Usage discussion:
*
* Some developers of the libburnia project have differing opinions how to
* ensure the compatibility of libaries and applications.
*
* It is about whether to use at compile time and at runtime the version
* numbers provided here. Thomas Schmitt advises to use them. Vreixo Formoso
* advises to use other means.
*
* At compile time:
*
* Vreixo Formoso advises to leave proper version matching to properly
* programmed checks in the the application's build system, which will
* eventually refuse compilation.
*
* Thomas Schmitt advises to use the macros defined here for comparison with
* the application's requirements of library revisions and to eventually
* break compilation.
*
* Both advises are combinable. I.e. be master of your build system and have
* #if checks in the source code of your application, nevertheless.
*
* At runtime (via iso_lib_is_compatible()):
*
* Vreixo Formoso advises to compare the application's requirements of
* library revisions with the runtime library. This is to allow runtime
* libraries which are young enough for the application but too old for
* the lib*.h files seen at compile time.
*
* Thomas Schmitt advises to compare the header revisions defined here with
* the runtime library. This is to enforce a strictly monotonous chain of
* revisions from app to header to library, at the cost of excluding some older
* libraries.
*
* These two advises are mutually exclusive.
*/
struct burn_source;
/**
* Context for image creation. It holds the files that will be added to image,
* and several options to control libisofs behavior.
*
* @since 0.6.2
*/
typedef struct Iso_Image IsoImage;
/*
* A node in the iso tree, i.e. a file that will be written to image.
*
* It can represent any kind of files. When needed, you can get the type with
* iso_node_get_type() and cast it to the appropiate subtype. Useful macros
* are provided, see below.
*
* @since 0.6.2
*/
typedef struct Iso_Node IsoNode;
/**
* A directory in the iso tree. It is an special type of IsoNode and can be
* casted to it in any case.
*
* @since 0.6.2
*/
typedef struct Iso_Dir IsoDir;
/**
* A symbolic link in the iso tree. It is an special type of IsoNode and can be
* casted to it in any case.
*
* @since 0.6.2
*/
typedef struct Iso_Symlink IsoSymlink;
/**
* A regular file in the iso tree. It is an special type of IsoNode and can be
* casted to it in any case.
*
* @since 0.6.2
*/
typedef struct Iso_File IsoFile;
/**
* An special file in the iso tree. This is used to represent any POSIX file
* other that regular files, directories or symlinks, i.e.: socket, block and
* character devices, and fifos.
* It is an special type of IsoNode and can be casted to it in any case.
*
* @since 0.6.2
*/
typedef struct Iso_Special IsoSpecial;
/**
* The type of an IsoNode.
*
* When an user gets an IsoNode from an image, (s)he can use
* iso_node_get_type() to get the current type of the node, and then
* cast to the appropriate subtype. For example:
*
* ...
* IsoNode *node;
* res = iso_dir_iter_next(iter, &node);
* if (res == 1 && iso_node_get_type(node) == LIBISO_DIR) {
* IsoDir *dir = (IsoDir *)node;
* ...
* }
*
* @since 0.6.2
*/
enum IsoNodeType {
LIBISO_DIR,
LIBISO_FILE,
LIBISO_SYMLINK,
LIBISO_SPECIAL,
LIBISO_BOOT
};
/* macros to check node type */
#define ISO_NODE_IS_DIR(n) (iso_node_get_type(n) == LIBISO_DIR)
#define ISO_NODE_IS_FILE(n) (iso_node_get_type(n) == LIBISO_FILE)
#define ISO_NODE_IS_SYMLINK(n) (iso_node_get_type(n) == LIBISO_SYMLINK)
#define ISO_NODE_IS_SPECIAL(n) (iso_node_get_type(n) == LIBISO_SPECIAL)
#define ISO_NODE_IS_BOOTCAT(n) (iso_node_get_type(n) == LIBISO_BOOT)
/* macros for safe downcasting */
#define ISO_DIR(n) ((IsoDir*)(ISO_NODE_IS_DIR(n) ? n : NULL))
#define ISO_FILE(n) ((IsoFile*)(ISO_NODE_IS_FILE(n) ? n : NULL))
#define ISO_SYMLINK(n) ((IsoSymlink*)(ISO_NODE_IS_SYMLINK(n) ? n : NULL))
#define ISO_SPECIAL(n) ((IsoSpecial*)(ISO_NODE_IS_SPECIAL(n) ? n : NULL))
#define ISO_NODE(n) ((IsoNode*)n)
/**
* File section in an old image.
*
* @since 0.6.8
*/
struct iso_file_section
{
uint32_t block;
uint32_t size;
};
/* If you get here because of a compilation error like
/usr/include/libisofs/libisofs.h:166: error:
expected specifier-qualifier-list before 'uint32_t'
then see the paragraph above about the definition of uint32_t.
*/
/**
* Context for iterate on directory children.
* @see iso_dir_get_children()
*
* @since 0.6.2
*/
typedef struct Iso_Dir_Iter IsoDirIter;
/**
* It represents an El-Torito boot image.
*
* @since 0.6.2
*/
typedef struct el_torito_boot_image ElToritoBootImage;
/**
* An special type of IsoNode that acts as a placeholder for an El-Torito
* boot catalog. Once written, it will appear as a regular file.
*
* @since 0.6.2
*/
typedef struct Iso_Boot IsoBoot;
/**
* Flag used to hide a file in the RR/ISO or Joliet tree.
*
* @see iso_node_set_hidden
* @since 0.6.2
*/
enum IsoHideNodeFlag {
/** Hide the node in the ECMA-119 / RR tree */
LIBISO_HIDE_ON_RR = 1 << 0,
/** Hide the node in the Joliet tree, if Joliet extension are enabled */
LIBISO_HIDE_ON_JOLIET = 1 << 1,
/** Hide the node in the ISO-9660:1999 tree, if that format is enabled */
LIBISO_HIDE_ON_1999 = 1 << 2,
/** With IsoNode and IsoBoot: Write data content even if the node is
* not visible in any tree.
* With directory nodes : Write data content of IsoNode and IsoBoot
* in the directory's tree unless they are
* explicitely marked LIBISO_HIDE_ON_RR
* without LIBISO_HIDE_BUT_WRITE.
* @since 0.6.34
*/
LIBISO_HIDE_BUT_WRITE = 1 << 3
};
/**
* El-Torito bootable image type.
*
* @since 0.6.2
*/
enum eltorito_boot_media_type {
ELTORITO_FLOPPY_EMUL,
ELTORITO_HARD_DISC_EMUL,
ELTORITO_NO_EMUL
};
/**
* Replace mode used when addding a node to a file.
* This controls how libisofs will act when you tried to add to a dir a file
* with the same name that an existing file.
*
* @since 0.6.2
*/
enum iso_replace_mode {
/**
* Never replace an existing node, and instead fail with
* ISO_NODE_NAME_NOT_UNIQUE.
*/
ISO_REPLACE_NEVER,
/**
* Always replace the old node with the new.
*/
ISO_REPLACE_ALWAYS,
/**
* Replace with the new node if it is the same file type
*/
ISO_REPLACE_IF_SAME_TYPE,
/**
* Replace with the new node if it is the same file type and its ctime
* is newer than the old one.
*/
ISO_REPLACE_IF_SAME_TYPE_AND_NEWER,
/**
* Replace with the new node if its ctime is newer than the old one.
*/
ISO_REPLACE_IF_NEWER
/*
* TODO #00006 define more values
* -if both are dirs, add contents (and what to do with conflicts?)
*/
};
/**
* Options for image written.
* @see iso_write_opts_new()
* @since 0.6.2
*/
typedef struct iso_write_opts IsoWriteOpts;
/**
* Options for image reading or import.
* @see iso_read_opts_new()
* @since 0.6.2
*/
typedef struct iso_read_opts IsoReadOpts;
/**
* Source for image reading.
*
* @see struct iso_data_source
* @since 0.6.2
*/
typedef struct iso_data_source IsoDataSource;
/**
* Data source used by libisofs for reading an existing image.
*
* It offers homogeneous read access to arbitrary blocks to different sources
* for images, such as .iso files, CD/DVD drives, etc...
*
* To create a multisession image, libisofs needs a IsoDataSource, that the
* user must provide. The function iso_data_source_new_from_file() constructs
* an IsoDataSource that uses POSIX I/O functions to access data. You can use
* it with regular .iso images, and also with block devices that represent a
* drive.
*
* @since 0.6.2
*/
struct iso_data_source
{
/* reserved for future usage, set to 0 */
int version;
/**
* Reference count for the data source. Should be 1 when a new source
* is created. Don't access it directly, but with iso_data_source_ref()
* and iso_data_source_unref() functions.
*/
unsigned int refcount;
/**
* Opens the given source. You must open() the source before any attempt
* to read data from it. The open is the right place for grabbing the
* underlying resources.
*
* @return
* 1 if success, < 0 on error (has to be a valid libisofs error code)
*/
int (*open)(IsoDataSource *src);
/**
* Close a given source, freeing all system resources previously grabbed in
* open().
*
* @return
* 1 if success, < 0 on error (has to be a valid libisofs error code)
*/
int (*close)(IsoDataSource *src);
/**
* Read an arbitrary block (2048 bytes) of data from the source.
*
* @param lba
* Block to be read.
* @param buffer
* Buffer where the data will be written. It should have at least
* 2048 bytes.
* @return
* 1 if success,
* < 0 if error. This function has to emit a valid libisofs error code.
* Predifined (but not mandatory) for this purpose are:
* ISO_DATA_SOURCE_SORRY , ISO_DATA_SOURCE_MISHAP,
* ISO_DATA_SOURCE_FAILURE , ISO_DATA_SOURCE_FATAL
*/
int (*read_block)(IsoDataSource *src, uint32_t lba, uint8_t *buffer);
/**
* Clean up the source specific data. Never call this directly, it is
* automatically called by iso_data_source_unref() when refcount reach
* 0.
*/
void (*free_data)(IsoDataSource *src);
/** Source specific data */
void *data;
};
/**
* Return information for image. This is optionally allocated by libisofs,
* as a way to inform user about the features of an existing image, such as
* extensions present, size, ...
*
* @see iso_image_import()
* @since 0.6.2
*/
typedef struct iso_read_image_features IsoReadImageFeatures;
/**
* POSIX abstraction for source files.
*
* @see struct iso_file_source
* @since 0.6.2
*/
typedef struct iso_file_source IsoFileSource;
/**
* Abstract for source filesystems.
*
* @see struct iso_filesystem
* @since 0.6.2
*/
typedef struct iso_filesystem IsoFilesystem;
/**
* Interface that defines the operations (methods) available for an
* IsoFileSource.
*
* @see struct IsoFileSource_Iface
* @since 0.6.2
*/
typedef struct IsoFileSource_Iface IsoFileSourceIface;
/**
* IsoFilesystem implementation to deal with ISO images, and to offer a way to
* access specific information of the image, such as several volume attributes,
* extensions being used, El-Torito artifacts...
*
* @since 0.6.2
*/
typedef IsoFilesystem IsoImageFilesystem;
/**
* See IsoFilesystem->get_id() for info about this.
* @since 0.6.2
*/
extern unsigned int iso_fs_global_id;
/**
* An IsoFilesystem is a handler for a source of files, or a "filesystem".
* That is defined as a set of files that are organized in a hierarchical
* structure.
*
* A filesystem allows libisofs to access files from several sources in
* an homogeneous way, thus abstracting the underlying operations needed to
* access and read file contents. Note that this doesn't need to be tied
* to the disc filesystem used in the partition being accessed. For example,
* we have an IsoFilesystem implementation to access any mounted filesystem,
* using standard POSIX functions. It is also legal, of course, to implement
* an IsoFilesystem to deal with a specific filesystem over raw partitions.
* That is what we do, for example, to access an ISO Image.
*
* Each file inside an IsoFilesystem is represented as an IsoFileSource object,
* that defines POSIX-like interface for accessing files.
*
* @since 0.6.2
*/
struct iso_filesystem
{
/**
* Type of filesystem.
* "file" -> local filesystem
* "iso " -> iso image filesystem
*/
char type[4];
/* reserved for future usage, set to 0 */
int version;
/**
* Get the root of a filesystem.
*
* @return
* 1 on success, < 0 on error (has to be a valid libisofs error code)
*/
int (*get_root)(IsoFilesystem *fs, IsoFileSource **root);
/**
* Retrieve a file from its absolute path inside the filesystem.
* @param file
* Returns a pointer to a IsoFileSource object representing the
* file. It has to be disposed by iso_file_source_unref() when
* no longer needed.
* @return
* 1 success, < 0 error (has to be a valid libisofs error code)
* Error codes:
* ISO_FILE_ACCESS_DENIED
* ISO_FILE_BAD_PATH
* ISO_FILE_DOESNT_EXIST
* ISO_OUT_OF_MEM
* ISO_FILE_ERROR
* ISO_NULL_POINTER
*/
int (*get_by_path)(IsoFilesystem *fs, const char *path,
IsoFileSource **file);
/**
* Get filesystem identifier.
*
* If the filesystem is able to generate correct values of the st_dev
* and st_ino fields for the struct stat of each file, this should
* return an unique number, greater than 0.
*
* To get a identifier for your filesystem implementation you should
* use iso_fs_global_id, incrementing it by one each time.
*
* Otherwise, if you can't ensure values in the struct stat are valid,
* this should return 0.
*/
unsigned int (*get_id)(IsoFilesystem *fs);
/**
* Opens the filesystem for several read operations. Calling this funcion
* is not needed at all, each time that the underlying system resource
* needs to be accessed, it is openned propertly.
* However, if you plan to execute several operations on the filesystem,
* it is a good idea to open it previously, to prevent several open/close
* operations to occur.
*
* @return 1 on success, < 0 on error (has to be a valid libisofs error code)
*/
int (*open)(IsoFilesystem *fs);
/**
* Close the filesystem, thus freeing all system resources. You should
* call this function if you have previously open() it.
* Note that you can open()/close() a filesystem several times.
*
* @return 1 on success, < 0 on error (has to be a valid libisofs error code)
*/
int (*close)(IsoFilesystem *fs);
/**
* Free implementation specific data. Should never be called by user.
* Use iso_filesystem_unref() instead.
*/
void (*free)(IsoFilesystem *fs);
/* internal usage, do never access them directly */
unsigned int refcount;
void *data;
};
/**
* Interface definition for an IsoFileSource. Defines the POSIX-like function
* to access files and abstract underlying source.
*
* @since 0.6.2
*/
struct IsoFileSource_Iface
{
/**
* Tells the version of the interface:
* Version 0 provides functions up to (*lseek)().
* @since 0.6.2
* Version 1 additionally provides function *(get_aa_string)().
* @since 0.6.14
* Version 2 additionally provides function *(clone_src)().
* @since 1.0.2
*/
int version;
/**
* Get the absolute path in the filesystem this file source belongs to.
*
* @return
* the path of the FileSource inside the filesystem, it should be
* freed when no more needed.
*/
char* (*get_path)(IsoFileSource *src);
/**
* Get the name of the file, with the dir component of the path.
*
* @return
* the name of the file, it should be freed when no more needed.
*/
char* (*get_name)(IsoFileSource *src);
/**
* Get information about the file. It is equivalent to lstat(2).
*
* @return
* 1 success, < 0 error (has to be a valid libisofs error code)
* Error codes:
* ISO_FILE_ACCESS_DENIED
* ISO_FILE_BAD_PATH
* ISO_FILE_DOESNT_EXIST
* ISO_OUT_OF_MEM
* ISO_FILE_ERROR
* ISO_NULL_POINTER
*/
int (*lstat)(IsoFileSource *src, struct stat *info);
/**
* Get information about the file. If the file is a symlink, the info
* returned refers to the destination. It is equivalent to stat(2).
*
* @return
* 1 success, < 0 error
* Error codes:
* ISO_FILE_ACCESS_DENIED
* ISO_FILE_BAD_PATH
* ISO_FILE_DOESNT_EXIST
* ISO_OUT_OF_MEM
* ISO_FILE_ERROR
* ISO_NULL_POINTER
*/
int (*stat)(IsoFileSource *src, struct stat *info);
/**
* Check if the process has access to read file contents. Note that this
* is not necessarily related with (l)stat functions. For example, in a
* filesystem implementation to deal with an ISO image, if the user has
* read access to the image it will be able to read all files inside it,
* despite of the particular permission of each file in the RR tree, that
* are what the above functions return.
*
* @return
* 1 if process has read access, < 0 on error (has to be a valid
* libisofs error code)
* Error codes:
* ISO_FILE_ACCESS_DENIED
* ISO_FILE_BAD_PATH
* ISO_FILE_DOESNT_EXIST
* ISO_OUT_OF_MEM
* ISO_FILE_ERROR
* ISO_NULL_POINTER
*/
int (*access)(IsoFileSource *src);
/**
* Opens the source.
* @return 1 on success, < 0 on error (has to be a valid libisofs error code)
* Error codes:
* ISO_FILE_ALREADY_OPENED
* ISO_FILE_ACCESS_DENIED
* ISO_FILE_BAD_PATH
* ISO_FILE_DOESNT_EXIST
* ISO_OUT_OF_MEM
* ISO_FILE_ERROR
* ISO_NULL_POINTER
*/
int (*open)(IsoFileSource *src);
/**
* Close a previuously openned file
* @return 1 on success, < 0 on error
* Error codes:
* ISO_FILE_ERROR
* ISO_NULL_POINTER
* ISO_FILE_NOT_OPENED
*/
int (*close)(IsoFileSource *src);
/**
* Attempts to read up to count bytes from the given source into
* the buffer starting at buf.
*
* The file src must be open() before calling this, and close() when no
* more needed. Not valid for dirs. On symlinks it reads the destination
* file.
*
* @return
* number of bytes read, 0 if EOF, < 0 on error (has to be a valid
* libisofs error code)
* Error codes:
* ISO_FILE_ERROR
* ISO_NULL_POINTER
* ISO_FILE_NOT_OPENED
* ISO_WRONG_ARG_VALUE -> if count == 0
* ISO_FILE_IS_DIR
* ISO_OUT_OF_MEM
* ISO_INTERRUPTED
*/
int (*read)(IsoFileSource *src, void *buf, size_t count);
/**
* Read a directory.
*
* Each call to this function will return a new children, until we reach
* the end of file (i.e, no more children), in that case it returns 0.
*
* The dir must be open() before calling this, and close() when no more
* needed. Only valid for dirs.
*
* Note that "." and ".." children MUST NOT BE returned.
*
* @param child
* pointer to be filled with the given child. Undefined on error or OEF
* @return
* 1 on success, 0 if EOF (no more children), < 0 on error (has to be
* a valid libisofs error code)
* Error codes:
* ISO_FILE_ERROR
* ISO_NULL_POINTER
* ISO_FILE_NOT_OPENED
* ISO_FILE_IS_NOT_DIR
* ISO_OUT_OF_MEM
*/
int (*readdir)(IsoFileSource *src, IsoFileSource **child);
/**
* Read the destination of a symlink. You don't need to open the file
* to call this.
*
* @param buf
* allocated buffer of at least bufsiz bytes.
* The dest. will be copied there, and it will be NULL-terminated
* @param bufsiz
* characters to be copied. Destination link will be truncated if
* it is larger than given size. This include the 0x0 character.
* @return
* 1 on success, < 0 on error (has to be a valid libisofs error code)
* Error codes:
* ISO_FILE_ERROR
* ISO_NULL_POINTER
* ISO_WRONG_ARG_VALUE -> if bufsiz <= 0
* ISO_FILE_IS_NOT_SYMLINK
* ISO_OUT_OF_MEM
* ISO_FILE_BAD_PATH
* ISO_FILE_DOESNT_EXIST
*
*/
int (*readlink)(IsoFileSource *src, char *buf, size_t bufsiz);
/**
* Get the filesystem for this source. No extra ref is added, so you
* musn't unref the IsoFilesystem.
*
* @return
* The filesystem, NULL on error
*/
IsoFilesystem* (*get_filesystem)(IsoFileSource *src);
/**
* Free implementation specific data. Should never be called by user.
* Use iso_file_source_unref() instead.
*/
void (*free)(IsoFileSource *src);
/**
* Repositions the offset of the IsoFileSource (must be opened) to the
* given offset according to the value of flag.
*
* @param offset
* in bytes
* @param flag
* 0 The offset is set to offset bytes (SEEK_SET)
* 1 The offset is set to its current location plus offset bytes
* (SEEK_CUR)
* 2 The offset is set to the size of the file plus offset bytes
* (SEEK_END).
* @return
* Absolute offset position of the file, or < 0 on error. Cast the
* returning value to int to get a valid libisofs error.
*
* @since 0.6.4
*/
off_t (*lseek)(IsoFileSource *src, off_t offset, int flag);
/* Add-ons of .version 1 begin here */
/**
* Valid only if .version is > 0. See above.
* Get the AAIP string with encoded ACL and xattr.
* (Not to be confused with ECMA-119 Extended Attributes).
*
* bit1 and bit2 of flag should be implemented so that freshly fetched
* info does not include the undesired ACL or xattr. Nevertheless if the
* aa_string is cached, then it is permissible that ACL and xattr are still
* delivered.
*
* @param flag Bitfield for control purposes
* bit0= Transfer ownership of AAIP string data.
* src will free the eventual cached data and might
* not be able to produce it again.
* bit1= No need to get ACL (no guarantee of exclusion)
* bit2= No need to get xattr (no guarantee of exclusion)
* @param aa_string Returns a pointer to the AAIP string data. If no AAIP
* string is available, *aa_string becomes NULL.
* (See doc/susp_aaip_*_*.txt for the meaning of AAIP and
* libisofs/aaip_0_2.h for encoding and decoding.)
* The caller is responsible for finally calling free()
* on non-NULL results.
* @return 1 means success (*aa_string == NULL is possible)
* <0 means failure and must b a valid libisofs error code
* (e.g. ISO_FILE_ERROR if no better one can be found).
* @since 0.6.14
*/
int (*get_aa_string)(IsoFileSource *src,
unsigned char **aa_string, int flag);
/**
* Produce a copy of a source. It must be possible to operate both source
* objects concurrently.
*
* @param old_src
* The existing source object to be copied
* @param new_stream
* Will return a pointer to the copy
* @param flag
* Bitfield for control purposes. Submit 0 for now.
* The function shall return ISO_STREAM_NO_CLONE on unknown flag bits.
*
* @since 1.0.2
* Present if .version is 2 or higher.
*/
int (*clone_src)(IsoFileSource *old_src, IsoFileSource **new_src,
int flag);
/*
* TODO #00004 Add a get_mime_type() function.
* This can be useful for GUI apps, to choose the icon of the file
*/
};
#ifndef __cplusplus
#ifndef Libisofs_h_as_cpluspluS
/**
* An IsoFile Source is a POSIX abstraction of a file.
*
* @since 0.6.2
*/
struct iso_file_source
{
const IsoFileSourceIface *class;
int refcount;
void *data;
};
#endif /* ! Libisofs_h_as_cpluspluS */
#endif /* ! __cplusplus */
/* A class of IsoStream is implemented by a class description
* IsoStreamIface = struct IsoStream_Iface
* and a structure of data storage for each instance of IsoStream.
* This structure shall be known to the functions of the IsoStreamIface.
* To create a custom IsoStream class:
* - Define the structure of the custom instance data.
* - Implement the methods which are described by the definition of
* struct IsoStream_Iface (see below),
* - Create a static instance of IsoStreamIface which lists the methods as
* C function pointers. (Example in libisofs/stream.c : fsrc_stream_class)
* To create an instance of that class:
* - Allocate sizeof(IsoStream) bytes of memory and initialize it as
* struct iso_stream :
* - Point to the custom IsoStreamIface by member .class .
* - Set member .refcount to 1.
* - Let member .data point to the custom instance data.
*
* Regrettably the choice of the structure member name "class" makes it
* impossible to implement this generic interface in C++ language directly.
* If C++ is absolutely necessary then you will have to make own copies
* of the public API structures. Use other names but take care to maintain
* the same memory layout.
*/
/**
* Representation of file contents. It is an stream of bytes, functionally
* like a pipe.
*
* @since 0.6.4
*/
typedef struct iso_stream IsoStream;
/**
* Interface that defines the operations (methods) available for an
* IsoStream.
*
* @see struct IsoStream_Iface
* @since 0.6.4
*/
typedef struct IsoStream_Iface IsoStreamIface;
/**
* Serial number to be used when you can't get a valid id for a Stream by other
* means. If you use this, both fs_id and dev_id should be set to 0.
* This must be incremented each time you get a reference to it.
*
* @see IsoStreamIface->get_id()
* @since 0.6.4
*/
extern ino_t serial_id;
/**
* Interface definition for IsoStream methods. It is public to allow
* implementation of own stream types.
* The methods defined here typically make use of stream.data which points
* to the individual state data of stream instances.
*
* @since 0.6.4
*/
struct IsoStream_Iface
{
/*
* Current version of the interface.
* Version 0 (since 0.6.4)
* deprecated but still valid.
* Version 1 (since 0.6.8)
* update_size() added.
* Version 2 (since 0.6.18)
* get_input_stream() added.
* A filter stream must have version 2 at least.
* Version 3 (since 0.6.20)
* compare() added.
* A filter stream should have version 3 at least.
* Version 4 (since 1.0.2)
* clone_stream() added.
*/
int version;
/**
* Type of Stream.
* "fsrc" -> Read from file source
* "cout" -> Cut out interval from disk file
* "mem " -> Read from memory
* "boot" -> Boot catalog
* "extf" -> External filter program
* "ziso" -> zisofs compression
* "osiz" -> zisofs uncompression
* "gzip" -> gzip compression
* "pizg" -> gzip uncompression (gunzip)
* "user" -> User supplied stream
*/
char type[4];
/**
* Opens the stream.
*
* @return
* 1 on success, 2 file greater than expected, 3 file smaller than
* expected, < 0 on error (has to be a valid libisofs error code)
*/
int (*open)(IsoStream *stream);
/**
* Close the Stream.
* @return
* 1 on success, < 0 on error (has to be a valid libisofs error code)
*/
int (*close)(IsoStream *stream);
/**
* Get the size (in bytes) of the stream. This function should always
* return the same size, even if the underlying source size changes,
* unless you call update_size() method.
*/
off_t (*get_size)(IsoStream *stream);
/**
* Attempt to read up to count bytes from the given stream into
* the buffer starting at buf. The implementation has to make sure that
* either the full desired count of bytes is delivered or that the
* next call to this function will return EOF or error.
* I.e. only the last read block may be shorter than parameter count.
*
* The stream must be open() before calling this, and close() when no
* more needed.
*
* @return
* number of bytes read, 0 if EOF, < 0 on error (has to be a valid
* libisofs error code)
*/
int (*read)(IsoStream *stream, void *buf, size_t count);
/**
* Tell whether this IsoStream can be read several times, with the same
* results. For example, a regular file is repeatable, you can read it
* as many times as you want. However, a pipe is not.
*
* @return
* 1 if stream is repeatable, 0 if not,
* < 0 on error (has to be a valid libisofs error code)
*/
int (*is_repeatable)(IsoStream *stream);
/**
* Get an unique identifier for the IsoStream.
*/
void (*get_id)(IsoStream *stream, unsigned int *fs_id, dev_t *dev_id,
ino_t *ino_id);
/**
* Free implementation specific data. Should never be called by user.
* Use iso_stream_unref() instead.
*/
void (*free)(IsoStream *stream);
/**
* Update the size of the IsoStream with the current size of the underlying
* source, if the source is prone to size changes. After calling this,
* get_size() shall eventually return the new size.
* This will never be called after iso_image_create_burn_source() was
* called and before the image was completely written.
* (The API call to update the size of all files in the image is
* iso_image_update_sizes()).
*
* @return
* 1 if ok, < 0 on error (has to be a valid libisofs error code)
*
* @since 0.6.8
* Present if .version is 1 or higher.
*/
int (*update_size)(IsoStream *stream);
/**
* Retrieve the eventual input stream of a filter stream.
*
* @param stream
* The eventual filter stream to be inquired.
* @param flag
* Bitfield for control purposes. 0 means normal behavior.
* @return
* The input stream, if one exists. Elsewise NULL.
* No extra reference to the stream shall be taken by this call.
*
* @since 0.6.18
* Present if .version is 2 or higher.
*/
IsoStream *(*get_input_stream)(IsoStream *stream, int flag);
/**
* Compare two streams whether they are based on the same input and will
* produce the same output. If in any doubt, then this comparison should
* indicate no match. A match might allow hardlinking of IsoFile objects.
*
* If this function cannot accept one of the given stream types, then
* the decision must be delegated to
* iso_stream_cmp_ino(s1, s2, 1);
* This is also appropriate if one has reason to implement stream.cmp_ino()
* without having an own special comparison algorithm.
*
* With filter streams, the decision whether the underlying chains of
* streams match, should be delegated to
* iso_stream_cmp_ino(iso_stream_get_input_stream(s1, 0),
* iso_stream_get_input_stream(s2, 0), 0);
*
* The stream.cmp_ino() function has to establish an equivalence and order
* relation:
* cmp_ino(A,A) == 0
* cmp_ino(A,B) == -cmp_ino(B,A)
* if cmp_ino(A,B) == 0 && cmp_ino(B,C) == 0 then cmp_ino(A,C) == 0
* if cmp_ino(A,B) < 0 && cmp_ino(B,C) < 0 then cmp_ino(A,C) < 0
*
* A big hazard to the last constraint are tests which do not apply to some
* types of streams.Thus it is mandatory to let iso_stream_cmp_ino(s1,s2,1)
* decide in this case.
*
* A function s1.(*cmp_ino)() must only accept stream s2 if function
* s2.(*cmp_ino)() would accept s1. Best is to accept only the own stream
* type or to have the same function for a family of similar stream types.
*
* @param s1
* The first stream to compare. Expect foreign stream types.
* @param s2
* The second stream to compare. Expect foreign stream types.
* @return
* -1 if s1 is smaller s2 , 0 if s1 matches s2 , 1 if s1 is larger s2
*
* @since 0.6.20
* Present if .version is 3 or higher.
*/
int (*cmp_ino)(IsoStream *s1, IsoStream *s2);
/**
* Produce a copy of a stream. It must be possible to operate both stream
* objects concurrently.
*
* @param old_stream
* The existing stream object to be copied
* @param new_stream
* Will return a pointer to the copy
* @param flag
* Bitfield for control purposes. 0 means normal behavior.
* The function shall return ISO_STREAM_NO_CLONE on unknown flag bits.
* @return
* 1 in case of success, or an error code < 0
*
* @since 1.0.2
* Present if .version is 4 or higher.
*/
int (*clone_stream)(IsoStream *old_stream, IsoStream **new_stream,
int flag);
};
#ifndef __cplusplus
#ifndef Libisofs_h_as_cpluspluS
/**
* Representation of file contents as a stream of bytes.
*
* @since 0.6.4
*/
struct iso_stream
{
IsoStreamIface *class;
int refcount;
void *data;
};
#endif /* ! Libisofs_h_as_cpluspluS */
#endif /* ! __cplusplus */
/**
* Initialize libisofs. Before any usage of the library you must either call
* this function or iso_init_with_flag().
* Only exception from this rule: iso_lib_version(), iso_lib_is_compatible().
* @return 1 on success, < 0 on error
*
* @since 0.6.2
*/
int iso_init();
/**
* Initialize libisofs. Before any usage of the library you must either call
* this function or iso_init() which is equivalent to iso_init_with_flag(0).
* Only exception from this rule: iso_lib_version(), iso_lib_is_compatible().
* @param flag
* Bitfield for control purposes
* bit0= do not set up locale by LC_* environment variables
* @return 1 on success, < 0 on error
*
* @since 0.6.18
*/
int iso_init_with_flag(int flag);
/**
* Finalize libisofs.
*
* @since 0.6.2
*/
void iso_finish();
/**
* Override the reply of libc function nl_langinfo(CODESET) which may or may
* not give the name of the character set which is in effect for your
* environment. So this call can compensate for inconsistent terminal setups.
* Another use case is to choose UTF-8 as intermediate character set for a
* conversion from an exotic input character set to an exotic output set.
*
* @param name
* Name of the character set to be assumed as "local" one.
* @param flag
* Unused yet. Submit 0.
* @return
* 1 indicates success, <=0 failure
*
* @since 0.6.12
*/
int iso_set_local_charset(char *name, int flag);
/**
* Obtain the local charset as currently assumed by libisofs.
* The result points to internal memory. It is volatile and must not be
* altered.
*
* @param flag
* Unused yet. Submit 0.
*
* @since 0.6.12
*/
char *iso_get_local_charset(int flag);
/**
* Create a new image, empty.
*
* The image will be owned by you and should be unref() when no more needed.
*
* @param name
* Name of the image. This will be used as volset_id and volume_id.
* @param image
* Location where the image pointer will be stored.
* @return
* 1 sucess, < 0 error
*
* @since 0.6.2
*/
int iso_image_new(const char *name, IsoImage **image);
/**
* Control whether ACL and xattr will be imported from external filesystems
* (typically the local POSIX filesystem) when new nodes get inserted. If
* enabled by iso_write_opts_set_aaip() they will later be written into the
* image as AAIP extension fields.
*
* A change of this setting does neither affect existing IsoNode objects
* nor the way how ACL and xattr are handled when loading an ISO image.
* The latter is controlled by iso_read_opts_set_no_aaip().
*
* @param image
* The image of which the behavior is to be controlled
* @param what
* A bit field which sets the behavior:
* bit0= ignore ACLs if the external file object bears some
* bit1= ignore xattr if the external file object bears some
* all other bits are reserved
*
* @since 0.6.14
*/
void iso_image_set_ignore_aclea(IsoImage *image, int what);
/**
* Creates an IsoWriteOpts for writing an image. You should set the options
* desired with the correspondent setters.
*
* Options by default are determined by the selected profile. Fifo size is set
* by default to 2 MB.
*
* @param opts
* Pointer to the location where the newly created IsoWriteOpts will be
* stored. You should free it with iso_write_opts_free() when no more
* needed.
* @param profile
* Default profile for image creation. For now the following values are
* defined:
* ---> 0 [BASIC]
* No extensions are enabled, and ISO level is set to 1. Only suitable
* for usage for very old and limited systems (like MS-DOS), or by a
* start point from which to set your custom options.
* ---> 1 [BACKUP]
* POSIX compatibility for backup. Simple settings, ISO level is set to
* 3 and RR extensions are enabled. Useful for backup purposes.
* Note that ACL and xattr are not enabled by default.
* If you enable them, expect them not to show up in the mounted image.
* They will have to be retrieved by libisofs applications like xorriso.
* ---> 2 [DISTRIBUTION]
* Setting for information distribution. Both RR and Joliet are enabled
* to maximize compatibility with most systems. Permissions are set to
* default values, and timestamps to the time of recording.
* @return
* 1 success, < 0 error
*
* @since 0.6.2
*/
int iso_write_opts_new(IsoWriteOpts **opts, int profile);
/**
* Free an IsoWriteOpts previously allocated with iso_write_opts_new().
*
* @since 0.6.2
*/
void iso_write_opts_free(IsoWriteOpts *opts);
/**
* Announce that only the image size is desired, that the struct burn_source
* which is set to consume the image output stream will stay inactive,
* and that the write thread will be cancelled anyway by the .cancel() method
* of the struct burn_source.
* This avoids to create a write thread which would begin production of the
* image stream and would generate a MISHAP event when burn_source.cancel()
* gets into effect.
*
* @param opts
* The option set to be manipulated.
* @param will_cancel
* 0= normal image generation
* 1= prepare for being canceled before image stream output is completed
* @return
* 1 success, < 0 error
*
* @since 0.6.40
*/
int iso_write_opts_set_will_cancel(IsoWriteOpts *opts, int will_cancel);
/**
* Set the ISO-9960 level to write at.
*
* @param opts
* The option set to be manipulated.
* @param level
* -> 1 for higher compatibility with old systems. With this level
* filenames are restricted to 8.3 characters.
* -> 2 to allow up to 31 filename characters.
* -> 3 to allow files greater than 4GB
* @return
* 1 success, < 0 error
*
* @since 0.6.2
*/
int iso_write_opts_set_iso_level(IsoWriteOpts *opts, int level);
/**
* Whether to use or not Rock Ridge extensions.
*
* This are standard extensions to ECMA-119, intended to add POSIX filesystem
* features to ECMA-119 images. Thus, usage of this flag is highly recommended
* for images used on GNU/Linux systems. With the usage of RR extension, the
* resulting image will have long filenames (up to 255 characters), deeper
* directory structure, POSIX permissions and owner info on files and
* directories, support for symbolic links or special files... All that
* attributes can be modified/setted with the appropiate function.
*
* @param opts
* The option set to be manipulated.
* @param enable
* 1 to enable RR extension, 0 to not add them
* @return
* 1 success, < 0 error
*
* @since 0.6.2
*/
int iso_write_opts_set_rockridge(IsoWriteOpts *opts, int enable);
/**
* Whether to add the non-standard Joliet extension to the image.
*
* This extensions are heavily used in Microsoft Windows systems, so if you
* plan to use your disc on such a system you should add this extension.
* Usage of Joliet supplies longer filesystem length (up to 64 unicode
* characters), and deeper directory structure.
*
* @param opts
* The option set to be manipulated.
* @param enable
* 1 to enable Joliet extension, 0 to not add them
* @return
* 1 success, < 0 error
*
* @since 0.6.2
*/
int iso_write_opts_set_joliet(IsoWriteOpts *opts, int enable);
/**
* Whether to use newer ISO-9660:1999 version.
*
* This is the second version of ISO-9660. It allows longer filenames and has
* less restrictions than old ISO-9660. However, nobody is using it so there
* are no much reasons to enable this.
*
* @since 0.6.2
*/
int iso_write_opts_set_iso1999(IsoWriteOpts *opts, int enable);
/**
* Control generation of non-unique inode numbers for the emerging image.
* Inode numbers get written as "file serial number" with PX entries as of
* RRIP-1.12. They may mark families of hardlinks.
* RRIP-1.10 prescribes a PX entry without file serial number. If not overriden
* by iso_write_opts_set_rrip_1_10_px_ino() there will be no file serial number
* written into RRIP-1.10 images.
*
* Inode number generation does not affect IsoNode objects which imported their
* inode numbers from the old ISO image (see iso_read_opts_set_new_inos())
* and which have not been altered since import. It rather applies to IsoNode
* objects which were newly added to the image, or to IsoNode which brought no
* inode number from the old image, or to IsoNode where certain properties
* have been altered since image import.
*
* If two IsoNode are found with same imported inode number but differing
* properties, then one of them will get assigned a new unique inode number.
* I.e. the hardlink relation between both IsoNode objects ends.
*
* @param opts
* The option set to be manipulated.
* @param enable
* 1 = Collect IsoNode objects which have identical data sources and
* properties.
* 0 = Generate unique inode numbers for all IsoNode objects which do not
* have a valid inode number from an imported ISO image.
* All other values are reserved.
*
* @since 0.6.20
*/
int iso_write_opts_set_hardlinks(IsoWriteOpts *opts, int enable);
/**
* Control writing of AAIP informations for ACL and xattr.
* For importing ACL and xattr when inserting nodes from external filesystems
* (e.g. the local POSIX filesystem) see iso_image_set_ignore_aclea().
* For loading of this information from images see iso_read_opts_set_no_aaip().
*
* @param opts
* The option set to be manipulated.
* @param enable
* 1 = write AAIP information from nodes into the image
* 0 = do not write AAIP information into the image
* All other values are reserved.
*
* @since 0.6.14
*/
int iso_write_opts_set_aaip(IsoWriteOpts *opts, int enable);
/**
* Use this only if you need to reproduce a suboptimal behavior of older
* versions of libisofs. They used address 0 for links and device files,
* and the address of the Volume Descriptor Set Terminator for empty data
* files.
* New versions let symbolic links, device files, and empty data files point
* to a dedicated block of zero-bytes after the end of the directory trees.
* (Single-pass reader libarchive needs to see all directory info before
* processing any data files.)
*
* @param opts
* The option set to be manipulated.
* @param enable
* 1 = use the suboptimal block addresses in the range of 0 to 115.
* 0 = use the address of a block after the directory tree. (Default)
*
* @since 1.0.2
*/
int iso_write_opts_set_old_empty(IsoWriteOpts *opts, int enable);
/**
* Caution: This option breaks any assumptions about names that
* are supported by ECMA-119 specifications.
* Try to omit any translation which would make a file name compliant to the
* ECMA-119 rules. This includes and exceeds omit_version_numbers,
* max_37_char_filenames, no_force_dots bit0, allow_full_ascii. Further it
* prevents the conversion from local character set to ASCII.
* The maximum name length is given by this call. If a filename exceeds
* this length or cannot be recorded untranslated for other reasons, then
* image production is aborted with ISO_NAME_NEEDS_TRANSL.
* Currently the length limit is 96 characters, because an ECMA-119 directory
* record may at most have 254 bytes and up to 158 other bytes must fit into
* the record. Probably 96 more bytes can be made free for the name in future.
* @param opts
* The option set to be manipulated.
* @param len
* 0 = disable this feature and perform name translation according to
* other settings.
* >0 = Omit any translation. Eventually abort image production
* if a name is longer than the given value.
* -1 = Like >0. Allow maximum possible length (currently 96)
* @return >=0 success, <0 failure
* In case of >=0 the return value tells the effectively set len.
* E.g. 96 after using len == -1.
* @since 1.0.0
*/
int iso_write_opts_set_untranslated_name_len(IsoWriteOpts *opts, int len);
/**
* Convert directory names for ECMA-119 similar to other file names, but do
* not force a dot or add a version number.
* This violates ECMA-119 by allowing one "." and especially ISO level 1
* by allowing DOS style 8.3 names rather than only 8 characters.
* (mkisofs and its clones seem to do this violation.)
* @param opts
* The option set to be manipulated.
* @param allow
* 1= allow dots , 0= disallow dots and convert them
* @return
* 1 success, < 0 error
* @since 1.0.0
*/
int iso_write_opts_set_allow_dir_id_ext(IsoWriteOpts *opts, int allow);
/**
* Omit the version number (";1") at the end of the ISO-9660 identifiers.
* This breaks ECMA-119 specification, but version numbers are usually not
* used, so it should work on most systems. Use with caution.
* @param opts
* The option set to be manipulated.
* @param omit
* bit0= omit version number with ECMA-119 and Joliet
* bit1= omit version number with Joliet alone (@since 0.6.30)
* @since 0.6.2
*/
int iso_write_opts_set_omit_version_numbers(IsoWriteOpts *opts, int omit);
/**
* Allow ISO-9660 directory hierarchy to be deeper than 8 levels.
* This breaks ECMA-119 specification. Use with caution.
*
* @since 0.6.2
*/
int iso_write_opts_set_allow_deep_paths(IsoWriteOpts *opts, int allow);
/**
* Allow path in the ISO-9660 tree to have more than 255 characters.
* This breaks ECMA-119 specification. Use with caution.
*
* @since 0.6.2
*/
int iso_write_opts_set_allow_longer_paths(IsoWriteOpts *opts, int allow);
/**
* Allow a single file or directory hierarchy to have up to 37 characters.
* This is larger than the 31 characters allowed by ISO level 2, and the
* extra space is taken from the version number, so this also forces
* omit_version_numbers.
* This breaks ECMA-119 specification and could lead to buffer overflow
* problems on old systems. Use with caution.
*
* @since 0.6.2
*/
int iso_write_opts_set_max_37_char_filenames(IsoWriteOpts *opts, int allow);
/**
* ISO-9660 forces filenames to have a ".", that separates file name from
* extension. libisofs adds it if original filename doesn't has one. Set
* this to 1 to prevent this behavior.
* This breaks ECMA-119 specification. Use with caution.
*
* @param opts
* The option set to be manipulated.
* @param no
* bit0= no forced dot with ECMA-119
* bit1= no forced dot with Joliet (@since 0.6.30)
*
* @since 0.6.2
*/
int iso_write_opts_set_no_force_dots(IsoWriteOpts *opts, int no);
/**
* Allow lowercase characters in ISO-9660 filenames. By default, only
* uppercase characters, numbers and a few other characters are allowed.
* This breaks ECMA-119 specification. Use with caution.
*
* @since 0.6.2
*/
int iso_write_opts_set_allow_lowercase(IsoWriteOpts *opts, int allow);
/**
* Allow all ASCII characters to be appear on an ISO-9660 filename. Note
* that "/" and 0x0 characters are never allowed, even in RR names.
* This breaks ECMA-119 specification. Use with caution.
*
* @since 0.6.2
*/
int iso_write_opts_set_allow_full_ascii(IsoWriteOpts *opts, int allow);
/**
* Allow all characters to be part of Volume and Volset identifiers on
* the Primary Volume Descriptor. This breaks ISO-9660 contraints, but
* should work on modern systems.
*
* @since 0.6.2
*/
int iso_write_opts_set_relaxed_vol_atts(IsoWriteOpts *opts, int allow);
/**
* Allow paths in the Joliet tree to have more than 240 characters.
* This breaks Joliet specification. Use with caution.
*
* @since 0.6.2
*/
int iso_write_opts_set_joliet_longer_paths(IsoWriteOpts *opts, int allow);
/**
* Allow leaf names in the Joliet tree to have up to 103 characters.
* Normal limit is 64.
* This breaks Joliet specification. Use with caution.
*
* @since 1.0.6
*/
int iso_write_opts_set_joliet_long_names(IsoWriteOpts *opts, int allow);
/**
* Write Rock Ridge info as of specification RRIP-1.10 rather than RRIP-1.12:
* signature "RRIP_1991A" rather than "IEEE_1282", field PX without file
* serial number.
*
* @since 0.6.12
*/
int iso_write_opts_set_rrip_version_1_10(IsoWriteOpts *opts, int oldvers);
/**
* Write field PX with file serial number (i.e. inode number) even if
* iso_write_opts_set_rrip_version_1_10(,1) is in effect.
* This clearly violates the RRIP-1.10 specs. But it is done by mkisofs since
* a while and no widespread protest is visible in the web.
* If this option is not enabled, then iso_write_opts_set_hardlinks() will
* only have an effect with iso_write_opts_set_rrip_version_1_10(,0).
*
* @since 0.6.20
*/
int iso_write_opts_set_rrip_1_10_px_ino(IsoWriteOpts *opts, int enable);
/**
* Write AAIP as extension according to SUSP 1.10 rather than SUSP 1.12.
* I.e. without announcing it by an ER field and thus without the need
* to preceed the RRIP fields and the AAIP field by ES fields.
* This saves 5 to 10 bytes per file and might avoid problems with readers
* which dislike ER fields other than the ones for RRIP.
* On the other hand, SUSP 1.12 frowns on such unannounced extensions
* and prescribes ER and ES. It does this since the year 1994.
*
* In effect only if above iso_write_opts_set_aaip() enables writing of AAIP.
*
* @since 0.6.14
*/
int iso_write_opts_set_aaip_susp_1_10(IsoWriteOpts *opts, int oldvers);
/**
* Store as ECMA-119 Directory Record timestamp the mtime of the source
* rather than the image creation time.
*
* @since 0.6.12
*/
int iso_write_opts_set_dir_rec_mtime(IsoWriteOpts *opts, int allow);
/**
* Whether to sort files based on their weight.
*
* @see iso_node_set_sort_weight
* @since 0.6.2
*/
int iso_write_opts_set_sort_files(IsoWriteOpts *opts, int sort);
/**
* Whether to compute and record MD5 checksums for the whole session and/or
* for each single IsoFile object. The checksums represent the data as they
* were written into the image output stream, not necessarily as they were
* on hard disk at any point of time.
* See also calls iso_image_get_session_md5() and iso_file_get_md5().
* @param opts
* The option set to be manipulated.
* @param session
* If bit0 set: Compute session checksum
* @param files
* If bit0 set: Compute a checksum for each single IsoFile object which
* gets its data content written into the session. Copy
* checksums from files which keep their data in older
* sessions.
* If bit1 set: Check content stability (only with bit0). I.e. before
* writing the file content into to image stream, read it
* once and compute a MD5. Do a second reading for writing
* into the image stream. Afterwards compare both MD5 and
* issue a MISHAP event ISO_MD5_STREAM_CHANGE if they do not
* match.
* Such a mismatch indicates content changes between the
* time point when the first MD5 reading started and the
* time point when the last block was read for writing.
* So there is high risk that the image stream was fed from
* changing and possibly inconsistent file content.
*
* @since 0.6.22
*/
int iso_write_opts_set_record_md5(IsoWriteOpts *opts, int session, int files);
/**
* Set the parameters "name" and "timestamp" for a scdbackup checksum tag.
* It will be appended to the libisofs session tag if the image starts at
* LBA 0 (see iso_write_opts_set_ms_block()). The scdbackup tag can be used
* to verify the image by command scdbackup_verify device -auto_end.
* See scdbackup/README appendix VERIFY for its inner details.
*
* @param opts
* The option set to be manipulated.
* @param name
* A word of up to 80 characters. Typically volno_totalno telling
* that this is volume volno of a total of totalno volumes.
* @param timestamp
* A string of 13 characters YYMMDD.hhmmss (e.g. A90831.190324).
* A9 = 2009, B0 = 2010, B1 = 2011, ... C0 = 2020, ...
* @param tag_written
* Either NULL or the address of an array with at least 512 characters.
* In the latter case the eventually produced scdbackup tag will be
* copied to this array when the image gets written. This call sets
* scdbackup_tag_written[0] = 0 to mark its preliminary invalidity.
* @return
* 1 indicates success, <0 is error
*
* @since 0.6.24
*/
int iso_write_opts_set_scdbackup_tag(IsoWriteOpts *opts,
char *name, char *timestamp,
char *tag_written);
/**
* Whether to set default values for files and directory permissions, gid and
* uid. All these take one of three values: 0, 1 or 2.
*
* If 0, the corresponding attribute will be kept as set in the IsoNode.
* Unless you have changed it, it corresponds to the value on disc, so it
* is suitable for backup purposes. If set to 1, the corresponding attrib.
* will be changed by a default suitable value. Finally, if you set it to
* 2, the attrib. will be changed with the value specified by the functioins
* below. Note that for mode attributes, only the permissions are set, the
* file type remains unchanged.
*
* @see iso_write_opts_set_default_dir_mode
* @see iso_write_opts_set_default_file_mode
* @see iso_write_opts_set_default_uid
* @see iso_write_opts_set_default_gid
* @since 0.6.2
*/
int iso_write_opts_set_replace_mode(IsoWriteOpts *opts, int dir_mode,
int file_mode, int uid, int gid);
/**
* Set the mode to use on dirs when you set the replace_mode of dirs to 2.
*
* @see iso_write_opts_set_replace_mode
* @since 0.6.2
*/
int iso_write_opts_set_default_dir_mode(IsoWriteOpts *opts, mode_t dir_mode);
/**
* Set the mode to use on files when you set the replace_mode of files to 2.
*
* @see iso_write_opts_set_replace_mode
* @since 0.6.2
*/
int iso_write_opts_set_default_file_mode(IsoWriteOpts *opts, mode_t file_mode);
/**
* Set the uid to use when you set the replace_uid to 2.
*
* @see iso_write_opts_set_replace_mode
* @since 0.6.2
*/
int iso_write_opts_set_default_uid(IsoWriteOpts *opts, uid_t uid);
/**
* Set the gid to use when you set the replace_gid to 2.
*
* @see iso_write_opts_set_replace_mode
* @since 0.6.2
*/
int iso_write_opts_set_default_gid(IsoWriteOpts *opts, gid_t gid);
/**
* 0 to use IsoNode timestamps, 1 to use recording time, 2 to use
* values from timestamp field. This has only meaning if RR extensions
* are enabled.
*
* @see iso_write_opts_set_default_timestamp
* @since 0.6.2
*/
int iso_write_opts_set_replace_timestamps(IsoWriteOpts *opts, int replace);
/**
* Set the timestamp to use when you set the replace_timestamps to 2.
*
* @see iso_write_opts_set_replace_timestamps
* @since 0.6.2
*/
int iso_write_opts_set_default_timestamp(IsoWriteOpts *opts, time_t timestamp);
/**
* Whether to always record timestamps in GMT.
*
* By default, libisofs stores local time information on image. You can set
* this to always store timestamps converted to GMT. This prevents any
* discrimination of the timezone of the image preparer by the image reader.
*
* It is useful if you want to hide your timezone, or you live in a timezone
* that can't be represented in ECMA-119. These are timezones with an offset
* from GMT greater than +13 hours, lower than -12 hours, or not a multiple
* of 15 minutes.
* Negative timezones (west of GMT) can trigger bugs in some operating systems
* which typically appear in mounted ISO images as if the timezone shift from
* GMT was applied twice (e.g. in New York 22:36 becomes 17:36).
*
* @since 0.6.2
*/
int iso_write_opts_set_always_gmt(IsoWriteOpts *opts, int gmt);
/**
* Set the charset to use for the RR names of the files that will be created
* on the image.
* NULL to use default charset, that is the locale charset.
* You can obtain the list of charsets supported on your system executing
* "iconv -l" in a shell.
*
* @since 0.6.2
*/
int iso_write_opts_set_output_charset(IsoWriteOpts *opts, const char *charset);
/**
* Set the type of image creation in case there was already an existing
* image imported. Libisofs supports two types of creation:
* stand-alone and appended.
*
* A stand-alone image is an image that does not need the old image any more
* for being mounted by the operating system or imported by libisofs. It may
* be written beginning with byte 0 of optical media or disk file objects.
* There will be no distinction between files from the old image and those
* which have been added by the new image generation.
*
* On the other side, an appended image is not self contained. It may refer
* to files that stay stored in the imported existing image.
* This usage model is inspired by CD multi-session. It demands that the
* appended image is finally written to the same media resp. disk file
* as the imported image at an address behind the end of that imported image.
* The exact address may depend on media peculiarities and thus has to be
* announced by the application via iso_write_opts_set_ms_block().
* The real address where the data will be written is under control of the
* consumer of the struct burn_source which takes the output of libisofs
* image generation. It may be the one announced to libisofs or an intermediate
* one. Nevertheless, the image will be readable only at the announced address.
*
* If you have not imported a previous image by iso_image_import(), then the
* image will always be a stand-alone image, as there is no previous data to
* refer to.
*
* @param opts
* The option set to be manipulated.
* @param append
* 1 to create an appended image, 0 for an stand-alone one.
*
* @since 0.6.2
*/
int iso_write_opts_set_appendable(IsoWriteOpts *opts, int append);
/**
* Set the start block of the image. It is supposed to be the lba where the
* first block of the image will be written on disc. All references inside the
* ISO image will take this into account, thus providing a mountable image.
*
* For appendable images, that are written to a new session, you should
* pass here the lba of the next writable address on disc.
*
* In stand alone images this is usually 0. However, you may want to
* provide a different ms_block if you don't plan to burn the image in the
* first session on disc, such as in some CD-Extra disc whether the data
* image is written in a new session after some audio tracks.
*
* @since 0.6.2
*/
int iso_write_opts_set_ms_block(IsoWriteOpts *opts, uint32_t ms_block);
/**
* Sets the buffer where to store the descriptors which shall be written
* at the beginning of an overwriteable media to point to the newly written
* image.
* This is needed if the write start address of the image is not 0.
* In this case the first 64 KiB of the media have to be overwritten
* by the buffer content after the session was written and the buffer
* was updated by libisofs. Otherwise the new session would not be
* found by operating system function mount() or by libisoburn.
* (One could still mount that session if its start address is known.)
*
* If you do not need this information, for example because you are creating a
* new image for LBA 0 or because you will create an image for a true
* multisession media, just do not use this call or set buffer to NULL.
*
* Use cases:
*
* - Together with iso_write_opts_set_appendable(opts, 1) the buffer serves
* for the growing of an image as done in growisofs by Andy Polyakov.
* This allows appending of a new session to non-multisession media, such
* as DVD+RW. The new session will refer to the data of previous sessions
* on the same media.
* libisoburn emulates multisession appendability on overwriteable media
* and disk files by performing this use case.
*
* - Together with iso_write_opts_set_appendable(opts, 0) the buffer allows
* to write the first session on overwriteable media to start addresses
* other than 0.
* This address must not be smaller than 32 blocks plus the eventual
* partition offset as defined by iso_write_opts_set_part_offset().
* libisoburn in most cases writes the first session on overwriteable media
* and disk files to LBA (32 + partition_offset) in order to preserve its
* descriptors from the subsequent overwriting by the descriptor buffer of
* later sessions.
*
* @param opts
* The option set to be manipulated.
* @param overwrite
* When not NULL, it should point to at least 64KiB of memory, where
* libisofs will install the contents that shall be written at the
* beginning of overwriteable media.
* You should initialize the buffer either with 0s, or with the contents
* of the first 32 blocks of the image you are growing. In most cases,
* 0 is good enought.
* IMPORTANT: If you use iso_write_opts_set_part_offset() then the
* overwrite buffer must be larger by the offset defined there.
*
* @since 0.6.2
*/
int iso_write_opts_set_overwrite_buf(IsoWriteOpts *opts, uint8_t *overwrite);
/**
* Set the size, in number of blocks, of the ring buffer used between the
* writer thread and the burn_source. You have to provide at least a 32
* blocks buffer. Default value is set to 2MB, if that is ok for you, you
* don't need to call this function.
*
* @since 0.6.2
*/
int iso_write_opts_set_fifo_size(IsoWriteOpts *opts, size_t fifo_size);
/*
* Attach 32 kB of binary data which shall get written to the first 32 kB
* of the ISO image, the ECMA-119 System Area. This space is intended for
* system dependent boot software, e.g. a Master Boot Record which allows to
* boot from USB sticks or hard disks. ECMA-119 makes no own assumptions or
* prescriptions about the byte content.
*
* If system area data are given or options bit0 is set, then bit1 of
* el_torito_set_isolinux_options() is automatically disabled.
*
* @param opts
* The option set to be manipulated.
* @param data
* Either NULL or 32 kB of data. Do not submit less bytes !
* @param options
* Can cause manipulations of submitted data before they get written:
* bit0= Only with System area type 0 = MBR
* Apply a --protective-msdos-label as of grub-mkisofs.
* This means to patch bytes 446 to 512 of the system area so
* that one partition is defined which begins at the second
* 512-byte block of the image and ends where the image ends.
* This works with and without system_area_data.
* bit1= Only with System area type 0 = MBR
* Apply isohybrid MBR patching to the system area.
* This works only with system area data from SYSLINUX plus an
* ISOLINUX boot image (see iso_image_set_boot_image()) and
* only if not bit0 is set.
* bit2-7= System area type
* 0= with bit0 or bit1: MBR
* else: unspecified type which will be used unaltered.
* @since 0.6.38
* 1= MIPS Big Endian Volume Header
* Submit up to 15 MIPS Big Endian boot files by
* iso_image_add_mips_boot_file().
* This will overwrite the first 512 bytes of the submitted
* data.
* 2= DEC Boot Block for MIPS Little Endian
* The first boot file submitted by
* iso_image_add_mips_boot_file() will be activated.
* This will overwrite the first 512 bytes of the submitted
* data.
* @since 0.6.40
* 3= SUN Disk Label for SUN SPARC
* Submit up to 7 SPARC boot images by
* iso_write_opts_set_partition_img() for partition numbers 2
* to 8.
* This will overwrite the first 512 bytes of the submitted
* bit8-9= Only with System area type 0 = MBR
* @since 1.0.4
* Cylinder alignment mode eventually pads the image to make it
* end at a cylinder boundary.
* 0 = auto (align if bit1)
* 1 = always align to cylinder boundary
* 2 = never align to cylinder boundary
* @param flag
* bit0 = invalidate any attached system area data. Same as data == NULL
* (This re-activates eventually loaded image System Area data.
* To erase those, submit 32 kB of zeros without flag bit0.)
* bit1 = keep data unaltered
* bit2 = keep options unaltered
* @return
* ISO_SUCCESS or error
* @since 0.6.30
*/
int iso_write_opts_set_system_area(IsoWriteOpts *opts, char data[32768],
int options, int flag);
/**
* Set a name for the system area. This setting is ignored unless system area
* type 3 "SUN Disk Label" is in effect by iso_write_opts_set_system_area().
* In this case it will replace the default text at the start of the image:
* "CD-ROM Disc with Sun sparc boot created by libisofs"
*
* @param opts
* The option set to be manipulated.
* @param label
* A text of up to 128 characters.
* @return
* ISO_SUCCESS or error
* @since 0.6.40
*/
int iso_write_opts_set_disc_label(IsoWriteOpts *opts, char *label);
/**
* Explicitely set the four timestamps of the emerging Primary Volume
* Descriptor. Default with all parameters is 0.
* ECMA-119 defines them as:
* @param opts
* The option set to be manipulated.
* @param vol_creation_time
* When "the information in the volume was created."
* A value of 0 means that the timepoint of write start is to be used.
* @param vol_modification_time
* When "the information in the volume was last modified."
* A value of 0 means that the timepoint of write start is to be used.
* @param vol_expiration_time
* When "the information in the volume may be regarded as obsolete."
* A value of 0 means that the information never shall expire.
* @param vol_effective_time
* When "the information in the volume may be used."
* A value of 0 means that not such retention is intended.
* @param vol_uuid
* If this text is not empty, then it overrides vol_creation_time and
* vol_modification_time by copying the first 16 decimal digits from
* uuid, eventually padding up with decimal '1', and writing a NUL-byte
* as timezone.
* Other than with vol_*_time the resulting string in the ISO image
* is fully predictable and free of timezone pitfalls.
* It should express a reasonable time in form YYYYMMDDhhmmsscc
* E.g.: "2010040711405800" = 7 Apr 2010 11:40:58 (+0 centiseconds)
* @return
* ISO_SUCCESS or error
*
* @since 0.6.30
*/
int iso_write_opts_set_pvd_times(IsoWriteOpts *opts,
time_t vol_creation_time, time_t vol_modification_time,
time_t vol_expiration_time, time_t vol_effective_time,
char *vol_uuid);
/*
* Control production of a second set of volume descriptors (superblock)
* and directory trees, together with a partition table in the MBR where the
* first partition has non-zero start address and the others are zeroed.
* The first partition stretches to the end of the whole ISO image.
* The additional volume descriptor set and trees will allow to mount the
* ISO image at the start of the first partition, while it is still possible
* to mount it via the normal first volume descriptor set and tree at the
* start of the image resp. storage device.
* This makes few sense on optical media. But on USB sticks it creates a
* conventional partition table which makes it mountable on e.g. Linux via
* /dev/sdb and /dev/sdb1 alike.
* IMPORTANT: When submitting memory by iso_write_opts_set_overwrite_buf()
* then its size must be at least 64 KiB + partition offset.
*
* @param opts
* The option set to be manipulated.
* @param block_offset_2k
* The offset of the partition start relative to device start.
* This is counted in 2 kB blocks. The partition table will show the
* according number of 512 byte sectors.
* Default is 0 which causes no special partition table preparations.
* If it is not 0 then it must not be smaller than 16.
* @param secs_512_per_head
* Number of 512 byte sectors per head. 1 to 63. 0=automatic.
* @param heads_per_cyl
* Number of heads per cylinder. 1 to 255. 0=automatic.
* @return
* ISO_SUCCESS or error
*
* @since 0.6.36
*/
int iso_write_opts_set_part_offset(IsoWriteOpts *opts,
uint32_t block_offset_2k,
int secs_512_per_head, int heads_per_cyl);
/** The minimum version of libjte to be used with this version of libisofs
at compile time. The use of libjte is optional and depends on configure
tests. It can be prevented by ./configure option --disable-libjte .
@since 0.6.38
*/
#define iso_libjte_req_major 1
#define iso_libjte_req_minor 0
#define iso_libjte_req_micro 0
/**
* Associate a libjte environment object to the upcomming write run.
* libjte implements Jigdo Template Extraction as of Steve McIntyre and
* Richard Atterer.
* The call will fail if no libjte support was enabled at compile time.
* @param opts
* The option set to be manipulated.
* @param libjte_handle
* Pointer to a struct libjte_env e.g. created by libjte_new().
* It must stay existent from the start of image generation by
* iso_image_create_burn_source() until the write thread has ended.
* This can be inquired by iso_image_generator_is_running().
* In order to keep the libisofs API identical with and without
* libjte support the parameter type is (void *).
* @return
* ISO_SUCCESS or error
*
* @since 0.6.38
*/
int iso_write_opts_attach_jte(IsoWriteOpts *opts, void *libjte_handle);
/**
* Remove eventual association to a libjte environment handle.
* The call will fail if no libjte support was enabled at compile time.
* @param opts
* The option set to be manipulated.
* @param libjte_handle
* If not submitted as NULL, this will return the previously set
* libjte handle.
* @return
* ISO_SUCCESS or error
*
* @since 0.6.38
*/
int iso_write_opts_detach_jte(IsoWriteOpts *opts, void **libjte_handle);
/**
* Cause a number of blocks with zero bytes to be written after the payload
* data, but before the eventual checksum data. Unlike libburn tail padding,
* these blocks are counted as part of the image and covered by eventual
* image checksums.
* A reason for such padding can be the wish to prevent the Linux read-ahead
* bug by sacrificial data which still belong to image and Jigdo template.
* Normally such padding would be the job of the burn program which should know
* that it is needed with CD write type TAO if Linux read(2) shall be able
* to read all payload blocks.
* 150 blocks = 300 kB is the traditional sacrifice to the Linux kernel.
* @param opts
* The option set to be manipulated.
* @param num_blocks
* Number of extra 2 kB blocks to be written.
* @return
* ISO_SUCCESS or error
*
* @since 0.6.38
*/
int iso_write_opts_set_tail_blocks(IsoWriteOpts *opts, uint32_t num_blocks);
/**
* Cause an arbitrary data file to be appended to the ISO image and to be
* described by a partition table entry in an MBR or SUN Disk Label at the
* start of the ISO image.
* The partition entry will bear the size of the image file rounded up to
* the next multiple of 2048 bytes.
* MBR or SUN Disk Label are selected by iso_write_opts_set_system_area()
* system area type: 0 selects MBR partition table. 3 selects a SUN partition
* table with 320 kB start alignment.
*
* @param opts
* The option set to be manipulated.
* @param partition_number
* Depicts the partition table entry which shall describe the
* appended image.
* Range with MBR: 1 to 4. 1 will cause the whole ISO image to be
* unclaimable space before partition 1.
* Range with SUN Disk Label: 2 to 8.
* @param image_path
* File address in the local file system.
* With SUN Disk Label: an empty name causes the partition to become
* a copy of the next lower partition.
* @param image_type
* The MBR partition type. E.g. FAT12 = 0x01 , FAT16 = 0x06,
* Linux Native Partition = 0x83. See fdisk command L.
* This parameter is ignored with SUN Disk Label.
* @return
* ISO_SUCCESS or error
*
* @since 0.6.38
*/
int iso_write_opts_set_partition_img(IsoWriteOpts *opts, int partition_number,
uint8_t partition_type, char *image_path, int flag);
/**
* Inquire the start address of the file data blocks after having used
* IsoWriteOpts with iso_image_create_burn_source().
* @param opts
* The option set that was used when starting image creation
* @param data_start
* Returns the logical block address if it is already valid
* @param flag
* Reserved for future usage, set to 0.
* @return
* 1 indicates valid data_start, <0 indicates invalid data_start
*
* @since 0.6.16
*/
int iso_write_opts_get_data_start(IsoWriteOpts *opts, uint32_t *data_start,
int flag);
/**
* Update the sizes of all files added to image.
*
* This may be called just before iso_image_create_burn_source() to force
* libisofs to check the file sizes again (they're already checked when added
* to IsoImage). It is useful if you have changed some files after adding then
* to the image.
*
* @return
* 1 on success, < 0 on error
* @since 0.6.8
*/
int iso_image_update_sizes(IsoImage *image);
/**
* Create a burn_source and a thread which immediately begins to generate
* the image. That burn_source can be used with libburn as a data source
* for a track. A copy of its public declaration in libburn.h can be found
* further below in this text.
*
* If image generation shall be aborted by the application program, then
* the .cancel() method of the burn_source must be called to end the
* generation thread: burn_src->cancel(burn_src);
*
* @param image
* The image to write.
* @param opts
* The options for image generation. All needed data will be copied, so
* you can free the given struct once this function returns.
* @param burn_src
* Location where the pointer to the burn_source will be stored
* @return
* 1 on success, < 0 on error
*
* @since 0.6.2
*/
int iso_image_create_burn_source(IsoImage *image, IsoWriteOpts *opts,
struct burn_source **burn_src);
/**
* Inquire whether the image generator thread is still at work. As soon as the
* reply is 0, the caller of iso_image_create_burn_source() may assume that
* the image generation has ended.
* Nevertheless there may still be readily formatted output data pending in
* the burn_source or its consumers. So the final delivery of the image has
* also to be checked at the data consumer side,e.g. by burn_drive_get_status()
* in case of libburn as consumer.
* @param image
* The image to inquire.
* @return
* 1 generating of image stream is still in progress
* 0 generating of image stream has ended meanwhile
*
* @since 0.6.38
*/
int iso_image_generator_is_running(IsoImage *image);
/**
* Creates an IsoReadOpts for reading an existent image. You should set the
* options desired with the correspondent setters. Note that you may want to
* set the start block value.
*
* Options by default are determined by the selected profile.
*
* @param opts
* Pointer to the location where the newly created IsoReadOpts will be
* stored. You should free it with iso_read_opts_free() when no more
* needed.
* @param profile
* Default profile for image reading. For now the following values are
* defined:
* ---> 0 [STANDARD]
* Suitable for most situations. Most extension are read. When both
* Joliet and RR extension are present, RR is used.
* AAIP for ACL and xattr is not enabled by default.
* @return
* 1 success, < 0 error
*
* @since 0.6.2
*/
int iso_read_opts_new(IsoReadOpts **opts, int profile);
/**
* Free an IsoReadOpts previously allocated with iso_read_opts_new().
*
* @since 0.6.2
*/
void iso_read_opts_free(IsoReadOpts *opts);
/**
* Set the block where the image begins. It is usually 0, but may be different
* on a multisession disc.
*
* @since 0.6.2
*/
int iso_read_opts_set_start_block(IsoReadOpts *opts, uint32_t block);
/**
* Do not read Rock Ridge extensions.
* In most cases you don't want to use this. It could be useful if RR info
* is damaged, or if you want to use the Joliet tree.
*
* @since 0.6.2
*/
int iso_read_opts_set_no_rockridge(IsoReadOpts *opts, int norr);
/**
* Do not read Joliet extensions.
*
* @since 0.6.2
*/
int iso_read_opts_set_no_joliet(IsoReadOpts *opts, int nojoliet);
/**
* Do not read ISO 9660:1999 enhanced tree
*
* @since 0.6.2
*/
int iso_read_opts_set_no_iso1999(IsoReadOpts *opts, int noiso1999);
/**
* Control reading of AAIP informations about ACL and xattr when loading
* existing images.
* For importing ACL and xattr when inserting nodes from external filesystems
* (e.g. the local POSIX filesystem) see iso_image_set_ignore_aclea().
* For eventual writing of this information see iso_write_opts_set_aaip().
*
* @param opts
* The option set to be manipulated
* @param noaaip
* 1 = Do not read AAIP information
* 0 = Read AAIP information if available
* All other values are reserved.
* @since 0.6.14
*/
int iso_read_opts_set_no_aaip(IsoReadOpts *opts, int noaaip);
/**
* Control reading of an array of MD5 checksums which is eventually stored
* at the end of a session. See also iso_write_opts_set_record_md5().
* Important: Loading of the MD5 array will only work if AAIP is enabled
* because its position and layout is recorded in xattr "isofs.ca".
*
* @param opts
* The option set to be manipulated
* @param no_md5
* 0 = Read MD5 array if available, refuse on non-matching MD5 tags
* 1 = Do not read MD5 checksum array
* 2 = Read MD5 array, but do not check MD5 tags
* @since 1.0.4
* All other values are reserved.
*
* @since 0.6.22
*/
int iso_read_opts_set_no_md5(IsoReadOpts *opts, int no_md5);
/**
* Control discarding of eventual inode numbers from existing images.
* Such numbers may come from RRIP 1.12 entries PX. If not discarded they
* get written unchanged when the file object gets written into an ISO image.
* If this inode number is missing with a file in the imported image,
* or if it has been discarded during image reading, then a unique inode number
* will be generated at some time before the file gets written into an ISO
* image.
* Two image nodes which have the same inode number represent two hardlinks
* of the same file object. So discarding the numbers splits hardlinks.
*
* @param opts
* The option set to be manipulated
* @param new_inos
* 1 = Discard imported inode numbers and finally hand out a unique new
* one to each single file before it gets written into an ISO image.
* 0 = Keep eventual inode numbers from PX entries.
* All other values are reserved.
* @since 0.6.20
*/
int iso_read_opts_set_new_inos(IsoReadOpts *opts, int new_inos);
/**
* Whether to prefer Joliet over RR. libisofs usually prefers RR over
* Joliet, as it give us much more info about files. So, if both extensions
* are present, RR is used. You can set this if you prefer Joliet, but
* note that this is not very recommended. This doesn't mean than RR
* extensions are not read: if no Joliet is present, libisofs will read
* RR tree.
*
* @since 0.6.2
*/
int iso_read_opts_set_preferjoliet(IsoReadOpts *opts, int preferjoliet);
/**
* Set default uid for files when RR extensions are not present.
*
* @since 0.6.2
*/
int iso_read_opts_set_default_uid(IsoReadOpts *opts, uid_t uid);
/**
* Set default gid for files when RR extensions are not present.
*
* @since 0.6.2
*/
int iso_read_opts_set_default_gid(IsoReadOpts *opts, gid_t gid);
/**
* Set default permissions for files when RR extensions are not present.
*
* @param opts
* The option set to be manipulated
* @param file_perm
* Permissions for files.
* @param dir_perm
* Permissions for directories.
*
* @since 0.6.2
*/
int iso_read_opts_set_default_permissions(IsoReadOpts *opts, mode_t file_perm,
mode_t dir_perm);
/**
* Set the input charset of the file names on the image. NULL to use locale
* charset. You have to specify a charset if the image filenames are encoded
* in a charset different that the local one. This could happen, for example,
* if the image was created on a system with different charset.
*
* @param opts
* The option set to be manipulated
* @param charset
* The charset to use as input charset. You can obtain the list of
* charsets supported on your system executing "iconv -l" in a shell.
*
* @since 0.6.2
*/
int iso_read_opts_set_input_charset(IsoReadOpts *opts, const char *charset);
/**
* Enable or disable methods to automatically choose an input charset.
* This eventually overrides the name set via iso_read_opts_set_input_charset()
*
* @param opts
* The option set to be manipulated
* @param mode
* Bitfield for control purposes:
* bit0= Allow to use the input character set name which is eventually
* stored in attribute "isofs.cs" of the root directory.
* Applications may attach this xattr by iso_node_set_attrs() to
* the root node, call iso_write_opts_set_output_charset() with the
* same name and enable iso_write_opts_set_aaip() when writing
* an image.
* Submit any other bits with value 0.
*
* @since 0.6.18
*
*/
int iso_read_opts_auto_input_charset(IsoReadOpts *opts, int mode);
/**
* Enable or disable loading of the first 32768 bytes of the session.
*
* @param opts
* The option set to be manipulated
* @param mode
* Bitfield for control purposes:
* bit0= Load System Area data and attach them to the image so that they
* get written by the next session, if not overridden by
* iso_write_opts_set_system_area().
* Submit any other bits with value 0.
*
* @since 0.6.30
*
*/
int iso_read_opts_load_system_area(IsoReadOpts *opts, int mode);
/**
* Import a previous session or image, for growing or modify.
*
* @param image
* The image context to which old image will be imported. Note that all
* files added to image, and image attributes, will be replaced with the
* contents of the old image.
* TODO #00025 support for merging old image files
* @param src
* Data Source from which old image will be read. A extra reference is
* added, so you still need to iso_data_source_unref() yours.
* @param opts
* Options for image import. All needed data will be copied, so you
* can free the given struct once this function returns.
* @param features
* If not NULL, a new IsoReadImageFeatures will be allocated and filled
* with the features of the old image. It should be freed with
* iso_read_image_features_destroy() when no more needed. You can pass
* NULL if you're not interested on them.
* @return
* 1 on success, < 0 on error
*
* @since 0.6.2
*/
int iso_image_import(IsoImage *image, IsoDataSource *src, IsoReadOpts *opts,
IsoReadImageFeatures **features);
/**
* Destroy an IsoReadImageFeatures object obtained with iso_image_import.
*
* @since 0.6.2
*/
void iso_read_image_features_destroy(IsoReadImageFeatures *f);
/**
* Get the size (in 2048 byte block) of the image, as reported in the PVM.
*
* @since 0.6.2
*/
uint32_t iso_read_image_features_get_size(IsoReadImageFeatures *f);
/**
* Whether RockRidge extensions are present in the image imported.
*
* @since 0.6.2
*/
int iso_read_image_features_has_rockridge(IsoReadImageFeatures *f);
/**
* Whether Joliet extensions are present in the image imported.
*
* @since 0.6.2
*/
int iso_read_image_features_has_joliet(IsoReadImageFeatures *f);
/**
* Whether the image is recorded according to ISO 9660:1999, i.e. it has
* a version 2 Enhanced Volume Descriptor.
*
* @since 0.6.2
*/
int iso_read_image_features_has_iso1999(IsoReadImageFeatures *f);
/**
* Whether El-Torito boot record is present present in the image imported.
*
* @since 0.6.2
*/
int iso_read_image_features_has_eltorito(IsoReadImageFeatures *f);
/**
* Increments the reference counting of the given image.
*
* @since 0.6.2
*/
void iso_image_ref(IsoImage *image);
/**
* Decrements the reference couting of the given image.
* If it reaches 0, the image is free, together with its tree nodes (whether
* their refcount reach 0 too, of course).
*
* @since 0.6.2
*/
void iso_image_unref(IsoImage *image);
/**
* Attach user defined data to the image. Use this if your application needs
* to store addition info together with the IsoImage. If the image already
* has data attached, the old data will be freed.
*
* @param image
* The image to which data shall be attached.
* @param data
* Pointer to application defined data that will be attached to the
* image. You can pass NULL to remove any already attached data.
* @param give_up
* Function that will be called when the image does not need the data
* any more. It receives the data pointer as an argumente, and eventually
* causes data to be freed. It can be NULL if you don't need it.
* @return
* 1 on succes, < 0 on error
*
* @since 0.6.2
*/
int iso_image_attach_data(IsoImage *image, void *data, void (*give_up)(void*));
/**
* The the data previously attached with iso_image_attach_data()
*
* @since 0.6.2
*/
void *iso_image_get_attached_data(IsoImage *image);
/**
* Get the root directory of the image.
* No extra ref is added to it, so you musn't unref it. Use iso_node_ref()
* if you want to get your own reference.
*
* @since 0.6.2
*/
IsoDir *iso_image_get_root(const IsoImage *image);
/**
* Fill in the volset identifier for a image.
*
* @since 0.6.2
*/
void iso_image_set_volset_id(IsoImage *image, const char *volset_id);
/**
* Get the volset identifier.
* The returned string is owned by the image and should not be freed nor
* changed.
*
* @since 0.6.2
*/
const char *iso_image_get_volset_id(const IsoImage *image);
/**
* Fill in the volume identifier for a image.
*
* @since 0.6.2
*/
void iso_image_set_volume_id(IsoImage *image, const char *volume_id);
/**
* Get the volume identifier.
* The returned string is owned by the image and should not be freed nor
* changed.
*
* @since 0.6.2
*/
const char *iso_image_get_volume_id(const IsoImage *image);
/**
* Fill in the publisher for a image.
*
* @since 0.6.2
*/
void iso_image_set_publisher_id(IsoImage *image, const char *publisher_id);
/**
* Get the publisher of a image.
* The returned string is owned by the image and should not be freed nor
* changed.
*
* @since 0.6.2
*/
const char *iso_image_get_publisher_id(const IsoImage *image);
/**
* Fill in the data preparer for a image.
*
* @since 0.6.2
*/
void iso_image_set_data_preparer_id(IsoImage *image,
const char *data_preparer_id);
/**
* Get the data preparer of a image.
* The returned string is owned by the image and should not be freed nor
* changed.
*
* @since 0.6.2
*/
const char *iso_image_get_data_preparer_id(const IsoImage *image);
/**
* Fill in the system id for a image. Up to 32 characters.
*
* @since 0.6.2
*/
void iso_image_set_system_id(IsoImage *image, const char *system_id);
/**
* Get the system id of a image.
* The returned string is owned by the image and should not be freed nor
* changed.
*
* @since 0.6.2
*/
const char *iso_image_get_system_id(const IsoImage *image);
/**
* Fill in the application id for a image. Up to 128 chars.
*
* @since 0.6.2
*/
void iso_image_set_application_id(IsoImage *image, const char *application_id);
/**
* Get the application id of a image.
* The returned string is owned by the image and should not be freed nor
* changed.
*
* @since 0.6.2
*/
const char *iso_image_get_application_id(const IsoImage *image);
/**
* Fill copyright information for the image. Usually this refers
* to a file on disc. Up to 37 characters.
*
* @since 0.6.2
*/
void iso_image_set_copyright_file_id(IsoImage *image,
const char *copyright_file_id);
/**
* Get the copyright information of a image.
* The returned string is owned by the image and should not be freed nor
* changed.
*
* @since 0.6.2
*/
const char *iso_image_get_copyright_file_id(const IsoImage *image);
/**
* Fill abstract information for the image. Usually this refers
* to a file on disc. Up to 37 characters.
*
* @since 0.6.2
*/
void iso_image_set_abstract_file_id(IsoImage *image,
const char *abstract_file_id);
/**
* Get the abstract information of a image.
* The returned string is owned by the image and should not be freed nor
* changed.
*
* @since 0.6.2
*/
const char *iso_image_get_abstract_file_id(const IsoImage *image);
/**
* Fill biblio information for the image. Usually this refers
* to a file on disc. Up to 37 characters.
*
* @since 0.6.2
*/
void iso_image_set_biblio_file_id(IsoImage *image, const char *biblio_file_id);
/**
* Get the biblio information of a image.
* The returned string is owned by the image and should not be freed nor
* changed.
*
* @since 0.6.2
*/
const char *iso_image_get_biblio_file_id(const IsoImage *image);
/**
* Create a new set of El-Torito bootable images by adding a boot catalog
* and the default boot image.
* Further boot images may then be added by iso_image_add_boot_image().
*
* @param image
* The image to make bootable. If it was already bootable this function
* returns an error and the image remains unmodified.
* @param image_path
* The absolute path of a IsoFile to be used as default boot image.
* @param type
* The boot media type. This can be one of 3 types:
* - Floppy emulation: Boot image file must be exactly
* 1200 kB, 1440 kB or 2880 kB.
* - Hard disc emulation: The image must begin with a master
* boot record with a single image.
* - No emulation. You should specify load segment and load size
* of image.
* @param catalog_path
* The absolute path in the image tree where the catalog will be stored.
* The directory component of this path must be a directory existent on
* the image tree, and the filename component must be unique among all
* children of that directory on image. Otherwise a correspodent error
* code will be returned. This function will add an IsoBoot node that acts
* as a placeholder for the real catalog, that will be generated at image
* creation time.
* @param boot
* Location where a pointer to the added boot image will be stored. That
* object is owned by the IsoImage and should not be freed by the user,
* nor dereferenced once the last reference to the IsoImage was disposed
* via iso_image_unref(). A NULL value is allowed if you don't need a
* reference to the boot image.
* @return
* 1 on success, < 0 on error
*
* @since 0.6.2
*/
int iso_image_set_boot_image(IsoImage *image, const char *image_path,
enum eltorito_boot_media_type type,
const char *catalog_path,
ElToritoBootImage **boot);
/**
* Add a further boot image to the set of El-Torito bootable images.
* This set has already to be created by iso_image_set_boot_image().
* Up to 31 further boot images may be added.
*
* @param image
* The image to which the boot image shall be added.
* returns an error and the image remains unmodified.
* @param image_path
* The absolute path of a IsoFile to be used as default boot image.
* @param type
* The boot media type. See iso_image_set_boot_image
* @param flag
* Bitfield for control purposes. Unused yet. Submit 0.
* @param boot
* Location where a pointer to the added boot image will be stored.
* See iso_image_set_boot_image
* @return
* 1 on success, < 0 on error
* ISO_BOOT_NO_CATALOG means iso_image_set_boot_image()
* was not called first.
*
* @since 0.6.32
*/
int iso_image_add_boot_image(IsoImage *image, const char *image_path,
enum eltorito_boot_media_type type, int flag,
ElToritoBootImage **boot);
/**
* Get the El-Torito boot catalog and the default boot image of an ISO image.
*
* This can be useful, for example, to check if a volume read from a previous
* session or an existing image is bootable. It can also be useful to get
* the image and catalog tree nodes. An application would want those, for
* example, to prevent the user removing it.
*
* Both nodes are owned by libisofs and should not be freed. You can get your
* own ref with iso_node_ref(). You can also check if the node is already
* on the tree by getting its parent (note that when reading El-Torito info
* from a previous image, the nodes might not be on the tree even if you haven't
* removed them). Remember that you'll need to get a new ref
* (with iso_node_ref()) before inserting them again to the tree, and probably
* you will also need to set the name or permissions.
*
* @param image
* The image from which to get the boot image.
* @param boot
* If not NULL, it will be filled with a pointer to the boot image, if
* any. That object is owned by the IsoImage and should not be freed by
* the user, nor dereferenced once the last reference to the IsoImage was
* disposed via iso_image_unref().
* @param imgnode
* When not NULL, it will be filled with the image tree node. No extra ref
* is added, you can use iso_node_ref() to get one if you need it.
* @param catnode
* When not NULL, it will be filled with the catnode tree node. No extra
* ref is added, you can use iso_node_ref() to get one if you need it.
* @return
* 1 on success, 0 is the image is not bootable (i.e., it has no El-Torito
* image), < 0 error.
*
* @since 0.6.2
*/
int iso_image_get_boot_image(IsoImage *image, ElToritoBootImage **boot,
IsoFile **imgnode, IsoBoot **catnode);
/**
* Get detailed information about the boot catalog that was loaded from
* an ISO image.
* The boot catalog links the El Torito boot record at LBA 17 with the
* boot images which are IsoFile objects in the image. The boot catalog
* itself is not a regular file and thus will not deliver an IsoStream.
* Its content is usually quite short and can be obtained by this call.
*
* @param image
* The image to inquire.
* @param catnode
* Will return the boot catalog tree node. No extra ref is taken.
* @param lba
* Will return the block address of the boot catalog in the image.
* @param content
* Will return either NULL or an allocated memory buffer with the
* content bytes of the boot catalog.
* Dispose it by free() when no longer needed.
* @param size
* Will return the number of bytes in content.
* @return
* 1 if reply is valid, 0 if not boot catalog was loaded, < 0 on error.
*
* @since 1.1.2
*/
int iso_image_get_bootcat(IsoImage *image, IsoBoot **catnode, uint32_t *lba,
char **content, off_t *size);
/**
* Get all El-Torito boot images of an ISO image.
*
* The first of these boot images is the same as returned by
* iso_image_get_boot_image(). The others are alternative boot images.
*
* @param image
* The image from which to get the boot images.
* @param num_boots
* The number of available array elements in boots and bootnodes.
* @param boots
* Returns NULL or an allocated array of pointers to boot images.
* Apply system call free(boots) to dispose it.
* @param bootnodes
* Returns NULL or an allocated array of pointers to the IsoFile nodes
* which bear the content of the boot images in boots.
* @param flag
* Bitfield for control purposes. Unused yet. Submit 0.
* @return
* 1 on success, 0 no El-Torito catalog and boot image attached,
* < 0 error.
*
* @since 0.6.32
*/
int iso_image_get_all_boot_imgs(IsoImage *image, int *num_boots,
ElToritoBootImage ***boots, IsoFile ***bootnodes, int flag);
/**
* Removes all El-Torito boot images from the ISO image.
*
* The IsoBoot node that acts as placeholder for the catalog is also removed
* for the image tree, if there.
* If the image is not bootable (don't have el-torito boot image) this function
* just returns.
*
* @since 0.6.2
*/
void iso_image_remove_boot_image(IsoImage *image);
/**
* Sets the sort weight of the boot catalog that is attached to an IsoImage.
*
* For the meaning of sort weights see iso_node_set_sort_weight().
* That function cannot be applied to the emerging boot catalog because
* it is not represented by an IsoFile.
*
* @param image
* The image to manipulate.
* @param sort_weight
* The larger this value, the lower will be the block address of the
* boot catalog record.
* @return
* 0= no boot catalog attached , 1= ok , <0 = error
*
* @since 0.6.32
*/
int iso_image_set_boot_catalog_weight(IsoImage *image, int sort_weight);
/**
* Hides the boot catalog file from directory trees.
*
* For the meaning of hiding files see iso_node_set_hidden().
*
*
* @param image
* The image to manipulate.
* @param hide_attrs
* Or-combination of values from enum IsoHideNodeFlag to set the trees
* in which the record.
* @return
* 0= no boot catalog attached , 1= ok , <0 = error
*
* @since 0.6.34
*/
int iso_image_set_boot_catalog_hidden(IsoImage *image, int hide_attrs);
/**
* Get the boot media type as of parameter "type" of iso_image_set_boot_image()
* resp. iso_image_add_boot_image().
*
* @param bootimg
* The image to inquire
* @param media_type
* Returns the media type
* @return
* 1 = ok , < 0 = error
*
* @since 0.6.32
*/
int el_torito_get_boot_media_type(ElToritoBootImage *bootimg,
enum eltorito_boot_media_type *media_type);
/**
* Sets the platform ID of the boot image.
*
* The Platform ID gets written into the boot catalog at byte 1 of the
* Validation Entry, or at byte 1 of a Section Header Entry.
* If Platform ID and ID String of two consequtive bootimages are the same
*
* @param bootimg
* The image to manipulate.
* @param id
* A Platform ID as of
* El Torito 1.0 : 0x00= 80x86, 0x01= PowerPC, 0x02= Mac
* Others : 0xef= EFI
* @return
* 1 ok , <=0 error
*
* @since 0.6.32
*/
int el_torito_set_boot_platform_id(ElToritoBootImage *bootimg, uint8_t id);
/**
* Get the platform ID value. See el_torito_set_boot_platform_id().
*
* @param bootimg
* The image to inquire
* @return
* 0 - 255 : The platform ID
* < 0 : error
*
* @since 0.6.32
*/
int el_torito_get_boot_platform_id(ElToritoBootImage *bootimg);
/**
* Sets the load segment for the initial boot image. This is only for
* no emulation boot images, and is a NOP for other image types.
*
* @since 0.6.2
*/
void el_torito_set_load_seg(ElToritoBootImage *bootimg, short segment);
/**
* Get the load segment value. See el_torito_set_load_seg().
*
* @param bootimg
* The image to inquire
* @return
* 0 - 65535 : The load segment value
* < 0 : error
*
* @since 0.6.32
*/
int el_torito_get_load_seg(ElToritoBootImage *bootimg);
/**
* Sets the number of sectors (512b) to be load at load segment during
* the initial boot procedure. This is only for
* no emulation boot images, and is a NOP for other image types.
*
* @since 0.6.2
*/
void el_torito_set_load_size(ElToritoBootImage *bootimg, short sectors);
/**
* Get the load size. See el_torito_set_load_size().
*
* @param bootimg
* The image to inquire
* @return
* 0 - 65535 : The load size value
* < 0 : error
*
* @since 0.6.32
*/
int el_torito_get_load_size(ElToritoBootImage *bootimg);
/**
* Marks the specified boot image as not bootable
*
* @since 0.6.2
*/
void el_torito_set_no_bootable(ElToritoBootImage *bootimg);
/**
* Get the bootability flag. See el_torito_set_no_bootable().
*
* @param bootimg
* The image to inquire
* @return
* 0 = not bootable, 1 = bootable , <0 = error
*
* @since 0.6.32
*/
int el_torito_get_bootable(ElToritoBootImage *bootimg);
/**
* Set the id_string of the Validation Entry resp. Sector Header Entry which
* will govern the boot image Section Entry in the El Torito Catalog.
*
* @param bootimg
* The image to manipulate.
* @param id_string
* The first boot image puts 24 bytes of ID string into the Validation
* Entry, where they shall "identify the manufacturer/developer of
* the CD-ROM".
* Further boot images put 28 bytes into their Section Header.
* El Torito 1.0 states that "If the BIOS understands the ID string, it
* may choose to boot the * system using one of these entries in place
* of the INITIAL/DEFAULT entry." (The INITIAL/DEFAULT entry points to the
* first boot image.)
* @return
* 1 = ok , <0 = error
*
* @since 0.6.32
*/
int el_torito_set_id_string(ElToritoBootImage *bootimg, uint8_t id_string[28]);
/**
* Get the id_string as of el_torito_set_id_string().
*
* @param bootimg
* The image to inquire
* @param id_string
* Returns 28 bytes of id string
* @return
* 1 = ok , <0 = error
*
* @since 0.6.32
*/
int el_torito_get_id_string(ElToritoBootImage *bootimg, uint8_t id_string[28]);
/**
* Set the Selection Criteria of a boot image.
*
* @param bootimg
* The image to manipulate.
* @param crit
* The first boot image has no selection criteria. They will be ignored.
* Further boot images put 1 byte of Selection Criteria Type and 19
* bytes of data into their Section Entry.
* El Torito 1.0 states that "The format of the selection criteria is
* a function of the BIOS vendor. In the case of a foreign language
* BIOS three bytes would be used to identify the language".
* Type byte == 0 means "no criteria",
* type byte == 1 means "Language and Version Information (IBM)".
* @return
* 1 = ok , <0 = error
*
* @since 0.6.32
*/
int el_torito_set_selection_crit(ElToritoBootImage *bootimg, uint8_t crit[20]);
/**
* Get the Selection Criteria bytes as of el_torito_set_selection_crit().
*
* @param bootimg
* The image to inquire
* @param id_string
* Returns 20 bytes of type and data
* @return
* 1 = ok , <0 = error
*
* @since 0.6.32
*/
int el_torito_get_selection_crit(ElToritoBootImage *bootimg, uint8_t crit[20]);
/**
* Makes a guess whether the boot image was patched by a boot information
* table. It is advisable to patch such boot images if their content gets
* copied to a new location. See el_torito_set_isolinux_options().
* Note: The reply can be positive only if the boot image was imported
* from an existing ISO image.
*
* @param bootimg
* The image to inquire
* @param flag
* Reserved for future usage, set to 0.
* @return
* 1 = seems to contain oot info table , 0 = quite surely not
* @since 0.6.32
*/
int el_torito_seems_boot_info_table(ElToritoBootImage *bootimg, int flag);
/**
* Specifies options for ISOLINUX or GRUB boot images. This should only be used
* if the type of boot image is known.
*
* @param bootimg
* The image to set options on
* @param options
* bitmask style flag. The following values are defined:
*
* bit 0 -> 1 to patch the boot info table of the boot image.
* 1 does the same as mkisofs option -boot-info-table.
* Needed for ISOLINUX or GRUB boot images with platform ID 0.
* The table is located at byte 8 of the boot image file.
* Its size is 56 bytes.
* The original boot image file on disk will not be modified.
*
* One may use el_torito_seems_boot_info_table() for a
* qualified guess whether a boot info table is present in
* the boot image. If the result is 1 then it should get bit0
* set if its content gets copied to a new LBA.
*
* bit 1 -> 1 to generate a ISOLINUX isohybrid image with MBR.
* ----------------------------------------------------------
* @deprecated since 31 Mar 2010:
* The author of syslinux, H. Peter Anvin requested that this
* feature shall not be used any more. He intends to cease
* support for the MBR template that is included in libisofs.
* ----------------------------------------------------------
* A hybrid image is a boot image that boots from either
* CD/DVD media or from disk-like media, e.g. USB stick.
* For that you need isolinux.bin from SYSLINUX 3.72 or later.
* IMPORTANT: The application has to take care that the image
* on media gets padded up to the next full MB.
* @param flag
* Reserved for future usage, set to 0.
* @return
* 1 success, < 0 on error
* @since 0.6.12
*/
int el_torito_set_isolinux_options(ElToritoBootImage *bootimg,
int options, int flag);
/**
* Get the options as of el_torito_set_isolinux_options().
*
* @param bootimg
* The image to inquire
* @param flag
* Reserved for future usage, set to 0.
* @return
* >= 0 returned option bits , <0 = error
*
* @since 0.6.32
*/
int el_torito_get_isolinux_options(ElToritoBootImage *bootimg, int flag);
/** Deprecated:
* Specifies that this image needs to be patched. This involves the writing
* of a 16 bytes boot information table at offset 8 of the boot image file.
* The original boot image file won't be modified.
* This is needed for isolinux boot images.
*
* @since 0.6.2
* @deprecated Use el_torito_set_isolinux_options() instead
*/
void el_torito_patch_isolinux_image(ElToritoBootImage *bootimg);
/**
* Obtain a copy of the eventually loaded first 32768 bytes of the imported
* session, the System Area.
* It will be written to the start of the next session unless it gets
* overwritten by iso_write_opts_set_system_area().
*
* @param img
* The image to be inquired.
* @param data
* A byte array of at least 32768 bytesi to take the loaded bytes.
* @param options
* The option bits which will be applied if not overridden by
* iso_write_opts_set_system_area(). See there.
* @param flag
* Bitfield for control purposes, unused yet, submit 0
* @return
* 1 on success, 0 if no System Area was loaded, < 0 error.
* @since 0.6.30
*/
int iso_image_get_system_area(IsoImage *img, char data[32768],
int *options, int flag);
/**
* Add a MIPS boot file path to the image.
* Up to 15 such files can be written into a MIPS Big Endian Volume Header
* if this is enabled by value 1 in iso_write_opts_set_system_area() option
* bits 2 to 7.
* A single file can be written into a DEC Boot Block if this is enabled by
* value 2 in iso_write_opts_set_system_area() option bits 2 to 7. So only
* the first added file gets into effect with this system area type.
* The data files which shall serve as MIPS boot files have to be brought into
* the image by the normal means.
* @param img
* The image to be manipulated.
* @param path
* Absolute path of the boot file in the ISO 9660 Rock Ridge tree.
* @param flag
* Bitfield for control purposes, unused yet, submit 0
* @return
* 1 on success, < 0 error
* @since 0.6.38
*/
int iso_image_add_mips_boot_file(IsoImage *image, char *path, int flag);
/**
* Obtain the number of added MIPS Big Endian boot files and pointers to
* their paths in the ISO 9660 Rock Ridge tree.
* @param img
* The image to be inquired.
* @param paths
* An array of pointers to be set to the registered boot file paths.
* This are just pointers to data inside IsoImage. Do not free() them.
* Eventually make own copies of the data before manipulating the image.
* @param flag
* Bitfield for control purposes, unused yet, submit 0
* @return
* >= 0 is the number of valid path pointers , <0 means error
* @since 0.6.38
*/
int iso_image_get_mips_boot_files(IsoImage *image, char *paths[15], int flag);
/**
* Clear the list of MIPS Big Endian boot file paths.
* @param img
* The image to be manipulated.
* @param flag
* Bitfield for control purposes, unused yet, submit 0
* @return
* 1 is success , <0 means error
* @since 0.6.38
*/
int iso_image_give_up_mips_boot(IsoImage *image, int flag);
/**
* Increments the reference counting of the given node.
*
* @since 0.6.2
*/
void iso_node_ref(IsoNode *node);
/**
* Decrements the reference couting of the given node.
* If it reach 0, the node is free, and, if the node is a directory,
* its children will be unref() too.
*
* @since 0.6.2
*/
void iso_node_unref(IsoNode *node);
/**
* Get the type of an IsoNode.
*
* @since 0.6.2
*/
enum IsoNodeType iso_node_get_type(IsoNode *node);
/**
* Class of functions to handle particular extended information. A function
* instance acts as an identifier for the type of the information. Structs
* with same information type must use a pointer to the same function.
*
* @param data
* Attached data
* @param flag
* What to do with the data. At this time the following values are
* defined:
* -> 1 the data must be freed
* @return
* 1 in any case.
*
* @since 0.6.4
*/
typedef int (*iso_node_xinfo_func)(void *data, int flag);
/**
* Add extended information to the given node. Extended info allows
* applications (and libisofs itself) to add more information to an IsoNode.
* You can use this facilities to associate temporary information with a given
* node. This information is not written into the ISO 9660 image on media
* and thus does not persist longer than the node memory object.
*
* Each node keeps a list of added extended info, meaning you can add several
* extended info data to each node. Each extended info you add is identified
* by the proc parameter, a pointer to a function that knows how to manage
* the external info data. Thus, in order to add several types of extended
* info, you need to define a "proc" function for each type.
*
* @param node
* The node where to add the extended info
* @param proc
* A function pointer used to identify the type of the data, and that
* knows how to manage it
* @param data
* Extended info to add.
* @return
* 1 if success, 0 if the given node already has extended info of the
* type defined by the "proc" function, < 0 on error
*
* @since 0.6.4
*/
int iso_node_add_xinfo(IsoNode *node, iso_node_xinfo_func proc, void *data);
/**
* Remove the given extended info (defined by the proc function) from the
* given node.
*
* @return
* 1 on success, 0 if node does not have extended info of the requested
* type, < 0 on error
*
* @since 0.6.4
*/
int iso_node_remove_xinfo(IsoNode *node, iso_node_xinfo_func proc);
/**
* Remove all extended information from the given node.
*
* @param node
* The node where to remove all extended info
* @param flag
* Bitfield for control purposes, unused yet, submit 0
* @return
* 1 on success, < 0 on error
*
* @since 1.0.2
*/
int iso_node_remove_all_xinfo(IsoNode *node, int flag);
/**
* Get the given extended info (defined by the proc function) from the
* given node.
*
* @param node
* The node to inquire
* @param proc
* The function pointer which serves as key
* @param data
* Will be filled with the extended info corresponding to the given proc
* function
* @return
* 1 on success, 0 if node does not have extended info of the requested
* type, < 0 on error
*
* @since 0.6.4
*/
int iso_node_get_xinfo(IsoNode *node, iso_node_xinfo_func proc, void **data);
/**
* Get the next pair of function pointer and data of an iteration of the
* list of extended informations. Like:
* iso_node_xinfo_func proc;
* void *handle = NULL, *data;
* while (iso_node_get_next_xinfo(node, &handle, &proc, &data) == 1) {
* ... make use of proc and data ...
* }
* The iteration allocates no memory. So you may end it without any disposal
* action.
* IMPORTANT: Do not continue iterations after manipulating the extended
* information of a node. Memory corruption hazard !
* @param node
* The node to inquire
* @param handle
* The opaque iteration handle. Initialize iteration by submitting
* a pointer to a void pointer with value NULL.
* Do not alter its content until iteration has ended.
* @param proc
* The function pointer which serves as key
* @param data
* Will be filled with the extended info corresponding to the given proc
* function
* @return
* 1 on success
* 0 if iteration has ended (proc and data are invalid then)
* < 0 on error
*
* @since 1.0.2
*/
int iso_node_get_next_xinfo(IsoNode *node, void **handle,
iso_node_xinfo_func *proc, void **data);
/**
* Class of functions to clone extended information. A function instance gets
* associated to a particular iso_node_xinfo_func instance by function
* iso_node_xinfo_make_clonable(). This is a precondition to have IsoNode
* objects clonable which carry data for a particular iso_node_xinfo_func.
*
* @param old_data
* Data item to be cloned
* @param new_data
* Shall return the cloned data item
* @param flag
* Unused yet, submit 0
* The function shall return ISO_XINFO_NO_CLONE on unknown flag bits.
* @return
* > 0 number of allocated bytes
* 0 no size info is available
* < 0 error
*
* @since 1.0.2
*/
typedef int (*iso_node_xinfo_cloner)(void *old_data, void **new_data,int flag);
/**
* Associate a iso_node_xinfo_cloner to a particular class of extended
* information in order to make it clonable.
*
* @param proc
* The key and disposal function which identifies the particular
* extended information class.
* @param cloner
* The cloner function which shall be associated with proc.
* @param flag
* Unused yet, submit 0
* @return
* 1 success, < 0 error
*
* @since 1.0.2
*/
int iso_node_xinfo_make_clonable(iso_node_xinfo_func proc,
iso_node_xinfo_cloner cloner, int flag);
/**
* Inquire the registered cloner function for a particular class of
* extended information.
*
* @param proc
* The key and disposal function which identifies the particular
* extended information class.
* @param cloner
* Will return the cloner function which is associated with proc, or NULL.
* @param flag
* Unused yet, submit 0
* @return
* 1 success, 0 no cloner registered for proc, < 0 error
*
* @since 1.0.2
*/
int iso_node_xinfo_get_cloner(iso_node_xinfo_func proc,
iso_node_xinfo_cloner *cloner, int flag);
/**
* Set the name of a node. Note that if the node is already added to a dir
* this can fail if dir already contains a node with the new name.
*
* @param node
* The node whose name you want to change. Note that you can't change
* the name of the root.
* @param name
* The name for the node. If you supply an empty string or a
* name greater than 255 characters this returns with failure, and
* node name is not modified.
* @return
* 1 on success, < 0 on error
*
* @since 0.6.2
*/
int iso_node_set_name(IsoNode *node, const char *name);
/**
* Get the name of a node.
* The returned string belongs to the node and should not be modified nor
* freed. Use strdup if you really need your own copy.
*
* @since 0.6.2
*/
const char *iso_node_get_name(const IsoNode *node);
/**
* Set the permissions for the node. This attribute is only useful when
* Rock Ridge extensions are enabled.
*
* @param node
* The node to change
* @param mode
* bitmask with the permissions of the node, as specified in 'man 2 stat'.
* The file type bitfields will be ignored, only file permissions will be
* modified.
*
* @since 0.6.2
*/
void iso_node_set_permissions(IsoNode *node, mode_t mode);
/**
* Get the permissions for the node
*
* @since 0.6.2
*/
mode_t iso_node_get_permissions(const IsoNode *node);
/**
* Get the mode of the node, both permissions and file type, as specified in
* 'man 2 stat'.
*
* @since 0.6.2
*/
mode_t iso_node_get_mode(const IsoNode *node);
/**
* Set the user id for the node. This attribute is only useful when
* Rock Ridge extensions are enabled.
*
* @since 0.6.2
*/
void iso_node_set_uid(IsoNode *node, uid_t uid);
/**
* Get the user id of the node.
*
* @since 0.6.2
*/
uid_t iso_node_get_uid(const IsoNode *node);
/**
* Set the group id for the node. This attribute is only useful when
* Rock Ridge extensions are enabled.
*
* @since 0.6.2
*/
void iso_node_set_gid(IsoNode *node, gid_t gid);
/**
* Get the group id of the node.
*
* @since 0.6.2
*/
gid_t iso_node_get_gid(const IsoNode *node);
/**
* Set the time of last modification of the file
*
* @since 0.6.2
*/
void iso_node_set_mtime(IsoNode *node, time_t time);
/**
* Get the time of last modification of the file
*
* @since 0.6.2
*/
time_t iso_node_get_mtime(const IsoNode *node);
/**
* Set the time of last access to the file
*
* @since 0.6.2
*/
void iso_node_set_atime(IsoNode *node, time_t time);
/**
* Get the time of last access to the file
*
* @since 0.6.2
*/
time_t iso_node_get_atime(const IsoNode *node);
/**
* Set the time of last status change of the file
*
* @since 0.6.2
*/
void iso_node_set_ctime(IsoNode *node, time_t time);
/**
* Get the time of last status change of the file
*
* @since 0.6.2
*/
time_t iso_node_get_ctime(const IsoNode *node);
/**
* Set whether the node will be hidden in the directory trees of RR/ISO 9660,
* or of Joliet (if enabled at all), or of ISO-9660:1999 (if enabled at all).
*
* A hidden file does not show up by name in the affected directory tree.
* For example, if a file is hidden only in Joliet, it will normally
* not be visible on Windows systems, while being shown on GNU/Linux.
*
* If a file is not shown in any of the enabled trees, then its content will
* not be written to the image, unless LIBISO_HIDE_BUT_WRITE is given (which
* is available only since release 0.6.34).
*
* @param node
* The node that is to be hidden.
* @param hide_attrs
* Or-combination of values from enum IsoHideNodeFlag to set the trees
* in which the node's name shall be hidden.
*
* @since 0.6.2
*/
void iso_node_set_hidden(IsoNode *node, int hide_attrs);
/**
* Get the hide_attrs as eventually set by iso_node_set_hidden().
*
* @param node
* The node to inquire.
* @return
* Or-combination of values from enum IsoHideNodeFlag which are
* currently set for the node.
*
* @since 0.6.34
*/
int iso_node_get_hidden(IsoNode *node);
/**
* Compare two nodes whether they are based on the same input and
* can be considered as hardlinks to the same file objects.
*
* @param n1
* The first node to compare.
* @param n2
* The second node to compare.
* @return
* -1 if s1 is smaller s2 , 0 if s1 matches s2 , 1 if s1 is larger s2
* @param flag
* Bitfield for control purposes, unused yet, submit 0
* @since 0.6.20
*/
int iso_node_cmp_ino(IsoNode *n1, IsoNode *n2, int flag);
/**
* Add a new node to a dir. Note that this function don't add a new ref to
* the node, so you don't need to free it, it will be automatically freed
* when the dir is deleted. Of course, if you want to keep using the node
* after the dir life, you need to iso_node_ref() it.
*
* @param dir
* the dir where to add the node
* @param child
* the node to add. You must ensure that the node hasn't previously added
* to other dir, and that the node name is unique inside the child.
* Otherwise this function will return a failure, and the child won't be
* inserted.
* @param replace
* if the dir already contains a node with the same name, whether to
* replace or not the old node with this.
* @return
* number of nodes in dir if succes, < 0 otherwise
* Possible errors:
* ISO_NULL_POINTER, if dir or child are NULL
* ISO_NODE_ALREADY_ADDED, if child is already added to other dir
* ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
* ISO_WRONG_ARG_VALUE, if child == dir, or replace != (0,1)
*
* @since 0.6.2
*/
int iso_dir_add_node(IsoDir *dir, IsoNode *child,
enum iso_replace_mode replace);
/**
* Locate a node inside a given dir.
*
* @param dir
* The dir where to look for the node.
* @param name
* The name of the node
* @param node
* Location for a pointer to the node, it will filled with NULL if the dir
* doesn't have a child with the given name.
* The node will be owned by the dir and shouldn't be unref(). Just call
* iso_node_ref() to get your own reference to the node.
* Note that you can pass NULL is the only thing you want to do is check
* if a node with such name already exists on dir.
* @return
* 1 node found, 0 child has no such node, < 0 error
* Possible errors:
* ISO_NULL_POINTER, if dir or name are NULL
*
* @since 0.6.2
*/
int iso_dir_get_node(IsoDir *dir, const char *name, IsoNode **node);
/**
* Get the number of children of a directory.
*
* @return
* >= 0 number of items, < 0 error
* Possible errors:
* ISO_NULL_POINTER, if dir is NULL
*
* @since 0.6.2
*/
int iso_dir_get_children_count(IsoDir *dir);
/**
* Removes a child from a directory.
* The child is not freed, so you will become the owner of the node. Later
* you can add the node to another dir (calling iso_dir_add_node), or free
* it if you don't need it (with iso_node_unref).
*
* @return
* 1 on success, < 0 error
* Possible errors:
* ISO_NULL_POINTER, if node is NULL
* ISO_NODE_NOT_ADDED_TO_DIR, if node doesn't belong to a dir
*
* @since 0.6.2
*/
int iso_node_take(IsoNode *node);
/**
* Removes a child from a directory and free (unref) it.
* If you want to keep the child alive, you need to iso_node_ref() it
* before this call, but in that case iso_node_take() is a better
* alternative.
*
* @return
* 1 on success, < 0 error
*
* @since 0.6.2
*/
int iso_node_remove(IsoNode *node);
/*
* Get the parent of the given iso tree node. No extra ref is added to the
* returned directory, you must take your ref. with iso_node_ref() if you
* need it.
*
* If node is the root node, the same node will be returned as its parent.
*
* This returns NULL if the node doesn't pertain to any tree
* (it was removed/taken).
*
* @since 0.6.2
*/
IsoDir *iso_node_get_parent(IsoNode *node);
/**
* Get an iterator for the children of the given dir.
*
* You can iterate over the children with iso_dir_iter_next. When finished,
* you should free the iterator with iso_dir_iter_free.
* You musn't delete a child of the same dir, using iso_node_take() or
* iso_node_remove(), while you're using the iterator. You can use
* iso_dir_iter_take() or iso_dir_iter_remove() instead.
*
* You can use the iterator in the way like this
*
* IsoDirIter *iter;
* IsoNode *node;
* if ( iso_dir_get_children(dir, &iter) != 1 ) {
* // handle error
* }
* while ( iso_dir_iter_next(iter, &node) == 1 ) {
* // do something with the child
* }
* iso_dir_iter_free(iter);
*
* An iterator is intended to be used in a single iteration over the
* children of a dir. Thus, it should be treated as a temporary object,
* and free as soon as possible.
*
* @return
* 1 success, < 0 error
* Possible errors:
* ISO_NULL_POINTER, if dir or iter are NULL
* ISO_OUT_OF_MEM
*
* @since 0.6.2
*/
int iso_dir_get_children(const IsoDir *dir, IsoDirIter **iter);
/**
* Get the next child.
* Take care that the node is owned by its parent, and will be unref() when
* the parent is freed. If you want your own ref to it, call iso_node_ref()
* on it.
*
* @return
* 1 success, 0 if dir has no more elements, < 0 error
* Possible errors:
* ISO_NULL_POINTER, if node or iter are NULL
* ISO_ERROR, on wrong iter usage, usual caused by modiying the
* dir during iteration
*
* @since 0.6.2
*/
int iso_dir_iter_next(IsoDirIter *iter, IsoNode **node);
/**
* Check if there're more children.
*
* @return
* 1 dir has more elements, 0 no, < 0 error
* Possible errors:
* ISO_NULL_POINTER, if iter is NULL
*
* @since 0.6.2
*/
int iso_dir_iter_has_next(IsoDirIter *iter);
/**
* Free a dir iterator.
*
* @since 0.6.2
*/
void iso_dir_iter_free(IsoDirIter *iter);
/**
* Removes a child from a directory during an iteration, without freeing it.
* It's like iso_node_take(), but to be used during a directory iteration.
* The node removed will be the last returned by the iteration.
*
* If you call this function twice without calling iso_dir_iter_next between
* them is not allowed and you will get an ISO_ERROR in second call.
*
* @return
* 1 on succes, < 0 error
* Possible errors:
* ISO_NULL_POINTER, if iter is NULL
* ISO_ERROR, on wrong iter usage, for example by call this before
* iso_dir_iter_next.
*
* @since 0.6.2
*/
int iso_dir_iter_take(IsoDirIter *iter);
/**
* Removes a child from a directory during an iteration and unref() it.
* Like iso_node_remove(), but to be used during a directory iteration.
* The node removed will be the one returned by the previous iteration.
*
* It is not allowed to call this function twice without calling
* iso_dir_iter_next inbetween.
*
* @return
* 1 on succes, < 0 error
* Possible errors:
* ISO_NULL_POINTER, if iter is NULL
* ISO_ERROR, on wrong iter usage, for example by calling this before
* iso_dir_iter_next.
*
* @since 0.6.2
*/
int iso_dir_iter_remove(IsoDirIter *iter);
/**
* Removes a node by iso_node_remove() or iso_dir_iter_remove(). If the node
* is a directory then the whole tree of nodes underneath is removed too.
*
* @param node
* The node to be removed.
* @param iter
* If not NULL, then the node will be removed by iso_dir_iter_remove(iter)
* else it will be removed by iso_node_remove(node).
* @return
* 1 is success, <0 indicates error
*
* @since 1.0.2
*/
int iso_node_remove_tree(IsoNode *node, IsoDirIter *boss_iter);
/**
* @since 0.6.4
*/
typedef struct iso_find_condition IsoFindCondition;
/**
* Create a new condition that checks if the node name matches the given
* wildcard.
*
* @param wildcard
* @result
* The created IsoFindCondition, NULL on error.
*
* @since 0.6.4
*/
IsoFindCondition *iso_new_find_conditions_name(const char *wildcard);
/**
* Create a new condition that checks the node mode against a mode mask. It
* can be used to check both file type and permissions.
*
* For example:
*
* iso_new_find_conditions_mode(S_IFREG) : search for regular files
* iso_new_find_conditions_mode(S_IFCHR | S_IWUSR) : search for character
* devices where owner has write permissions.
*
* @param mask
* Mode mask to AND against node mode.
* @result
* The created IsoFindCondition, NULL on error.
*
* @since 0.6.4
*/
IsoFindCondition *iso_new_find_conditions_mode(mode_t mask);
/**
* Create a new condition that checks the node gid.
*
* @param gid
* Desired Group Id.
* @result
* The created IsoFindCondition, NULL on error.
*
* @since 0.6.4
*/
IsoFindCondition *iso_new_find_conditions_gid(gid_t gid);
/**
* Create a new condition that checks the node uid.
*
* @param uid
* Desired User Id.
* @result
* The created IsoFindCondition, NULL on error.
*
* @since 0.6.4
*/
IsoFindCondition *iso_new_find_conditions_uid(uid_t uid);
/**
* Possible comparison between IsoNode and given conditions.
*
* @since 0.6.4
*/
enum iso_find_comparisons {
ISO_FIND_COND_GREATER,
ISO_FIND_COND_GREATER_OR_EQUAL,
ISO_FIND_COND_EQUAL,
ISO_FIND_COND_LESS,
ISO_FIND_COND_LESS_OR_EQUAL
};
/**
* Create a new condition that checks the time of last access.
*
* @param time
* Time to compare against IsoNode atime.
* @param comparison
* Comparison to be done between IsoNode atime and submitted time.
* Note that ISO_FIND_COND_GREATER, for example, is true if the node
* time is greater than the submitted time.
* @result
* The created IsoFindCondition, NULL on error.
*
* @since 0.6.4
*/
IsoFindCondition *iso_new_find_conditions_atime(time_t time,
enum iso_find_comparisons comparison);
/**
* Create a new condition that checks the time of last modification.
*
* @param time
* Time to compare against IsoNode mtime.
* @param comparison
* Comparison to be done between IsoNode mtime and submitted time.
* Note that ISO_FIND_COND_GREATER, for example, is true if the node
* time is greater than the submitted time.
* @result
* The created IsoFindCondition, NULL on error.
*
* @since 0.6.4
*/
IsoFindCondition *iso_new_find_conditions_mtime(time_t time,
enum iso_find_comparisons comparison);
/**
* Create a new condition that checks the time of last status change.
*
* @param time
* Time to compare against IsoNode ctime.
* @param comparison
* Comparison to be done between IsoNode ctime and submitted time.
* Note that ISO_FIND_COND_GREATER, for example, is true if the node
* time is greater than the submitted time.
* @result
* The created IsoFindCondition, NULL on error.
*
* @since 0.6.4
*/
IsoFindCondition *iso_new_find_conditions_ctime(time_t time,
enum iso_find_comparisons comparison);
/**
* Create a new condition that check if the two given conditions are
* valid.
*
* @param a
* @param b
* IsoFindCondition to compare
* @result
* The created IsoFindCondition, NULL on error.
*
* @since 0.6.4
*/
IsoFindCondition *iso_new_find_conditions_and(IsoFindCondition *a,
IsoFindCondition *b);
/**
* Create a new condition that check if at least one the two given conditions
* is valid.
*
* @param a
* @param b
* IsoFindCondition to compare
* @result
* The created IsoFindCondition, NULL on error.
*
* @since 0.6.4
*/
IsoFindCondition *iso_new_find_conditions_or(IsoFindCondition *a,
IsoFindCondition *b);
/**
* Create a new condition that check if the given conditions is false.
*
* @param negate
* @result
* The created IsoFindCondition, NULL on error.
*
* @since 0.6.4
*/
IsoFindCondition *iso_new_find_conditions_not(IsoFindCondition *negate);
/**
* Find all directory children that match the given condition.
*
* @param dir
* Directory where we will search children.
* @param cond
* Condition that the children must match in order to be returned.
* It will be free together with the iterator. Remember to delete it
* if this function return error.
* @param iter
* Iterator that returns only the children that match condition.
* @return
* 1 on success, < 0 on error
*
* @since 0.6.4
*/
int iso_dir_find_children(IsoDir* dir, IsoFindCondition *cond,
IsoDirIter **iter);
/**
* Get the destination of a node.
* The returned string belongs to the node and should not be modified nor
* freed. Use strdup if you really need your own copy.
*
* @since 0.6.2
*/
const char *iso_symlink_get_dest(const IsoSymlink *link);
/**
* Set the destination of a link.
*
* @param opts
* The option set to be manipulated
* @param dest
* New destination for the link. It must be a non-empty string, otherwise
* this function doesn't modify previous destination.
* @return
* 1 on success, < 0 on error
*
* @since 0.6.2
*/
int iso_symlink_set_dest(IsoSymlink *link, const char *dest);
/**
* Sets the order in which a node will be written on image. The data content
* of files with high weight will be written to low block addresses.
*
* @param node
* The node which weight will be changed. If it's a dir, this function
* will change the weight of all its children. For nodes other that dirs
* or regular files, this function has no effect.
* @param w
* The weight as a integer number, the greater this value is, the
* closer from the begining of image the file will be written.
* Default value at IsoNode creation is 0.
*
* @since 0.6.2
*/
void iso_node_set_sort_weight(IsoNode *node, int w);
/**
* Get the sort weight of a file.
*
* @since 0.6.2
*/
int iso_file_get_sort_weight(IsoFile *file);
/**
* Get the size of the file, in bytes
*
* @since 0.6.2
*/
off_t iso_file_get_size(IsoFile *file);
/**
* Get the device id (major/minor numbers) of the given block or
* character device file. The result is undefined for other kind
* of special files, of first be sure iso_node_get_mode() returns either
* S_IFBLK or S_IFCHR.
*
* @since 0.6.6
*/
dev_t iso_special_get_dev(IsoSpecial *special);
/**
* Get the IsoStream that represents the contents of the given IsoFile.
* The stream may be a filter stream which itself get its input from a
* further stream. This may be inquired by iso_stream_get_input_stream().
*
* If you iso_stream_open() the stream, iso_stream_close() it before
* image generation begins.
*
* @return
* The IsoStream. No extra ref is added, so the IsoStream belongs to the
* IsoFile, and it may be freed together with it. Add your own ref with
* iso_stream_ref() if you need it.
*
* @since 0.6.4
*/
IsoStream *iso_file_get_stream(IsoFile *file);
/**
* Get the block lba of a file node, if it was imported from an old image.
*
* @param file
* The file
* @param lba
* Will be filled with the kba
* @param flag
* Reserved for future usage, submit 0
* @return
* 1 if lba is valid (file comes from old image), 0 if file was newly
* added, i.e. it does not come from an old image, < 0 error
*
* @since 0.6.4
*
* @deprecated Use iso_file_get_old_image_sections(), as this function does
* not work with multi-extend files.
*/
int iso_file_get_old_image_lba(IsoFile *file, uint32_t *lba, int flag);
/**
* Get the start addresses and the sizes of the data extents of a file node
* if it was imported from an old image.
*
* @param file
* The file
* @param section_count
* Returns the number of extent entries in sections array.
* @param sections
* Returns the array of file sections. Apply free() to dispose it.
* @param flag
* Reserved for future usage, submit 0
* @return
* 1 if there are valid extents (file comes from old image),
* 0 if file was newly added, i.e. it does not come from an old image,
* < 0 error
*
* @since 0.6.8
*/
int iso_file_get_old_image_sections(IsoFile *file, int *section_count,
struct iso_file_section **sections,
int flag);
/*
* Like iso_file_get_old_image_lba(), but take an IsoNode.
*
* @return
* 1 if lba is valid (file comes from old image), 0 if file was newly
* added, i.e. it does not come from an old image, 2 node type has no
* LBA (no regular file), < 0 error
*
* @since 0.6.4
*/
int iso_node_get_old_image_lba(IsoNode *node, uint32_t *lba, int flag);
/**
* Add a new directory to the iso tree. Permissions, owner and hidden atts
* are taken from parent, you can modify them later.
*
* @param parent
* the dir where the new directory will be created
* @param name
* name for the new dir. If a node with same name already exists on
* parent, this functions fails with ISO_NODE_NAME_NOT_UNIQUE.
* @param dir
* place where to store a pointer to the newly created dir. No extra
* ref is addded, so you will need to call iso_node_ref() if you really
* need it. You can pass NULL in this parameter if you don't need the
* pointer.
* @return
* number of nodes in parent if success, < 0 otherwise
* Possible errors:
* ISO_NULL_POINTER, if parent or name are NULL
* ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
* ISO_OUT_OF_MEM
*
* @since 0.6.2
*/
int iso_tree_add_new_dir(IsoDir *parent, const char *name, IsoDir **dir);
/**
* Add a new regular file to the iso tree. Permissions are set to 0444,
* owner and hidden atts are taken from parent. You can modify any of them
* later.
*
* @param parent
* the dir where the new file will be created
* @param name
* name for the new file. If a node with same name already exists on
* parent, this functions fails with ISO_NODE_NAME_NOT_UNIQUE.
* @param stream
* IsoStream for the contents of the file. The reference will be taken
* by the newly created file, you will need to take an extra ref to it
* if you need it.
* @param file
* place where to store a pointer to the newly created file. No extra
* ref is addded, so you will need to call iso_node_ref() if you really
* need it. You can pass NULL in this parameter if you don't need the
* pointer
* @return
* number of nodes in parent if success, < 0 otherwise
* Possible errors:
* ISO_NULL_POINTER, if parent, name or dest are NULL
* ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
* ISO_OUT_OF_MEM
*
* @since 0.6.4
*/
int iso_tree_add_new_file(IsoDir *parent, const char *name, IsoStream *stream,
IsoFile **file);
/**
* Create an IsoStream object from content which is stored in a dynamically
* allocated memory buffer. The new stream will become owner of the buffer
* and apply free() to it when the stream finally gets destroyed itself.
*
* @param buf
* The dynamically allocated memory buffer with the stream content.
* @parm size
* The number of bytes which may be read from buf.
* @param stream
* Will return a reference to the newly created stream.
* @return
* ISO_SUCCESS or <0 for error. E.g. ISO_NULL_POINTER, ISO_OUT_OF_MEM.
*
* @since 1.0.0
*/
int iso_memory_stream_new(unsigned char *buf, size_t size, IsoStream **stream);
/**
* Add a new symlink to the directory tree. Permissions are set to 0777,
* owner and hidden atts are taken from parent. You can modify any of them
* later.
*
* @param parent
* the dir where the new symlink will be created
* @param name
* name for the new symlink. If a node with same name already exists on
* parent, this functions fails with ISO_NODE_NAME_NOT_UNIQUE.
* @param dest
* destination of the link
* @param link
* place where to store a pointer to the newly created link. No extra
* ref is addded, so you will need to call iso_node_ref() if you really
* need it. You can pass NULL in this parameter if you don't need the
* pointer
* @return
* number of nodes in parent if success, < 0 otherwise
* Possible errors:
* ISO_NULL_POINTER, if parent, name or dest are NULL
* ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
* ISO_OUT_OF_MEM
*
* @since 0.6.2
*/
int iso_tree_add_new_symlink(IsoDir *parent, const char *name,
const char *dest, IsoSymlink **link);
/**
* Add a new special file to the directory tree. As far as libisofs concerns,
* an special file is a block device, a character device, a FIFO (named pipe)
* or a socket. You can choose the specific kind of file you want to add
* by setting mode propertly (see man 2 stat).
*
* Note that special files are only written to image when Rock Ridge
* extensions are enabled. Moreover, a special file is just a directory entry
* in the image tree, no data is written beyond that.
*
* Owner and hidden atts are taken from parent. You can modify any of them
* later.
*
* @param parent
* the dir where the new special file will be created
* @param name
* name for the new special file. If a node with same name already exists
* on parent, this functions fails with ISO_NODE_NAME_NOT_UNIQUE.
* @param mode
* file type and permissions for the new node. Note that you can't
* specify any kind of file here, only special types are allowed. i.e,
* S_IFSOCK, S_IFBLK, S_IFCHR and S_IFIFO are valid types; S_IFLNK,
* S_IFREG and S_IFDIR aren't.
* @param dev
* device ID, equivalent to the st_rdev field in man 2 stat.
* @param special
* place where to store a pointer to the newly created special file. No
* extra ref is addded, so you will need to call iso_node_ref() if you
* really need it. You can pass NULL in this parameter if you don't need
* the pointer.
* @return
* number of nodes in parent if success, < 0 otherwise
* Possible errors:
* ISO_NULL_POINTER, if parent, name or dest are NULL
* ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
* ISO_WRONG_ARG_VALUE if you select a incorrect mode
* ISO_OUT_OF_MEM
*
* @since 0.6.2
*/
int iso_tree_add_new_special(IsoDir *parent, const char *name, mode_t mode,
dev_t dev, IsoSpecial **special);
/**
* Set whether to follow or not symbolic links when added a file from a source
* to IsoImage. Default behavior is to not follow symlinks.
*
* @since 0.6.2
*/
void iso_tree_set_follow_symlinks(IsoImage *image, int follow);
/**
* Get current setting for follow_symlinks.
*
* @see iso_tree_set_follow_symlinks
* @since 0.6.2
*/
int iso_tree_get_follow_symlinks(IsoImage *image);
/**
* Set whether to skip or not disk files with names beginning by '.'
* when adding a directory recursively.
* Default behavior is to not ignore them.
*
* Clarification: This is not related to the IsoNode property to be hidden
* in one or more of the resulting image trees as of
* IsoHideNodeFlag and iso_node_set_hidden().
*
* @since 0.6.2
*/
void iso_tree_set_ignore_hidden(IsoImage *image, int skip);
/**
* Get current setting for ignore_hidden.
*
* @see iso_tree_set_ignore_hidden
* @since 0.6.2
*/
int iso_tree_get_ignore_hidden(IsoImage *image);
/**
* Set the replace mode, that defines the behavior of libisofs when adding
* a node whit the same name that an existent one, during a recursive
* directory addition.
*
* @since 0.6.2
*/
void iso_tree_set_replace_mode(IsoImage *image, enum iso_replace_mode mode);
/**
* Get current setting for replace_mode.
*
* @see iso_tree_set_replace_mode
* @since 0.6.2
*/
enum iso_replace_mode iso_tree_get_replace_mode(IsoImage *image);
/**
* Set whether to skip or not special files. Default behavior is to not skip
* them. Note that, despite of this setting, special files will never be added
* to an image unless RR extensions were enabled.
*
* @param image
* The image to manipulate.
* @param skip
* Bitmask to determine what kind of special files will be skipped:
* bit0: ignore FIFOs
* bit1: ignore Sockets
* bit2: ignore char devices
* bit3: ignore block devices
*
* @since 0.6.2
*/
void iso_tree_set_ignore_special(IsoImage *image, int skip);
/**
* Get current setting for ignore_special.
*
* @see iso_tree_set_ignore_special
* @since 0.6.2
*/
int iso_tree_get_ignore_special(IsoImage *image);
/**
* Add a excluded path. These are paths that won't never added to image, and
* will be excluded even when adding recursively its parent directory.
*
* For example, in
*
* iso_tree_add_exclude(image, "/home/user/data/private");
* iso_tree_add_dir_rec(image, root, "/home/user/data");
*
* the directory /home/user/data/private won't be added to image.
*
* However, if you explicity add a deeper dir, it won't be excluded. i.e.,
* in the following example.
*
* iso_tree_add_exclude(image, "/home/user/data");
* iso_tree_add_dir_rec(image, root, "/home/user/data/private");
*
* the directory /home/user/data/private is added. On the other, side, and
* foollowing the the example above,
*
* iso_tree_add_dir_rec(image, root, "/home/user");
*
* will exclude the directory "/home/user/data".
*
* Absolute paths are not mandatory, you can, for example, add a relative
* path such as:
*
* iso_tree_add_exclude(image, "private");
* iso_tree_add_exclude(image, "user/data");
*
* to excluve, respectively, all files or dirs named private, and also all
* files or dirs named data that belong to a folder named "user". Not that the
* above rule about deeper dirs is still valid. i.e., if you call
*
* iso_tree_add_dir_rec(image, root, "/home/user/data/music");
*
* it is included even containing "user/data" string. However, a possible
* "/home/user/data/music/user/data" is not added.
*
* Usual wildcards, such as * or ? are also supported, with the usual meaning
* as stated in "man 7 glob". For example
*
* // to exclude backup text files
* iso_tree_add_exclude(image, "*.~");
*
* @return
* 1 on success, < 0 on error
*
* @since 0.6.2
*/
int iso_tree_add_exclude(IsoImage *image, const char *path);
/**
* Remove a previously added exclude.
*
* @see iso_tree_add_exclude
* @return
* 1 on success, 0 exclude do not exists, < 0 on error
*
* @since 0.6.2
*/
int iso_tree_remove_exclude(IsoImage *image, const char *path);
/**
* Set a callback function that libisofs will call for each file that is
* added to the given image by a recursive addition function. This includes
* image import.
*
* @param image
* The image to manipulate.
* @param report
* pointer to a function that will be called just before a file will be
* added to the image. You can control whether the file will be in fact
* added or ignored.
* This function should return 1 to add the file, 0 to ignore it and
* continue, < 0 to abort the process
* NULL is allowed if you don't want any callback.
*
* @since 0.6.2
*/
void iso_tree_set_report_callback(IsoImage *image,
int (*report)(IsoImage*, IsoFileSource*));
/**
* Add a new node to the image tree, from an existing file.
*
* TODO comment Builder and Filesystem related issues when exposing both
*
* All attributes will be taken from the source file. The appropriate file
* type will be created.
*
* @param image
* The image
* @param parent
* The directory in the image tree where the node will be added.
* @param path
* The absolute path of the file in the local filesystem.
* The node will have the same leaf name as the file on disk.
* Its directory path depends on the parent node.
* @param node
* place where to store a pointer to the newly added file. No
* extra ref is addded, so you will need to call iso_node_ref() if you
* really need it. You can pass NULL in this parameter if you don't need
* the pointer.
* @return
* number of nodes in parent if success, < 0 otherwise
* Possible errors:
* ISO_NULL_POINTER, if image, parent or path are NULL
* ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
* ISO_OUT_OF_MEM
*
* @since 0.6.2
*/
int iso_tree_add_node(IsoImage *image, IsoDir *parent, const char *path,
IsoNode **node);
/**
* This is a more versatile form of iso_tree_add_node which allows to set
* the node name in ISO image already when it gets added.
*
* Add a new node to the image tree, from an existing file, and with the
* given name, that must not exist on dir.
*
* @param image
* The image
* @param parent
* The directory in the image tree where the node will be added.
* @param name
* The leaf name that the node will have on image.
* Its directory path depends on the parent node.
* @param path
* The absolute path of the file in the local filesystem.
* @param node
* place where to store a pointer to the newly added file. No
* extra ref is addded, so you will need to call iso_node_ref() if you
* really need it. You can pass NULL in this parameter if you don't need
* the pointer.
* @return
* number of nodes in parent if success, < 0 otherwise
* Possible errors:
* ISO_NULL_POINTER, if image, parent or path are NULL
* ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
* ISO_OUT_OF_MEM
*
* @since 0.6.4
*/
int iso_tree_add_new_node(IsoImage *image, IsoDir *parent, const char *name,
const char *path, IsoNode **node);
/**
* Add a new node to the image tree with the given name that must not exist
* on dir. The node data content will be a byte interval out of the data
* content of a file in the local filesystem.
*
* @param image
* The image
* @param parent
* The directory in the image tree where the node will be added.
* @param name
* The leaf name that the node will have on image.
* Its directory path depends on the parent node.
* @param path
* The absolute path of the file in the local filesystem. For now
* only regular files and symlinks to regular files are supported.
* @param offset
* Byte number in the given file from where to start reading data.
* @param size
* Max size of the file. This may be more than actually available from
* byte offset to the end of the file in the local filesystem.
* @param node
* place where to store a pointer to the newly added file. No
* extra ref is addded, so you will need to call iso_node_ref() if you
* really need it. You can pass NULL in this parameter if you don't need
* the pointer.
* @return
* number of nodes in parent if success, < 0 otherwise
* Possible errors:
* ISO_NULL_POINTER, if image, parent or path are NULL
* ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
* ISO_OUT_OF_MEM
*
* @since 0.6.4
*/
int iso_tree_add_new_cut_out_node(IsoImage *image, IsoDir *parent,
const char *name, const char *path,
off_t offset, off_t size,
IsoNode **node);
/**
* Create a copy of the given node under a different path. If the node is
* actually a directory then clone its whole subtree.
* This call may fail because an IsoFile is encountered which gets fed by an
* IsoStream which cannot be cloned. See also IsoStream_Iface method
* clone_stream().
* Surely clonable node types are:
* IsoDir,
* IsoSymlink,
* IsoSpecial,
* IsoFile from a loaded ISO image,
* IsoFile referring to local filesystem files,
* IsoFile created by iso_tree_add_new_file
* from a stream created by iso_memory_stream_new(),
* IsoFile created by iso_tree_add_new_cut_out_node()
* Silently ignored are nodes of type IsoBoot.
* An IsoFile node with IsoStream filters can be cloned if all those filters
* are clonable and the node would be clonable without filter.
* Clonable IsoStream filters are created by:
* iso_file_add_zisofs_filter()
* iso_file_add_gzip_filter()
* iso_file_add_external_filter()
* An IsoNode with extended information as of iso_node_add_xinfo() can only be
* cloned if each of the iso_node_xinfo_func instances is associated to a
* clone function. See iso_node_xinfo_make_clonable().
* All internally used classes of extended information are clonable.
*
* @param node
* The node to be cloned.
* @param new_parent
* The existing directory node where to insert the cloned node.
* @param new_name
* The name for the cloned node. It must not yet exist in new_parent,
* unless it is a directory and node is a directory and flag bit0 is set.
* @param new_node
* Will return a pointer (without reference) to the newly created clone.
* @param flag
* Bitfield for control purposes. Submit any undefined bits as 0.
* bit0= Merge directories rather than returning ISO_NODE_NAME_NOT_UNIQUE.
* This will not allow to overwrite any existing node.
* Attributes of existing directories will not be overwritten.
* @return
* <0 means error, 1 = new node created,
* 2 = if flag bit0 is set: new_node is a directory which already existed.
*
* @since 1.0.2
*/
int iso_tree_clone(IsoNode *node,
IsoDir *new_parent, char *new_name, IsoNode **new_node,
int flag);
/**
* Add the contents of a dir to a given directory of the iso tree.
*
* There are several options to control what files are added or how they are
* managed. Take a look at iso_tree_set_* functions to see diferent options
* for recursive directory addition.
*
* TODO comment Builder and Filesystem related issues when exposing both
*
* @param image
* The image to which the directory belongs.
* @param parent
* Directory on the image tree where to add the contents of the dir
* @param dir
* Path to a dir in the filesystem
* @return
* number of nodes in parent if success, < 0 otherwise
*
* @since 0.6.2
*/
int iso_tree_add_dir_rec(IsoImage *image, IsoDir *parent, const char *dir);
/**
* Locate a node by its absolute path on image.
*
* @param image
* The image to which the node belongs.
* @param node
* Location for a pointer to the node, it will filled with NULL if the
* given path does not exists on image.
* The node will be owned by the image and shouldn't be unref(). Just call
* iso_node_ref() to get your own reference to the node.
* Note that you can pass NULL is the only thing you want to do is check
* if a node with such path really exists.
* @return
* 1 found, 0 not found, < 0 error
*
* @since 0.6.2
*/
int iso_tree_path_to_node(IsoImage *image, const char *path, IsoNode **node);
/**
* Get the absolute path on image of the given node.
*
* @return
* The path on the image, that must be freed when no more needed. If the
* given node is not added to any image, this returns NULL.
* @since 0.6.4
*/
char *iso_tree_get_node_path(IsoNode *node);
/**
* Increments the reference counting of the given IsoDataSource.
*
* @since 0.6.2
*/
void iso_data_source_ref(IsoDataSource *src);
/**
* Decrements the reference counting of the given IsoDataSource, freeing it
* if refcount reach 0.
*
* @since 0.6.2
*/
void iso_data_source_unref(IsoDataSource *src);
/**
* Create a new IsoDataSource from a local file. This is suitable for
* accessing regular files or block devices with ISO images.
*
* @param path
* The absolute path of the file
* @param src
* Will be filled with the pointer to the newly created data source.
* @return
* 1 on success, < 0 on error.
*
* @since 0.6.2
*/
int iso_data_source_new_from_file(const char *path, IsoDataSource **src);
/**
* Get the status of the buffer used by a burn_source.
*
* @param b
* A burn_source previously obtained with
* iso_image_create_burn_source().
* @param size
* Will be filled with the total size of the buffer, in bytes
* @param free_bytes
* Will be filled with the bytes currently available in buffer
* @return
* < 0 error, > 0 state:
* 1="active" : input and consumption are active
* 2="ending" : input has ended without error
* 3="failing" : input had error and ended,
* 5="abandoned" : consumption has ended prematurely
* 6="ended" : consumption has ended without input error
* 7="aborted" : consumption has ended after input error
*
* @since 0.6.2
*/
int iso_ring_buffer_get_status(struct burn_source *b, size_t *size,
size_t *free_bytes);
#define ISO_MSGS_MESSAGE_LEN 4096
/**
* Control queueing and stderr printing of messages from libisofs.
* Severity may be one of "NEVER", "FATAL", "SORRY", "WARNING", "HINT",
* "NOTE", "UPDATE", "DEBUG", "ALL".
*
* @param queue_severity Gives the minimum limit for messages to be queued.
* Default: "NEVER". If you queue messages then you
* must consume them by iso_msgs_obtain().
* @param print_severity Does the same for messages to be printed directly
* to stderr.
* @param print_id A text prefix to be printed before the message.
* @return >0 for success, <=0 for error
*
* @since 0.6.2
*/
int iso_set_msgs_severities(char *queue_severity, char *print_severity,
char *print_id);
/**
* Obtain the oldest pending libisofs message from the queue which has at
* least the given minimum_severity. This message and any older message of
* lower severity will get discarded from the queue and is then lost forever.
*
* Severity may be one of "NEVER", "FATAL", "SORRY", "WARNING", "HINT",
* "NOTE", "UPDATE", "DEBUG", "ALL". To call with minimum_severity "NEVER"
* will discard the whole queue.
*
* @param minimum_severity
* Threshhold
* @param error_code
* Will become a unique error code as listed at the end of this header
* @param imgid
* Id of the image that was issued the message.
* @param msg_text
* Must provide at least ISO_MSGS_MESSAGE_LEN bytes.
* @param severity
* Will become the severity related to the message and should provide at
* least 80 bytes.
* @return
* 1 if a matching item was found, 0 if not, <0 for severe errors
*
* @since 0.6.2
*/
int iso_obtain_msgs(char *minimum_severity, int *error_code, int *imgid,
char msg_text[], char severity[]);
/**
* Submit a message to the libisofs queueing system. It will be queued or
* printed as if it was generated by libisofs itself.
*
* @param error_code
* The unique error code of your message.
* Submit 0 if you do not have reserved error codes within the libburnia
* project.
* @param msg_text
* Not more than ISO_MSGS_MESSAGE_LEN characters of message text.
* @param os_errno
* Eventual errno related to the message. Submit 0 if the message is not
* related to a operating system error.
* @param severity
* One of "ABORT", "FATAL", "FAILURE", "SORRY", "WARNING", "HINT", "NOTE",
* "UPDATE", "DEBUG". Defaults to "FATAL".
* @param origin
* Submit 0 for now.
* @return
* 1 if message was delivered, <=0 if failure
*
* @since 0.6.4
*/
int iso_msgs_submit(int error_code, char msg_text[], int os_errno,
char severity[], int origin);
/**
* Convert a severity name into a severity number, which gives the severity
* rank of the name.
*
* @param severity_name
* A name as with iso_msgs_submit(), e.g. "SORRY".
* @param severity_number
* The rank number: the higher, the more severe.
* @return
* >0 success, <=0 failure
*
* @since 0.6.4
*/
int iso_text_to_sev(char *severity_name, int *severity_number);
/**
* Convert a severity number into a severity name
*
* @param severity_number
* The rank number: the higher, the more severe.
* @param severity_name
* A name as with iso_msgs_submit(), e.g. "SORRY".
*
* @since 0.6.4
*/
int iso_sev_to_text(int severity_number, char **severity_name);
/**
* Get the id of an IsoImage, used for message reporting. This message id,
* retrieved with iso_obtain_msgs(), can be used to distinguish what
* IsoImage has isssued a given message.
*
* @since 0.6.2
*/
int iso_image_get_msg_id(IsoImage *image);
/**
* Get a textual description of a libisofs error.
*
* @since 0.6.2
*/
const char *iso_error_to_msg(int errcode);
/**
* Get the severity of a given error code
* @return
* 0x10000000 -> DEBUG
* 0x20000000 -> UPDATE
* 0x30000000 -> NOTE
* 0x40000000 -> HINT
* 0x50000000 -> WARNING
* 0x60000000 -> SORRY
* 0x64000000 -> MISHAP
* 0x68000000 -> FAILURE
* 0x70000000 -> FATAL
* 0x71000000 -> ABORT
*
* @since 0.6.2
*/
int iso_error_get_severity(int e);
/**
* Get the priority of a given error.
* @return
* 0x00000000 -> ZERO
* 0x10000000 -> LOW
* 0x20000000 -> MEDIUM
* 0x30000000 -> HIGH
*
* @since 0.6.2
*/
int iso_error_get_priority(int e);
/**
* Get the message queue code of a libisofs error.
*/
int iso_error_get_code(int e);
/**
* Set the minimum error severity that causes a libisofs operation to
* be aborted as soon as possible.
*
* @param severity
* one of "FAILURE", "MISHAP", "SORRY", "WARNING", "HINT", "NOTE".
* Severities greater or equal than FAILURE always cause program to abort.
* Severities under NOTE won't never cause function abort.
* @return
* Previous abort priority on success, < 0 on error.
*
* @since 0.6.2
*/
int iso_set_abort_severity(char *severity);
/**
* Return the messenger object handle used by libisofs. This handle
* may be used by related libraries to their own compatible
* messenger objects and thus to direct their messages to the libisofs
* message queue. See also: libburn, API function burn_set_messenger().
*
* @return the handle. Do only use with compatible
*
* @since 0.6.2
*/
void *iso_get_messenger();
/**
* Take a ref to the given IsoFileSource.
*
* @since 0.6.2
*/
void iso_file_source_ref(IsoFileSource *src);
/**
* Drop your ref to the given IsoFileSource, eventually freeing the associated
* system resources.
*
* @since 0.6.2
*/
void iso_file_source_unref(IsoFileSource *src);
/*
* this are just helpers to invoque methods in class
*/
/**
* Get the absolute path in the filesystem this file source belongs to.
*
* @return
* the path of the FileSource inside the filesystem, it should be
* freed when no more needed.
*
* @since 0.6.2
*/
char* iso_file_source_get_path(IsoFileSource *src);
/**
* Get the name of the file, with the dir component of the path.
*
* @return
* the name of the file, it should be freed when no more needed.
*
* @since 0.6.2
*/
char* iso_file_source_get_name(IsoFileSource *src);
/**
* Get information about the file.
* @return
* 1 success, < 0 error
* Error codes:
* ISO_FILE_ACCESS_DENIED
* ISO_FILE_BAD_PATH
* ISO_FILE_DOESNT_EXIST
* ISO_OUT_OF_MEM
* ISO_FILE_ERROR
* ISO_NULL_POINTER
*
* @since 0.6.2
*/
int iso_file_source_lstat(IsoFileSource *src, struct stat *info);
/**
* Check if the process has access to read file contents. Note that this
* is not necessarily related with (l)stat functions. For example, in a
* filesystem implementation to deal with an ISO image, if the user has
* read access to the image it will be able to read all files inside it,
* despite of the particular permission of each file in the RR tree, that
* are what the above functions return.
*
* @return
* 1 if process has read access, < 0 on error
* Error codes:
* ISO_FILE_ACCESS_DENIED
* ISO_FILE_BAD_PATH
* ISO_FILE_DOESNT_EXIST
* ISO_OUT_OF_MEM
* ISO_FILE_ERROR
* ISO_NULL_POINTER
*
* @since 0.6.2
*/
int iso_file_source_access(IsoFileSource *src);
/**
* Get information about the file. If the file is a symlink, the info
* returned refers to the destination.
*
* @return
* 1 success, < 0 error
* Error codes:
* ISO_FILE_ACCESS_DENIED
* ISO_FILE_BAD_PATH
* ISO_FILE_DOESNT_EXIST
* ISO_OUT_OF_MEM
* ISO_FILE_ERROR
* ISO_NULL_POINTER
*
* @since 0.6.2
*/
int iso_file_source_stat(IsoFileSource *src, struct stat *info);
/**
* Opens the source.
* @return 1 on success, < 0 on error
* Error codes:
* ISO_FILE_ALREADY_OPENED
* ISO_FILE_ACCESS_DENIED
* ISO_FILE_BAD_PATH
* ISO_FILE_DOESNT_EXIST
* ISO_OUT_OF_MEM
* ISO_FILE_ERROR
* ISO_NULL_POINTER
*
* @since 0.6.2
*/
int iso_file_source_open(IsoFileSource *src);
/**
* Close a previuously openned file
* @return 1 on success, < 0 on error
* Error codes:
* ISO_FILE_ERROR
* ISO_NULL_POINTER
* ISO_FILE_NOT_OPENED
*
* @since 0.6.2
*/
int iso_file_source_close(IsoFileSource *src);
/**
* Attempts to read up to count bytes from the given source into
* the buffer starting at buf.
*
* The file src must be open() before calling this, and close() when no
* more needed. Not valid for dirs. On symlinks it reads the destination
* file.
*
* @param src
* The given source
* @param buf
* Pointer to a buffer of at least count bytes where the read data will be
* stored
* @param count
* Bytes to read
* @return
* number of bytes read, 0 if EOF, < 0 on error
* Error codes:
* ISO_FILE_ERROR
* ISO_NULL_POINTER
* ISO_FILE_NOT_OPENED
* ISO_WRONG_ARG_VALUE -> if count == 0
* ISO_FILE_IS_DIR
* ISO_OUT_OF_MEM
* ISO_INTERRUPTED
*
* @since 0.6.2
*/
int iso_file_source_read(IsoFileSource *src, void *buf, size_t count);
/**
* Repositions the offset of the given IsoFileSource (must be opened) to the
* given offset according to the value of flag.
*
* @param src
* The given source
* @param offset
* in bytes
* @param flag
* 0 The offset is set to offset bytes (SEEK_SET)
* 1 The offset is set to its current location plus offset bytes
* (SEEK_CUR)
* 2 The offset is set to the size of the file plus offset bytes
* (SEEK_END).
* @return
* Absolute offset posistion on the file, or < 0 on error. Cast the
* returning value to int to get a valid libisofs error.
* @since 0.6.4
*/
off_t iso_file_source_lseek(IsoFileSource *src, off_t offset, int flag);
/**
* Read a directory.
*
* Each call to this function will return a new child, until we reach
* the end of file (i.e, no more children), in that case it returns 0.
*
* The dir must be open() before calling this, and close() when no more
* needed. Only valid for dirs.
*
* Note that "." and ".." children MUST NOT BE returned.
*
* @param src
* The given source
* @param child
* pointer to be filled with the given child. Undefined on error or OEF
* @return
* 1 on success, 0 if EOF (no more children), < 0 on error
* Error codes:
* ISO_FILE_ERROR
* ISO_NULL_POINTER
* ISO_FILE_NOT_OPENED
* ISO_FILE_IS_NOT_DIR
* ISO_OUT_OF_MEM
*
* @since 0.6.2
*/
int iso_file_source_readdir(IsoFileSource *src, IsoFileSource **child);
/**
* Read the destination of a symlink. You don't need to open the file
* to call this.
*
* @param src
* An IsoFileSource corresponding to a symbolic link.
* @param buf
* Allocated buffer of at least bufsiz bytes.
* The destination string will be copied there, and it will be 0-terminated
* if the return value indicates success or ISO_RR_PATH_TOO_LONG.
* @param bufsiz
* Maximum number of buf characters + 1. The string will be truncated if
* it is larger than bufsiz - 1 and ISO_RR_PATH_TOO_LONG. will be returned.
* @return
* 1 on success, < 0 on error
* Error codes:
* ISO_FILE_ERROR
* ISO_NULL_POINTER
* ISO_WRONG_ARG_VALUE -> if bufsiz <= 0
* ISO_FILE_IS_NOT_SYMLINK
* ISO_OUT_OF_MEM
* ISO_FILE_BAD_PATH
* ISO_FILE_DOESNT_EXIST
* ISO_RR_PATH_TOO_LONG (@since 1.0.6)
*
* @since 0.6.2
*/
int iso_file_source_readlink(IsoFileSource *src, char *buf, size_t bufsiz);
/**
* Get the AAIP string with encoded ACL and xattr.
* (Not to be confused with ECMA-119 Extended Attributes).
* @param src The file source object to be inquired.
* @param aa_string Returns a pointer to the AAIP string data. If no AAIP
* string is available, *aa_string becomes NULL.
* (See doc/susp_aaip_2_0.txt for the meaning of AAIP.)
* The caller is responsible for finally calling free()
* on non-NULL results.
* @param flag Bitfield for control purposes
* bit0= Transfer ownership of AAIP string data.
* src will free the eventual cached data and might
* not be able to produce it again.
* bit1= No need to get ACL (but no guarantee of exclusion)
* bit2= No need to get xattr (but no guarantee of exclusion)
* @return 1 means success (*aa_string == NULL is possible)
* <0 means failure and must b a valid libisofs error code
* (e.g. ISO_FILE_ERROR if no better one can be found).
* @since 0.6.14
*/
int iso_file_source_get_aa_string(IsoFileSource *src,
unsigned char **aa_string, int flag);
/**
* Get the filesystem for this source. No extra ref is added, so you
* musn't unref the IsoFilesystem.
*
* @return
* The filesystem, NULL on error
*
* @since 0.6.2
*/
IsoFilesystem* iso_file_source_get_filesystem(IsoFileSource *src);
/**
* Take a ref to the given IsoFilesystem
*
* @since 0.6.2
*/
void iso_filesystem_ref(IsoFilesystem *fs);
/**
* Drop your ref to the given IsoFilesystem, evetually freeing associated
* resources.
*
* @since 0.6.2
*/
void iso_filesystem_unref(IsoFilesystem *fs);
/**
* Create a new IsoFilesystem to access a existent ISO image.
*
* @param src
* Data source to access data.
* @param opts
* Image read options
* @param msgid
* An image identifer, obtained with iso_image_get_msg_id(), used to
* associated messages issued by the filesystem implementation with an
* existent image. If you are not using this filesystem in relation with
* any image context, just use 0x1fffff as the value for this parameter.
* @param fs
* Will be filled with a pointer to the filesystem that can be used
* to access image contents.
* @param
* 1 on success, < 0 on error
*
* @since 0.6.2
*/
int iso_image_filesystem_new(IsoDataSource *src, IsoReadOpts *opts, int msgid,
IsoImageFilesystem **fs);
/**
* Get the volset identifier for an existent image. The returned string belong
* to the IsoImageFilesystem and shouldn't be free() nor modified.
*
* @since 0.6.2
*/
const char *iso_image_fs_get_volset_id(IsoImageFilesystem *fs);
/**
* Get the volume identifier for an existent image. The returned string belong
* to the IsoImageFilesystem and shouldn't be free() nor modified.
*
* @since 0.6.2
*/
const char *iso_image_fs_get_volume_id(IsoImageFilesystem *fs);
/**
* Get the publisher identifier for an existent image. The returned string
* belong to the IsoImageFilesystem and shouldn't be free() nor modified.
*
* @since 0.6.2
*/
const char *iso_image_fs_get_publisher_id(IsoImageFilesystem *fs);
/**
* Get the data preparer identifier for an existent image. The returned string
* belong to the IsoImageFilesystem and shouldn't be free() nor modified.
*
* @since 0.6.2
*/
const char *iso_image_fs_get_data_preparer_id(IsoImageFilesystem *fs);
/**
* Get the system identifier for an existent image. The returned string belong
* to the IsoImageFilesystem and shouldn't be free() nor modified.
*
* @since 0.6.2
*/
const char *iso_image_fs_get_system_id(IsoImageFilesystem *fs);
/**
* Get the application identifier for an existent image. The returned string
* belong to the IsoImageFilesystem and shouldn't be free() nor modified.
*
* @since 0.6.2
*/
const char *iso_image_fs_get_application_id(IsoImageFilesystem *fs);
/**
* Get the copyright file identifier for an existent image. The returned string
* belong to the IsoImageFilesystem and shouldn't be free() nor modified.
*
* @since 0.6.2
*/
const char *iso_image_fs_get_copyright_file_id(IsoImageFilesystem *fs);
/**
* Get the abstract file identifier for an existent image. The returned string
* belong to the IsoImageFilesystem and shouldn't be free() nor modified.
*
* @since 0.6.2
*/
const char *iso_image_fs_get_abstract_file_id(IsoImageFilesystem *fs);
/**
* Get the biblio file identifier for an existent image. The returned string
* belong to the IsoImageFilesystem and shouldn't be free() nor modified.
*
* @since 0.6.2
*/
const char *iso_image_fs_get_biblio_file_id(IsoImageFilesystem *fs);
/**
* Increment reference count of an IsoStream.
*
* @since 0.6.4
*/
void iso_stream_ref(IsoStream *stream);
/**
* Decrement reference count of an IsoStream, and eventually free it if
* refcount reach 0.
*
* @since 0.6.4
*/
void iso_stream_unref(IsoStream *stream);
/**
* Opens the given stream. Remember to close the Stream before writing the
* image.
*
* @return
* 1 on success, 2 file greater than expected, 3 file smaller than
* expected, < 0 on error
*
* @since 0.6.4
*/
int iso_stream_open(IsoStream *stream);
/**
* Close a previously openned IsoStream.
*
* @return
* 1 on success, < 0 on error
*
* @since 0.6.4
*/
int iso_stream_close(IsoStream *stream);
/**
* Get the size of a given stream. This function should always return the same
* size, even if the underlying source size changes, unless you call
* iso_stream_update_size().
*
* @return
* IsoStream size in bytes
*
* @since 0.6.4
*/
off_t iso_stream_get_size(IsoStream *stream);
/**
* Attempts to read up to count bytes from the given stream into
* the buffer starting at buf.
*
* The stream must be open() before calling this, and close() when no
* more needed.
*
* @return
* number of bytes read, 0 if EOF, < 0 on error
*
* @since 0.6.4
*/
int iso_stream_read(IsoStream *stream, void *buf, size_t count);
/**
* Whether the given IsoStream can be read several times, with the same
* results.
* For example, a regular file is repeatable, you can read it as many
* times as you want. However, a pipe isn't.
*
* This function doesn't take into account if the file has been modified
* between the two reads.
*
* @return
* 1 if stream is repeatable, 0 if not, < 0 on error
*
* @since 0.6.4
*/
int iso_stream_is_repeatable(IsoStream *stream);
/**
* Updates the size of the IsoStream with the current size of the
* underlying source.
*
* @return
* 1 if ok, < 0 on error (has to be a valid libisofs error code),
* 0 if the IsoStream does not support this function.
* @since 0.6.8
*/
int iso_stream_update_size(IsoStream *stream);
/**
* Get an unique identifier for a given IsoStream.
*
* @since 0.6.4
*/
void iso_stream_get_id(IsoStream *stream, unsigned int *fs_id, dev_t *dev_id,
ino_t *ino_id);
/**
* Try to get eventual source path string of a stream. Meaning and availability
* of this string depends on the stream.class . Expect valid results with
* types "fsrc" and "cout". Result formats are
* fsrc: result of file_source_get_path()
* cout: result of file_source_get_path() " " offset " " size
* @param stream
* The stream to be inquired.
* @param flag
* Bitfield for control purposes, unused yet, submit 0
* @return
* A copy of the path string. Apply free() when no longer needed.
* NULL if no path string is available.
*
* @since 0.6.18
*/
char *iso_stream_get_source_path(IsoStream *stream, int flag);
/**
* Compare two streams whether they are based on the same input and will
* produce the same output. If in any doubt, then this comparison will
* indicate no match.
*
* @param s1
* The first stream to compare.
* @param s2
* The second stream to compare.
* @return
* -1 if s1 is smaller s2 , 0 if s1 matches s2 , 1 if s1 is larger s2
* @param flag
* bit0= do not use s1->class->compare() even if available
* (e.g. because iso_stream_cmp_ino(0 is called as fallback
* from said stream->class->compare())
*
* @since 0.6.20
*/
int iso_stream_cmp_ino(IsoStream *s1, IsoStream *s2, int flag);
/**
* Produce a copy of a stream. It must be possible to operate both stream
* objects concurrently. The success of this function depends on the
* existence of a IsoStream_Iface.clone_stream() method with the stream
* and with its eventual subordinate streams.
* See iso_tree_clone() for a list of surely clonable built-in streams.
*
* @param old_stream
* The existing stream object to be copied
* @param new_stream
* Will return a pointer to the copy
* @param flag
* Bitfield for control purposes. Submit 0 for now.
* @return
* >0 means success
* ISO_STREAM_NO_CLONE is issued if no .clone_stream() exists
* other error return values < 0 may occur depending on kind of stream
*
* @since 1.0.2
*/
int iso_stream_clone(IsoStream *old_stream, IsoStream **new_stream, int flag);
/* --------------------------------- AAIP --------------------------------- */
/**
* Function to identify and manage AAIP strings as xinfo of IsoNode.
*
* An AAIP string contains the Attribute List with the xattr and ACL of a node
* in the image tree. It is formatted according to libisofs specification
* AAIP-2.0 and ready to be written into the System Use Area resp. Continuation
* Area of a directory entry in an ISO image.
*
* Applications are not supposed to manipulate AAIP strings directly.
* They should rather make use of the appropriate iso_node_get_* and
* iso_node_set_* calls.
*
* AAIP represents ACLs as xattr with empty name and AAIP-specific binary
* content. Local filesystems may represent ACLs as xattr with names like
* "system.posix_acl_access". libisofs does not interpret those local
* xattr representations of ACL directly but rather uses the ACL interface of
* the local system. By default the local xattr representations of ACL will
* not become part of the AAIP Attribute List via iso_local_get_attrs() and
* not be attached to local files via iso_local_set_attrs().
*
* @since 0.6.14
*/
int aaip_xinfo_func(void *data, int flag);
/**
* The iso_node_xinfo_cloner function which gets associated to aaip_xinfo_func
* by iso_init() resp. iso_init_with_flag() via iso_node_xinfo_make_clonable().
* @since 1.0.2
*/
int aaip_xinfo_cloner(void *old_data, void **new_data, int flag);
/**
* Get the eventual ACLs which are associated with the node.
* The result will be in "long" text form as of man acl resp. acl_to_text().
* Call this function with flag bit15 to finally release the memory
* occupied by an ACL inquiry.
*
* @param node
* The node that is to be inquired.
* @param access_text
* Will return a pointer to the eventual "access" ACL text or NULL if it
* is not available and flag bit 4 is set.
* @param default_text
* Will return a pointer to the eventual "default" ACL or NULL if it
* is not available.
* (GNU/Linux directories can have a "default" ACL which influences
* the permissions of newly created files.)
* @param flag
* Bitfield for control purposes
* bit4= if no "access" ACL is available: return *access_text == NULL
* else: produce ACL from stat(2) permissions
* bit15= free memory and return 1 (node may be NULL)
* @return
* 2 *access_text was produced from stat(2) permissions
* 1 *access_text was produced from ACL of node
* 0 if flag bit4 is set and no ACL is available
* < 0 on error
*
* @since 0.6.14
*/
int iso_node_get_acl_text(IsoNode *node,
char **access_text, char **default_text, int flag);
/**
* Set the ACLs of the given node to the lists in parameters access_text and
* default_text or delete them.
*
* The stat(2) permission bits get updated according to the new "access" ACL if
* neither bit1 of parameter flag is set nor parameter access_text is NULL.
* Note that S_IRWXG permission bits correspond to ACL mask permissions
* if a "mask::" entry exists in the ACL. Only if there is no "mask::" then
* the "group::" entry corresponds to to S_IRWXG.
*
* @param node
* The node that is to be manipulated.
* @param access_text
* The text to be set into effect as "access" ACL. NULL will delete an
* eventually existing "access" ACL of the node.
* @param default_text
* The text to be set into effect as "default" ACL. NULL will delete an
* eventually existing "default" ACL of the node.
* (GNU/Linux directories can have a "default" ACL which influences
* the permissions of newly created files.)
* @param flag
* Bitfield for control purposes
* bit1= ignore text parameters but rather update eventual "access" ACL
* to the stat(2) permissions of node. If no "access" ACL exists,
* then do nothing and return success.
* @return
* > 0 success
* < 0 failure
*
* @since 0.6.14
*/
int iso_node_set_acl_text(IsoNode *node,
char *access_text, char *default_text, int flag);
/**
* Like iso_node_get_permissions but reflecting ACL entry "group::" in S_IRWXG
* rather than ACL entry "mask::". This is necessary if the permissions of a
* node with ACL shall be restored to a filesystem without restoring the ACL.
* The same mapping happens internally when the ACL of a node is deleted.
* If the node has no ACL then the result is iso_node_get_permissions(node).
* @param node
* The node that is to be inquired.
* @return
* Permission bits as of stat(2)
*
* @since 0.6.14
*/
mode_t iso_node_get_perms_wo_acl(const IsoNode *node);
/**
* Get the list of xattr which is associated with the node.
* The resulting data may finally be disposed by a call to this function
* with flag bit15 set, or its components may be freed one-by-one.
* The following values are either NULL or malloc() memory:
* *names, *value_lengths, *values, (*names)[i], (*values)[i]
* with 0 <= i < *num_attrs.
* It is allowed to replace or reallocate those memory items in order to
* to manipulate the attribute list before submitting it to other calls.
*
* If enabled by flag bit0, this list possibly includes the ACLs of the node.
* They are eventually encoded in a pair with empty name. It is not advisable
* to alter the value or name of that pair. One may decide to erase both ACLs
* by deleting this pair or to copy both ACLs by copying the content of this
* pair to an empty named pair of another node.
* For all other ACL purposes use iso_node_get_acl_text().
*
* @param node
* The node that is to be inquired.
* @param num_attrs
* Will return the number of name-value pairs
* @param names
* Will return an array of pointers to 0-terminated names
* @param value_lengths
* Will return an arry with the lenghts of values
* @param values
* Will return an array of pointers to strings of 8-bit bytes
* @param flag
* Bitfield for control purposes
* bit0= obtain eventual ACLs as attribute with empty name
* bit2= with bit0: do not obtain attributes other than ACLs
* bit15= free memory (node may be NULL)
* @return
* 1 = ok (but *num_attrs may be 0)
* < 0 = error
*
* @since 0.6.14
*/
int iso_node_get_attrs(IsoNode *node, size_t *num_attrs,
char ***names, size_t **value_lengths, char ***values, int flag);
/**
* Obtain the value of a particular xattr name. Eventually make a copy of
* that value and add a trailing 0 byte for caller convenience.
* @param node
* The node that is to be inquired.
* @param name
* The xattr name that shall be looked up.
* @param value_length
* Will return the lenght of value
* @param value
* Will return a string of 8-bit bytes. free() it when no longer needed.
* @param flag
* Bitfield for control purposes, unused yet, submit 0
* @return
* 1= name found , 0= name not found , <0 indicates error
*
* @since 0.6.18
*/
int iso_node_lookup_attr(IsoNode *node, char *name,
size_t *value_length, char **value, int flag);
/**
* Set the list of xattr which is associated with the node.
* The data get copied so that you may dispose your input data afterwards.
*
* If enabled by flag bit0 then the submitted list of attributes will not only
* overwrite xattr but also both eventual ACLs of the node. Eventual ACL in
* the submitted list have to reside in an attribute with empty name.
*
* @param node
* The node that is to be manipulated.
* @param num_attrs
* Number of attributes
* @param names
* Array of pointers to 0 terminated name strings
* @param value_lengths
* Array of byte lengths for each value
* @param values
* Array of pointers to the value bytes
* @param flag
* Bitfield for control purposes
* bit0= Do not maintain eventual existing ACL of the node.
* Set eventual new ACL from value of empty name.
* bit1= Do not clear the existing attribute list but merge it with
* the list given by this call.
* The given values override the values of their eventually existing
* names. If no xattr with a given name exists, then it will be
* added as new xattr. So this bit can be used to set a single
* xattr without inquiring any other xattr of the node.
* bit2= Delete the attributes with the given names
* bit3= Allow to affect non-user attributes.
* I.e. those with a non-empty name which does not begin by "user."
* (The empty name is always allowed and governed by bit0.) This
* deletes all previously existing attributes if not bit1 is set.
* @return
* 1 = ok
* < 0 = error
*
* @since 0.6.14
*/
int iso_node_set_attrs(IsoNode *node, size_t num_attrs, char **names,
size_t *value_lengths, char **values, int flag);
/* ----- This is an interface to ACL and xattr of the local filesystem ----- */
/**
* libisofs has an internal system dependent adapter to ACL and xattr
* operations. For the sake of completeness and simplicity it exposes this
* functionality to its applications which might want to get and set ACLs
* from local files.
*/
/**
* Inquire whether local filesystem operations with ACL or xattr are enabled
* inside libisofs. They may be disabled because of compile time decisions.
* E.g. because the operating system does not support these features or
* because libisofs has not yet an adapter to use them.
*
* @param flag
* Bitfield for control purposes
* bit0= inquire availability of ACL
* bit1= inquire availability of xattr
* bit2 - bit7= Reserved for future types.
* It is permissibile to set them to 1 already now.
* bit8 and higher: reserved, submit 0
* @return
* Bitfield corresponding to flag. If bits are set, th
* bit0= ACL adapter is enabled
* bit1= xattr adapter is enabled
* bit2 - bit7= Reserved for future types.
* bit8 and higher: reserved, do not interpret these
*
* @since 1.1.6
*/
int iso_local_attr_support(int flag);
/**
* Get an ACL of the given file in the local filesystem in long text form.
*
* @param disk_path
* Absolute path to the file
* @param text
* Will return a pointer to the ACL text. If not NULL the text will be
* 0 terminated and finally has to be disposed by a call to this function
* with bit15 set.
* @param flag
* Bitfield for control purposes
* bit0= get "default" ACL rather than "access" ACL
* bit4= set *text = NULL and return 2
* if the ACL matches st_mode permissions.
* bit5= in case of symbolic link: inquire link target
* bit15= free text and return 1
* @return
* 1 ok
* 2 ok, trivial ACL found while bit4 is set, *text is NULL
* 0 no ACL manipulation adapter available / ACL not supported on fs
* -1 failure of system ACL service (see errno)
* -2 attempt to inquire ACL of a symbolic link without bit4 or bit5
* resp. with no suitable link target
*
* @since 0.6.14
*/
int iso_local_get_acl_text(char *disk_path, char **text, int flag);
/**
* Set the ACL of the given file in the local filesystem to a given list
* in long text form.
*
* @param disk_path
* Absolute path to the file
* @param text
* The input text (0 terminated, ACL long text form)
* @param flag
* Bitfield for control purposes
* bit0= set "default" ACL rather than "access" ACL
* bit5= in case of symbolic link: manipulate link target
* @return
* > 0 ok
* 0 no ACL manipulation adapter available for desired ACL type
* -1 failure of system ACL service (see errno)
* -2 attempt to manipulate ACL of a symbolic link without bit5
* resp. with no suitable link target
*
* @since 0.6.14
*/
int iso_local_set_acl_text(char *disk_path, char *text, int flag);
/**
* Obtain permissions of a file in the local filesystem which shall reflect
* ACL entry "group::" in S_IRWXG rather than ACL entry "mask::". This is
* necessary if the permissions of a disk file with ACL shall be copied to
* an object which has no ACL.
* @param disk_path
* Absolute path to the local file which may have an "access" ACL or not.
* @param flag
* Bitfield for control purposes
* bit5= in case of symbolic link: inquire link target
* @param st_mode
* Returns permission bits as of stat(2)
* @return
* 1 success
* -1 failure of lstat() resp. stat() (see errno)
*
* @since 0.6.14
*/
int iso_local_get_perms_wo_acl(char *disk_path, mode_t *st_mode, int flag);
/**
* Get xattr and non-trivial ACLs of the given file in the local filesystem.
* The resulting data has finally to be disposed by a call to this function
* with flag bit15 set.
*
* Eventual ACLs will get encoded as attribute pair with empty name if this is
* enabled by flag bit0. An ACL which simply replects stat(2) permissions
* will not be put into the result.
*
* @param disk_path
* Absolute path to the file
* @param num_attrs
* Will return the number of name-value pairs
* @param names
* Will return an array of pointers to 0-terminated names
* @param value_lengths
* Will return an arry with the lenghts of values
* @param values
* Will return an array of pointers to 8-bit values
* @param flag
* Bitfield for control purposes
* bit0= obtain eventual ACLs as attribute with empty name
* bit2= do not obtain attributes other than ACLs
* bit3= do not ignore eventual non-user attributes.
* I.e. those with a name which does not begin by "user."
* bit5= in case of symbolic link: inquire link target
* bit15= free memory
* @return
* 1 ok
* < 0 failure
*
* @since 0.6.14
*/
int iso_local_get_attrs(char *disk_path, size_t *num_attrs, char ***names,
size_t **value_lengths, char ***values, int flag);
/**
* Attach a list of xattr and ACLs to the given file in the local filesystem.
*
* Eventual ACLs have to be encoded as attribute pair with empty name.
*
* @param disk_path
* Absolute path to the file
* @param num_attrs
* Number of attributes
* @param names
* Array of pointers to 0 terminated name strings
* @param value_lengths
* Array of byte lengths for each attribute payload
* @param values
* Array of pointers to the attribute payload bytes
* @param flag
* Bitfield for control purposes
* bit0= do not attach ACLs from an eventual attribute with empty name
* bit3= do not ignore eventual non-user attributes.
* I.e. those with a name which does not begin by "user."
* bit5= in case of symbolic link: manipulate link target
* bit6= @since 1.1.6
tolerate inappropriate presence or absence of
* directory "default" ACL
* @return
* 1 = ok
* < 0 = error
*
* @since 0.6.14
*/
int iso_local_set_attrs(char *disk_path, size_t num_attrs, char **names,
size_t *value_lengths, char **values, int flag);
/* Default in case that the compile environment has no macro PATH_MAX.
*/
#define Libisofs_default_path_maX 4096
/* --------------------------- Filters in General -------------------------- */
/*
* A filter is an IsoStream which uses another IsoStream as input. It gets
* attached to an IsoFile by specialized calls iso_file_add_*_filter() which
* replace its current IsoStream by the filter stream which takes over the
* current IsoStream as input.
* The consequences are:
* iso_file_get_stream() will return the filter stream.
* iso_stream_get_size() will return the (cached) size of the filtered data,
* iso_stream_open() will start eventual child processes,
* iso_stream_close() will kill eventual child processes,
* iso_stream_read() will return filtered data. E.g. as data file content
* during ISO image generation.
*
* There are external filters which run child processes
* iso_file_add_external_filter()
* and internal filters
* iso_file_add_zisofs_filter()
* iso_file_add_gzip_filter()
* which may or may not be available depending on compile time settings and
* installed software packages like libz.
*
* During image generation filters get not in effect if the original IsoStream
* is an "fsrc" stream based on a file in the loaded ISO image and if the
* image generation type is set to 1 by iso_write_opts_set_appendable().
*/
/**
* Delete the top filter stream from a data file. This is the most recent one
* which was added by iso_file_add_*_filter().
* Caution: One should not do this while the IsoStream of the file is opened.
* For now there is no general way to determine this state.
* Filter stream implementations are urged to eventually call .close()
* inside method .free() . This will close the input stream too.
* @param file
* The data file node which shall get rid of one layer of content
* filtering.
* @param flag
* Bitfield for control purposes, unused yet, submit 0.
* @return
* 1 on success, 0 if no filter was present
* <0 on error
*
* @since 0.6.18
*/
int iso_file_remove_filter(IsoFile *file, int flag);
/**
* Obtain the eventual input stream of a filter stream.
* @param stream
* The eventual filter stream to be inquired.
* @param flag
* Bitfield for control purposes. Submit 0 for now.
* @return
* The input stream, if one exists. Elsewise NULL.
* No extra reference to the stream is taken by this call.
*
* @since 0.6.18
*/
IsoStream *iso_stream_get_input_stream(IsoStream *stream, int flag);
/* ---------------------------- External Filters --------------------------- */
/**
* Representation of an external program that shall serve as filter for
* an IsoStream. This object may be shared among many IsoStream objects.
* It is to be created and disposed by the application.
*
* The filter will act as proxy between the original IsoStream of an IsoFile.
* Up to completed image generation it will be run at least twice:
* for IsoStream.class.get_size() and for .open() with subsequent .read().
* So the original IsoStream has to return 1 by its .class.is_repeatable().
* The filter program has to be repeateable too. I.e. it must produce the same
* output on the same input.
*
* @since 0.6.18
*/
struct iso_external_filter_command
{
/* Will indicate future extensions. It has to be 0 for now. */
int version;
/* Tells how many IsoStream objects depend on this command object.
* One may only dispose an IsoExternalFilterCommand when this count is 0.
* Initially this value has to be 0.
*/
int refcount;
/* An optional instance id.
* Set to empty text if no individual name for this object is intended.
*/
char *name;
/* Absolute local filesystem path to the executable program. */
char *path;
/* Tells the number of arguments. */
int argc;
/* NULL terminated list suitable for system call execv(3).
* I.e. argv[0] points to the alleged program name,
* argv[1] to argv[argc] point to program arguments (if argc > 0)
* argv[argc+1] is NULL
*/
char **argv;
/* A bit field which controls behavior variations:
* bit0= Do not install filter if the input has size 0.
* bit1= Do not install filter if the output is not smaller than the input.
* bit2= Do not install filter if the number of output blocks is
* not smaller than the number of input blocks. Block size is 2048.
* Assume that non-empty input yields non-empty output and thus do
* not attempt to attach a filter to files smaller than 2049 bytes.
* bit3= suffix removed rather than added.
* (Removal and adding suffixes is the task of the application.
* This behavior bit serves only as reminder for the application.)
*/
int behavior;
/* The eventual suffix which is supposed to be added to the IsoFile name
* resp. to be removed from the name.
* (This is to be done by the application, not by calls
* iso_file_add_external_filter() or iso_file_remove_filter().
* The value recorded here serves only as reminder for the application.)
*/
char *suffix;
};
typedef struct iso_external_filter_command IsoExternalFilterCommand;
/**
* Install an external filter command on top of the content stream of a data
* file. The filter process must be repeatable. It will be run once by this
* call in order to cache the output size.
* @param file
* The data file node which shall show filtered content.
* @param cmd
* The external program and its arguments which shall do the filtering.
* @param flag
* Bitfield for control purposes, unused yet, submit 0.
* @return
* 1 on success, 2 if filter installation revoked (e.g. cmd.behavior bit1)
* <0 on error
*
* @since 0.6.18
*/
int iso_file_add_external_filter(IsoFile *file, IsoExternalFilterCommand *cmd,
int flag);
/**
* Obtain the IsoExternalFilterCommand which is eventually associated with the
* given stream. (Typically obtained from an IsoFile by iso_file_get_stream()
* or from an IsoStream by iso_stream_get_input_stream()).
* @param stream
* The stream to be inquired.
* @param cmd
* Will return the external IsoExternalFilterCommand. Valid only if
* the call returns 1. This does not increment cmd->refcount.
* @param flag
* Bitfield for control purposes, unused yet, submit 0.
* @return
* 1 on success, 0 if the stream is not an external filter
* <0 on error
*
* @since 0.6.18
*/
int iso_stream_get_external_filter(IsoStream *stream,
IsoExternalFilterCommand **cmd, int flag);
/* ---------------------------- Internal Filters --------------------------- */
/**
* Install a zisofs filter on top of the content stream of a data file.
* zisofs is a compression format which is decompressed by some Linux kernels.
* See also doc/zisofs_format.txt .
* The filter will not be installed if its output size is not smaller than
* the size of the input stream.
* This is only enabled if the use of libz was enabled at compile time.
* @param file
* The data file node which shall show filtered content.
* @param flag
* Bitfield for control purposes
* bit0= Do not install filter if the number of output blocks is
* not smaller than the number of input blocks. Block size is 2048.
* bit1= Install a decompression filter rather than one for compression.
* bit2= Only inquire availability of zisofs filtering. file may be NULL.
* If available return 2, else return error.
* bit3= is reserved for internal use and will be forced to 0
* @return
* 1 on success, 2 if filter available but installation revoked
* <0 on error, e.g. ISO_ZLIB_NOT_ENABLED
*
* @since 0.6.18
*/
int iso_file_add_zisofs_filter(IsoFile *file, int flag);
/**
* Inquire the number of zisofs compression and uncompression filters which
* are in use.
* @param ziso_count
* Will return the number of currently installed compression filters.
* @param osiz_count
* Will return the number of currently installed uncompression filters.
* @param flag
* Bitfield for control purposes, unused yet, submit 0
* @return
* 1 on success, <0 on error
*
* @since 0.6.18
*/
int iso_zisofs_get_refcounts(off_t *ziso_count, off_t *osiz_count, int flag);
/**
* Parameter set for iso_zisofs_set_params().
*
* @since 0.6.18
*/
struct iso_zisofs_ctrl {
/* Set to 0 for this version of the structure */
int version;
/* Compression level for zlib function compress2(). From <zlib.h>:
* "between 0 and 9:
* 1 gives best speed, 9 gives best compression, 0 gives no compression"
* Default is 6.
*/
int compression_level;
/* Log2 of the block size for compression filters. Allowed values are:
* 15 = 32 kiB , 16 = 64 kiB , 17 = 128 kiB
*/
uint8_t block_size_log2;
};
/**
* Set the global parameters for zisofs filtering.
* This is only allowed while no zisofs compression filters are installed.
* i.e. ziso_count returned by iso_zisofs_get_refcounts() has to be 0.
* @param params
* Pointer to a structure with the intended settings.
* @param flag
* Bitfield for control purposes, unused yet, submit 0
* @return
* 1 on success, <0 on error
*
* @since 0.6.18
*/
int iso_zisofs_set_params(struct iso_zisofs_ctrl *params, int flag);
/**
* Get the current global parameters for zisofs filtering.
* @param params
* Pointer to a caller provided structure which shall take the settings.
* @param flag
* Bitfield for control purposes, unused yet, submit 0
* @return
* 1 on success, <0 on error
*
* @since 0.6.18
*/
int iso_zisofs_get_params(struct iso_zisofs_ctrl *params, int flag);
/**
* Check for the given node or for its subtree whether the data file content
* effectively bears zisofs file headers and eventually mark the outcome
* by an xinfo data record if not already marked by a zisofs compressor filter.
* This does not install any filter but only a hint for image generation
* that the already compressed files shall get written with zisofs ZF entries.
* Use this if you insert the compressed reults of program mkzftree from disk
* into the image.
* @param node
* The node which shall be checked and eventually marked.
* @param flag
* Bitfield for control purposes, unused yet, submit 0
* bit0= prepare for a run with iso_write_opts_set_appendable(,1).
* Take into account that files from the imported image
* do not get their content filtered.
* bit1= permission to overwrite existing zisofs_zf_info
* bit2= if no zisofs header is found:
* create xinfo with parameters which indicate no zisofs
* bit3= no tree recursion if node is a directory
* bit4= skip files which stem from the imported image
* @return
* 0= no zisofs data found
* 1= zf xinfo added
* 2= found existing zf xinfo and flag bit1 was not set
* 3= both encountered: 1 and 2
* <0 means error
*
* @since 0.6.18
*/
int iso_node_zf_by_magic(IsoNode *node, int flag);
/**
* Install a gzip or gunzip filter on top of the content stream of a data file.
* gzip is a compression format which is used by programs gzip and gunzip.
* The filter will not be installed if its output size is not smaller than
* the size of the input stream.
* This is only enabled if the use of libz was enabled at compile time.
* @param file
* The data file node which shall show filtered content.
* @param flag
* Bitfield for control purposes
* bit0= Do not install filter if the number of output blocks is
* not smaller than the number of input blocks. Block size is 2048.
* bit1= Install a decompression filter rather than one for compression.
* bit2= Only inquire availability of gzip filtering. file may be NULL.
* If available return 2, else return error.
* bit3= is reserved for internal use and will be forced to 0
* @return
* 1 on success, 2 if filter available but installation revoked
* <0 on error, e.g. ISO_ZLIB_NOT_ENABLED
*
* @since 0.6.18
*/
int iso_file_add_gzip_filter(IsoFile *file, int flag);
/**
* Inquire the number of gzip compression and uncompression filters which
* are in use.
* @param gzip_count
* Will return the number of currently installed compression filters.
* @param gunzip_count
* Will return the number of currently installed uncompression filters.
* @param flag
* Bitfield for control purposes, unused yet, submit 0
* @return
* 1 on success, <0 on error
*
* @since 0.6.18
*/
int iso_gzip_get_refcounts(off_t *gzip_count, off_t *gunzip_count, int flag);
/* ---------------------------- MD5 Checksums --------------------------- */
/* Production and loading of MD5 checksums is controlled by calls
iso_write_opts_set_record_md5() and iso_read_opts_set_no_md5().
For data representation details see doc/checksums.txt .
*/
/**
* Eventually obtain the recorded MD5 checksum of the session which was
* loaded as ISO image. Such a checksum may be stored together with others
* in a contiguous array at the end of the session. The session checksum
* covers the data blocks from address start_lba to address end_lba - 1.
* It does not cover the recorded array of md5 checksums.
* Layout, size, and position of the checksum array is recorded in the xattr
* "isofs.ca" of the session root node.
* @param image
* The image to inquire
* @param start_lba
* Eventually returns the first block address covered by md5
* @param end_lba
* Eventually returns the first block address not covered by md5 any more
* @param md5
* Eventually returns 16 byte of MD5 checksum
* @param flag
* Bitfield for control purposes, unused yet, submit 0
* @return
* 1= md5 found , 0= no md5 available , <0 indicates error
*
* @since 0.6.22
*/
int iso_image_get_session_md5(IsoImage *image, uint32_t *start_lba,
uint32_t *end_lba, char md5[16], int flag);
/**
* Eventually obtain the recorded MD5 checksum of a data file from the loaded
* ISO image. Such a checksum may be stored with others in a contiguous
* array at the end of the loaded session. The data file eventually has an
* xattr "isofs.cx" which gives the index in that array.
* @param image
* The image from which file stems.
* @param file
* The file object to inquire
* @param md5
* Eventually returns 16 byte of MD5 checksum
* @param flag
* Bitfield for control purposes
* bit0= only determine return value, do not touch parameter md5
* @return
* 1= md5 found , 0= no md5 available , <0 indicates error
*
* @since 0.6.22
*/
int iso_file_get_md5(IsoImage *image, IsoFile *file, char md5[16], int flag);
/**
* Read the content of an IsoFile object, compute its MD5 and attach it to
* the IsoFile. It can then be inquired by iso_file_get_md5() and will get
* written into the next session if this is enabled at write time and if the
* image write process does not compute an MD5 from content which it copies.
* So this call can be used to equip nodes from the old image with checksums
* or to make available checksums of newly added files before the session gets
* written.
* @param file
* The file object to read data from and to which to attach the checksum.
* If the file is from the imported image, then its most original stream
* will be checksummed. Else the eventual filter streams will get into
* effect.
* @param flag
* Bitfield for control purposes. Unused yet. Submit 0.
* @return
* 1= ok, MD5 is computed and attached , <0 indicates error
*
* @since 0.6.22
*/
int iso_file_make_md5(IsoFile *file, int flag);
/**
* Check a data block whether it is a libisofs session checksum tag and
* eventually obtain its recorded parameters. These tags get written after
* volume descriptors, directory tree and checksum array and can be detected
* without loading the image tree.
* One may start reading and computing MD5 at the suspected image session
* start and look out for a session tag on the fly. See doc/checksum.txt .
* @param data
* A complete and aligned data block read from an ISO image session.
* @param tag_type
* 0= no tag
* 1= session tag
* 2= superblock tag
* 3= tree tag
* 4= relocated 64 kB superblock tag (at LBA 0 of overwriteable media)
* @param pos
* Returns the LBA where the tag supposes itself to be stored.
* If this does not match the data block LBA then the tag might be
* image data payload and should be ignored for image checksumming.
* @param range_start
* Returns the block address where the session is supposed to start.
* If this does not match the session start on media then the image
* volume descriptors have been been relocated.
* A proper checksum will only emerge if computing started at range_start.
* @param range_size
* Returns the number of blocks beginning at range_start which are
* covered by parameter md5.
* @param next_tag
* Returns the predicted block address of the next tag.
* next_tag is valid only if not 0 and only with return values 2, 3, 4.
* With tag types 2 and 3, reading shall go on sequentially and the MD5
* computation shall continue up to that address.
* With tag type 4, reading shall resume either at LBA 32 for the first
* session or at the given address for the session which is to be loaded
* by default. In both cases the MD5 computation shall be re-started from
* scratch.
* @param md5
* Returns 16 byte of MD5 checksum.
* @param flag
* Bitfield for control purposes:
* bit0-bit7= tag type being looked for
* 0= any checksum tag
* 1= session tag
* 2= superblock tag
* 3= tree tag
* 4= relocated superblock tag
* @return
* 0= not a checksum tag, return parameters are invalid
* 1= checksum tag found, return parameters are valid
* <0= error
* (return parameters are valid with error ISO_MD5_AREA_CORRUPTED
* but not trustworthy because the tag seems corrupted)
*
* @since 0.6.22
*/
int iso_util_decode_md5_tag(char data[2048], int *tag_type, uint32_t *pos,
uint32_t *range_start, uint32_t *range_size,
uint32_t *next_tag, char md5[16], int flag);
/* The following functions allow to do own MD5 computations. E.g for
comparing the result with a recorded checksum.
*/
/**
* Create a MD5 computation context and hand out an opaque handle.
*
* @param md5_context
* Returns the opaque handle. Submitted *md5_context must be NULL or
* point to freeable memory.
* @return
* 1= success , <0 indicates error
*
* @since 0.6.22
*/
int iso_md5_start(void **md5_context);
/**
* Advance the computation of a MD5 checksum by a chunk of data bytes.
*
* @param md5_context
* An opaque handle once returned by iso_md5_start() or iso_md5_clone().
* @param data
* The bytes which shall be processed into to the checksum.
* @param datalen
* The number of bytes to be processed.
* @return
* 1= success , <0 indicates error
*
* @since 0.6.22
*/
int iso_md5_compute(void *md5_context, char *data, int datalen);
/**
* Create a MD5 computation context as clone of an existing one. One may call
* iso_md5_clone(old, &new, 0) and then iso_md5_end(&new, result, 0) in order
* to obtain an intermediate MD5 sum before the computation goes on.
*
* @param old_md5_context
* An opaque handle once returned by iso_md5_start() or iso_md5_clone().
* @param new_md5_context
* Returns the opaque handle to the new MD5 context. Submitted
* *md5_context must be NULL or point to freeable memory.
* @return
* 1= success , <0 indicates error
*
* @since 0.6.22
*/
int iso_md5_clone(void *old_md5_context, void **new_md5_context);
/**
* Obtain the MD5 checksum from a MD5 computation context and dispose this
* context. (If you want to keep the context then call iso_md5_clone() and
* apply iso_md5_end() to the clone.)
*
* @param md5_context
* A pointer to an opaque handle once returned by iso_md5_start() or
* iso_md5_clone(). *md5_context will be set to NULL in this call.
* @param result
* Gets filled with the 16 bytes of MD5 checksum.
* @return
* 1= success , <0 indicates error
*
* @since 0.6.22
*/
int iso_md5_end(void **md5_context, char result[16]);
/**
* Inquire whether two MD5 checksums match. (This is trivial but such a call
* is convenient and completes the interface.)
* @param first_md5
* A MD5 byte string as returned by iso_md5_end()
* @param second_md5
* A MD5 byte string as returned by iso_md5_end()
* @return
* 1= match , 0= mismatch
*
* @since 0.6.22
*/
int iso_md5_match(char first_md5[16], char second_md5[16]);
/************ Error codes and return values for libisofs ********************/
/** successfully execution */
#define ISO_SUCCESS 1
/**
* special return value, it could be or not an error depending on the
* context.
*/
#define ISO_NONE 0
/** Operation canceled (FAILURE,HIGH, -1) */
#define ISO_CANCELED 0xE830FFFF
/** Unknown or unexpected fatal error (FATAL,HIGH, -2) */
#define ISO_FATAL_ERROR 0xF030FFFE
/** Unknown or unexpected error (FAILURE,HIGH, -3) */
#define ISO_ERROR 0xE830FFFD
/** Internal programming error. Please report this bug (FATAL,HIGH, -4) */
#define ISO_ASSERT_FAILURE 0xF030FFFC
/**
* NULL pointer as value for an arg. that doesn't allow NULL (FAILURE,HIGH, -5)
*/
#define ISO_NULL_POINTER 0xE830FFFB
/** Memory allocation error (FATAL,HIGH, -6) */
#define ISO_OUT_OF_MEM 0xF030FFFA
/** Interrupted by a signal (FATAL,HIGH, -7) */
#define ISO_INTERRUPTED 0xF030FFF9
/** Invalid parameter value (FAILURE,HIGH, -8) */
#define ISO_WRONG_ARG_VALUE 0xE830FFF8
/** Can't create a needed thread (FATAL,HIGH, -9) */
#define ISO_THREAD_ERROR 0xF030FFF7
/** Write error (FAILURE,HIGH, -10) */
#define ISO_WRITE_ERROR 0xE830FFF6
/** Buffer read error (FAILURE,HIGH, -11) */
#define ISO_BUF_READ_ERROR 0xE830FFF5
/** Trying to add to a dir a node already added to a dir (FAILURE,HIGH, -64) */
#define ISO_NODE_ALREADY_ADDED 0xE830FFC0
/** Node with same name already exists (FAILURE,HIGH, -65) */
#define ISO_NODE_NAME_NOT_UNIQUE 0xE830FFBF
/** Trying to remove a node that was not added to dir (FAILURE,HIGH, -65) */
#define ISO_NODE_NOT_ADDED_TO_DIR 0xE830FFBE
/** A requested node does not exist (FAILURE,HIGH, -66) */
#define ISO_NODE_DOESNT_EXIST 0xE830FFBD
/**
* Try to set the boot image of an already bootable image (FAILURE,HIGH, -67)
*/
#define ISO_IMAGE_ALREADY_BOOTABLE 0xE830FFBC
/** Trying to use an invalid file as boot image (FAILURE,HIGH, -68) */
#define ISO_BOOT_IMAGE_NOT_VALID 0xE830FFBB
/** Too many boot images (FAILURE,HIGH, -69) */
#define ISO_BOOT_IMAGE_OVERFLOW 0xE830FFBA
/** No boot catalog created yet ((FAILURE,HIGH, -70) */ /* @since 0.6.34 */
#define ISO_BOOT_NO_CATALOG 0xE830FFB9
/**
* Error on file operation (FAILURE,HIGH, -128)
* (take a look at more specified error codes below)
*/
#define ISO_FILE_ERROR 0xE830FF80
/** Trying to open an already opened file (FAILURE,HIGH, -129) */
#define ISO_FILE_ALREADY_OPENED 0xE830FF7F
/* @deprecated use ISO_FILE_ALREADY_OPENED instead */
#define ISO_FILE_ALREADY_OPENNED 0xE830FF7F
/** Access to file is not allowed (FAILURE,HIGH, -130) */
#define ISO_FILE_ACCESS_DENIED 0xE830FF7E
/** Incorrect path to file (FAILURE,HIGH, -131) */
#define ISO_FILE_BAD_PATH 0xE830FF7D
/** The file does not exist in the filesystem (FAILURE,HIGH, -132) */
#define ISO_FILE_DOESNT_EXIST 0xE830FF7C
/** Trying to read or close a file not openned (FAILURE,HIGH, -133) */
#define ISO_FILE_NOT_OPENED 0xE830FF7B
/* @deprecated use ISO_FILE_NOT_OPENED instead */
#define ISO_FILE_NOT_OPENNED ISO_FILE_NOT_OPENED
/** Directory used where no dir is expected (FAILURE,HIGH, -134) */
#define ISO_FILE_IS_DIR 0xE830FF7A
/** Read error (FAILURE,HIGH, -135) */
#define ISO_FILE_READ_ERROR 0xE830FF79
/** Not dir used where a dir is expected (FAILURE,HIGH, -136) */
#define ISO_FILE_IS_NOT_DIR 0xE830FF78
/** Not symlink used where a symlink is expected (FAILURE,HIGH, -137) */
#define ISO_FILE_IS_NOT_SYMLINK 0xE830FF77
/** Can't seek to specified location (FAILURE,HIGH, -138) */
#define ISO_FILE_SEEK_ERROR 0xE830FF76
/** File not supported in ECMA-119 tree and thus ignored (WARNING,MEDIUM, -139) */
#define ISO_FILE_IGNORED 0xD020FF75
/* A file is bigger than supported by used standard (WARNING,MEDIUM, -140) */
#define ISO_FILE_TOO_BIG 0xD020FF74
/* File read error during image creation (MISHAP,HIGH, -141) */
#define ISO_FILE_CANT_WRITE 0xE430FF73
/* Can't convert filename to requested charset (WARNING,MEDIUM, -142) */
#define ISO_FILENAME_WRONG_CHARSET 0xD020FF72
/* This was once a HINT. Deprecated now. */
#define ISO_FILENAME_WRONG_CHARSET_OLD 0xC020FF72
/* File can't be added to the tree (SORRY,HIGH, -143) */
#define ISO_FILE_CANT_ADD 0xE030FF71
/**
* File path break specification constraints and will be ignored
* (WARNING,MEDIUM, -144)
*/
#define ISO_FILE_IMGPATH_WRONG 0xD020FF70
/**
* Offset greater than file size (FAILURE,HIGH, -150)
* @since 0.6.4
*/
#define ISO_FILE_OFFSET_TOO_BIG 0xE830FF6A
/** Charset conversion error (FAILURE,HIGH, -256) */
#define ISO_CHARSET_CONV_ERROR 0xE830FF00
/**
* Too many files to mangle, i.e. we cannot guarantee unique file names
* (FAILURE,HIGH, -257)
*/
#define ISO_MANGLE_TOO_MUCH_FILES 0xE830FEFF
/* image related errors */
/**
* Wrong or damaged Primary Volume Descriptor (FAILURE,HIGH, -320)
* This could mean that the file is not a valid ISO image.
*/
#define ISO_WRONG_PVD 0xE830FEC0
/** Wrong or damaged RR entry (SORRY,HIGH, -321) */
#define ISO_WRONG_RR 0xE030FEBF
/** Unsupported RR feature (SORRY,HIGH, -322) */
#define ISO_UNSUPPORTED_RR 0xE030FEBE
/** Wrong or damaged ECMA-119 (FAILURE,HIGH, -323) */
#define ISO_WRONG_ECMA119 0xE830FEBD
/** Unsupported ECMA-119 feature (FAILURE,HIGH, -324) */
#define ISO_UNSUPPORTED_ECMA119 0xE830FEBC
/** Wrong or damaged El-Torito catalog (WARN,HIGH, -325) */
#define ISO_WRONG_EL_TORITO 0xD030FEBB
/** Unsupported El-Torito feature (WARN,HIGH, -326) */
#define ISO_UNSUPPORTED_EL_TORITO 0xD030FEBA
/** Can't patch an isolinux boot image (SORRY,HIGH, -327) */
#define ISO_ISOLINUX_CANT_PATCH 0xE030FEB9
/** Unsupported SUSP feature (SORRY,HIGH, -328) */
#define ISO_UNSUPPORTED_SUSP 0xE030FEB8
/** Error on a RR entry that can be ignored (WARNING,HIGH, -329) */
#define ISO_WRONG_RR_WARN 0xD030FEB7
/** Error on a RR entry that can be ignored (HINT,MEDIUM, -330) */
#define ISO_SUSP_UNHANDLED 0xC020FEB6
/** Multiple ER SUSP entries found (WARNING,HIGH, -331) */
#define ISO_SUSP_MULTIPLE_ER 0xD030FEB5
/** Unsupported volume descriptor found (HINT,MEDIUM, -332) */
#define ISO_UNSUPPORTED_VD 0xC020FEB4
/** El-Torito related warning (WARNING,HIGH, -333) */
#define ISO_EL_TORITO_WARN 0xD030FEB3
/** Image write cancelled (MISHAP,HIGH, -334) */
#define ISO_IMAGE_WRITE_CANCELED 0xE430FEB2
/** El-Torito image is hidden (WARNING,HIGH, -335) */
#define ISO_EL_TORITO_HIDDEN 0xD030FEB1
/** AAIP info with ACL or xattr in ISO image will be ignored
(NOTE, HIGH, -336) */
#define ISO_AAIP_IGNORED 0xB030FEB0
/** Error with decoding ACL from AAIP info (FAILURE, HIGH, -337) */
#define ISO_AAIP_BAD_ACL 0xE830FEAF
/** Error with encoding ACL for AAIP (FAILURE, HIGH, -338) */
#define ISO_AAIP_BAD_ACL_TEXT 0xE830FEAE
/** AAIP processing for ACL or xattr not enabled at compile time
(FAILURE, HIGH, -339) */
#define ISO_AAIP_NOT_ENABLED 0xE830FEAD
/** Error with decoding AAIP info for ACL or xattr (FAILURE, HIGH, -340) */
#define ISO_AAIP_BAD_AASTRING 0xE830FEAC
/** Error with reading ACL or xattr from local file (FAILURE, HIGH, -341) */
#define ISO_AAIP_NO_GET_LOCAL 0xE830FEAB
/** Error with attaching ACL or xattr to local file (FAILURE, HIGH, -342) */
#define ISO_AAIP_NO_SET_LOCAL 0xE830FEAA
/** Unallowed attempt to set an xattr with non-userspace name
(FAILURE, HIGH, -343) */
#define ISO_AAIP_NON_USER_NAME 0xE830FEA9
/** Too many references on a single IsoExternalFilterCommand
(FAILURE, HIGH, -344) */
#define ISO_EXTF_TOO_OFTEN 0xE830FEA8
/** Use of zlib was not enabled at compile time (FAILURE, HIGH, -345) */
#define ISO_ZLIB_NOT_ENABLED 0xE830FEA7
/** Cannot apply zisofs filter to file >= 4 GiB (FAILURE, HIGH, -346) */
#define ISO_ZISOFS_TOO_LARGE 0xE830FEA6
/** Filter input differs from previous run (FAILURE, HIGH, -347) */
#define ISO_FILTER_WRONG_INPUT 0xE830FEA5
/** zlib compression/decompression error (FAILURE, HIGH, -348) */
#define ISO_ZLIB_COMPR_ERR 0xE830FEA4
/** Input stream is not in zisofs format (FAILURE, HIGH, -349) */
#define ISO_ZISOFS_WRONG_INPUT 0xE830FEA3
/** Cannot set global zisofs parameters while filters exist
(FAILURE, HIGH, -350) */
#define ISO_ZISOFS_PARAM_LOCK 0xE830FEA2
/** Premature EOF of zlib input stream (FAILURE, HIGH, -351) */
#define ISO_ZLIB_EARLY_EOF 0xE830FEA1
/**
* Checksum area or checksum tag appear corrupted (WARNING,HIGH, -352)
* @since 0.6.22
*/
#define ISO_MD5_AREA_CORRUPTED 0xD030FEA0
/**
* Checksum mismatch between checksum tag and data blocks
* (FAILURE, HIGH, -353)
* @since 0.6.22
*/
#define ISO_MD5_TAG_MISMATCH 0xE830FE9F
/**
* Checksum mismatch in System Area, Volume Descriptors, or directory tree.
* (FAILURE, HIGH, -354)
* @since 0.6.22
*/
#define ISO_SB_TREE_CORRUPTED 0xE830FE9E
/**
* Unexpected checksum tag type encountered. (WARNING, HIGH, -355)
* @since 0.6.22
*/
#define ISO_MD5_TAG_UNEXPECTED 0xD030FE9D
/**
* Misplaced checksum tag encountered. (WARNING, HIGH, -356)
* @since 0.6.22
*/
#define ISO_MD5_TAG_MISPLACED 0xD030FE9C
/**
* Checksum tag with unexpected address range encountered.
* (WARNING, HIGH, -357)
* @since 0.6.22
*/
#define ISO_MD5_TAG_OTHER_RANGE 0xD030FE9B
/**
* Detected file content changes while it was written into the image.
* (MISHAP, HIGH, -358)
* @since 0.6.22
*/
#define ISO_MD5_STREAM_CHANGE 0xE430FE9A
/**
* Session does not start at LBA 0. scdbackup checksum tag not written.
* (WARNING, HIGH, -359)
* @since 0.6.24
*/
#define ISO_SCDBACKUP_TAG_NOT_0 0xD030FE99
/**
* The setting of iso_write_opts_set_ms_block() leaves not enough room
* for the prescibed size of iso_write_opts_set_overwrite_buf().
* (FAILURE, HIGH, -360)
* @since 0.6.36
*/
#define ISO_OVWRT_MS_TOO_SMALL 0xE830FE98
/**
* The partition offset is not 0 and leaves not not enough room for
* system area, volume descriptors, and checksum tags of the first tree.
* (FAILURE, HIGH, -361)
*/
#define ISO_PART_OFFST_TOO_SMALL 0xE830FE97
/**
* The ring buffer is smaller than 64 kB + partition offset.
* (FAILURE, HIGH, -362)
*/
#define ISO_OVWRT_FIFO_TOO_SMALL 0xE830FE96
/** Use of libjte was not enabled at compile time (FAILURE, HIGH, -363) */
#define ISO_LIBJTE_NOT_ENABLED 0xE830FE95
/** Failed to start up Jigdo Template Extraction (FAILURE, HIGH, -364) */
#define ISO_LIBJTE_START_FAILED 0xE830FE94
/** Failed to finish Jigdo Template Extraction (FAILURE, HIGH, -365) */
#define ISO_LIBJTE_END_FAILED 0xE830FE93
/** Failed to process file for Jigdo Template Extraction
(MISHAP, HIGH, -366) */
#define ISO_LIBJTE_FILE_FAILED 0xE430FE92
/** Too many MIPS Big Endian boot files given (max. 15) (FAILURE, HIGH, -367)*/
#define ISO_BOOT_TOO_MANY_MIPS 0xE830FE91
/** Boot file missing in image (MISHAP, HIGH, -368) */
#define ISO_BOOT_FILE_MISSING 0xE430FE90
/** Partition number out of range (FAILURE, HIGH, -369) */
#define ISO_BAD_PARTITION_NO 0xE830FE8F
/** Cannot open data file for appended partition (FAILURE, HIGH, -370) */
#define ISO_BAD_PARTITION_FILE 0xE830FE8E
/** May not combine appended partition with non-MBR system area
(FAILURE, HIGH, -371) */
#define ISO_NON_MBR_SYS_AREA 0xE830FE8D
/** Displacement offset leads outside 32 bit range (FAILURE, HIGH, -372) */
#define ISO_DISPLACE_ROLLOVER 0xE830FE8C
/** File name cannot be written into ECMA-119 untranslated
(FAILURE, HIGH, -373) */
#define ISO_NAME_NEEDS_TRANSL 0xE830FE8B
/** Data file input stream object offers no cloning method
(FAILURE, HIGH, -374) */
#define ISO_STREAM_NO_CLONE 0xE830FE8A
/** Extended information class offers no cloning method
(FAILURE, HIGH, -375) */
#define ISO_XINFO_NO_CLONE 0xE830FE89
/** Found copied superblock checksum tag (WARNING, HIGH, -376) */
#define ISO_MD5_TAG_COPIED 0xD030FE88
/** Rock Ridge leaf name too long (FAILURE, HIGH, -377) */
#define ISO_RR_NAME_TOO_LONG 0xE830FE87
/** Reserved Rock Ridge leaf name (FAILURE, HIGH, -378) */
#define ISO_RR_NAME_RESERVED 0xE830FE86
/** Rock Ridge path too long (FAILURE, HIGH, -379) */
#define ISO_RR_PATH_TOO_LONG 0xE830FE85
/** Attribute name cannot be represented (FAILURE, HIGH, -380) */
#define ISO_AAIP_BAD_ATTR_NAME 0xE830FE84
/** ACL text contains multiple entries of user::, group::, other::
(FAILURE, HIGH, -379) */
#define ISO_AAIP_ACL_MULT_OBJ 0xE830FE83
/* Internal developer note:
Place new error codes directly above this comment.
Newly introduced errors must get a message entry in
libisofs/message.c, function iso_error_to_msg()
*/
/* ! PLACE NEW ERROR CODES ABOVE. NOT AFTER THIS LINE ! */
/** Read error occured with IsoDataSource (SORRY,HIGH, -513) */
#define ISO_DATA_SOURCE_SORRY 0xE030FCFF
/** Read error occured with IsoDataSource (MISHAP,HIGH, -513) */
#define ISO_DATA_SOURCE_MISHAP 0xE430FCFF
/** Read error occured with IsoDataSource (FAILURE,HIGH, -513) */
#define ISO_DATA_SOURCE_FAILURE 0xE830FCFF
/** Read error occured with IsoDataSource (FATAL,HIGH, -513) */
#define ISO_DATA_SOURCE_FATAL 0xF030FCFF
/* ! PLACE NEW ERROR CODES SEVERAL LINES ABOVE. NOT HERE ! */
/* ------------------------------------------------------------------------- */
#ifdef LIBISOFS_WITHOUT_LIBBURN
/**
This is a copy from the API of libburn-0.6.0 (under GPL).
It is supposed to be as stable as any overall include of libburn.h.
I.e. if this definition is out of sync then you cannot rely on any
contract that was made with libburn.h.
Libisofs does not need to be linked with libburn at all. But if it is
linked with libburn then it must be libburn-0.4.2 or later.
An application that provides own struct burn_source objects and does not
include libburn/libburn.h has to define LIBISOFS_WITHOUT_LIBBURN before
including libisofs/libisofs.h in order to make this copy available.
*/
/** Data source interface for tracks.
This allows to use arbitrary program code as provider of track input data.
Objects compliant to this interface are either provided by the application
or by API calls of libburn: burn_fd_source_new() , burn_file_source_new(),
and burn_fifo_source_new().
The API calls allow to use any file object as data source. Consider to feed
an eventual custom data stream asynchronously into a pipe(2) and to let
libburn handle the rest.
In this case the following rule applies:
Call burn_source_free() exactly once for every source obtained from
libburn API. You MUST NOT otherwise use or manipulate its components.
In general, burn_source objects can be freed as soon as they are attached
to track objects. The track objects will keep them alive and dispose them
when they are no longer needed. With a fifo burn_source it makes sense to
keep the own reference for inquiring its state while burning is in
progress.
---
The following description of burn_source applies only to application
implemented burn_source objects. You need not to know it for API provided
ones.
If you really implement an own passive data producer by this interface,
then beware: it can do anything and it can spoil everything.
In this case the functions (*read), (*get_size), (*set_size), (*free_data)
MUST be implemented by the application and attached to the object at
creation time.
Function (*read_sub) is allowed to be NULL or it MUST be implemented and
attached.
burn_source.refcount MUST be handled properly: If not exactly as many
references are freed as have been obtained, then either memory leaks or
corrupted memory are the consequence.
All objects which are referred to by *data must be kept existent until
(*free_data) is called via burn_source_free() by the last referer.
*/
struct burn_source {
/** Reference count for the data source. MUST be 1 when a new source
is created and thus the first reference is handed out. Increment
it to take more references for yourself. Use burn_source_free()
to destroy your references to it. */
int refcount;
/** Read data from the source. Semantics like with read(2), but MUST
either deliver the full buffer as defined by size or MUST deliver
EOF (return 0) or failure (return -1) at this call or at the
next following call. I.e. the only incomplete buffer may be the
last one from that source.
libburn will read a single sector by each call to (*read).
The size of a sector depends on BURN_MODE_*. The known range is
2048 to 2352.
If this call is reading from a pipe then it will learn
about the end of data only when that pipe gets closed on the
feeder side. So if the track size is not fixed or if the pipe
delivers less than the predicted amount or if the size is not
block aligned, then burning will halt until the input process
closes the pipe.
IMPORTANT:
If this function pointer is NULL, then the struct burn_source is of
version >= 1 and the job of .(*read)() is done by .(*read_xt)().
See below, member .version.
*/
int (*read)(struct burn_source *, unsigned char *buffer, int size);
/** Read subchannel data from the source (NULL if lib generated)
WARNING: This is an obscure feature with CD raw write modes.
Unless you checked the libburn code for correctness in that aspect
you should not rely on raw writing with own subchannels.
ADVICE: Set this pointer to NULL.
*/
int (*read_sub)(struct burn_source *, unsigned char *buffer, int size);
/** Get the size of the source's data. Return 0 means unpredictable
size. If application provided (*get_size) allows return 0, then
the application MUST provide a fully functional (*set_size).
*/
off_t (*get_size)(struct burn_source *);
/* @since 0.3.2 */
/** Program the reply of (*get_size) to a fixed value. It is advised
to implement this by a attribute off_t fixed_size; in *data .
The read() function does not have to take into respect this fake
setting. It is rather a note of libburn to itself. Eventually
necessary truncation or padding is done in libburn. Truncation
is usually considered a misburn. Padding is considered ok.
libburn is supposed to work even if (*get_size) ignores the
setting by (*set_size). But your application will not be able to
enforce fixed track sizes by burn_track_set_size() and possibly
even padding might be left out.
*/
int (*set_size)(struct burn_source *source, off_t size);
/** Clean up the source specific data. This function will be called
once by burn_source_free() when the last referer disposes the
source.
*/
void (*free_data)(struct burn_source *);
/** Next source, for when a source runs dry and padding is disabled
WARNING: This is an obscure feature. Set to NULL at creation and
from then on leave untouched and uninterpreted.
*/
struct burn_source *next;
/** Source specific data. Here the various source classes express their
specific properties and the instance objects store their individual
management data.
E.g. data could point to a struct like this:
struct app_burn_source
{
struct my_app *app_handle;
... other individual source parameters ...
off_t fixed_size;
};
Function (*free_data) has to be prepared to clean up and free
the struct.
*/
void *data;
/* @since 0.4.2 */
/** Valid only if above member .(*read)() is NULL. This indicates a
version of struct burn_source younger than 0.
From then on, member .version tells which further members exist
in the memory layout of struct burn_source. libburn will only touch
those announced extensions.
Versions:
0 has .(*read)() != NULL, not even .version is present.
1 has .version, .(*read_xt)(), .(*cancel)()
*/
int version;
/** This substitutes for (*read)() in versions above 0. */
int (*read_xt)(struct burn_source *, unsigned char *buffer, int size);
/** Informs the burn_source that the consumer of data prematurely
ended reading. This call may or may not be issued by libburn
before (*free_data)() is called.
*/
int (*cancel)(struct burn_source *source);
};
#endif /* LIBISOFS_WITHOUT_LIBBURN */
/* ----------------------------- Bug Fixes ----------------------------- */
/* currently none being tested */
/* ---------------------------- Improvements --------------------------- */
/* currently none being tested */
/* ---------------------------- Experiments ---------------------------- */
/* Experiment: Write obsolete RR entries with Rock Ridge.
I suspect Solaris wants to see them.
DID NOT HELP: Solaris knows only RRIP_1991A.
#define Libisofs_with_rrip_rR yes
*/
#endif /*LIBISO_LIBISOFS_H_*/
|