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
|
/* */
/* Copyright (C) 2001 International Business Machines */
/* All rights reserved. */
/* */
/* This file is part of the GPFS user library. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following conditions */
/* are met: */
/* */
/* 1. Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the following disclaimer. */
/* 2. Redistributions in binary form must reproduce the above copyright */
/* notice, this list of conditions and the following disclaimer in the */
/* documentation and/or other materials provided with the distribution. */
/* 3. The name of the author may not be used to endorse or promote products */
/* derived from this software without specific prior written */
/* permission. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES */
/* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. */
/* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; */
/* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, */
/* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */
/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF */
/* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* */
/* @(#)42 1.1.15.1 src/avs/fs/mmfs/ts/util/gpfs.h, mmfs, avs_rtac505, rtac5052017d.b 4/7/20 08:36:44 */
/*
* Library calls for GPFS interfaces
*/
#ifndef H_GPFS
#define H_GPFS
#include <stddef.h>
/* Define GPFS_64BIT_INODES to map the default interface definitions
to 64-bit interfaces. Without this define, the 32-bit interface
is the default. Both interfaces are always present, but the
define sets the default. The actual mapping can be found near the
end of this header. */
/* #define GPFS_64BIT_INODES 1 */
#define NFS_IP_SIZE 46
#ifdef __cplusplus
extern "C" {
#endif
#if defined(WIN32) && defined(GPFSDLL)
/* The following errno values either are missing from Windows errno.h or
have a conflicting value. Other errno values (e.g. EPERM) are okay. */
#define GPFS_EALREADY 37 /* Operation already in progress */
#define GPFS_EOPNOTSUPP 45 /* Operation not supported */
#define GPFS_EDQUOT 69 /* Disk quota exceeded */
#define GPFS_ESTALE 9 /* No file system (mapped to EBADF) */
#define GPFS_EFORMAT 19 /* Unformatted media (mapped to ENODEV) */
/* specify the library calling convention */
#define GPFS_API __stdcall
/* On Windows, this is a HANDLE as returned by CreateFile() */
typedef void* gpfs_file_t;
#else /* not gpfs.dll on Windows */
#define GPFS_API
/* On UNIX systems, this is a file descriptor as returned by open() */
typedef int gpfs_file_t;
#endif
typedef unsigned int gpfs_uid_t;
typedef long long gpfs_off64_t;
typedef unsigned long long gpfs_uid64_t;
typedef struct gpfs_timestruc
{
unsigned int tv_sec;
unsigned int tv_nsec;
} gpfs_timestruc_t;
typedef struct gpfs_timestruc64
{
long long tv_sec;
unsigned int tv_nsec;
} gpfs_timestruc64_t;
#define GPFS_SLITE_SIZE_BIT 0x00000001
#define GPFS_SLITE_BLKSIZE_BIT 0x00000002
#define GPFS_SLITE_BLOCKS_BIT 0x00000004
#define GPFS_SLITE_ATIME_BIT 0x00000010
#define GPFS_SLITE_MTIME_BIT 0x00000020
#define GPFS_SLITE_CTIME_BIT 0x00000040
#define GPFS_SLITE_EXACT_BITS 0x00000077
/* Returns "1" if the attribute is requested to be accurate.
(On output, indicates the value returned in statbufP is accurate). */
#define GPFS_SLITE(m) (0 == (m))
#define GPFS_SLITE_SIZET(m) (0 != ((m) & GPFS_SLITE_SIZE_BIT))
#define GPFS_SLITE_BLKSIZE(m) (0 != ((m) & GPFS_SLITE_BLKSIZE_BIT))
#define GPFS_SLITE_BLOCKS(m) (0 != ((m) & GPFS_SLITE_BLOCKS_BIT))
#define GPFS_SLITE_ATIME(m) (0 != ((m) & GPFS_SLITE_ATIME_BIT))
#define GPFS_SLITE_MTIME(m) (0 != ((m) & GPFS_SLITE_MTIME_BIT))
#define GPFS_SLITE_CTIME(m) (0 != ((m) & GPFS_SLITE_CTIME_BIT))
#define GPFS_SLITE_EXACT(m) (GPFS_SLITE_EXACT_BITS == (m))
/* Sets the litemask bit indicating that the attribute should be accurate */
#define GPFS_S_SLITE(m) (m) = 0
#define GPFS_S_SLITE_SIZET(m) (m) |= GPFS_SLITE_SIZE_BIT
#define GPFS_S_SLITE_BLKSIZE(m) (m) |= GPFS_SLITE_BLKSIZE_BIT
#define GPFS_S_SLITE_BLOCKS(m) (m) |= GPFS_SLITE_BLOCKS_BIT
#define GPFS_S_SLITE_ATIME(m) (m) |= GPFS_SLITE_ATIME_BIT
#define GPFS_S_SLITE_MTIME(m) (m) |= GPFS_SLITE_MTIME_BIT
#define GPFS_S_SLITE_CTIME(m) (m) |= GPFS_SLITE_CTIME_BIT
#define GPFS_S_SLITE_EXACT(m) (m) |= GPFS_SLITE_EXACT_BITS
#define GPFS_STATLITE 0
#define GPFS_NOFOLLOW 1
/* Mapping of buffer for gpfs_getacl, gpfs_putacl. */
typedef struct gpfs_opaque_acl
{
int acl_buffer_len; /* INPUT: Total size of buffer (including this field).
OUTPUT: Actual size of the ACL information. */
unsigned short acl_version; /* INPUT: Set to zero.
OUTPUT: Current version of the returned ACL. */
unsigned char acl_type; /* INPUT: Type of ACL: access (1) or default (2). */
char acl_var_data[1]; /* OUTPUT: Remainder of the ACL information. */
} gpfs_opaque_acl_t;
/* ACL types (acl_type field in gpfs_opaque_acl_t or gpfs_acl_t) */
#define GPFS_ACL_TYPE_ACCESS 1
#define GPFS_ACL_TYPE_DEFAULT 2
#define GPFS_ACL_TYPE_NFS4 3
/* gpfs_getacl, gpfs_putacl flag indicating structures instead of the
opaque style data normally used. */
#define GPFS_GETACL_STRUCT 0x00000020
#define GPFS_PUTACL_STRUCT 0x00000020
/* gpfs_getacl, gpfs_putacl flag indicating smbd is the caller */
#define GPFS_ACL_SAMBA 0x00000040
/* Defined values for gpfs_aclVersion_t */
#define GPFS_ACL_VERSION_POSIX 1
#define GPFS_ACL_VERSION_NFS4F 3 /* GPFS_ACL_VERSION_NFS4 plus V4FLAGS */
#define GPFS_ACL_VERSION_NFS4 4
/* Values for gpfs_aclLevel_t */
#define GPFS_ACL_LEVEL_BASE 0 /* compatible with all acl_version values */
#define GPFS_ACL_LEVEL_V4FLAGS 1 /* requires GPFS_ACL_VERSION_NFS4 */
/* Values for gpfs_aceType_t (ACL_VERSION_POSIX) */
#define GPFS_ACL_USER_OBJ 1
#define GPFS_ACL_GROUP_OBJ 2
#define GPFS_ACL_OTHER 3
#define GPFS_ACL_MASK 4
#define GPFS_ACL_USER 5
#define GPFS_ACL_GROUP 6
/* Values for gpfs_acePerm_t (ACL_VERSION_POSIX) */
#define ACL_PERM_EXECUTE 001
#define ACL_PERM_WRITE 002
#define ACL_PERM_READ 004
#define ACL_PERM_CONTROL 010
/* Values for gpfs_aceType_t (ACL_VERSION_NFS4) */
#define ACE4_TYPE_ALLOW 0
#define ACE4_TYPE_DENY 1
#define ACE4_TYPE_AUDIT 2
#define ACE4_TYPE_ALARM 3
/* Values for gpfs_aceFlags_t (ACL_VERSION_NFS4) */
#define ACE4_FLAG_FILE_INHERIT 0x00000001
#define ACE4_FLAG_DIR_INHERIT 0x00000002
#define ACE4_FLAG_NO_PROPAGATE 0x00000004
#define ACE4_FLAG_INHERIT_ONLY 0x00000008
#define ACE4_FLAG_SUCCESSFUL 0x00000010
#define ACE4_FLAG_FAILED 0x00000020
#define ACE4_FLAG_GROUP_ID 0x00000040
#define ACE4_FLAG_INHERITED 0x00000080
/* GPFS-defined flags. Placed in a separate ACL field to avoid
ever running into newly defined NFSv4 flags. */
#define ACE4_IFLAG_SPECIAL_ID 0x80000000
/* Values for gpfs_aceMask_t (ACL_VERSION_NFS4) */
#define ACE4_MASK_READ 0x00000001
#define ACE4_MASK_LIST_DIR 0x00000001
#define ACE4_MASK_WRITE 0x00000002
#define ACE4_MASK_ADD_FILE 0x00000002
#define ACE4_MASK_APPEND 0x00000004
#define ACE4_MASK_ADD_SUBDIR 0x00000004
#define ACE4_MASK_READ_NAMED 0x00000008
#define ACE4_MASK_WRITE_NAMED 0x00000010
#define ACE4_MASK_EXECUTE 0x00000020
/* The rfc doesn't provide a mask equivalent to "search" ("x" on a
* directory in posix), but it also doesn't say that its EXECUTE
* is to have this dual use (even though it does so for other dual
* use permissions such as read/list. Going to make the assumption
* here that the EXECUTE bit has this dual meaning... otherwise
* we're left with no control over search.
*/
#define ACE4_MASK_SEARCH 0x00000020
#define ACE4_MASK_DELETE_CHILD 0x00000040
#define ACE4_MASK_READ_ATTR 0x00000080
#define ACE4_MASK_WRITE_ATTR 0x00000100
#define ACE4_MASK_DELETE 0x00010000
#define ACE4_MASK_READ_ACL 0x00020000
#define ACE4_MASK_WRITE_ACL 0x00040000
#define ACE4_MASK_WRITE_OWNER 0x00080000
#define ACE4_MASK_SYNCHRONIZE 0x00100000
#define ACE4_MASK_ALL 0x001f01ff
/* Values for gpfs_uid_t (ACL_VERSION_NFS4) */
#define ACE4_SPECIAL_OWNER 1
#define ACE4_SPECIAL_GROUP 2
#define ACE4_SPECIAL_EVERYONE 3
/* per-ACL flags imported from a Windows security descriptor object */
#define ACL4_FLAG_OWNER_DEFAULTED 0x00000100
#define ACL4_FLAG_GROUP_DEFAULTED 0x00000200
#define ACL4_FLAG_DACL_PRESENT 0x00000400
#define ACL4_FLAG_DACL_DEFAULTED 0x00000800
#define ACL4_FLAG_SACL_PRESENT 0x00001000
#define ACL4_FLAG_SACL_DEFAULTED 0x00002000
#define ACL4_FLAG_DACL_UNTRUSTED 0x00004000
#define ACL4_FLAG_SERVER_SECURITY 0x00008000
#define ACL4_FLAG_DACL_AUTO_INHERIT_REQ 0x00010000
#define ACL4_FLAG_SACL_AUTO_INHERIT_REQ 0x00020000
#define ACL4_FLAG_DACL_AUTO_INHERITED 0x00040000
#define ACL4_FLAG_SACL_AUTO_INHERITED 0x00080000
#define ACL4_FLAG_DACL_PROTECTED 0x00100000
#define ACL4_FLAG_SACL_PROTECTED 0x00200000
#define ACL4_FLAG_RM_CONTROL_VALID 0x00400000
#define ACL4_FLAG_NULL_DACL 0x00800000
#define ACL4_FLAG_NULL_SACL 0x01000000
#define ACL4_FLAG_VALID_FLAGS 0x01ffff00
/* Externalized ACL defintions */
typedef unsigned int gpfs_aclType_t;
typedef unsigned int gpfs_aclLen_t;
typedef unsigned int gpfs_aclLevel_t;
typedef unsigned int gpfs_aclVersion_t;
typedef unsigned int gpfs_aclCount_t;
typedef unsigned int gpfs_aclFlag_t;
typedef unsigned int gpfs_aceType_t;
typedef unsigned int gpfs_aceFlags_t;
typedef unsigned int gpfs_acePerm_t;
typedef unsigned int gpfs_aceMask_t;
/* A POSIX ACL Entry */
typedef struct gpfs_ace_v1
{
gpfs_aceType_t ace_type; /* POSIX ACE type */
gpfs_uid_t ace_who; /* uid/gid */
gpfs_acePerm_t ace_perm; /* POSIX permissions */
} gpfs_ace_v1_t;
/* An NFSv4 ACL Entry */
typedef struct gpfs_ace_v4
{
gpfs_aceType_t aceType; /* Allow or Deny */
gpfs_aceFlags_t aceFlags; /* Inherit specifications, etc. */
gpfs_aceFlags_t aceIFlags; /* GPFS Internal flags */
gpfs_aceMask_t aceMask; /* NFSv4 mask specification */
gpfs_uid_t aceWho; /* User/Group identification */
} gpfs_ace_v4_t;
/* when GPFS_ACL_VERSION_NFS4, and GPFS_ACL_LEVEL_V4FLAGS */
typedef struct v4Level1_ext /* ACL extension */
{
gpfs_aclFlag_t acl_flags; /* per-ACL flags */
gpfs_ace_v4_t ace_v4[1];
} v4Level1_t;
/* The GPFS ACL */
typedef struct gpfs_acl
{
gpfs_aclLen_t acl_len; /* Total length of this ACL in bytes */
gpfs_aclLevel_t acl_level; /* Reserved (must be zero) */
gpfs_aclVersion_t acl_version; /* POSIX or NFS4 ACL */
gpfs_aclType_t acl_type; /* Access, Default, or NFS4 */
gpfs_aclCount_t acl_nace; /* Number of Entries that follow */
union
{
gpfs_ace_v1_t ace_v1[1]; /* when GPFS_ACL_VERSION_POSIX */
gpfs_ace_v4_t ace_v4[1]; /* when GPFS_ACL_VERSION_NFS4 */
v4Level1_t v4Level1; /* when GPFS_ACL_LEVEL_V4FLAGS */
};
} gpfs_acl_t;
/* NAME: gpfs_getacl()
*
* FUNCTION: Retrieves the ACL information for a file.
*
* The aclP parameter must point to a buffer mapped by either:
* - gpfs_opaque_acl_t (when flags are zero). In this case,
* the opaque data that is intended to be used by a backup
* program (restoreed by passing this data back on a subsequent
* call to gpfs_putacl).
* - gpfs_acl_t (when GPFS_GETACL_STRUCT is specified). In this
* case, the data can be interpreted by the calling application
* (and may be modified and applied to the file by passing it
* to gpfs_putacl...along with the GPFS_PUTACL_STRUCT flag).
*
* On input, the first four bytes of the buffer must contain its
* total size.
*
* Returns: 0 Successful
* -1 Failure
*
* Errno: ENOSYS function not available
* ENOSPC buffer too small to return the entire ACL.
* Needed size is returned in the first four
* bytes of the buffer pointed to by aclP.
* EINVAL Invalid arguments
* ENOTDIR Not on directory
* ENOMEM Out of memory
*/
int GPFS_API
gpfs_getacl(const char *pathname,
int flags,
void *acl);
int GPFS_API
gpfs_getacl_fd(gpfs_file_t fileDesc,
int flags,
void *acl);
/* NAME: gpfs_putacl()
*
* FUNCTION: Sets the ACL information for a file.
* The buffer passed in should contain the ACL data
* that was obtained by a previous call to gpfs_getacl.
*
* Returns: 0 Successful
* -1 Failure
*
* Errno: ENOSYS function not available
* EINVAL Invalid arguments
* ENOTDIR Not on directory
* ENOMEM Out of memory
* EPERM Caller does not hold appropriate privilege
*/
int GPFS_API
gpfs_putacl(const char *pathname,
int flags,
void *acl);
int GPFS_API
gpfs_putacl_fd(gpfs_file_t fileDesc,
int flags,
void *acl);
/* NAME: gpfs_prealloc()
*
* FUNCTION: Preallocate disk storage for a file or directory, starting
* at the specified startOffset and covering at least the number
* of bytes requested by bytesToPrealloc. Allocations are rounded
* to block boundaries (block size can be found in st_blksize
* returned by fstat()), or possibly larger sizes. For files, the
* file descriptor must be open for write, but any existing data
* already present will not be modified. Reading the preallocated
* blocks will return zeros. For directories, the file descriptor
* may be open for read but the caller must have write permission,
* and existing entries are unaffected; startOffset must be zero.
*
* This function implements the behavior of mmchattr when invoked
* with --compact[=minimumEntries]. The minimumEntries value
* specifies both the lower bound on automatic compaction and the
* desired size for pre-allocation. It defaults to zero, meaning
* no pre-allocation and compact the directory as much as
* possible. The mapping between minimumEntries and the
* bytesToPrealloc is given by GPFS_PREALLOC_DIR_SLOT_SIZE, see
* below.
*
* Directory compaction (zero bytesToPrealloc) requires a file
* system supporting V2 directories (format version 1400, v4.1).
* Directories created before upgrading the file system to version
* 4.1, are upgraded from V1 to V2 by this operation even if no
* other change is made. Since v4.2.2, bytesToPrealloc may be
* nonzero effecting pre-allocation by setting a minimum
* compaction size. Prior to v4.2.2 the minimum size of any
* directory is zero.
*
* Returns: 0 Success
* -1 Failure
*
* Errno: ENOSYS No prealloc service available
* EBADF Bad file descriptor
* EINVAL Not a GPFS file
* EINVAL Not a regular file or directory
* EINVAL Directory pre-allocation not supported
* EINVAL startOffset or bytesToPrealloc < 0
* EACCES File not opened for writing
* EACCES Caller does not have write access to directory.
* EDQUOT Quota exceeded
* ENOSPC Not enough space on disk
* EPERM File is in a snapshot
*/
int GPFS_API
gpfs_prealloc(gpfs_file_t fileDesc,
gpfs_off64_t startOffset,
gpfs_off64_t bytesToPrealloc);
/* Directory entries are nominally (assuming compact names of 19 bytes or less)
32 bytes in size. This conversion factor is used in mapping between a
number of entries (for mmchattr) and a size when calling gpfs_prealloc. */
#define GPFS_PREALLOC_DIR_SLOT_SIZE 32 /* for size => bytes per entry */
typedef struct gpfs_winattr
{
gpfs_timestruc_t creationTime;
unsigned int winAttrs; /* values as defined below */
} gpfs_winattr_t;
/* winAttrs values */
#define GPFS_WINATTR_ARCHIVE 0x0001
#define GPFS_WINATTR_COMPRESSED 0x0002
#define GPFS_WINATTR_DEVICE 0x0004
#define GPFS_WINATTR_DIRECTORY 0x0008
#define GPFS_WINATTR_ENCRYPTED 0x0010
#define GPFS_WINATTR_HIDDEN 0x0020
#define GPFS_WINATTR_NORMAL 0x0040
#define GPFS_WINATTR_NOT_CONTENT_INDEXED 0x0080
#define GPFS_WINATTR_OFFLINE 0x0100
#define GPFS_WINATTR_READONLY 0x0200
#define GPFS_WINATTR_REPARSE_POINT 0x0400
#define GPFS_WINATTR_SPARSE_FILE 0x0800
#define GPFS_WINATTR_SYSTEM 0x1000
#define GPFS_WINATTR_TEMPORARY 0x2000
#define GPFS_WINATTR_HAS_STREAMS 0x4000
/* NAME: gpfs_get_winattrs()
* gpfs_get_winattrs_path()
*
* FUNCTION: Returns gpfs_winattr_t attributes
*
* Returns: 0 Success
* -1 Failure
*
* Errno: ENOENT file not found
* EBADF Bad file handle, not a GPFS file
* ENOMEM Memory allocation failed
* EACCESS Permission denied
* EFAULT Bad address provided
* EINVAL Not a regular file
* ENOSYS function not available
*/
int GPFS_API
gpfs_get_winattrs(gpfs_file_t fileDesc, gpfs_winattr_t *attrP);
int GPFS_API
gpfs_get_winattrs_path(const char *pathname, gpfs_winattr_t *attrP);
/* NAME: gpfs_set_winattrs()
* gpfs_set_winattrs_path()
*
* FUNCTION: Sets gpfs_winattr_t attributes (as specified by
* the flags).
*
* Returns: 0 Success
* -1 Failure
*
* Errno: ENOENT file not found
* EBADF Bad file handle, not a GPFS file
* ENOMEM Memory allocation failed
* EACCESS Permission denied
* EFAULT Bad address provided
* EINVAL Not a regular file
* ENOSYS function not available
*/
int GPFS_API
gpfs_set_winattrs(gpfs_file_t fileDesc, int flags, gpfs_winattr_t *attrP);
int GPFS_API
gpfs_set_winattrs_path(const char *pathname, int flags, gpfs_winattr_t *attrP);
/* gpfs_set_winattr flag values */
#define GPFS_WINATTR_SET_CREATION_TIME 0x08
#define GPFS_WINATTR_SET_ATTRS 0x10
/*
* NAME: gpfs_set_times(), gpfs_set_times_path()
*
* FUNCTION: Sets file access time, modified time, change time,
* and/or creation time (as specified by the flags).
*
* Input: flagsfileDesc : file descriptor of the object to set
* pathname : path to a file or directory
* flag : define time value to set
* GPFS_SET_ATIME - set access time
* GPFS_SET_MTIME - set mod. time
* GPFS_SET_CTIME - set change time
* GPFS_SET_CREATION_TIME - set creation time
* GPFS_SET_TIME_NO_FOLLOW - don't follow links
* times : array to times
*
* Returns: 0 Successful
* -1 Failure
*
* Errno: ENOSYS function not available
* EBADF Not a GPFS File
* EINVAL invalid argument
* EACCES Permission denied
* EROFS Filesystem is read only
* ENOENT No such file or directory
*/
typedef gpfs_timestruc_t gpfs_times_vector_t[4];
int GPFS_API
gpfs_set_times(gpfs_file_t fileDesc, int flags, gpfs_times_vector_t times);
int GPFS_API
gpfs_set_times_path(char *pathname, int flags, gpfs_times_vector_t times);
/* gpfs_set_times flag values */
#define GPFS_SET_ATIME 0x01
#define GPFS_SET_MTIME 0x02
#define GPFS_SET_CTIME 0x04
#define GPFS_SET_CREATION_TIME 0x08
#define GPFS_SET_TIME_NO_FOLLOW 0x10
/* NAME: gpfs_set_share()
*
* FUNCTION: Acquire shares
*
* Input: fileDesc : file descriptor
* allow : share type being requested
* GPFS_SHARE_NONE, GPFS_SHARE_READ,
* GPFS_SHARE_WRITE, GPFS_SHARE_BOTH
* deny : share type to deny to others
* GPFS_DENY_NONE, GPFS_DENY_READ,
* GPFS_DENY_WRITE, GPFS_DENY_BOTH
*
* Returns: 0 Success
* -1 Failure
*
* Errno: EBADF Bad file handle
* EINVAL Bad argument given
* EFAULT Bad address provided
* ENOMEM Memory allocation failed
* EACCES share mode not available
* ENOSYS function not available
*/
/* allow/deny specifications */
#define GPFS_SHARE_NONE 0
#define GPFS_SHARE_READ 1
#define GPFS_SHARE_WRITE 2
#define GPFS_SHARE_BOTH 3
#define GPFS_SHARE_ALL 3
#define GPFS_DENY_NONE 0
#define GPFS_DENY_READ 1
#define GPFS_DENY_WRITE 2
#define GPFS_DENY_BOTH 3
#define GPFS_DENY_DELETE 4
#define GPFS_DENY_ALL 7
int GPFS_API
gpfs_set_share(gpfs_file_t fileDesc,
unsigned int share,
unsigned int deny);
/* NAME: gpfs_set_lease()
*
* FUNCTION: Acquire leases for Samba
*
* Input: fileDesc : file descriptor
* leaseType : lease type being requested
* GPFS_LEASE_NONE GPFS_LEASE_READ,
* GPFS_LEASE_WRITE
*
* Returns: 0 Success
* -1 Failure
*
* Errno: EBADF Bad file handle
* EINVAL Bad argument given
* EFAULT Bad address provided
* ENOMEM Memory allocation failed
* EAGAIN lease not available
* EACCES permission denied
* EOPNOTSUPP unsupported leaseType
* ESTALE unmounted file system
* ENOSYS function not available
*/
/* leaseType specifications */
#define GPFS_LEASE_NONE 0
#define GPFS_LEASE_READ 1
#define GPFS_LEASE_WRITE 2
int GPFS_API
gpfs_set_lease(gpfs_file_t fileDesc,
unsigned int leaseType);
/* NAME: gpfs_get_lease()
*
* FUNCTION: Returns the type of lease currently held
*
* Returns: GPFS_LEASE_READ
* GPFS_LEASE_WRITE
* GPFS_LEASE_NONE
*
* Returns: >= 0 Success
* -1 Failure
*
* Errno: EINVAL
*/
int GPFS_API
gpfs_get_lease(gpfs_file_t fileDesc);
/* NAME: gpfs_get_realfilename(), gpfs_get_realfilename_path()
*
* FUNCTION: Interface to get real name of a file.
*
* INPUT: File descriptor, pathname, buffer, bufferlength
* OUTPUT: Real file name stored in file system
*
* Returns: 0 Success
* -1 Failure
*
* Errno: EBADF Bad file handle
* EINVAL Not a regular file
* EFAULT Bad address provided
* ENOSPC buffer too small to return the real file name.
* Needed size is returned in buflen parameter.
* ENOENT File does not exist
* ENOMEM Memory allocation failed
* EACCESS Permission denied
* ENOSYS function not available
*/
int GPFS_API
gpfs_get_realfilename(gpfs_file_t fileDesc,
char *fileNameP,
int *buflen);
int GPFS_API
gpfs_get_realfilename_path(const char *pathname,
char *fileNameP,
int *buflen);
/* NAME: gpfs_ftruncate()
*
* FUNCTION: Interface to truncate a file.
*
* INPUT: File descriptor
* length
* Returns: 0 Successful
* -1 Failure
*
* Errno: ENOSYS function not available
* EBADF Bad file handle
* EBADF Not a GPFS file
* EINVAL Not a regular file
* ENOENT File does not exist
* ENOMEM Memory allocation failed
* EINVAL length < 0
* EACCESS Permission denied
*/
int GPFS_API
gpfs_ftruncate(gpfs_file_t fileDesc, gpfs_off64_t length);
#define GPFS_WIN_CIFS_REGISTERED 0x02000000
typedef struct cifsThreadData_t
{
unsigned int dataLength; /* Total buffer length */
unsigned int share; /* gpfs_set_share declaration */
unsigned int deny; /* gpfs_set_share specification */
unsigned int lease; /* gpfs_set_lease lease type */
unsigned int secInfoFlags; /* Future use. Must be zero */
gpfs_uid_t sdUID; /* Owning user */
gpfs_uid_t sdGID; /* Owning group */
int shareLocked_fd; /* file descriptor with share locks */
unsigned int aclLength ; /* Length of the following ACL */
gpfs_acl_t acl; /* The initial ACL for create/mkdir */
} cifsThreadData_t;
/* NAME: gpfs_register_cifs_export()
*
* FUNCTION: Register a CIFS export process.
*
* INPUT: implicit use of the process ids
*
* Returns: 0 Successful
* ENOSYS function not available
* EACCES cannot establish credentials
* ENOMEM temporary shortage of memory
* EINVAL prior process/thread registrations exist
* EBADF unable to allocate a file descriptor
*/
int GPFS_API
gpfs_register_cifs_export(void);
/* NAME: gpfs_unregister_cifs_export()
*
* FUNCTION: remove a registration for a CIFS export
*
* INPUT: implicit use of the process ids
*
* Returns: 0 Successful
* ENOSYS function not available
* EACCES cannot establish credentials
* ENOMEM temporary shortage of memory
*/
int GPFS_API
gpfs_unregister_cifs_export(void);
/* NAME: gpfs_register_cifs_buffer()
*
* FUNCTION: Register a CIFS thread/buffer combination
*
* INPUT: implicit use of the process and thread ids
* Address of a cifsThreadData_t structure that will include
* a GPFS ACL (GPFS_ACL_VERSION_NFS4/GPFS_ACL_LEVEL_V4FLAGS)
* that can be applied at file/dir creation.
*
* Returns: 0 Successful
* ENOSYS function not available
* EACCES cannot establish credentials
* ENOMEM unable to allocate required memory
* EINVAL no associated process registrion exists
* bad dataLength in buffer.
*/
int GPFS_API
gpfs_register_cifs_buffer(cifsThreadData_t *bufP);
/* NAME: gpfs_unregister_cifs_buffer()
*
* FUNCTION: remove a CIFS thread/buffer registration
*
* INPUT: implicit use of the process and thread ids
*
* Returns: 0 Successful
* ENOSYS function not available
* EACCES cannot establish credentials
* ENOMEM unable to allocate required memory
* EINVAL no associated process registrion exists
*/
int GPFS_API
gpfs_unregister_cifs_buffer(void);
/* NAME: gpfs_lib_init()
*
* FUNCTION: Open GPFS main module device file
*
* INPUT: Flags
* Returns: 0 Successful
* -1 Failure
*
* Errno: ENOSYS Function not available
*/
int GPFS_API
gpfs_lib_init(int flags);
/* NAME: gpfs_lib_term()
*
* FUNCTION: Close GPFS main module device file
*
* INPUT: Flags
* Returns: 0 Successful
* -1 Failure
*
* Errno: ENOSYS Function not available
*/
int GPFS_API
gpfs_lib_term(int flags);
/* Define maximum length of the name for a GPFS named object, such
as a snapshot, storage pool or fileset. The name is a null-terminated
character string, which is not include in the max length */
#define GPFS_MAXNAMLEN 255
/* Define maximum length of the path to a GPFS named object
such as a snapshot or fileset. If the absolute path name exceeds
this limit, then use a relative path name. The path is a null-terminated
character string, which is not included in the max length */
#define GPFS_MAXPATHLEN 1023
/* ASCII code for "GPFS" in the struct statfs f_type field */
#define GPFS_SUPER_MAGIC 0x47504653
/* GPFS inode attributes
gpfs_uid_t - defined above
gpfs_uid64_t - defined above
gpfs_off64_t - defined above
gpfs_mode_t may include gpfs specific values including 0x02000000
To have a gpfs_mode_t be equivalent to a mode_t mask that value out.
*/
typedef unsigned int gpfs_mode_t;
typedef unsigned int gpfs_gid_t;
typedef unsigned long long gpfs_gid64_t;
typedef unsigned int gpfs_ino_t;
typedef unsigned long long gpfs_ino64_t;
typedef unsigned int gpfs_gen_t;
typedef unsigned long long gpfs_gen64_t;
typedef unsigned int gpfs_dev_t;
typedef unsigned int gpfs_mask_t;
typedef unsigned int gpfs_pool_t;
typedef unsigned int gpfs_snapid_t;
typedef unsigned long long gpfs_snapid64_t;
typedef unsigned long long gpfs_fsid64_t[2];
typedef short gpfs_nlink_t;
typedef long long gpfs_nlink64_t;
#if defined(WIN32) || defined(_MS_SUA_)
typedef struct gpfs_stat64
{
gpfs_dev_t st_dev; /* id of device containing file */
gpfs_ino64_t st_ino; /* file inode number */
gpfs_mode_t st_mode; /* access mode */
gpfs_nlink64_t st_nlink; /* number of links */
unsigned int st_flags; /* flag word */
gpfs_uid64_t st_uid; /* owner uid */
gpfs_gid64_t st_gid; /* owner gid */
gpfs_dev_t st_rdev; /* device id (if special file) */
gpfs_off64_t st_size; /* file size in bytes */
gpfs_timestruc64_t st_atime; /* time of last access */
gpfs_timestruc64_t st_mtime; /* time of last data modification */
gpfs_timestruc64_t st_ctime; /* time of last status change */
int st_blksize; /* preferred block size for io */
gpfs_off64_t st_blocks; /* 512 byte blocks of disk held by file */
long long st_fsid; /* file system id */
unsigned int st_type; /* file type */
gpfs_gen64_t st_gen; /* inode generation number */
gpfs_timestruc64_t st_createtime; /* time of creation */
unsigned int st_attrs; /* Windows flags */
} gpfs_stat64_t;
#else
typedef struct stat64 gpfs_stat64_t;
#endif
#if defined(WIN32) || defined(_MS_SUA_)
typedef struct gpfs_statfs64
{
gpfs_off64_t f_blocks; /* total data blocks in file system */
gpfs_off64_t f_bfree; /* free block in fs */
gpfs_off64_t f_bavail; /* free blocks avail to non-superuser */
int f_bsize; /* optimal file system block size */
gpfs_ino64_t f_files; /* total file nodes in file system */
gpfs_ino64_t f_ffree; /* free file nodes in fs */
gpfs_fsid64_t f_fsid; /* file system id */
int f_fsize; /* fundamental file system block size */
int f_sector_size; /* logical disk sector size */
char f_fname[32]; /* file system name (usually mount pt.) */
char f_fpack[32]; /* file system pack name */
int f_name_max; /* maximum component name length for posix */
} gpfs_statfs64_t;
#else
typedef struct statfs64 gpfs_statfs64_t;
#endif
/* Declarations for backwards compatibility. */
typedef gpfs_stat64_t stat64_t;
typedef gpfs_statfs64_t statfs64_t;
/* Define a version number for the directory entry data to allow
future changes in this structure. Careful callers should also use
the d_reclen field for the size of the structure rather than sizeof,
to allow some degree of forward compatibility */
#define GPFS_D_VERSION 1
typedef struct gpfs_direntx
{
int d_version; /* this struct's version */
unsigned short d_reclen; /* actual size of this struct including
null terminated variable length d_name */
unsigned short d_type; /* Types are defined below */
gpfs_ino_t d_ino; /* File inode number */
gpfs_gen_t d_gen; /* Generation number for the inode */
char d_name[256]; /* null terminated variable length name */
} gpfs_direntx_t;
#define GPFS_D64_VERSION 2
typedef struct gpfs_direntx64
{
int d_version; /* this struct's version */
unsigned short d_reclen; /* actual size of this struct including
null terminated variable length d_name */
unsigned short d_type; /* Types are defined below */
gpfs_ino64_t d_ino; /* File inode number */
gpfs_gen64_t d_gen; /* Generation number for the inode */
unsigned int d_flags; /* Flags are defined below */
char d_name[1028]; /* null terminated variable length name */
/* (1020+null+7 byte pad to double word) */
/* to handle up to 255 UTF-8 chars */
} gpfs_direntx64_t;
/* File types for d_type field in gpfs_direntx_t */
#define GPFS_DE_OTHER 0
#define GPFS_DE_FIFO 1
#define GPFS_DE_CHR 2
#define GPFS_DE_DIR 4
#define GPFS_DE_BLK 6
#define GPFS_DE_REG 8
#define GPFS_DE_LNK 10
#define GPFS_DE_SOCK 12
#define GPFS_DE_DEL 16
/* Define flags for gpfs_direntx64_t */
#define GPFS_DEFLAG_NONE 0x0000 /* Default value, no flags set */
#define GPFS_DEFLAG_JUNCTION 0x0001 /* DirEnt is a fileset junction */
#define GPFS_DEFLAG_IJUNCTION 0x0002 /* DirEnt is a inode space junction */
#define GPFS_DEFLAG_ORPHAN 0x0004 /* DirEnt is an orphan (pcache) */
#define GPFS_DEFLAG_CLONE 0x0008 /* DirEnt is a clone child */
#define GPFS_DEFLAG_OBJECT 0x0010 /* DirEnt is for an AFM Object */
#define GPFS_DEFLAG_OBJECT_DIR 0x0020 /* DirEnt is for an AFM Object directory */
/* Define a version number for the iattr data to allow future changes
in this structure. Careful callers should also use the ia_reclen field
for the size of the structure rather than sizeof, to allow some degree
of forward compatibility */
#define GPFS_IA_VERSION 1
#define GPFS_IA64_VERSION 3 /* ver 3 adds ia_repl_xxxx bytes instead of ia_pad2 */
#define GPFS_IA64_RESERVED 4
#define GPFS_IA64_UNUSED 8
typedef struct gpfs_iattr
{
int ia_version; /* this struct version */
int ia_reclen; /* sizeof this structure */
int ia_checksum; /* validity check on iattr struct */
gpfs_mode_t ia_mode; /* access mode; see gpfs_mode_t comment */
gpfs_uid_t ia_uid; /* owner uid */
gpfs_gid_t ia_gid; /* owner gid */
gpfs_ino_t ia_inode; /* file inode number */
gpfs_gen_t ia_gen; /* inode generation number */
gpfs_nlink_t ia_nlink; /* number of links */
short ia_flags; /* Flags (defined below) */
int ia_blocksize; /* preferred block size for io */
gpfs_mask_t ia_mask; /* Initial attribute mask (not used) */
unsigned int ia_pad1; /* reserved space */
gpfs_off64_t ia_size; /* file size in bytes */
gpfs_off64_t ia_blocks; /* 512 byte blocks of disk held by file */
gpfs_timestruc_t ia_atime; /* time of last access */
gpfs_timestruc_t ia_mtime; /* time of last data modification */
gpfs_timestruc_t ia_ctime; /* time of last status change */
gpfs_dev_t ia_rdev; /* id of device */
unsigned int ia_xperm; /* extended attributes (defined below) */
unsigned int ia_modsnapid; /* snapshot id of last modification */
unsigned int ia_filesetid; /* fileset ID */
unsigned int ia_datapoolid; /* storage pool ID for data */
unsigned int ia_pad2; /* reserved space */
} gpfs_iattr_t;
typedef struct gpfs_iattr64
{
int ia_version; /* this struct version */
int ia_reclen; /* sizeof this structure */
int ia_checksum; /* validity check on iattr struct */
gpfs_mode_t ia_mode; /* access mode; see gpfs_mode_t comment */
gpfs_uid64_t ia_uid; /* owner uid */
gpfs_gid64_t ia_gid; /* owner gid */
gpfs_ino64_t ia_inode; /* file inode number */
gpfs_gen64_t ia_gen; /* inode generation number */
gpfs_nlink64_t ia_nlink; /* number of links */
gpfs_off64_t ia_size; /* file size in bytes */
gpfs_off64_t ia_blocks; /* 512 byte blocks of disk held by file */
gpfs_timestruc64_t ia_atime; /* time of last access */
unsigned int ia_winflags; /* windows flags (defined below) */
unsigned int ia_pad1; /* reserved space */
gpfs_timestruc64_t ia_mtime; /* time of last data modification */
unsigned int ia_flags; /* flags (defined below) */
/* next four bytes were ia_pad2 */
unsigned char ia_repl_data; /* data replication factor */
unsigned char ia_repl_data_max; /* data replication max factor */
unsigned char ia_repl_meta; /* meta data replication factor */
unsigned char ia_repl_meta_max; /* meta data replication max factor */
gpfs_timestruc64_t ia_ctime; /* time of last status change */
int ia_blocksize; /* preferred block size for io */
unsigned int ia_pad3; /* reserved space */
gpfs_timestruc64_t ia_createtime; /* creation time */
gpfs_mask_t ia_mask; /* initial attribute mask (not used) */
int ia_pad4; /* reserved space */
unsigned int ia_reserved[GPFS_IA64_RESERVED]; /* reserved space */
unsigned int ia_xperm; /* extended attributes (defined below) */
gpfs_dev_t ia_dev; /* id of device containing file */
gpfs_dev_t ia_rdev; /* device id (if special file) */
unsigned int ia_pcacheflags; /* pcache inode bits */
gpfs_snapid64_t ia_modsnapid; /* snapshot id of last modification */
unsigned int ia_filesetid; /* fileset ID */
unsigned int ia_datapoolid; /* storage pool ID for data */
gpfs_ino64_t ia_inode_space_mask; /* inode space mask of this file system */
/* This value is saved in the iattr structure
during backup and used during restore */
gpfs_off64_t ia_dirminsize; /* dir pre-allocation size in bytes */
unsigned int ia_unused[GPFS_IA64_UNUSED]; /* reserved space */
} gpfs_iattr64_t;
/* Define flags for inode attributes */
#define GPFS_IAFLAG_SNAPDIR 0x0001 /* (obsolete) */
#define GPFS_IAFLAG_USRQUOTA 0x0002 /* inode is a user quota file */
#define GPFS_IAFLAG_GRPQUOTA 0x0004 /* inode is a group quota file */
#define GPFS_IAFLAG_ERROR 0x0008 /* error reading inode */
/* Define flags for inode replication attributes */
#define GPFS_IAFLAG_FILESET_ROOT 0x0010 /* root dir of a fileset */
#define GPFS_IAFLAG_NO_SNAP_RESTORE 0x0020 /* don't restore from snapshots */
#define GPFS_IAFLAG_FILESETQUOTA 0x0040 /* inode is a fileset quota file */
#define GPFS_IAFLAG_COMANAGED 0x0080 /* file data is co-managed */
#define GPFS_IAFLAG_ILLPLACED 0x0100 /* may not be properly placed */
#define GPFS_IAFLAG_REPLMETA 0x0200 /* metadata replication set */
#define GPFS_IAFLAG_REPLDATA 0x0400 /* data replication set */
#define GPFS_IAFLAG_EXPOSED 0x0800 /* may have data on suspended disks */
#define GPFS_IAFLAG_ILLREPLICATED 0x1000 /* may not be properly replicated */
#define GPFS_IAFLAG_UNBALANCED 0x2000 /* may not be properly balanced */
#define GPFS_IAFLAG_DATAUPDATEMISS 0x4000 /* has stale data blocks on
unavailable disk */
#define GPFS_IAFLAG_METAUPDATEMISS 0x8000 /* has stale metadata on
unavailable disk */
#define GPFS_IAFLAG_IMMUTABLE 0x00010000 /* Immutability */
#define GPFS_IAFLAG_INDEFRETENT 0x00020000 /* Indefinite retention */
#define GPFS_IAFLAG_SECUREDELETE 0x00040000 /* Secure deletion */
#define GPFS_IAFLAG_TRUNCMANAGED 0x00080000 /* dmapi truncate event enabled */
#define GPFS_IAFLAG_READMANAGED 0x00100000 /* dmapi read event enabled */
#define GPFS_IAFLAG_WRITEMANAGED 0x00200000 /* dmapi write event enabled */
#define GPFS_IAFLAG_APPENDONLY 0x00400000 /* AppendOnly only */
#define GPFS_IAFLAG_DELETED 0x00800000 /* inode has been deleted */
#define GPFS_IAFLAG_ILLCOMPRESSED 0x01000000 /* may not be properly compressed */
#define GPFS_IAFLAG_FPOILLPLACED 0x02000000 /* may not be properly placed per
FPO attributes (bgf, wad, wadfg) */
#define GPFS_IAFLAG_OBJECT 0x04000000 /* Object directory entry */
#define GPFS_IAFLAG_OBJECT_DIR 0x08000000 /* Object directory */
/* Define flags for window's attributes */
#define GPFS_IWINFLAG_ARCHIVE 0x0001 /* Archive */
#define GPFS_IWINFLAG_HIDDEN 0x0002 /* Hidden */
#define GPFS_IWINFLAG_NOTINDEXED 0x0004 /* Not content indexed */
#define GPFS_IWINFLAG_OFFLINE 0x0008 /* Off-line */
#define GPFS_IWINFLAG_READONLY 0x0010 /* Read-only */
#define GPFS_IWINFLAG_REPARSE 0x0020 /* Reparse point */
#define GPFS_IWINFLAG_SYSTEM 0x0040 /* System */
#define GPFS_IWINFLAG_TEMPORARY 0x0080 /* Temporary */
#define GPFS_IWINFLAG_COMPRESSED 0x0100 /* Compressed */
#define GPFS_IWINFLAG_ENCRYPTED 0x0200 /* Encrypted */
#define GPFS_IWINFLAG_SPARSE 0x0400 /* Sparse file */
#define GPFS_IWINFLAG_HASSTREAMS 0x0800 /* Has streams */
/* Define flags for extended attributes */
#define GPFS_IAXPERM_ACL 0x0001 /* file has acls */
#define GPFS_IAXPERM_XATTR 0x0002 /* file has extended attributes */
#define GPFS_IAXPERM_DMATTR 0x0004 /* file has dm attributes */
#define GPFS_IAXPERM_DOSATTR 0x0008 /* file has non-default dos attrs */
#define GPFS_IAXPERM_RPATTR 0x0010 /* file has restore policy attrs */
/* Define flags for pcache bits defined in the inode */
#define GPFS_ICAFLAG_CACHED 0x0001 /* "cached complete" */
#define GPFS_ICAFLAG_CREATE 0x0002 /* "created" */
#define GPFS_ICAFLAG_DIRTY 0x0004 /* "data dirty" */
#define GPFS_ICAFLAG_LINK 0x0008 /* "hard linked" */
#define GPFS_ICAFLAG_SETATTR 0x0010 /* "attr changed" */
#define GPFS_ICAFLAG_LOCAL 0x0020 /* "local" */
#define GPFS_ICAFLAG_APPEND 0x0040 /* "append" */
#define GPFS_ICAFLAG_STATE 0x0080 /* "has remote state" */
/* Define pointers to interface types */
typedef struct gpfs_fssnap_handle gpfs_fssnap_handle_t;
typedef struct gpfs_iscan gpfs_iscan_t;
typedef struct gpfs_ifile gpfs_ifile_t;
typedef struct gpfs_restore gpfs_restore_t;
typedef struct gpfs_fssnap_id
{
char opaque[48];
} gpfs_fssnap_id_t;
/* Define extended return codes for gpfs backup & restore
calls without an explicit return code will return the value in errno */
#define GPFS_NEW_ERRNO_BASE 185
#define GPFS_E_INVAL_INUM (GPFS_NEW_ERRNO_BASE+0) /* invalid inode number */
#define GPFS_ERRNO_BASE 190
#define GPFS_E_INVAL_FSSNAPID (GPFS_ERRNO_BASE+0) /* invalid fssnap id */
#define GPFS_E_INVAL_ISCAN (GPFS_ERRNO_BASE+1) /* invalid iscan pointer */
#define GPFS_E_INVAL_IFILE (GPFS_ERRNO_BASE+2) /* invalid ifile pointer */
#define GPFS_E_INVAL_IATTR (GPFS_ERRNO_BASE+3) /* invalid iattr structure */
#define GPFS_E_INVAL_RESTORE (GPFS_ERRNO_BASE+4) /* invalid restore pointer */
#define GPFS_E_INVAL_FSSNAPHANDLE (GPFS_ERRNO_BASE+5) /* invalid fssnap handle */
#define GPFS_E_INVAL_SNAPNAME (GPFS_ERRNO_BASE+6) /* invalid snapshot name */
#define GPFS_E_FS_NOT_RESTORABLE (GPFS_ERRNO_BASE+7) /* FS is not clean */
#define GPFS_E_RESTORE_NOT_ENABLED (GPFS_ERRNO_BASE+8) /* Restore was not enabled */
#define GPFS_E_RESTORE_STARTED (GPFS_ERRNO_BASE+9) /* Restore is running */
#define GPFS_E_INVAL_XATTR (GPFS_ERRNO_BASE+10) /* invalid extended
attribute pointer */
/* Define flags parameter for get/put file attributes.
Used by gpfs_fgetattr, gpfs_fputattr, gpfs_fputattrwithpath
gpfs_igetattrsx, gpfs_iputattrsx
and gpfs_lwe_getattrs, gpfs_lwe_putattrs
*/
#define GPFS_ATTRFLAG_DEFAULT 0x0000 /* default behavior */
#define GPFS_ATTRFLAG_NO_PLACEMENT 0x0001 /* exclude file placement attributes */
#define GPFS_ATTRFLAG_IGNORE_POOL 0x0002 /* saved poolid is not valid */
#define GPFS_ATTRFLAG_USE_POLICY 0x0004 /* use restore policy rules to
determine poolid */
#define GPFS_ATTRFLAG_INCL_DMAPI 0x0008 /* Include dmapi attributes */
#define GPFS_ATTRFLAG_FINALIZE_ATTRS 0x0010 /* Finalize immutability attributes */
#define GPFS_ATTRFLAG_SKIP_IMMUTABLE 0x0020 /* Skip immutable attributes */
#define GPFS_ATTRFLAG_INCL_ENCR 0x0040 /* Include encryption attributes */
#define GPFS_ATTRFLAG_SKIP_CLONE 0x0080 /* Skip clone attributes */
#define GPFS_ATTRFLAG_MODIFY_CLONEPARENT 0x0100 /* Allow modification on clone parent */
#define GPFS_ATTRFLAG_NO_COMPRESSED 0x0200 /* exclude "compressed" attribute */
#define GPFS_ATTRFLAG_SKIP_COMPRESSION 0x0400 /* Skip compression attribute */
/* Define structure used by gpfs_statfspool */
typedef struct gpfs_statfspool_s
{
gpfs_off64_t f_blocks; /* total data blocks in pool */
gpfs_off64_t f_bfree; /* free blocks in pool */
gpfs_off64_t f_bavail; /* free blocks avail to non-superuser */
gpfs_off64_t f_mblocks; /* total metadata blocks in pool */
gpfs_off64_t f_mfree; /* free blocks avail for system metadata */
int f_bsize; /* optimal storage pool block size */
int f_files; /* total file nodes assigned to pool */
gpfs_pool_t f_poolid; /* storage pool id */
int f_fsize; /* fundamental file system block size */
unsigned int f_usage; /* data and/or metadata stored in pool */
int f_replica; /* replica */
int f_bgf; /* block group factor */
int f_wad; /* write affinity depth */
int f_allowWriteAffinity; /* allow write affinity depth. 1 means yes */
int f_reserved[3];/* Current unused and set to zero */
} gpfs_statfspool_t;
#define STATFSPOOL_USAGE_DATA 0x0001 /* Pool stores user data */
#define STATFSPOOL_USAGE_METADATA 0x0002 /* Pool stores system metadata */
/* NAME: gpfs_fstat(), gpfs_stat()
*
* FUNCTION: Get exact stat information for a file descriptor (or filename).
* Forces all other nodes to flush dirty data and metadata to disk.
* Returns: 0 Successful
* -1 Failure
*
* Errno: ENOSYS The gpfs_fstat() (or) gpfs_stat() subroutine is not supported
* under the current file system format
* EBADF The file descriptor is not valid.
* EINVAL The file descriptor does not refer to a GPFS file or a
* regular file.
* ESTALE The cached file system information was not valid.
*/
int GPFS_API
gpfs_fstat(gpfs_file_t fileDesc,
gpfs_stat64_t *buffer);
int GPFS_API
gpfs_stat(const char *pathname, /* File pathname */
gpfs_stat64_t *buffer);
/* NAME: gpfs_fstat_x(), gpfs_stat_x()
*
* FUNCTION: Returns extended stat() information with specified accuracy
* for a file descriptor (or filename)
*
* Input: fileDesc : file descriptor or handle
* pathname : path to a file or directory
* iattrBufLen : length of iattr buffer
*
* In/Out: st_litemaskP: bitmask specification of required accuracy
* iattr : buffer for returned stat information
*
* Returns: 0 Successful
* -1 Failure
*
* Errno: ENOSYS function not available
* ENOENT invalid pathname
* EBADF Bad file desc
* EINVAL Not a GPFS file
* ESTALE cached fs information was invalid
*/
int GPFS_API
gpfs_fstat_x(gpfs_file_t fileDesc,
unsigned int *st_litemaskP,
gpfs_iattr64_t *iattr,
size_t iattrBufLen);
int GPFS_API
gpfs_stat_x(const char *pathname, /* File pathname */
unsigned int *st_litemaskP,
gpfs_iattr64_t *iattr,
size_t iattrBufLen);
/* NAME: gpfs_statfs64()
*
* FUNCTION: Get information about the file system.
*
* Returns: 0 Successful
* -1 Failure
*
* Errno: ENOSYS function not available
* EBADF Bad file desc
* EINVAL Not a GPFS file
* ESTALE cached fs information was invalid
*/
int GPFS_API
gpfs_statfs64(const char *pathname, /* File pathname */
gpfs_statfs64_t *buffer);
/* NAME: gpfs_statlite()
* gpfs_lstatlite() - do not follow a symlink at the end of the path
*
* FUNCTION: Returns stat() information with specified accuracy
*
* Input: pathname : path to a file or directory
*
* In/Out: st_litemaskP: bitmask specification of required accuracy
* statbufP : buffer for returned stat information
*
* Returns: 0 Successful
* -1 Failure
*
* Errno: Specific error indication
* EINVAL
*
*/
int GPFS_API
gpfs_statlite(const char *pathname,
unsigned int *st_litemaskP,
gpfs_stat64_t *statbufP);
int GPFS_API
gpfs_lstatlite(const char *pathname,
unsigned int *st_litemaskP,
gpfs_stat64_t *statbufP);
/* NAME: gpfs_fgetattrs()
*
* FUNCTION: Retrieves all extended file attributes in opaque format.
* This function together with gpfs_fputattrs is intended for
* use by a backup program to save (gpfs_fgetattrs) and
* restore (gpfs_fputattrs) all extended file attributes
* (ACLs, user attributes, ...) in one call.
*
* NOTE: This call does not return extended attributes used for
* the Data Storage Management (XDSM) API (aka DMAPI).
*
* Input: flags Define behavior of get attributes
* GPFS_ATTRFLAG_NO_PLACEMENT - file attributes for placement
* are not saved, neither is the current storage pool.
* GPFS_ATTRFLAG_IGNORE_POOL - file attributes for placement
* are saved, but the current storage pool is not.
*
* Returns: 0 Successful
* -1 Failure
*
* Errno: ENOSYS function not available
* EINVAL Not a GPFS file
* EINVAL invalid flags provided
* ENOSPC buffer too small to return all attributes
* *attrSizeP will be set to the size necessary
*/
int GPFS_API
gpfs_fgetattrs(gpfs_file_t fileDesc,
int flags,
void *bufferP,
int bufferSize,
int *attrSizeP);
/* NAME: gpfs_fputattrs()
*
* FUNCTION: Sets all extended file attributes of a file
* and sets the file's storage pool and data replication
* to the values saved in the extended attributes.
*
* If the saved storage pool is not valid or if the IGNORE_POOL
* flag is set, then it will select the storage pool by matching
* a PLACEMENT rule using the saved file attributes.
* If it fails to match a placement rule or if there are
* no placement rules installed it will assign the file
* to the "system" storage pool.
*
* The buffer passed in should contain extended attribute data
* that was obtained by a previous call to gpfs_fgetattrs.
*
* Input: flags Define behavior of put attributes
* GPFS_ATTRFLAG_NO_PLACEMENT - file attributes are restored
* but the storage pool and data replication are unchanged
* GPFS_ATTRFLAG_IGNORE_POOL - file attributes are restored
* but the storage pool and data replication are selected
* by matching the saved attributes to a placement rule
* instead of restoring the saved storage pool.
*
* Returns: 0 Successful
* -1 Failure
*
* Errno: ENOSYS function not available
* EINVAL Not a GPFS file
* EINVAL the buffer does not contain valid attribute data
* EINVAL invalid flags provided
*/
int GPFS_API
gpfs_fputattrs(gpfs_file_t fileDesc,
int flags,
void *bufferP);
/* NAME: gpfs_fputattrswithpathname()
*
* FUNCTION: Sets all extended file attributes of a file and invokes
* the policy engine to match a RESTORE rule using the file's
* attributes saved in the extended attributes to set the
* file's storage pool and data replication. The caller should
* include the full path to the file, including the file name,
* to allow rule selection based on file name or path.
*
* If the file fails to match a RESTORE rule, or if there are
* no RESTORE rules installed, then the storage pool and data
* replication are selected as when calling gpfs_fputattrs().
*
* The buffer passed in should contain extended attribute data
* that was obtained by a previous call to gpfs_fgetattrs.
*
* pathName is a UTF-8 encoded string. On Windows, applications
* can convert UTF-16 ("Unicode") to UTF-8 using the platforms
* WideCharToMultiByte function.
*
*
* Input: flags Define behavior of put attributes
* GPFS_ATTRFLAG_NO_PLACEMENT - file attributes are restored
* but the storage pool and data replication are unchanged
* GPFS_ATTRFLAG_IGNORE_POOL - file attributes are restored
* but if the file fails to match a RESTORE rule, it
* ignore the saved storage pool and select a pool
* by matching the saved attributes to a PLACEMENT rule.
* GPFS_ATTRFLAG_SKIP_IMMUTABLE - Skip immutable/appendOnly flags
* before restoring file data. Then use GPFS_ATTRFLAG_FINALIZE_ATTRS
* to restore immutable/appendOnly flags after data is restored.
* GPFS_ATTRFLAG_FINALIZE_ATTRS - file attributes that are restored
* after data is retored. If file is immutable/appendOnly
* call without this flag before restoring data
* then call with this flag after restoring data
*
* Returns: 0 Successful
* -1 Failure
*
* Errno: ENOSYS function not available
* EINVAL Not a GPFS file
* EINVAL the buffer does not contain valid attribute data
* ENOENT invalid pathname
* EINVAL invalid flags provided
*/
int GPFS_API
gpfs_fputattrswithpathname(gpfs_file_t fileDesc,
int flags,
void *bufferP,
const char *pathName);
/* NAME: gpfs_get_fssnaphandle_by_path()
*
* FUNCTION: Get a volatile handle to uniquely identify a file system
* and snapshot by the path to the file system and snapshot
*
* Input: pathName: path to a file or directory in a gpfs file system
* or to one of its snapshots
*
* Returns: pointer to gpfs_fssnap_handle_t (Successful)
* NULL and errno is set (Failure)
*
* Errno: ENOSYS function not available
* EINVAL Not a GPFS file
* ENOENT invalid pathname
* see system calls open(), fstatfs(), and malloc() ERRORS
*/
gpfs_fssnap_handle_t * GPFS_API
gpfs_get_fssnaphandle_by_path(const char *pathName);
/* NAME: gpfs_get_fssnaphandle_by_name()
*
* FUNCTION: Get a volatile handle to uniquely identify a file system
* and snapshot by the file system name and snapshot name.
*
* Input: fsName: unique name for gpfs file system (may be specified
* as fsName or /dev/fsName)
* snapName: name for snapshot within that file system
* or NULL to access the active file system rather
* than a snapshot within the file system.
*
* Returns: pointer to gpfs_fssnap_handle_t (Successful)
* NULL and errno is set (Failure)
*
* Errno: ENOSYS function not available
* ENOENT invalid file system name
* GPFS_E_INVAL_SNAPNAME invalid snapshot name
* see system calls open(), fstatfs(), and malloc() ERRORS
*/
gpfs_fssnap_handle_t * GPFS_API
gpfs_get_fssnaphandle_by_name(const char *fsName,
const char *snapName);
/* NAME: gpfs_get_fssnaphandle_by_fssnapid()
*
* FUNCTION: Get a volatile handle to uniquely identify a file system
* and snapshot by a fssnapId created from a previous handle.
*
* Input: fssnapId: unique id for a file system and snapshot
*
* Returns: pointer to gpfs_fssnap_handle_t (Successful)
* NULL and errno is set (Failure)
*
* Errno: ENOSYS function not available
* GPFS_E_INVAL_FSSNAPID invalid snapshot id
* see system calls open(), fstatfs(), and malloc() ERRORS
*/
gpfs_fssnap_handle_t * GPFS_API
gpfs_get_fssnaphandle_by_fssnapid(const gpfs_fssnap_id_t *fssnapId);
/* NAME: gpfs_get_fset_snaphandle_by_path()
*
* FUNCTION: Get a volatile handle to uniquely identify an inode space within a
* filesyetsm and snapshot by the path to the file system and snapshot.
*
* Input: pathName: path to a file or directory in a gpfs file system
* or to one of its snapshots
*
* Returns: pointer to gpfs_fssnap_handle_t (Successful)
* NULL and errno is set (Failure)
*
* Errno: ENOSYS function not available
* EINVAL Not a GPFS file
* ENOENT invalid pathname
* see system calls open(), fstatfs(), and malloc() ERRORS
*/
gpfs_fssnap_handle_t * GPFS_API
gpfs_get_fset_snaphandle_by_path(const char *pathName);
/* NAME: gpfs_get_fset_snaphandle_by_name()
*
* FUNCTION: Get a volatile handle to uniquely identify an inode space within a
* file system and snapshot by the independent fileset name, file system
* name and snapshot name.
*
* Input: fsName: unique name for gpfs file system (may be specified
* as fsName or /dev/fsName)
* fsetName name of the independent fileset that owns the inode space
* snapName: name for snapshot within that file system
* or NULL to access the active file system rather
* than a snapshot within the file system.
*
* Returns: pointer to gpfs_fssnap_handle_t (Successful)
* NULL and errno is set (Failure)
*
* Errno: ENOSYS function not available
* ENOENT invalid file system name
* GPFS_E_INVAL_FSETNAME invalid fset nsmae
* GPFS_E_INVAL_SNAPNAME invalid snapshot name
* see system calls open(), fstatfs(), and malloc() ERRORS
*/
gpfs_fssnap_handle_t * GPFS_API
gpfs_get_fset_snaphandle_by_name(const char *fsName,
const char *fsetName,
const char *snapName);
/* NAME: gpfs_get_fset_snaphandle_by_fset_snapid()
*
* FUNCTION: Get a volatile handle to uniquely identify a file system
* and snapshot by a fssnapId created from a previous handle.
*
* Input: fssnapId: unique id for a file system and snapshot
*
* Returns: pointer to gpfs_fssnap_handle_t (Successful)
* NULL and errno is set (Failure)
*
* Errno: ENOSYS function not available
* GPFS_E_INVAL_FSSNAPID invalid snapshot id
* see system calls open(), fstatfs(), and malloc() ERRORS
*/
gpfs_fssnap_handle_t * GPFS_API
gpfs_get_fset_snaphandle_by_fset_snapid(const gpfs_fssnap_id_t *fsetsnapId);
/* NAME: gpfs_get_pathname_from_fssnaphandle()
*
* FUNCTION: Get the mountpoint and path to a file system
* and snapshot identified by a fssnapHandle
*
* Input: fssnapHandle: ptr to file system & snapshot handle
*
* Returns: ptr to path name to the file system (Successful)
* NULL and errno is set (Failure)
*
* Errno: ENOSYS function not available
* GPFS_E_INVAL_FSSNAPHANDLE invalid fssnapHandle
*/
const char * GPFS_API
gpfs_get_pathname_from_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle);
/* NAME: gpfs_get_fsname_from_fssnaphandle()
*
* FUNCTION: Get the unique name for the file system
* identified by a fssnapHandle
*
* Input: fssnapHandle: ptr to file system & snapshot handle
*
* Returns: ptr to name of the file system (Successful)
* NULL and errno is set (Failure)
*
* Errno: ENOSYS function not available
* GPFS_E_INVAL_FSSNAPHANDLE invalid fssnapHandle
*/
const char * GPFS_API
gpfs_get_fsname_from_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle);
/* NAME: gpfs_get_snapname_from_fssnaphandle()
*
* FUNCTION: Get the name for the snapshot
* uniquely identified by a fssnapHandle
*
* Input: fssnapHandle: ptr to file system & snapshot handle
*
* Returns: ptr to name assigned to the snapshot (Successful)
* NULL and errno is set (Failure)
*
* Errno: ENOSYS function not available
* GPFS_E_INVAL_FSSNAPHANDLE invalid fssnaphandle
* GPFS_E_INVAL_SNAPNAME snapshot has been deleted
*
* Notes: If the snapshot has been deleted from the file system
* the snapId may still be valid, but the call will fail
* with errno set to GPFS_E_INVAL_SNAPNAME.
*/
const char * GPFS_API
gpfs_get_snapname_from_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle);
/* NAME: gpfs_get_snapid_from_fssnaphandle()
*
* FUNCTION: Get the numeric id for the snapshot identified
* by a fssnapHandle. The snapshots define an ordered
* sequence of changes to each file. The file's iattr
* structure defines the snapshot id in which the file
* was last modified (ia_modsnapid). This numeric value
* can be compared to the numeric snapid from a fssnaphandle
* to determine if the file changed before or after the
* snapshot identified by the fssnaphandle.
*
* Input: fssnapHandle: ptr to file system & snapshot handle
*
* Returns: Numeric id for the snapshot referred to by the fssnaphandle
* 0 if the fssnaphandle does not refer to a snapshot
* -1 and errno is set (Failure)
*
* Errno: ENOSYS function not available
* GPFS_E_INVAL_FSSNAPHANDLE invalid fssnaphandle
*
* Notes: The snapshot need not be on-line to determine the
* snapshot's numeric id.
*/
gpfs_snapid_t GPFS_API
gpfs_get_snapid_from_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle);
gpfs_snapid64_t GPFS_API
gpfs_get_snapid_from_fssnaphandle64(gpfs_fssnap_handle_t *fssnapHandle);
/* NAME: gpfs_get_fssnapid_from_fssnaphandle()
*
* FUNCTION: Get a unique, non-volatile file system and snapshot id
* for the file system and snapshot identified by a
* volatile fssnap handle.
*
* Input: fssnapHandle: ptr to file system & snapshot handle
* fssnapId: returned fssnapId uniquely identifying the
* file system and snapshot being scanned
*
* Returns: 0 and fssnapId is set with id (Successful)
* -1 and errno is set (Failure)
*
* Errno: GPFS_E_INVAL_FSSNAPHANDLE invalid fssnaphandle
* EINVAL null ptr given for returned fssnapId
* EFAULT size mismatch for fssnapId
*/
int GPFS_API
gpfs_get_fssnapid_from_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle,
gpfs_fssnap_id_t *fssnapId);
/* NAME: gpfs_get_restore_fssnapid_from_fssnaphandle()
*
* FUNCTION: Get the unique, non-volatile file system and snapshot id
* used for the last complete restore of a mirrored file
* system. The file system must been a previous restore
* target and ready for additional incremental restore.
*
* Input: fssnapHandle: ptr to file system & snapshot handle
* fssnapId: returned fssnapId uniquely identifying the
* last complete restored file system.
*
* Returns: 0 and fssnapId is set with id (Successful)
* -1 and errno is set (Failure)
*
* Errno: GPFS_E_INVAL_FSSNAPHANDLE invalid fssnaphandle
* EINVAL null ptr given for returned fssnapId
* EFAULT size mismatch for fssnapId
* EPERM caller must have superuser privilege
* ENOMEM unable to allocate memory for request
* GPFS_E_FS_NOT_RESTORABLE fs is not clean for restore
*/
int GPFS_API
gpfs_get_restore_fssnapid_from_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle,
gpfs_fssnap_id_t *fssnapId);
/* NAME: gpfs_free_fssnaphandle()
*
* FUNCTION: Free a fssnapHandle
*
* Input: fssnapHandle: ptr to file system & snapshot handle
*
* Returns: void
*
* Errno: None
*/
void GPFS_API
gpfs_free_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle);
/* NAME: gpfs_get_snapdirname()
*
* FUNCTION: Get the name of the directory containing snapshots.
*
* Input: fssnapHandle: handle for the file system
* snapdirName: buffer into which the name of the snapshot
* directory will be copied
* bufLen: the size of the provided buffer
*
* Returns: 0 (Successful)
* -1 and errno is set (Failure)
*
* Errno: ENOSYS function not available
* EPERM caller must have superuser privilege
* ESTALE cached fs information was invalid
* ENOMEM unable to allocate memory for request
* GPFS_E_INVAL_FSSNAPHANDLE fssnapHandle is invalid
* E2BIG buffer too small to return the snapshot directory name
*/
int GPFS_API
gpfs_get_snapdirname(gpfs_fssnap_handle_t *fssnapHandle,
char *snapdirName,
int bufLen);
/* NAME: gpfs_open_inodescan()
*
* FUNCTION: Open inode file for inode scan.
*
* Input: fssnapHandle: handle for file system and snapshot
* to be scanned
* prev_fssnapId:
* if NULL, all inodes of existing file will be returned;
* if non-null, only returns inodes of files that have changed
* since the specified previous snapshot;
* if specifies the same snapshot as the one referred by
* fssnapHandle, only the snapshot inodes that have been
* copied into this snap inode file are returned;
* maxIno: if non-null, returns the maximum inode number
* available in the inode file being scanned.
*
* Returns: pointer to gpfs_iscan_t (Successful)
* NULL and errno is set (Failure)
*
* Errno: ENOSYS function not available
* EINVAL bad parameters
* EPERM caller must have superuser privilege
* ESTALE cached fs information was invalid
* ENOMEM unable to allocate memory for request
* GPFS_E_INVAL_FSSNAPHANDLE fssnapHandle is invalid
* GPFS_E_INVAL_FSSNAPID prev_fssnapId is invalid
* EDOM prev_fssnapId is from a different fs
* ERANGE prev_fssnapId is more recent than snapId
* being scanned
* see system calls dup() and malloc() ERRORS
*/
gpfs_iscan_t * GPFS_API
gpfs_open_inodescan(gpfs_fssnap_handle_t *fssnapHandle,
const gpfs_fssnap_id_t *prev_fssnapId,
gpfs_ino_t *maxIno);
gpfs_iscan_t * GPFS_API
gpfs_open_inodescan64(gpfs_fssnap_handle_t *fssnapHandle,
const gpfs_fssnap_id_t *prev_fssnapId,
gpfs_ino64_t *maxIno);
/* NAME: gpfs_open_inodescan_with_xattrs()
*
* FUNCTION: Open inode file and extended attributes for an inode scan
*
* Input: fssnapHandle: handle for file system and snapshot
* to be scanned
* prev_fssnapId: if NULL, all inodes of existing file will
* be returned; if non-null, only returns inodes of files
* that have changed since the specified previous snapshot;
* if specifies the same snapshot as the one referred by
* fssnapHandle, only the snapshot inodes that have been
* copied into this snap inode file are returned;
* nxAttrs: count of extended attributes to be returned.
* if nxAttrs is set to 0, call returns no extended
* attributes, like gpfs_open_inodescan.
* if nxAttrs is set to -1, call returns all extended attributes
* xAttrList: pointer to array of pointers to names of extended
* attribute to be returned. nxAttrList may be null if nxAttrs
* is set to 0 or -1.
* maxIno: if non-null, returns the maximum inode number
* available in the inode file being scanned.
*
* Returns: pointer to gpfs_iscan_t (Successful)
* NULL and errno is set (Failure)
*
* Errno: ENOSYS function not available
* EINVAL bad parameters
* EPERM caller must have superuser privilege
* ESTALE cached fs information was invalid
* ENOMEM unable to allocate memory for request
* GPFS_E_INVAL_FSSNAPHANDLE fssnapHandle is invalid
* GPFS_E_INVAL_FSSNAPID prev_fssnapId is invalid
* EDOM prev_fssnapId is from a different fs
* ERANGE prev_fssnapId is more recent than snapId
* being scanned
* see system calls dup() and malloc() ERRORS
*/
gpfs_iscan_t * GPFS_API
gpfs_open_inodescan_with_xattrs(gpfs_fssnap_handle_t *fssnapHandle,
const gpfs_fssnap_id_t *prev_fssnapId,
int nxAttrs,
const char *xattrsList[],
gpfs_ino_t *maxIno);
gpfs_iscan_t * GPFS_API
gpfs_open_inodescan_with_xattrs64(gpfs_fssnap_handle_t *fssnapHandle,
const gpfs_fssnap_id_t *prev_fssnapId,
int nxAttrs,
const char *xattrList[],
gpfs_ino64_t *maxIno);
/* NAME: gpfs_next_inode()
*
* FUNCTION: Get next inode from inode scan. Scan terminates before
* the last inode specified or the last inode in the
* inode file being scanned.
*
* If the inode scan was opened to expressly look for inodes
* in a snapshot, and not dittos, gets the next inode skipping
* holes, if any.
*
* Input: iscan: ptr to inode scan descriptor
* termIno: scan terminates before this inode number
* caller may specify maxIno from gpfs_open_inodescan()
* or 0 to scan the entire inode file.
* iattr: pointer to returned pointer to file's iattr.
*
* Returns: 0 and *iattr set to point to gpfs_iattr_t (Successful)
* 0 and *iattr set to NULL for no more inodes before termIno
* -1 and errno is set (Failure)
*
* Errno: ENOSYS function not available
* EPERM caller must have superuser privilege
* ESTALE cached fs information was invalid
* ENOMEM buffer too small
* GPFS_E_INVAL_ISCAN bad parameters
* GPFS_E_INVAL_FSSNAPID the snapshot id provided in the
* gpfs iscan is not valid
*
* Notes: The data returned by gpfs_next_inode() is overwritten by
* subsequent calls to gpfs_next_inode() or gpfs_seek_inode().
*
* The termIno parameter provides a means to partition an
* inode scan such that it may be executed on more than one node.
*/
int GPFS_API
gpfs_next_inode(gpfs_iscan_t *iscan,
gpfs_ino_t termIno,
const gpfs_iattr_t **iattr);
int GPFS_API
gpfs_next_inode64(gpfs_iscan_t *iscan,
gpfs_ino64_t termIno,
const gpfs_iattr64_t **iattr);
/* NAME: gpfs_next_inode_with_xattrs()
*
* FUNCTION: Get next inode and its extended attributes from the inode scan.
* The set of extended attributes returned were defined when
* the inode scan was opened. The scan terminates before the last
* inode specified or the last inode in the inode file being
* scanned.
*
* If the inode scan was opened to expressly look for inodes
* in a snapshot, and not dittos, gets the next inode skipping
* holes, if any.
*
* Input: iscan: ptr to inode scan descriptor
* termIno: scan terminates before this inode number
* caller may specify maxIno from gpfs_open_inodescan()
* or 0 to scan the entire inode file.
* iattr: pointer to returned pointer to file's iattr.
* xattrBuf: pointer to returned pointer to xattr buffer
* xattrBufLen: returned length of xattr buffer
*
*
* Returns: 0 and *iattr set to point to gpfs_iattr_t (Successful)
* 0 and *iattr set to NULL for no more inodes before termIno
* -1 and errno is set (Failure)
*
* Errno: ENOSYS function not available
* EPERM caller must have superuser privilege
* ESTALE cached fs information was invalid
* EFAULT buffer data was overwritten
* ENOMEM buffer too small
* GPFS_E_INVAL_ISCAN bad parameters
* GPFS_E_INVAL_XATTR bad parameters
*
* Notes: The data returned by gpfs_next_inode() is overwritten by
* subsequent calls to gpfs_next_inode(), gpfs_seek_inode()
* or gpfs_stat_inode().
*
* The termIno parameter provides a means to partition an
* inode scan such that it may be executed on more than one node.
*
* The returned values for xattrBuf and xattrBufLen must be
* provided to gpfs_next_xattr() to obtain the extended attribute
* names and values. The buffer used for the extended attributes
* is overwritten by subsequent calls to gpfs_next_inode(),
* gpfs_seek_inode() or gpfs_stat_inode();
*
* The returned pointers to the extended attribute name and value
* will be aligned to a double-word boundary.
*/
int GPFS_API
gpfs_next_inode_with_xattrs(gpfs_iscan_t *iscan,
gpfs_ino_t termIno,
const gpfs_iattr_t **iattr,
const char **xattrBuf,
unsigned int *xattrBufLen);
int GPFS_API
gpfs_next_inode_with_xattrs64(gpfs_iscan_t *iscan,
gpfs_ino64_t termIno,
const gpfs_iattr64_t **iattr,
const char **xattrBuf,
unsigned int *xattrBufLen);
/* NAME: gpfs_next_xattr()
*
* FUNCTION: Iterate over the extended attributes buffer returned
* by get_next_inode_with_xattrs to return the individual
* attributes and their values. Note that the attribute names
* are null-terminated strings, whereas the atttribute value
* contains binary data.
*
* Input: iscan: ptr to inode scan descriptor
* xattrBufLen: ptr to attribute buffer length
* xattrBuf: ptr to the ptr to the attribute buffer
*
* Returns: 0 and *name set to point attribue name (Successful)
* also sets: *valueLen to length of attribute value
* *value to point to attribute value
* *xattrBufLen to remaining length of buffer
* **xattrBuf to index next attribute in buffer
* 0 and *name set to NULL for no more attributes in buffer
* also sets: *valueLen to 0
* *value to NULL
* *xattrBufLen to 0
* **xattrBuf to NULL
* -1 and errno is set (Failure)
*
* Errno: ENOSYS function not available
* GPFS_E_INVAL_ISCAN invalid iscan parameter
* GPFS_E_INVAL_XATTR invalid xattr parameters
*
* Notes: The caller is not allowed to modify the returned attribute
* names or values. The data returned by gpfs_next_attribute()
* may be overwritten by subsequent calls to gpfs_next_attribute()
* or other gpfs library calls.
*/
int GPFS_API
gpfs_next_xattr(gpfs_iscan_t *iscan,
const char **xattrBuf,
unsigned int *xattrBufLen,
const char **name,
unsigned int *valueLen,
const char **value);
/* NAME: gpfs_seek_inode()
*
* FUNCTION: Seek to a given inode number.
*
* Input: iscan: ptr to inode scan descriptor
* ino: next inode number to be scanned
*
* Returns: 0 Successful
* -1 Failure and errno is set
*
* Errno: ENOSYS function not available
* GPFS_E_INVAL_ISCAN bad parameters
*/
int GPFS_API
gpfs_seek_inode(gpfs_iscan_t *iscan,
gpfs_ino_t ino);
int GPFS_API
gpfs_seek_inode64(gpfs_iscan_t *iscan,
gpfs_ino64_t ino);
#ifdef SNAPSHOT_ILM
/* define GPFS generated errno */
#define GPFS_E_HOLE_IN_IFILE 238 /* hole in inode file */
#endif
/* NAME: gpfs_stat_inode()
* NAME: gpfs_stat_inode_with_xattrs()
*
* FUNCTION: Seek to the specified inode and get that inode and
* its extended attributes from the inode scan. This is
* simply a combination of gpfs_seek_inode and get_next_inode
* but will only return the specified inode.
*
* Input: iscan: ptr to inode scan descriptor
* ino: inode number to be returned
* termIno: prefetch inodes up to this inode
* caller may specify maxIno from gpfs_open_inodescan()
* or 0 to allow prefetching over the entire inode file.
* iattr: pointer to returned pointer to file's iattr.
* xattrBuf: pointer to returned pointer to xattr buffer
* xattrBufLen: returned length of xattr buffer
*
* Returns: 0 and *iattr set to point to gpfs_iattr_t (Successful)
* 0 and *iattr set to NULL for no more inodes before termIno
* or if requested inode does not exist.
* -1 and errno is set (Failure)
*
* Errno: ENOSYS function not available
* EPERM caller must have superuser privilege
* ESTALE cached fs information was invalid
* ENOMEM buffer too small
* GPFS_E_INVAL_ISCAN bad parameters
* GPFS_E_HOLE_IN_IFILE if we are expressly looking for inodes in
* the snapshot file and this one has yet not
* been copied into snapshot.
*
* Notes: The data returned by gpfs_next_inode() is overwritten by
* subsequent calls to gpfs_next_inode(), gpfs_seek_inode()
* or gpfs_stat_inode().
*
* The termIno parameter provides a means to partition an
* inode scan such that it may be executed on more than one node.
* It is only used by this call to control prefetching.
*
* The returned values for xattrBuf and xattrBufLen must be
* provided to gpfs_next_xattr() to obtain the extended attribute
* names and values. The buffer used for the extended attributes
* is overwritten by subsequent calls to gpfs_next_inode(),
* gpfs_seek_inode() or gpfs_stat_inode();
*/
int GPFS_API
gpfs_stat_inode(gpfs_iscan_t *iscan,
gpfs_ino_t ino,
gpfs_ino_t termIno,
const gpfs_iattr_t **iattr);
int GPFS_API
gpfs_stat_inode64(gpfs_iscan_t *iscan,
gpfs_ino64_t ino,
gpfs_ino64_t termIno,
const gpfs_iattr64_t **iattr);
int GPFS_API
gpfs_stat_inode_with_xattrs(gpfs_iscan_t *iscan,
gpfs_ino_t ino,
gpfs_ino_t termIno,
const gpfs_iattr_t **iattr,
const char **xattrBuf,
unsigned int *xattrBufLen);
int GPFS_API
gpfs_stat_inode_with_xattrs64(gpfs_iscan_t *iscan,
gpfs_ino64_t ino,
gpfs_ino64_t termIno,
const gpfs_iattr64_t **iattr,
const char **xattrBuf,
unsigned int *xattrBufLen);
/* NAME: gpfs_close_inodescan()
*
* FUNCTION: Close inode file.
*
* Input: iscan: ptr to inode scan descriptor
*
* Returns: void
*
* Errno: None
*/
void GPFS_API
gpfs_close_inodescan(gpfs_iscan_t *iscan);
/* NAME: gpfs_cmp_fssnapid()
*
* FUNCTION: Compare two fssnapIds for the same file system to
* determine the order in which the two snapshots were taken.
* The 'result' variable will be set as follows:
* *result < 0: snapshot 1 was taken before snapshot 2
* *result == 0: snapshot 1 and 2 are the same
* *result > 0: snapshot 1 was taken after snapshot 2
*
* Input: fssnapId1: ptr to fssnapId 1
* fssnapId2: ptr to fssnapId id 2
* result: ptr to returned results
*
* Returns: 0 and *result is set as described above (Successful)
* -1 and errno is set (Failure)
*
* Errno: ENOSYS function not available
* GPFS_E_INVAL_FSSNAPID fssnapid1 or fssnapid2 is not a
* valid snapshot id
* EDOM the two snapshots cannot be compared because
* they were taken from two different file systems.
*/
int GPFS_API
gpfs_cmp_fssnapid(const gpfs_fssnap_id_t *fssnapId1,
const gpfs_fssnap_id_t *fssnapId2,
int *result);
/* NAME: gpfs_iopen()
*
* FUNCTION: Open a file or directory by inode number.
*
* Input: fssnapHandle: handle for file system and snapshot
* being scanned
* ino: inode number
* open_flags: O_RDONLY for gpfs_iread()
* O_WRONLY for gpfs_iwrite()
* O_CREAT create the file if it doesn't exist
* O_TRUNC if the inode already exists delete it
* caller may use GPFS_O_BACKUP to read files for backup
* and GPFS_O_RESTORE to write files for restore
* statxbuf: used only with O_CREAT/GPFS_O_BACKUP
* all other cases set to NULL
* symLink: used only with O_CREAT/GPFS_O_BACKUP for a symbolic link
* all other cases set to NULL
*
* Returns: pointer to gpfs_ifile_t (Successful)
* NULL and errno is set (Failure)
*
* Errno: ENOSYS function not available
* ENOENT file not existed
* EINVAL missing or bad parameter
* EPERM caller must have superuser privilege
* ESTALE cached fs information was invalid
* ENOMEM unable to allocate memory for request
* EFORMAT invalid fs version number
* EIO error reading original inode
* ERANGE error ino is out of range, should use gpfs_iopen64
* GPFS_E_INVAL_INUM reserved inode is not allowed to open
* GPFS_E_INVAL_IATTR iattr structure was corrupted
* see dup() and malloc() ERRORS
*/
gpfs_ifile_t * GPFS_API
gpfs_iopen(gpfs_fssnap_handle_t *fssnapHandle,
gpfs_ino_t ino,
int open_flags,
const gpfs_iattr_t *statxbuf,
const char *symLink);
gpfs_ifile_t * GPFS_API
gpfs_iopen64(gpfs_fssnap_handle_t *fssnapHandle,
gpfs_ino64_t ino,
int open_flags,
const gpfs_iattr64_t *statxbuf,
const char *symLink);
/* Define gpfs_iopen flags as used by the backup & restore by inode.
The backup code will only read the source files.
The restore code writes the target files & creates them if they
don't already exist. The file length is set by the inode attributes.
Consequently, to restore a user file it is unnecessary to include
the O_TRUNC flag. */
#define GPFS_O_BACKUP (O_RDONLY)
#define GPFS_O_RESTORE (O_WRONLY | O_CREAT)
/* NAME: gpfs_iread()
*
* FUNCTION: Read file opened by gpfs_iopen.
*
* Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen
* buffer: buffer for data to be read
* bufferSize: size of buffer (ie amount of data to be read)
* In/Out offset: offset of where within the file to read
* if successful, offset will be updated to the
* next byte after the last one that was read
*
* Returns: number of bytes read (Successful)
* -1 and errno is set (Failure)
*
* Errno: ENOSYS function not available
* EISDIR file is a directory
* EPERM caller must have superuser privilege
* ESTALE cached fs information was invalid
* GPFS_E_INVAL_IFILE bad ifile parameters
* see system call read() ERRORS
*/
int GPFS_API
gpfs_iread(gpfs_ifile_t *ifile,
void *buffer,
int bufferSize,
gpfs_off64_t *offset);
/* NAME: gpfs_iwrite()
*
* FUNCTION: Write file opened by gpfs_iopen.
*
* Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen
* buffer: the data to be written
* writeLen: how much to write
* In/Out offset: offset of where within the file to write
* if successful, offset will be updated to the
* next byte after the last one that was written
*
* Returns: number of bytes written (Successful)
* -1 and errno is set (Failure)
*
* Errno: ENOSYS function not available
* EISDIR file is a directory
* EPERM caller must have superuser privilege
* ESTALE cached fs information was invalid
* GPFS_E_INVAL_IFILE bad ifile parameters
* see system call write() ERRORS
*/
int GPFS_API
gpfs_iwrite(gpfs_ifile_t *ifile,
void *buffer,
int writeLen,
gpfs_off64_t *offset);
/* NAME: gpfs_ireaddir()
*
* FUNCTION: Get next directory entry.
*
* Input: idir: pointer to gpfs_ifile_t from gpfs_iopen
* dirent: pointer to returned pointer to directory entry
*
* Returns: 0 and pointer to gpfs_direntx set (Successful)
* 0 and pointer to gpfs_direntx set to NULL (End of directory)
* -1 and errno is set (Failure)
*
* Errno: ENOSYS function not available
* ENOTDIR file is not a directory
* EPERM caller must have superuser privilege
* ESTALE cached fs information was invalid
* GPFS_E_INVAL_IFILE bad ifile parameter
* ENOMEM unable to allocate memory for request
*
* Notes: The data returned by gpfs_ireaddir() is overwritten by
* subsequent calls to gpfs_ireaddir().
*/
int GPFS_API
gpfs_ireaddir(gpfs_ifile_t *idir,
const gpfs_direntx_t **dirent);
int GPFS_API
gpfs_ireaddir64(gpfs_ifile_t *idir,
const gpfs_direntx64_t **dirent);
int GPFS_API
gpfs_ireaddirx(gpfs_ifile_t *idir,
gpfs_iscan_t *iscan, /* in only */
const gpfs_direntx_t **dirent);
int GPFS_API
gpfs_ireaddirx64(gpfs_ifile_t *idir,
gpfs_iscan_t *iscan, /* in only */
const gpfs_direntx64_t **dirent);
/* NAME: gpfs_iwritedir()
*
* FUNCTION: Create a directory entry in a directory opened by gpfs_iopen.
*
* Input: idir: pointer to gpfs_ifile_t from gpfs_iopen
* dirent: directory entry to be written
*
* Returns: 0 (Successful)
* -1 and errno is set (Failure)
*
* Errno: ENOSYS function not available
* GPFS_E_INVAL_IFILE bad file pointer
* ENOTDIR file is not a directory
* EPERM caller must have superuser privilege
* ESTALE cached fs information was invalid
* ENOMEM unable to allocate memory for request
* EFORMAT invalid dirent version number
* see system call write() ERRORS
*/
int GPFS_API
gpfs_iwritedir(gpfs_ifile_t *idir,
const gpfs_direntx_t *dirent);
int GPFS_API
gpfs_iwritedir64(gpfs_ifile_t *idir,
const gpfs_direntx64_t *dirent);
/* NAME: gpfs_igetattrs()
*
* FUNCTION: Retrieves all extended file attributes in opaque format.
* This function together with gpfs_iputattrs is intended for
* use by a backup program to save (gpfs_igetattrs) and
* restore (gpfs_iputattrs) all extended file attributes
* (ACLs, user attributes, ...) in one call.
*
* NOTE: This call does not return extended attributes used for
* the Data Storage Management (XDSM) API (aka DMAPI).
*
* Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen
* buffer: pointer to buffer for returned attributes
* bufferSize: size of buffer
* attrSize: ptr to returned size of attributes
*
* Returns: 0 Successful
* -1 Failure and errno is set
*
* Errno: ENOSYS function not available
* EPERM caller must have superuser privilege
* ESTALE cached fs information was invalid
* ENOSPC buffer too small to return all attributes
* *attrSizeP will be set to the size necessary
* GPFS_E_INVAL_IFILE bad ifile parameters
*/
int GPFS_API
gpfs_igetattrs(gpfs_ifile_t *ifile,
void *buffer,
int bufferSize,
int *attrSize);
/* NAME: gpfs_igetattrsx()
*
* FUNCTION: Retrieves all extended file attributes in opaque format.
* This function together with gpfs_iputattrsx is intended for
* use by a backup program to save (gpfs_igetattrsx) and
* restore (gpfs_iputattrsx) all extended file attributes
* (ACLs, user attributes, ...) in one call.
*
* NOTE: This call can optionally return extended attributes
* used for the Data Storage Management (XDSM) API
* (aka DMAPI).
*
* Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen
* flags Define behavior of get attributes
* GPFS_ATTRFLAG_NO_PLACEMENT - file attributes for placement
* are not saved, neither is the current storage pool.
* GPFS_ATTRFLAG_IGNORE_POOL - file attributes for placement
* are saved, but the current storage pool is not.
* GPFS_ATTRFLAG_INCL_DMAPI - file attributes for dmapi are
* included in the returned buffer
* GPFS_ATTRFLAG_INCL_ENCR - file attributes for encryption
* are included in the returned buffer
*
* buffer: pointer to buffer for returned attributes
* bufferSize: size of buffer
* attrSize: ptr to returned size of attributes
*
* Returns: 0 Successful
* -1 Failure
*
* Errno: ENOSYS function not available
* EINVAL Not a GPFS file
* EINVAL invalid flags provided
* ENOSPC buffer too small to return all attributes
* *attrSizeP will be set to the size necessary
*/
int GPFS_API
gpfs_igetattrsx(gpfs_ifile_t *ifile,
int flags,
void *buffer,
int bufferSize,
int *attrSize);
/* NAME: gpfs_igetxattr()
*
* FUNCTION: Retrieves an extended file attributes from ifile which has been open
* by gpfs_iopen().
*
* NOTE: This call does not return extended attributes used for
* the Data Storage Management (XDSM) API (aka DMAPI).
*
* Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen
* buffer: pointer to buffer for key and returned extended
* attribute value
* bufferSize: size of buffer, should be enough to save attribute value
* attrSize: ptr to key length as input and ptr to the returned
* size of attributes as putput.
*
* Returns: 0 Successful
* -1 Failure and errno is set
*
* Errno: ENOSYS function not available
* EPERM caller must have superuser priviledges
* ESTALE cached fs information was invalid
* ENOSPC buffer too small to return all attributes
* *attrSize will be set to the size necessary
* GPFS_E_INVAL_IFILE bad ifile parameters
*/
int GPFS_API
gpfs_igetxattr(gpfs_ifile_t *ifile,
void *buffer,
int bufferSize,
int *attrSize);
/* NAME: gpfs_iputattrs()
*
* FUNCTION: Sets all extended file attributes of a file.
* The buffer passed in should contain extended attribute data
* that was obtained by a previous call to gpfs_igetattrs.
*
* NOTE: This call will not restore extended attributes
* used for the Data Storage Management (XDSM) API
* (aka DMAPI). They will be silently ignored.
*
* Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen
* buffer: pointer to buffer for returned attributes
*
* Returns: 0 Successful
* -1 Failure and errno is set
*
* Errno: ENOSYS function not available
* EINVAL the buffer does not contain valid attribute data
* EPERM caller must have superuser privilege
* ESTALE cached fs information was invalid
* GPFS_E_INVAL_IFILE bad ifile parameters
*/
int GPFS_API
gpfs_iputattrs(gpfs_ifile_t *ifile,
void *buffer);
/* NAME: gpfs_iputattrsx()
*
* FUNCTION: Sets all extended file attributes of a file.
*
* This routine can optionally invoke the policy engine
* to match a RESTORE rule using the file's attributes saved
* in the extended attributes to set the file's storage pool and
* data replication as when calling gpfs_fputattrswithpathname.
* When used with the policy the caller should include the
* full path to the file, including the file name, to allow
* rule selection based on file name or path.
*
* By default, the routine will not use RESTORE policy rules
* for data placement. The pathName parameter will be ignored
* and may be set to NULL.
*
* If the call does not use RESTORE policy rules, or if the
* file fails to match a RESTORE rule, or if there are no
* RESTORE rules installed, then the storage pool and data
* replication are selected as when calling gpfs_fputattrs().
*
* The buffer passed in should contain extended attribute data
* that was obtained by a previous call to gpfs_fgetattrs.
*
* pathName is a UTF-8 encoded string. On Windows, applications
* can convert UTF-16 ("Unicode") to UTF-8 using the platforms
* WideCharToMultiByte function.
*
* NOTE: This call will restore extended attributes
* used for the Data Storage Management (XDSM) API
* (aka DMAPI) if they are present in the buffer.
*
* Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen
* flags Define behavior of put attributes
* GPFS_ATTRFLAG_NO_PLACEMENT - file attributes are restored
* but the storage pool and data replication are unchanged
* GPFS_ATTRFLAG_IGNORE_POOL - file attributes are restored
* but the storage pool and data replication are selected
* by matching the saved attributes to a placement rule
* instead of restoring the saved storage pool.
* GPFS_ATTRFLAG_USE_POLICY - file attributes are restored
* but the storage pool and data replication are selected
* by matching the saved attributes to a RESTORE rule
* instead of restoring the saved storage pool.
* GPFS_ATTRFLAG_FINALIZE_ATTRS - file attributes that are restored
* after data is retored. If file is immutable/appendOnly
* call without this flag before restoring data
* then call with this flag after restoring data
* GPFS_ATTRFLAG_INCL_ENCR - file attributes for encryption
* are restored. Note that this may result in the file's
* File Encryption Key (FEK) being changed, and in this
* case any prior content in the file is effectively lost.
* This option should only be used when the entire file
* content is restored after the attributes are restored.
*
* buffer: pointer to buffer for returned attributes
* pathName: pointer to file path and file name for file
* May be set to NULL.
*
* Returns: 0 Successful
* -1 Failure and errno is set
*
* Errno: ENOSYS function not available
* EINVAL the buffer does not contain valid attribute data
* EINVAL invalid flags provided
* EPERM caller must have superuser privilege
* ESTALE cached fs information was invalid
* GPFS_E_INVAL_IFILE bad ifile parameters
*/
int GPFS_API
gpfs_iputattrsx(gpfs_ifile_t *ifile,
int flags,
void *buffer,
const char *pathName);
/* NAME: gpfs_igetcompressionlib()
*
* FUNCTION: Retrieves the selected compression library from ifile which has been
* open by gpfs_iopen().
*
* Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen
* buffer: pointer to buffer for key and returned extended
* attribute value
* bufferSize: size of buffer, should be enough to save attribute value
* attrSize: ptr to key length as input and ptr to the returned
* size of attributes as putput.
*
* Returns: 0 Successful
* -1 Failure and errno is set
*
* Errno: ENOSYS function not available
* EPERM caller must have superuser priviledges
* ESTALE cached fs information was invalid
* ENOSPC buffer too small to return all attributes
* *attrSize will be set to the size necessary
* EINVAL buffer is NULL
* EIO selected compression library is corrupted or not available
* GPFS_E_INVAL_IFILE bad ifile parameters
*/
int GPFS_API
gpfs_igetcompressionlib(gpfs_ifile_t *ifile,
void *buffer,
int bufferSize,
int *attrSize);
/* NAME: gpfs_igetfilesetname()
*
* FUNCTION: Retrieves the name of the fileset which contains this file.
* The fileset name is a null-terminated string, with a
* a maximum length of GPFS_MAXNAMLEN.
*
* Input: iscan: ptr to gpfs_iscan_t from gpfs_open_inodescan()
* filesetId: ia_filesetId returned in an iattr from the iscan
* buffer: pointer to buffer for returned fileset name
* bufferSize: size of buffer
*
* Returns: 0 Successful
* -1 Failure and errno is set
*
* Errno: ENOSYS function not available
* EPERM caller must have superuser privilege
* ESTALE cached fs information was invalid
* ENOSPC buffer too small to return fileset name
* GPFS_E_INVAL_ISCAN bad iscan parameter
*/
int GPFS_API
gpfs_igetfilesetname(gpfs_iscan_t *iscan,
unsigned int filesetId,
void *buffer,
int bufferSize);
/* NAME: gpfs_igetstoragepool()
*
* FUNCTION: Retrieves the name of the storage pool assigned for
* this file's data. The storage pool name is a null-terminated
* string, with a maximum length of GPFS_MAXNAMLEN.
*
* Input: iscan: ptr to gpfs_iscan_t from gpfs_open_inodescan()
* dataPoolId: ia_dataPoolId returned in an iattr from the iscan
* buffer: pointer to buffer for returned attributes
* bufferSize: size of buffer
*
* Returns: 0 Successful
* -1 Failure and errno is set
*
* Errno: ENOSYS function not available
* EPERM caller must have superuser privilege
* ESTALE cached fs information was invalid
* ENOSPC buffer too small to return all storage pool name
* GPFS_E_INVAL_ISCAN bad iscan parameters
*/
int GPFS_API
gpfs_igetstoragepool(gpfs_iscan_t *iscan,
unsigned int dataPoolId,
void *buffer,
int bufferSize);
/* NAME: gpfs_iclose()
*
* FUNCTION: Close file opened by inode and update dates.
*
* Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen
*
* Returns: void
*/
void GPFS_API
gpfs_iclose(gpfs_ifile_t *ifile);
/* NAME: gpfs_ireadlink()
*
* FUNCTION: Read symbolic link by inode number.
*
* Input: fssnapHandle: handle for file system & snapshot being scanned
* ino: inode number of link file to read
* buffer: pointer to buffer for returned link data
* bufferSize: size of the buffer
*
* Returns: number of bytes read (Successful)
* -1 and errno is set (Failure)
*
* Errno: ENOSYS function not available
* EPERM caller must have superuser privilege
* ESTALE cached fs information was invalid
* GPFS_E_INVAL_FSSNAPHANDLE invalid fssnap handle
* see system call readlink() ERRORS
*/
int GPFS_API
gpfs_ireadlink(gpfs_fssnap_handle_t *fssnapHandle,
gpfs_ino_t ino,
char *buffer,
int bufferSize);
int GPFS_API
gpfs_ireadlink64(gpfs_fssnap_handle_t *fssnapHandle,
gpfs_ino64_t ino,
char *buffer,
int bufferSize);
/* NAME: gpfs_sync_fs()
*
* FUNCTION: sync file system.
*
* Input: fssnapHandle: handle for file system being restored
*
* Returns: 0 all data flushed to disk (Successful)
* -1 and errno is set (Failure)
*
* Errno: ENOSYS function not available
* ENOMEM unable to allocate memory for request
* EPERM caller must have superuser privilege
* ESTALE cached fs information was invalid
* GPFS_E_INVAL_FSSNAPHANDLE invalid fssnapHandle
*/
int GPFS_API
gpfs_sync_fs(gpfs_fssnap_handle_t *fssnapHandle);
/* NAME: gpfs_enable_restore()
*
* FUNCTION: Mark file system as enabled for restore on/off
*
* Input: fssnapHandle: handle for file system to be enabled
* or disabled for restore
* on_off: flag set to 1 to enable restore
* 0 to disable restore
*
* Returns: 0 (Successful)
* -1 and errno is set (Failure)
*
* Errno: ENOSYS function not available
* EINVAL bad parameters
* GPFS_E_INVAL_FSSNAPHANDLE invalid fssnapHandle
* EPERM caller must have superuser privilege
* ESTALE cached fs information was invalid
* ENOMEM unable to allocate memory for request
* E_FS_NOT_RESTORABLE fs is not clean
* EALREADY fs already marked as requested
* E_RESTORE_STARTED restore in progress
*
* Notes: EALREADY indicates enable/disable restore was already called
* for this fs. The caller must decide if EALREADY represents an
* error condition.
*/
int GPFS_API
gpfs_enable_restore(gpfs_fssnap_handle_t *fssnapHandle,
int on_off);
/* NAME: gpfs_start_restore()
*
* FUNCTION: Start a restore session.
*
* Input: fssnapHandle: handle for file system to be restored
* restore_flags: Flag to indicate the restore should be started
* even if a prior restore has not completed.
* old_fssnapId: fssnapId of last restored snapshot
* new_fssnapId: fssnapId of snapshot being restored
*
* Returns: pointer to gpfs_restore_t (Successful)
* NULL and errno is set (Failure)
*
* Errno: ENOSYS function not available
* ENOMEM unable to allocate memory for request
* EINVAL missing parameter
* EPERM caller must have superuser privilege
* ESTALE cached fs information was invalid
* EDOM restore fs does not match existing fs
* ERANGE restore is missing updates
* EFORMAT invalid fs version number
* GPFS_E_INVAL_FSSNAPHANDLE invalid fssnaphandle
* GPFS_E_INVAL_FSSNAPID bad fssnapId parameter
* E_FS_NOT_RESTORABLE fs is not clean for restore
* E_RESTORE_NOT_ENABLED fs is not enabled for restore
* EALREADY Restore already in progress
*
* Note: EALREADY indicates start restore was already called for
* this fs. This could be due to a prior restore process that failed
* or it could be due to a concurrent restore process still running.
* The caller must decide if EALREADY represents an error condition.
*/
gpfs_restore_t * GPFS_API
gpfs_start_restore(gpfs_fssnap_handle_t *fssnapHandle,
int restore_flags,
const gpfs_fssnap_id_t *old_fssnapId,
const gpfs_fssnap_id_t *new_fssnapId);
#define GPFS_RESTORE_NORMAL 0 /* Restore not started if prior restore
has not completed. */
#define GPFS_RESTORE_FORCED 1 /* Restore starts even if prior restore
has not completed. */
/* NAME: gpfs_end_restore()
*
* FUNCTION: End a restore session.
*
* Input: restoreId: ptr to gpfs_restore_t
*
* Returns: 0 (Successful)
* -1 and errno is set (Failure)
*
* Errno: ENOSYS function not available
* EINVAL bad parameters
* EPERM caller must have superuser privilege
* ESTALE cached fs information was invalid
* GPFS_E_INVAL_RESTORE bad restoreId parameter
* GPFS_E_FS_NOT_RESTORABLE fs is not clean for restore
* GPFS_E_RESTORE_NOT_ENABLED fs is not enabled for restore
* EALREADY Restore already ended
*
* Note: EALREADY indicates end restore was already called for
* this fs. This could be due to a concurrent restore process that
* already completed. The caller must decide if EALREADY represents
* an error condition.
*/
int GPFS_API
gpfs_end_restore(gpfs_restore_t *restoreId);
/* NAME: gpfs_ireadx()
*
* FUNCTION: Block level incremental read on a file opened by gpfs_iopen
* with a given incremental scan opened via gpfs_open_inodescan.
*
* Input: ifile: ptr to gpfs_ifile_t returned from gpfs_iopen()
* iscan: ptr to gpfs_iscan_t from gpfs_open_inodescan()
* buffer: ptr to buffer for returned data
* bufferSize: size of buffer for returned data
* offset: ptr to offset value
* termOffset: read terminates before reading this offset
* caller may specify ia_size for the file's
* gpfs_iattr_t or 0 to scan the entire file.
* hole: ptr to returned flag to indicate a hole in the file
*
* Returns: number of bytes read and returned in buffer
* or size of hole encountered in the file. (Success)
* -1 and errno is set (Failure)
*
* On input, *offset contains the offset in the file
* at which to begin reading to find a difference same file
* in a previous snapshot specified when the inodescan was opened.
* On return, *offset contains the offset of the first
* difference.
*
* On return, *hole indicates if the change in the file
* was data (*hole == 0) and the data is returned in the
* buffer provided. The function's value is the amount of data
* returned. If the change is a hole in the file,
* *hole != 0 and the size of the changed hole is returned
* as the function value.
*
* A call with a NULL buffer pointer will query the next increment
* to be read from the current offset. The *offset, *hole and
* returned length will be set for the next increment to be read,
* but no data will be returned. The bufferSize parameter is
* ignored, but the termOffset parameter will limit the
* increment returned.
*
* Errno: ENOSYS function not available
* EINVAL missing or bad parameter
* EISDIR file is a directory
* EPERM caller must have superuser privilege
* ESTALE cached fs information was invalid
* ENOMEM unable to allocate memory for request
* EDOM fs snapId does match local fs
* ERANGE previous snapId is more recent than scanned snapId
* GPFS_E_INVAL_IFILE bad ifile parameter
* GPFS_E_INVAL_ISCAN bad iscan parameter
* see system call read() ERRORS
*
* Notes: The termOffset parameter provides a means to partition a
* file's data such that it may be read on more than one node.
*/
gpfs_off64_t GPFS_API
gpfs_ireadx(gpfs_ifile_t *ifile, /* in only */
gpfs_iscan_t *iscan, /* in only */
void *buffer, /* in only */
int bufferSize, /* in only */
gpfs_off64_t *offset, /* in/out */
gpfs_off64_t termOffset, /* in only */
int *hole); /* out only */
/* NAME: gpfs_ireadx_ext
*
* FUNCTION: gpfs_ireadx_ext is used to find different blocks between clone
* child and parent files. Input and output are the same as
* gpfs_ireadx.
*
* Returns: See gpfs_ireadx()
*/
gpfs_off64_t GPFS_API
gpfs_ireadx_ext(gpfs_ifile_t *ifile, /* in only */
gpfs_iscan_t *iscan, /* in only */
void *buffer, /* in only */
int bufferSize, /* in only */
gpfs_off64_t *offset, /* in/out */
gpfs_off64_t termOffset, /* in only */
int *hole);
/* NAME: gpfs_iwritex()
*
* FUNCTION: Write file opened by gpfs_iopen.
* If parameter hole == 0, then write data
* addressed by buffer to the given offset for the
* given length. If hole != 0, then write
* a hole at the given offset for the given length.
*
* Input: ifile : ptr to gpfs_ifile_t returned from gpfs_iopen()
* buffer: ptr to data buffer
* writeLen: length of data to write
* offset: offset in file to write data
* hole: flag =1 to write a "hole"
* =0 to write data
*
* Returns: number of bytes/size of hole written (Success)
* -1 and errno is set (Failure)
*
* Errno: ENOSYS function not available
* EINVAL missing or bad parameter
* EISDIR file is a directory
* EPERM caller must have superuser privilege
* ESTALE cached fs information was invalid
* GPFS_E_INVAL_IFILE bad ifile parameter
* see system call write() ERRORS
*/
gpfs_off64_t GPFS_API
gpfs_iwritex(gpfs_ifile_t *ifile, /* in only */
void *buffer, /* in only */
gpfs_off64_t writeLen, /* in only */
gpfs_off64_t offset, /* in only */
int hole); /* in only */
/* NAME: gpfs_statfspool()
*
* FUNCTION: Obtain status information about the storage pools
*
* Input: pathname : path to any file in the file system
* poolId : id of first pool to return
* on return set to next poolId or -1
* to indicate there are no more pools.
* options : option flags (currently not used)
* nPools : number of stat structs requested or 0
* on return number of stat structs in buffer
* or if nPools was 0 its value is the max number
* of storage pools currently defined
* buffer : ptr to return stat structures
* bufferSize : sizeof stat buffer
*
* The user is expected to issue two or more calls. On the first
* call the user should pass nPools set to 0 and gpfs will
* return in nPools the total number of storage pools currently
* defined for the file system indicated by the pathname
* and it returns in poolId the id of the first storage pool.
* The buffer parameter may be set to NULL for this call.
*
* The user may then allocate a buffer large enough to contain
* a gpfs_statfspool_t structure for each of the pools and issue
* a second call to obtain stat information about each pool.
* Parameter nPools should be set the number of pools requested.
* On return, nPools will be set to the number of stat structs
* contained in the buffer, and poolId will be set to the id
* of the next storage pool or -1 to indicate there are no
* additional storage pools defined.
*
* Alternatively, if the user has a valid poolId from a previous
* call, the user may provide that poolId and a buffer large
* enough for a single gpfs_statfspool_t structure, and the call
* will return the status for a single storage pool.
*
*
* Returns: 0 Successful
* -1 Failure
*
* Errno: Specific error indication
* EINVAL
*/
int GPFS_API
gpfs_statfspool(const char *pathname, /* in only: path to file system*/
gpfs_pool_t *poolId, /* in out: id of first pool to return
on return set to next poolId
or -1 when there are no more pools */
unsigned int options, /* in only: option flags */
int *nPools, /* in out: number of pool stats requested
on return number of stat structs
returned in buffer or if nPools was
set to 0, the return value is the
number of pools currently defined */
void *buffer, /* ptr to return stat structures */
int bufferSize); /* sizeof stat buffer or 0 */
/* NAME: gpfs_getpoolname()
*
* FUNCTION: Retrieves the name of the storage pool assigned for
* this file's data. The storage pool name is a null-terminated
* string, with a maximum length of GPFS_MAXNAMLEN.
*
* Input: pathname: path to any file in the file system
* poolId: f_poolid returned in gpfs_statfspool_t
* buffer: pointer to buffer for returned name
* bufferSize: size of buffer
*
* Returns: 0 Successful
* -1 Failure and errno is set
*
* Errno: ENOSYS function not available
* ESTALE file system was unmounted
* E_FORMAT_INCOMPAT file system does not support pools
* E2BIG buffer too small to return storage pool name
*/
int GPFS_API
gpfs_getpoolname(const char *pathname,
gpfs_pool_t poolId,
void *buffer,
int bufferSize);
/* /usr/src/linux/include/linux/fs.h includes /usr/src/linux/include/linux/quota.h
which has conflicting definitions. */
#ifdef _LINUX_QUOTA_
#undef Q_SYNC
#undef Q_GETQUOTA
#undef Q_SETQUOTA
#undef Q_QUOTAON
#undef Q_QUOTAOFF
#endif
/* GPFS QUOTACTL */
/*
* Command definitions for the 'gpfs_quotactl' system call.
* The commands are broken into a main command defined below
* and a subcommand that is used to convey the type of
* quota that is being manipulated (see above).
*/
#define SUBCMDMASK 0x00ff
#define SUBCMDSHIFT 8
#define GPFS_QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
#define Q_QUOTAON 0x0100 /* enable quotas */
#define Q_QUOTAOFF 0x0200 /* disable quotas */
#define Q_GETQUOTA 0x0300 /* get limits and usage */
#ifndef _LINUX_SOURCE_COMPAT
/* Standard AIX definitions of quota commands */
#define Q_SETQUOTA 0x0400 /* set limits */
#define Q_SETQLIM Q_SETQUOTA
#else
/* Alternate definitions, for Linux Affinity */
#define Q_SETQLIM 0x0400 /* set limits */
#define Q_SETQUOTA 0x0700 /* set limits and usage */
#endif
#define Q_SETUSE 0x0500 /* set usage */
#define Q_SYNC 0x0600 /* sync disk copy of a file systems quotas */
#define Q_SETGRACETIME 0x0900 /* set grace time */
#define Q_SETGRACETIME_ENHANCE 0x0800 /* set grace time and update all
* quota entries */
#define Q_GETDQPFSET 0x0A00 /* get default quota per fileset */
#define Q_SETDQPFSET 0x0B00 /* set default quota per fileset */
#define Q_SETQUOTA_UPDATE_ET 0x0C00 /* this SETQUOTA needs to update entryType */
#define Q_GETDQPFSYS 0x0D00 /* get default quota per file system */
#define Q_SETDQPFSYS 0x0E00 /* set default quota per file system */
/* gpfs quota types */
#define GPFS_USRQUOTA 0
#define GPFS_GRPQUOTA 1
#define GPFS_FILESETQUOTA 2
/* define GPFS generated errno */
#define GPFS_E_NO_QUOTA_INST 237 /* file system does not support quotas */
typedef struct gpfs_quotaInfo
{
gpfs_off64_t blockUsage; /* current block count in 1 KB units*/
gpfs_off64_t blockHardLimit; /* absolute limit on disk blks alloc */
gpfs_off64_t blockSoftLimit; /* preferred limit on disk blks */
gpfs_off64_t blockInDoubt; /* distributed shares + "lost" usage for blks */
int inodeUsage; /* current # allocated inodes */
int inodeHardLimit; /* absolute limit on allocated inodes */
int inodeSoftLimit; /* preferred inode limit */
int inodeInDoubt; /* distributed shares + "lost" usage for inodes */
gpfs_uid_t quoId; /* uid, gid or fileset id */
int entryType; /* entry type, not used */
unsigned int blockGraceTime; /* time limit for excessive disk use */
unsigned int inodeGraceTime; /* time limit for excessive inode use */
} gpfs_quotaInfo_t;
/* NAME: gpfs_quotactl()
*
* FUNCTION: Manipulate disk quotas
* INPUT: pathname: specifies the pathname of any file within the
* mounted file system to which the command is to
* be applied
* cmd: specifies a quota control command to be applied
* to UID/GID/FILESETID id. The cmd parameter can be
* constructed using GPFS_QCMD(cmd, type) macro defined
* in gpfs.h
* id: UID or GID or FILESETID that command applied to.
* bufferP: points to the address of an optional, command
* specific, data structure that is copied in or out of
* the system.
*
* OUTPUT: bufferP, if applicable.
*
* Returns: 0 success
* -1 failure
*
* Errno: EACCESS
* EFAULT An invalid bufferP parameter is supplied;
* the associated structure could not be copied
* in or out of the kernel
* EINVAL
* ENOENT No such file or directory
* EPERM The quota control command is privileged and
* the caller did not have root user authority
* EOPNOTSUPP
* GPFS_E_NO_QUOTA_INST The file system does not support quotas
*/
int GPFS_API
gpfs_quotactl(const char *pathname,
int cmd,
int id,
void *bufferP);
/* NAME: gpfs_getfilesetid()
*
* FUNCTION: Translate FilesetName to FilesetID
*
* INPUT: pathname: specifies the pathname of any file within the
* mounted file system to which the command is to
* be applied
* name: name of the fileset
*
* OUTPUT: idP: points to the address of an integer that receives the ID
*
* Returns: 0 success
* -1 failure
*
* Errno: EACCESS
* EFAULT An invalid pointer is supplied; the associated
* data could not be copied in or out of the kernel
* EINVAL
* ENOENT No such file, directory or fileset
*/
int GPFS_API
gpfs_getfilesetid(const char *pathname,
const char *name,
int *idP);
/* NAME: gpfs_clone_snap()
*
* FUNCTION: Create an immutable clone parent from a source file
*
* Input: sourcePathP: path to source file, which will be cloned
* destPathP: path to destination file, to be created
*
* If destPathP is NULL, then the source file will be changed
* in place into an immutable clone parent.
*
* Returns: 0 Successful
* -1 Failure
*
* Errno: ENOSYS Function not available
* ENOENT File does not exist
* EACCESS Write access to target or source search permission denied
* EINVAL Not a regular file or not a GPFS file system
* EFAULT Input argument points outside accessible address space
* ENAMETOOLONG Source or destination path name too long
* ENOSPC Not enough space on disk
* EISDIR Destination is a directory
* EXDEV Source and destination aren't in the same file system
* EROFS Destination is read-only
* EPERM Invalid source file
* EEXIST Destination file already exists
* EBUSY Source file is open
* EFORMAT File system does not support clones
* EMEDIUMTYPE File system does not support clones
*/
int GPFS_API
gpfs_clone_snap(const char *sourcePathP, const char *destPathP);
/* NAME: gpfs_clone_copy()
*
* FUNCTION: Create a clone copy of an immutable clone parent file
*
* Input: sourcePathP: path to immutable source file, to be cloned
* destPathP: path to destination file, to be created
*
* Returns: 0 Successful
* -1 Failure
*
* Errno: ENOSYS Function not available
* ENOENT File does not exist
* EACCESS Write access to target or source search permission denied
* EINVAL Not a regular file or not a GPFS file system
* EFAULT Input argument points outside accessible address space
* ENAMETOOLONG Source or destination path name too long
* ENOSPC Not enough space on disk
* EISDIR Destination is a directory
* EXDEV Source and destination aren't in the same file system
* EROFS Destination is read-only
* EPERM Invalid source or destination file
* EEXIST Destination file already exists
* EFORMAT File system does not support clones
* EMEDIUMTYPE File system does not support clones
*/
int GPFS_API
gpfs_clone_copy(const char *sourcePathP, const char *destPathP);
/* NAME: gpfs_declone()
*
* FUNCTION: Copy blocks from clone parent(s) to child so that the
* parent blocks are no longer referenced by the child.
*
* Input: fileDesc: File descriptor for file to be de-cloned
* ancLimit: Ancestor limit (immediate parent only, or all)
* nBlocks: Maximum number of GPFS blocks to copy
* In/Out: offsetP: Pointer to starting offset within file (will be
* updated to offset of next block to process or
* -1 if no more blocks)
*
* Returns: 0 Successful
* -1 Failure
*
* Errno: ENOSYS Function not available
* EINVAL Invalid argument to function
* EBADF Bad file descriptor or not a GPFS file
* EPERM Not a regular file
* EACCESS Write access to target file not permitted
* EFAULT Input argument points outside accessible address space
* ENOSPC Not enough space on disk
*/
/* Values for ancLimit */
#define GPFS_CLONE_ALL 0
#define GPFS_CLONE_PARENT_ONLY 1
int GPFS_API
gpfs_declone(gpfs_file_t fileDesc, int ancLimit, gpfs_off64_t nBlocks,
gpfs_off64_t *offsetP);
/* NAME: gpfs_clone_split()
*
* FUNCTION: Split a clone child file from its parent. Must call
* gpfs_declone first, to remove all references.
*
* Input: fileDesc: File descriptor for file to be split
* ancLimit: Ancestor limit (immediate parent only, or all)
*
* Returns: 0 Successful
* -1 Failure
*
* Errno: ENOSYS Function not available
* EINVAL Invalid argument to function
* EBADF Bad file descriptor or not a GPFS file
* EPERM Not a regular file or not a clone child
* EACCESS Write access to target file not permitted
*/
int GPFS_API
gpfs_clone_split(gpfs_file_t fileDesc, int ancLimit);
/* NAME: gpfs_clone_unsnap()
*
* FUNCTION: Change a clone parent with no children back into a
* normal file.
*
* Input: fileDesc: File descriptor for file to be un-snapped
*
* Returns: 0 Successful
* -1 Failure
*
* Errno: ENOSYS Function not available
* EINVAL Invalid argument to function
* EBADF Bad file descriptor or not a GPFS file
* EPERM Not a regular file or not a clone parent
* EACCESS Write access to target file not permitted
*/
int GPFS_API
gpfs_clone_unsnap(gpfs_file_t fileDesc);
/* NAME: gpfs_get_fset_masks()
*
* FUNCTION: return bit masks governing "external" inode and inode-space numbering
*
* Input: fset_snaphandle: ptr to an fset snaphandle
* Output: the bit masks and inodes per block factor.
*
* Returns: 0 Success
* -1 Failure
*
* Errno: ENOSYS function not available
* GPFS_E_INVAL_FSSNAPHANDLE invalid fssnapHandle
*/
int GPFS_API
gpfs_get_fset_masks(gpfs_fssnap_handle_t* fset_snapHandle,
gpfs_ino64_t* inodeSpaceMask,
gpfs_ino64_t* inodeBlockMask,
int* inodesPerInodeBlock);
/*
* API functions for Light Weight Event
*/
/*
* Define light weight event types
*/
typedef enum
{
GPFS_LWE_EVENT_UNKNOWN = 0, /* "Uknown event" */
GPFS_LWE_EVENT_FILEOPEN = 1, /* 'OPEN' - look at getInfo('OPEN_FLAGS') if you care */
GPFS_LWE_EVENT_FILECLOSE = 2, /* "File Close Event" 'CLOSE' */
GPFS_LWE_EVENT_FILEREAD = 3, /* "File Read Event" 'READ' */
GPFS_LWE_EVENT_FILEWRITE = 4, /* "File Write Event" 'WRITE' */
GPFS_LWE_EVENT_FILEDESTROY = 5, /* File is being destroyed 'DESTROY' */
GPFS_LWE_EVENT_FILEEVICT = 6, /* OpenFile object is being evicted from memory 'FILE_EVICT' */
GPFS_LWE_EVENT_BUFFERFLUSH = 7, /* Data buffer is being written to disk 'BUFFER_FLUSH' */
GPFS_LWE_EVENT_POOLTHRESHOLD = 8, /* Storage pool exceeded defined utilization 'POOL_THRESHOLD' */
GPFS_LWE_EVENT_FILEDATA = 9, /* "Read/Write/Trunc" event on open file */
GPFS_LWE_EVENT_FILERENAME = 10, /* Rename event on open file */
GPFS_LWE_EVENT_FILEUNLINK = 11, /* Unlink file event */
GPFS_LWE_EVENT_FILERMDIR = 12, /* Remove directory event */
GPFS_LWE_EVENT_EVALUATE = 13, /* Evaluate And Set Events */
GPFS_LWE_EVENT_FILEOPEN_READ = 14, /* Open for Read Only - EVENT 'OPEN_READ' - deprecated, use 'OPEN' */
GPFS_LWE_EVENT_FILEOPEN_WRITE = 15, /* Open with Writing privileges - EVENT 'OPEN_WRITE' - deprecated, use 'OPEN' */
GPFS_LWE_EVENT_FILEPOOL_CHANGE = 16, /* Open with Writing privileges - EVENT 'OPEN_WRITE' - deprecated, use 'OPEN' */
GPFS_LWE_EVENT_XATTR_CHANGE = 17, /* EAs of file are changed */
GPFS_LWE_EVENT_ACL_CHANGE = 18, /* ACLs (both GPFS ACLs and Posix permissions) of a file are changed */
GPFS_LWE_EVENT_CREATE = 19, /* create, including mkdir, symlink, special file */
GPFS_LWE_EVENT_GPFSATTR_CHANGE = 20, /* ts-specific attributes of file are changed */
GPFS_LWE_EVENT_FILETRUNCATE = 21, /* "File Truncate Event" 'TRUNCATE' */
GPFS_LWE_EVENT_FS_UNMOUNT_ALL = 22, /* FS is not externally mounted anywhere */
GPFS_LWE_EVENT_MAX = 23, /* 1 greater than any of the above */
} gpfs_lwe_eventtype_t;
/* Define light weight event response types */
typedef enum
{
GPFS_LWE_RESP_INVALID = 0, /* "Response Invalid/Unknown" */
GPFS_LWE_RESP_CONTINUE = 1, /* "Response Continue" */
GPFS_LWE_RESP_ABORT = 2, /* "Response Abort" */
GPFS_LWE_RESP_DONTCARE = 3 /* "Response DontCare" */
} gpfs_lwe_resp_t;
/*
* Define light weight event inofrmation
*/
#define LWE_DATA_FS_NAME 0x00000001 /* "fsName" */
#define LWE_DATA_PATH_NAME 0x00000002 /* "pathName" */
#define LWE_DATA_PATH_NEW_NAME 0x00000004 /* "pathNewName" for reanem */
#define LWE_DATA_URL 0x00000008 /* "URL" */
#define LWE_DATA_INODE 0x00000010 /* "inode" */
#define LWE_DATA_OPEN_FLAGS 0x00000020 /* "openFlags" */
#define LWE_DATA_POOL_NAME 0x00000040 /* "poolName" */
#define LWE_DATA_FILE_SIZE 0x00000080 /* "fileSize" */
#define LWE_DATA_OWNER_UID 0x00000100 /* "ownerUserId" */
#define LWE_DATA_OWNER_GID 0x00000200 /* "ownerGroupId" */
#define LWE_DATA_ATIME 0x00000400 /* "atime" */
#define LWE_DATA_MTIME 0x00000800 /* "mtime" */
#define LWE_DATA_NOW_TIME 0x00001000 /* "nowTime" */
#define LWE_DATA_ELAPSED_TIME 0x00002000 /* "elapsedTime" */
#define LWE_DATA_CLIENT_UID 0x00004000 /* "clientUserId" */
#define LWE_DATA_CLIENT_GID 0x00008000 /* "clientGroupId" */
#define LWE_DATA_NFS_IP 0x00010000 /* "clientIp" */
#define LWE_DATA_PROCESS_ID 0x00020000 /* "processId" */
#define LWE_DATA_TARGET_POOL_NAME 0x00040000 /* "targetPoolName" */
#define LWE_DATA_BYTES_READ 0x00080000 /* "bytesRead" */
#define LWE_DATA_BYTES_WRITTEN 0x00100000 /* "bytesWritten" */
#define LWE_DATA_CLUSTER_NAME 0x00200000 /* "clusterName" */
#define LWE_DATA_NODE_NAME 0x00400000 /* "nodeName" */
#define LWE_DATA_LWESEND 0x00800000 /* "lweSend" */
/*
* Define light weight events
*/
#define LWE_EVENT_EVALUATED 0x00000001 /* policy was evaluated */
#define LWE_EVENT_FILEOPEN 0x00000002 /* "op_open" */
#define LWE_EVENT_FILECLOSE 0x00000004 /* "op_close" */
#define LWE_EVENT_FILEREAD 0x00000008 /* "op_read" */
#define LWE_EVENT_FILEWRITE 0x00000010 /* "op_write" */
#define LWE_EVENT_FILEDESTROY 0x00000020 /* "op_destroy" */
#define LWE_EVENT_FILEEVICT 0x00000040 /* "op_evict" OpenFile object is being evicted from memory 'FILE_EVICT' */
#define LWE_EVENT_BUFFERFLUSH 0x00000080 /* "op_buffer_flush" Data buffer is being written to disk 'BUFFER_FLUSH' */
#define LWE_EVENT_POOLTHRESHOLD 0x00000100 /* "op_pool_threshhold" Storage pool exceeded defined utilization 'POOL_THRESHOLD' */
#define LWE_EVENT_FILEDATA 0x00000200 /* "op_data" "Read/Write/Trunc" event on open file */
#define LWE_EVENT_FILERENAME 0x00000400 /* "op_rename" Rename event on open file */
#define LWE_EVENT_FILEUNLINK 0x00000800 /* "op_unlink" Unlink file event */
#define LWE_EVENT_FILERMDIR 0x00001000 /* "op_rmdir" Remove directory event */
#define LWE_EVENT_FILEOPEN_READ 0x00002000 /* "op_open_read" Open for Read Only - EVENT 'OPEN_READ' - deprecated, use 'OPEN' */
#define LWE_EVENT_FILEOPEN_WRITE 0x00004000 /* "op_open_write" Open with Writing privileges - EVENT 'OPEN_WRITE' - deprecated, use 'OPEN' */
#define LWE_EVENT_FILEPOOL_CHANGE 0x00008000 /* "op_pool_change" Open with Writing privileges - EVENT 'OPEN_WRITE' - deprecated, use 'OPEN' */
/*
* Defines for light weight sessions
*/
typedef unsigned long long gpfs_lwe_sessid_t;
#define GPFS_LWE_NO_SESSION ((gpfs_lwe_sessid_t) 0)
#define GPFS_LWE_SESSION_INFO_LEN 256
/*
* Define light weight token to identify access right
*/
typedef struct gpfs_lwe_token
{
unsigned long long high;
unsigned long long low;
#ifdef __cplusplus
bool operator == (const struct gpfs_lwe_token& rhs) const
{ return high == rhs.high && low == rhs.low; };
bool operator != (const struct gpfs_lwe_token& rhs) const
{ return high != rhs.high || low != rhs.low; };
#endif /* __cplusplus */
} gpfs_lwe_token_t;
/* Define special tokens */
static const gpfs_lwe_token_t _gpfs_lwe_no_token = { 0, 0 };
#define GPFS_LWE_NO_TOKEN _gpfs_lwe_no_token
static const gpfs_lwe_token_t _gpfs_lwe_invalid_token = { 0, 1 };
#define GPFS_LWE_INVALID_TOKEN _gpfs_lwe_invalid_token
/*
* Note: LWE data managers can set a file's off-line bit
* or any of the managed bits visible to the policy language
* by calling dm_set_region or dm_set_region_nosync
* with a LWE session and LWE exclusive token. To set the bits
* there must be * exactly one managed region with offset = -1
* and size = 0. Any other values will return EINVAL.
*/
/* LWE also provides light weight regions
* that are set via policy rules.
*/
#define GPFS_LWE_MAX_REGIONS 2
/* LWE data events are generated from user access
* to a LWE managed region. */
#define GPFS_LWE_DATAEVENT_NONE (0x0)
#define GPFS_LWE_DATAEVENT_READ (0x1)
#define GPFS_LWE_DATAEVENT_WRITE (0x2)
#define GPFS_LWE_DATAEVENT_TRUNCATE (0x4)
#define GPFS_LWE_ATTRCHANGEEVENT_IMMUTABILITY (0x8)
#define GPFS_LWE_ATTRCHANGEEVENT_APPENDONLY (0x10)
/*
* Define light weight event structure
*/
typedef struct gpfs_lwe_event {
int eventLen; /* offset 0 */
gpfs_lwe_eventtype_t eventType; /* offset 4 */
gpfs_lwe_token_t eventToken; /* offset 8 <--- Must on DWORD */
int isSync; /* offset 16 */
int parmLen; /* offset 20 */
char* parmP; /* offset 24 <-- Must on DWORD */
} gpfs_lwe_event_t;
/*
* Define light weight access rights
*/
#define GPFS_LWE_RIGHT_NULL 0
#define GPFS_LWE_RIGHT_SHARED 1
#define GPFS_LWE_RIGHT_EXCL 2
/* Flag indicating whether to wait
* when requesting a right or an event
*/
#define GPFS_LWE_FLAG_NONE 0
#define GPFS_LWE_FLAG_WAIT 1
/* NAME: gpfs_lwe_create_session()
*
* FUNCTION: create a light weight event session
*
* Input: oldsid: existing session id,
* Set to GPFS_LWE_NO_SESSION to start new session
* - If a session with the same name and id already exists
* it is not terminated, nor will outstanding events
* be redelivered. This is typically used if a session
* is shared between multiple processes.
* Set to an existing session's id to resume that session
* - If a session with the same name exists, that session
* will be terminated. All pending/outstanding events
* for the old session will be redelivered on the new one.
* This is typically used to take over a session from a
* failed/hung process.
* sessinfop: session string, unique for each session
*
* Output: newsidp: session id for new session
*
* Returns: 0 Success
* -1 Failure
*
* Errno: ENOSYS Function not available
* EINVAL invalid parameters
* ENFILE maximum number of sessions have already been created
* ENOMEM insufficient memory to create new session
* ENOENT session to resume does not exist
* EEXIST session to resume exists with different id
* EPERM Caller does not hold appropriate privilege
*/
int GPFS_API
gpfs_lwe_create_session(gpfs_lwe_sessid_t oldsid, /* IN */
char *sessinfop, /* IN */
gpfs_lwe_sessid_t *newsidp); /* OUT */
#define GPFS_MAX_LWE_SESSION_INFO_LEN 100
/* NAME: gpfs_lwe_destroy_session()
*
* FUNCTION: destroy a light weight event session
*
* Input: sid: id of the session to be destroyed
*
* Returns: 0 Success
* -1 Failure
*
* Errno: ENOSYS Function not available
* EINVAL sid invalid
* EBUSY session is busy
* EPERM Caller does not hold appropriate privilege
*/
int GPFS_API
gpfs_lwe_destroy_session(gpfs_lwe_sessid_t sid); /* IN */
/* NAME: gpfs_lwe_getall_sessions()
*
* FUNCTION: fetch all lwe sessions
*
* Input: nelem: max number of elements
* sidbufp: array of session id
* nelemp: number of session returned in sidbufp
*
* Returns: 0 Success
* -1 Failure
*
* Errno: ENOSYS Function not available
* EINVAL pass in args invalid
* E2BIG information is too large
* EPERM Caller does not hold appropriate privilege
*/
int GPFS_API
gpfs_lwe_getall_sessions(unsigned int nelem, /* IN */
gpfs_lwe_sessid_t *sidbufp, /* OUT */
unsigned int *nelemp); /* OUT */
/* NAME: gpfs_lw_query_session()
*
* FUNCTION: query session string by id
*
* Input: sid: id of session to be queryed
* buflen: length of buffer
* bufp: buffer to store sessions string
* rlenp: returned length of bufp
*
* Returns: 0 Success
* -1 Failure
*
* Errno: ENOSYS Function not available
* EINVAL pass in args invalid
* E2BIG information is too large
* EPERM Caller does not hold appropriate privilege
*/
int GPFS_API
gpfs_lwe_query_session(gpfs_lwe_sessid_t sid, /* IN */
size_t buflen, /* IN */
void *bufp, /* OUT */
size_t *rlenP); /* OUT */
/* NAME: gpfs_lwe_get_events()
*
* FUNCTION: get events from a light weight session
*
* Input: sid: id of the session
* maxmsgs: max number of event to fetch,
* 0 to fetch all possible
* flags: GPFS_LWE_EV_WAIT: waiting for new events if event
* queue is empty
* buflen: length of the buffer
* bufp: buffer to hold events
* rlenp: returned length of bufp
*
* Returns: 0 Success
* E2BIG information is too large
* EINVAL pass in args invalid
*/
int GPFS_API
gpfs_lwe_get_events(gpfs_lwe_sessid_t sid, /* IN */
unsigned int maxmsgs, /* IN */
unsigned int flags, /* IN */
size_t buflen, /* IN */
void *bufp, /* OUT */
size_t *rlenp); /* OUT */
/* NAME: gpfs_lwe_respond_event()
*
* FUNCTION: response to a light weight event
*
* Input: sid: id of the session
* token: token of the event
* response: response to the event
* reterror: return error to event callers
*
* Returns: 0 Success
* EINVAL pass in args invalid
*
*/
int GPFS_API
gpfs_lwe_respond_event(gpfs_lwe_sessid_t sid, /* IN */
gpfs_lwe_token_t token, /* IN */
gpfs_lwe_resp_t response, /* IN */
int reterror); /* IN */
/* NAME: gpfs_lwe_request_right
*
* FUNCTION: Request an access right to a file using a dmapi handle
*
* Input: sid Id of lw session
* hanp Pointer to dmapi handle
* hlen Length of dmapi handle
* right Shared or exclusive access requested
* flags Caller will wait to acquire access if necessary
*
* Output: token Unique identifier for access right
*
* Returns: 0 Success
* -1 Failure
*
* Errno: ENOSYS Function not available
* ESTALE GPFS not available
* EINVAL Invalid arguments
* EFAULT Invalid pointer provided
* EBADF Bad file
* ENOMEM Uable to allocate memory for request
* EPERM Caller does not hold appropriate privilege
* EAGAIN flags parameter did not include WAIT
* and process would be blocked
*
*/
int GPFS_API
gpfs_lwe_request_right(gpfs_lwe_sessid_t sid, /* IN */
void *hanp, /* IN */
size_t hlen, /* IN */
unsigned int right, /* IN */
unsigned int flags, /* IN */
gpfs_lwe_token_t *token); /* OUT */
/* NAME: gpfs_lwe_upgrade_right
*
* FUNCTION: Upgrade an access right from shared to exclusive
*
* This is a non-blocking call to upgrade an access right
* from shared to exclusive. If the token already conveys
* exclusive access this call returns imediately with sucess.
* If another process also holds a shared access right
* this call fails with EBUSY to avoid deadlocks.
*
* Input: sid Id of lw session
* hanp Pointer to dmapi handle
* hlen Length of dmapi handle
* token Unique identifier for access right
*
* Output: None
*
* Returns: 0 Success
* -1 Failure
*
* Errno: ENOSYS Function not available
* ESTALE GPFS not available
* EINVAL Invalid arguments
* EINVAL The token is invalid
* EFAULT Invalid pointer provided
* EPERM Caller does not hold appropriate privilege
* EPERM Token's right is not shared or exclusive
* EBUSY Process would be blocked
*
*/
int GPFS_API
gpfs_lwe_upgrade_right(gpfs_lwe_sessid_t sid, /* IN */
void *hanp, /* IN */
size_t hlen, /* IN */
gpfs_lwe_token_t token); /* IN */
/* NAME: gpfs_lwe_downgrade_right
*
* FUNCTION: Downgrade an access right from exclusive to shared
*
* This reduces an access right from exclusive to shared
* without dropping the exclusive right to acquire the shared.
* The token must convey exclusive right before the call.
*
* Input: sid Id of lw session
* hanp Pointer to dmapi handle
* hlen Length of dmapi handle
* token Unique identifier for access right
*
* Output: None
*
* Returns: 0 Success
* -1 Failure
*
* Errno: ENOSYS Function not available
* ESTALE GPFS not available
* EINVAL Invalid arguments
* EINVAL The token is invalid
* EFAULT Invalid pointer provided
* EPERM Caller does not hold appropriate privilege
* EPERM Token's right is not exclusive
*
*/
int GPFS_API
gpfs_lwe_downgrade_right(gpfs_lwe_sessid_t sid, /* IN */
void *hanp, /* IN */
size_t hlen, /* IN */
gpfs_lwe_token_t token); /* IN */
/* NAME: gpfs_lwe_release_right
*
* FUNCTION: Release an access right conveyed by a token
*
* This releases the access right held by a token
* and invalidates the token. Once the access right
* is released the token cannot be reused.
*
* Input: sid Id of lw session
* hanp Pointer to dmapi handle
* hlen Length of dmapi handle
* token Unique identifier for access right
*
* Output: None
*
* Returns: 0 Success
* -1 Failure
*
* Errno: ENOSYS Function not available
* ESTALE GPFS not available
* EINVAL Invalid arguments
* EINVAL The token is invalid
* EFAULT Invalid pointer provided
* EPERM Caller does not hold appropriate privilege
*/
int GPFS_API
gpfs_lwe_release_right(gpfs_lwe_sessid_t sid, /* IN */
void *hanp, /* IN */
size_t hlen, /* IN */
gpfs_lwe_token_t token); /* IN */
/* NAME: gpfs_lwe_getattrs()
*
* FUNCTION: Retrieves all extended file attributes in opaque format.
* This function together with gpfs_lwe_putattrs is intended for
* use by a backup program to save (gpfs_lwe_getattrs) and
* restore (gpfs_lwe_putattrs) all extended file attributes
* (ACLs, user attributes, ...) in one call.
*
* NOTE: This call is the lwe equivalent of gpfs_igetattrsx
* but uses a file handle to identify the file
* and an existing LWE token for locking it.
*
*
* Input: sid Id of lw session
* hanp Pointer to dmapi handle
* hlen Length of dmapi handle
* token Unique identifier for access right
* flags Define behavior of get attributes
* GPFS_ATTRFLAG_NO_PLACEMENT - file attributes for placement
* are not saved, neither is the current storage pool.
* GPFS_ATTRFLAG_IGNORE_POOL - file attributes for placement
* are saved, but the current storage pool is not.
* GPFS_ATTRFLAG_INCL_DMAPI - file attributes for dmapi are
* included in the returned buffer
* GPFS_ATTRFLAG_INCL_ENCR - file attributes for encryption
* are included in the returned buffer
*
* buffer: pointer to buffer for returned attributes
* bufferSize: size of buffer
* attrSize: ptr to returned size of attributes
*
* Returns: 0 Successful
* -1 Failure
*
* Errno: ENOSYS function not available
* EINVAL Not a GPFS file
* EINVAL invalid flags provided
* ENOSPC buffer too small to return all attributes
* *attrSizeP will be set to the size necessary
*/
int GPFS_API
gpfs_lwe_getattrs(gpfs_lwe_sessid_t sid,
void *hanp,
size_t hlen,
gpfs_lwe_token_t token,
int flags,
void *buffer,
int bufferSize,
int *attrSize);
/* NAME: gpfs_lwe_putattrs()
*
* FUNCTION: Sets all extended file attributes of a file.
*
* This routine can optionally invoke the policy engine
* to match a RESTORE rule using the file's attributes saved
* in the extended attributes to set the file's storage pool and
* data replication as when calling gpfs_fputattrswithpathname.
* When used with the policy the caller should include the
* full path to the file, including the file name, to allow
* rule selection based on file name or path.
*
* By default, the routine will not use RESTORE policy rules
* for data placement. The pathName parameter will be ignored
* and may be set to NULL.
*
* If the call does not use RESTORE policy rules, or if the
* file fails to match a RESTORE rule, or if there are no
* RESTORE rules installed, then the storage pool and data
* replication are selected as when calling gpfs_fputattrs().
*
* The buffer passed in should contain extended attribute data
* that was obtained by a previous call to gpfs_fgetattrs.
*
* pathName is a UTF-8 encoded string. On Windows, applications
* can convert UTF-16 ("Unicode") to UTF-8 using the platforms
* WideCharToMultiByte function.
*
* NOTE: This call is the lwe equivalent of gpfs_iputaattrsx
* but uses a file handle to identify the file
* and an existing LWE token for locking it.
*
*
* Input: sid Id of lw session
* hanp Pointer to dmapi handle
* hlen Length of dmapi handle
* token Unique identifier for access right
* flags Define behavior of put attributes
* GPFS_ATTRFLAG_NO_PLACEMENT - file attributes are restored
* but the storage pool and data replication are unchanged
* GPFS_ATTRFLAG_IGNORE_POOL - file attributes are restored
* but the storage pool and data replication are selected
* by matching the saved attributes to a placement rule
* instead of restoring the saved storage pool.
* GPFS_ATTRFLAG_USE_POLICY - file attributes are restored
* but the storage pool and data replication are selected
* by matching the saved attributes to a RESTORE rule
* instead of restoring the saved storage pool.
* GPFS_ATTRFLAG_FINALIZE_ATTRS - file attributes that are restored
* after data is retored. If file is immutable/appendOnly
* call without this flag before restoring data
* then call with this flag after restoring data
* GPFS_ATTRFLAG_INCL_ENCR - file attributes for encryption
* are restored. Note that this may result in the file's
* File Encryption Key (FEK) being changed, and in this
* case any prior content in the file is effectively lost.
* This option should only be used when the entire file
* content is restored after the attributes are restored.
*
* buffer: pointer to buffer for returned attributes
* pathName: pointer to file path and file name for file
* May be set to NULL.
*
* Returns: 0 Successful
* -1 Failure and errno is set
*
* Errno: ENOSYS function not available
* EINVAL the buffer does not contain valid attribute data
* EINVAL invalid flags provided
* EPERM caller must have superuser privilege
* ESTALE cached fs information was invalid
* GPFS_E_INVAL_IFILE bad ifile parameters
*/
int GPFS_API
gpfs_lwe_putattrs(gpfs_lwe_sessid_t sid,
void *hanp,
size_t hlen,
gpfs_lwe_token_t token,
int flags,
void *buffer,
const char *pathName);
const char* GPFS_API
gpfs_get_fspathname_from_fsname(const char* fsname_or_path);
/* Check that fsname_or_path refers to a GPFS file system and find the path to its root
Return a strdup()ed copy of the path -OR- NULL w/errno
*/
int GPFS_API
/* experimental */
gpfs_qos_getstats(
const char *fspathname, /* in only: path to file system*/
unsigned int options, /* in only: option flags: 0=begin at specified qip, 1=begin after qip */
unsigned int qosid, /* in only: 0 or a specific qosid at which to start or continue */
gpfs_pool_t poolid, /* in only: -1 or a specific poolid at which to start or continue */
unsigned int mqips, /* in only: max number of qip=(qosid,poolid) histories to retrieve */
unsigned int nslots, /* in only: max number of time slots of history to retrieve */
void *bufferP, /* ptr to return stat structures */
unsigned int bufferSize); /* sizeof stat buffer or 0 */
int GPFS_API
/* experimental */
gpfs_qos_control(
const char *fspathname, /* in only: path to file system*/
void *bufferP, /* in/out control/get/set structs */
unsigned int bufferSize);
int GPFS_API
gpfs_qos_set(
const char *fspathname,
const char *classname, /* "gold", "silver", or .. "1" or "2" .. */
int id, /* process id or pgrp or userid */
int which, /* process, pgrp or user */
double* qshareP); /* return the share, percentage or when negative IOP limit */
/* if id==0 then getpid() or getpgrp() or getuid()
if which==0 or 1 then process, if 2 process then group, if 3 then userid
Return -1 on error, with errno=
ENOSYS if QOS is not available in the currently installed GPFS software.
ENOENT if classname is not recognized.
ENXIO if QOS throttling is not active
(but classname is recognized and *qshareP has configured value)
*/
/* For the given process get QOS info */
int GPFS_API
gpfs_qos_get(
const char *fspathname,
int *classnumP,
char classname[GPFS_MAXNAMLEN+1], /* "gold", "silver", or .. "1" or "2" .. */
int id, /* process id or pgrp or userid */
int which, /* process, pgrp or user */
double* qshareP); /* return the share, percentage or when negative IOP limit */
/* given classname, set *classnumP and set *qshareP
Return -1 on error, with errno=
ENOSYS if QOS is not available in the currently installed GPFS software.
ENOENT if classname is not recognized.
ENXIO if QOS throttling is not active
(but classname is recognized, *classnumP and *qshareP have configured values)
*/
int GPFS_API
gpfs_qos_lkupName(
const char *fspathname,
int *classnumP,
const char *classname,
double* qshareP);
/* given classnumber, find name and share (similar to above), but start with number instead of name */
int GPFS_API
gpfs_qos_lkupVal(
const char *fspathname,
int val,
char classname[GPFS_MAXNAMLEN+1],
double* qshareP);
int GPFS_API
gpfs_ioprio_set(int,int,int); /* do not call directly */
int GPFS_API
gpfs_ioprio_get(int,int); /* do not call directly */
/* NAME: gpfs_enc_file_rewrap_key()
*
* FUNCTION: Re-wrap the File Encryption Key (FEK) for the file,
* replacing the usage of the original (second parameter)
* Master Encryption Key (MEK) with the new key provided as
* the third parameter. The content of the file remains intact.
*
* If the FEK is not currently being wrapped with the MEK
* identified by the second parameter then no action is taken.
*
* This function is normally invoked before the original MEK is
* removed.
*
* The file may be opened in read-only mode for this function
* to perform the key rewrap.
*
* Superuser privilege is required to invoke this API.
*
* INPUT: fileDesc: File descriptor for file whose key is to be rewrapped
* orig_key_p: Key ID for the key (MEK) to be replaced
* new_key_p: Key ID for the new key (MEK) to be used
*
* OUTPUT: N/A
*
* Returns: 0 success
* -1 failure
*
* Errno:
* EACCESS Existing or new key cannot be retrieved
* The new key is already being used to wrap the
* file's FEK
* EBADF Bad file descriptor
* EINVAL Arguments are invalid: key format is incorrect
* EFAULT An invalid pointer is supplied; the associated
* data could not be copied in or out of the kernel
* E2BIG Key IDs provided are too long
* ENOSYS Function not available (cluster or file system not
* enabled for encryption)
* EPERM File is in a snapshot
* Caller must have superuser privilege
*/
/* The Key ID is a string comprised of the key ID and the remote key
server RKM ID, separated by ':' */
typedef const char *gpfs_enc_key_id_t; /* "<KEY ID> : <KMS ID>" */
int GPFS_API
gpfs_enc_file_rewrap_key(gpfs_file_t fileDesc,
gpfs_enc_key_id_t orig_key_p,
gpfs_enc_key_id_t new_key_p);
/* NAME: gpfs_enc_get_algo()
*
* FUNCTION: Retrieve a string describing the encryption algorithm, key
* length, Master Encryption Key(s) ID, and wrapping and combining
* mechanisms used for the file.
*
* INPUT: fileDesc: File descriptor for file whose encryption
* algorithm is being retrieved
* encryption_xattrP: content of the gpfs.Encryption
* extended attribute, retrieved by a call to
* gpfs_fcntl (with structure type GPFS_FCNTL_GET_XATTR)
* xattr_len: length of the data in encryption_xattrP
* algo_txt_size: space reserved by the caller for algo_txtP
*
* OUTPUT: algo_txtP: NULL-terminated string describing the
* encryption for the file
*
* Returns: 0 success
* -1 failure
*
* Errno:
* ENOENT File not found
* EBADF Bad file handle, not a GPFS file
* EACCESS Permission denied
* EFAULT Bad address provided
* EINVAL Not a regular file
* EINVAL Invalid values for xattr_len or algo_txt_size
* EINVAL Invalid content of encryption extended attribute
* ENOSYS Function not available
* E2BIG Output string does not fit in algo_txtP
*/
int GPFS_API
gpfs_enc_get_algo(gpfs_file_t fileDesc,
const char *encryption_xattrP,
int xattr_len,
char *algo_txtP,
int algo_txt_size);
/* NAME: gpfs_init_trace()
*
* FUNCTION: Initialize the GPFS trace facility and start to use it.
* Must be called before calling gpfs_add_trace().
*
* Returns: 0 Success
* -1 Failure
*
* Errno: ENOENT file not found
* ENOMEM Memory allocation failed
* EACCESS Permission denied
* ENFILE Too many open files
* ENOSYS Function not available
*/
int GPFS_API
gpfs_init_trace(void);
/* NAME: gpfs_query_trace()
*
* FUNCTION: Query and cache the latest settings of GPFS trace facility.
* Generally this should be called by the notification handler
* for the "traceConfigChanged" event, which is invoked when
* something changes in the configuration of the trace facility.
*
* Returns: 0 Success
* -1 Failure
*
* Errno: ENOENT file not found
* ENOMEM Memory allocation failed
* EACCESS Permission denied
* ENFILE Too many open files
* ENOSYS Function not available
*/
int GPFS_API
gpfs_query_trace(void);
/* NAME: gpfs_add_trace()
*
* FUNCTION: write the logs into GPFS trace driver. When the user specified
* parameter "level" is less than or equal to the GPFS trace level,
* the log message pointed to by parameter "msg" would be written to
* GPFS trace buffer, and user can use mmtracectl command to cut
* the GPFS trace buffer into a file to observe. Must be called after
* the call to gpfs_init_trace(). Also ensure the gpfs_query_trace()
* is called properly to update the gpfs trace level cached in
* application, otherwise, the trace may miss to write down to
* GPFS trace driver.
*
* Input: level: the level for this trace generation. When the level
* is less than or equal to the GPFS trace level, this
* trace record would be written to GPFS trace buffer.
* msg: the message string that would be put into GPFS trace buffer.
*
* Returns: None.
*/
void GPFS_API
gpfs_add_trace(int level, const char *msg);
/* NAME: gpfs_fini_trace()
*
* FUNCTION: Stop using GPFS trace facility. This should be paired with
* gpfs_init_trace(), and must be called after the last
* gpfs_add_trace().
*
* Returns: None.
*/
void gpfs_fini_trace(void);
/*
* When GPFS_64BIT_INODES is defined, use the 64-bit interface definitions as
* the default.
*/
#ifdef GPFS_64BIT_INODES
#undef GPFS_D_VERSION
#define GPFS_D_VERSION GPFS_D64_VERSION
#undef GPFS_IA_VERSION
#define GPFS_IA_VERSION GPFS_IA64_VERSION
#define gpfs_ino_t gpfs_ino64_t
#define gpfs_gen_t gpfs_gen64_t
#define gpfs_uid_t gpfs_uid64_t
#define gpfs_gid_t gpfs_gid64_t
#define gpfs_snapid_t gpfs_snapid64_t
#define gpfs_nlink_t gpfs_nlink64_t
#define gpfs_timestruc_t gpfs_timestruc64_t
#define gpfs_direntx_t gpfs_direntx64_t
#define gpfs_direntx gpfs_direntx64
#define gpfs_iattr_t gpfs_iattr64_t
#define gpfs_get_snapid_from_fssnaphandle gpfs_get_snapid_from_fssnaphandle64
#define gpfs_open_inodescan gpfs_open_inodescan64
#define gpfs_open_inodescan_with_xattrs gpfs_open_inodescan_with_xattrs64
#define gpfs_next_inode gpfs_next_inode64
#define gpfs_next_inode_with_xattrs gpfs_next_inode_with_xattrs64
#define gpfs_seek_inode gpfs_seek_inode64
#define gpfs_stat_inode gpfs_stat_inode64
#define gpfs_stat_inode_with_xattrs gpfs_stat_inode_with_xattrs64
#define gpfs_iopen gpfs_iopen64
#define gpfs_ireaddir gpfs_ireaddir64
#define gpfs_ireaddirx gpfs_ireaddirx64
#define gpfs_iwritedir gpfs_iwritedir64
#define gpfs_ireadlink gpfs_ireadlink64
#endif
#define gpfs_icreate gpfs_icreate64
#ifdef __cplusplus
}
#endif
#endif /* H_GPFS */
|