1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11168
11169
11170
11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
11291
11292
11293
11294
11295
11296
11297
11298
11299
11300
11301
11302
11303
11304
11305
11306
11307
11308
11309
11310
11311
11312
11313
11314
11315
11316
11317
11318
11319
11320
11321
11322
11323
11324
11325
11326
11327
11328
11329
11330
11331
11332
11333
11334
11335
11336
11337
11338
11339
11340
11341
11342
11343
11344
11345
11346
11347
11348
11349
11350
11351
11352
11353
11354
11355
11356
11357
11358
11359
11360
11361
11362
11363
11364
11365
11366
11367
11368
11369
11370
11371
11372
11373
11374
11375
11376
11377
11378
11379
11380
11381
11382
11383
11384
11385
11386
11387
11388
11389
11390
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11412
11413
11414
11415
11416
11417
11418
11419
11420
11421
11422
11423
11424
11425
11426
11427
11428
11429
11430
11431
11432
11433
11434
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11446
11447
11448
11449
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11464
11465
11466
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
11477
11478
11479
11480
11481
11482
11483
11484
11485
11486
11487
11488
11489
11490
11491
11492
11493
11494
11495
11496
11497
11498
11499
11500
11501
11502
11503
11504
11505
11506
11507
11508
11509
11510
11511
11512
11513
11514
11515
11516
11517
11518
11519
11520
11521
11522
11523
11524
11525
11526
11527
11528
11529
11530
11531
11532
11533
11534
11535
11536
11537
11538
11539
11540
11541
11542
11543
11544
11545
11546
11547
11548
11549
11550
11551
11552
11553
11554
11555
11556
11557
11558
11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
11633
11634
11635
11636
11637
11638
11639
11640
11641
11642
11643
11644
11645
11646
11647
11648
11649
11650
11651
11652
11653
11654
11655
11656
11657
11658
11659
11660
11661
11662
11663
11664
11665
11666
11667
11668
11669
11670
11671
11672
11673
11674
11675
11676
11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687
11688
11689
11690
11691
11692
11693
11694
11695
11696
11697
11698
11699
11700
11701
11702
11703
11704
11705
11706
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
11718
11719
11720
11721
11722
11723
11724
11725
11726
11727
11728
11729
11730
11731
11732
11733
11734
11735
11736
11737
11738
11739
11740
11741
11742
11743
11744
11745
11746
11747
11748
11749
11750
11751
11752
11753
11754
11755
11756
11757
11758
11759
11760
11761
11762
11763
11764
11765
11766
11767
11768
11769
11770
11771
11772
11773
11774
11775
11776
11777
11778
11779
11780
11781
11782
11783
11784
11785
11786
11787
11788
11789
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11804
11805
11806
11807
11808
11809
11810
11811
11812
11813
11814
11815
11816
11817
11818
11819
11820
11821
11822
11823
11824
11825
11826
11827
11828
11829
11830
11831
11832
11833
11834
11835
11836
11837
11838
11839
11840
11841
11842
11843
11844
11845
11846
11847
11848
11849
11850
11851
11852
11853
11854
11855
11856
11857
11858
11859
11860
11861
11862
11863
11864
11865
11866
11867
11868
11869
11870
11871
11872
11873
11874
11875
11876
11877
11878
11879
11880
11881
11882
11883
11884
11885
11886
11887
11888
11889
11890
11891
11892
11893
11894
11895
11896
11897
11898
11899
11900
11901
11902
11903
11904
11905
11906
11907
11908
11909
11910
11911
11912
11913
11914
11915
11916
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931
11932
11933
11934
11935
11936
11937
11938
11939
11940
11941
11942
11943
11944
11945
11946
11947
11948
11949
11950
11951
11952
11953
11954
11955
11956
11957
11958
11959
11960
11961
11962
11963
11964
11965
11966
11967
11968
11969
11970
11971
11972
11973
11974
11975
11976
11977
11978
11979
11980
11981
11982
11983
11984
11985
11986
11987
11988
11989
11990
11991
11992
11993
11994
11995
11996
11997
11998
11999
12000
12001
12002
12003
12004
12005
12006
12007
12008
12009
12010
12011
12012
12013
12014
12015
12016
12017
12018
12019
12020
12021
12022
12023
12024
12025
12026
12027
12028
12029
12030
12031
12032
12033
12034
12035
12036
12037
12038
12039
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049
12050
12051
12052
12053
12054
12055
12056
12057
12058
12059
12060
12061
12062
12063
12064
12065
12066
12067
12068
12069
12070
12071
12072
12073
12074
12075
12076
12077
12078
12079
12080
12081
12082
12083
12084
12085
12086
12087
12088
12089
12090
12091
12092
12093
12094
12095
12096
12097
12098
12099
12100
12101
12102
12103
12104
12105
12106
12107
12108
12109
12110
12111
12112
12113
12114
12115
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
12128
12129
12130
12131
12132
12133
12134
12135
12136
12137
12138
12139
12140
12141
12142
12143
12144
12145
12146
12147
12148
12149
12150
12151
12152
12153
12154
12155
12156
12157
12158
12159
12160
12161
12162
12163
12164
12165
12166
12167
12168
12169
12170
12171
12172
12173
12174
12175
12176
12177
12178
12179
12180
12181
12182
12183
12184
12185
12186
12187
12188
12189
12190
12191
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12202
12203
12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12233
12234
12235
12236
12237
12238
12239
12240
12241
12242
12243
12244
12245
12246
12247
12248
12249
12250
12251
12252
12253
12254
12255
12256
12257
12258
12259
12260
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277
12278
12279
12280
12281
12282
12283
12284
12285
12286
12287
12288
12289
12290
12291
12292
12293
12294
12295
12296
12297
12298
12299
12300
12301
12302
12303
12304
12305
12306
12307
12308
12309
12310
12311
12312
12313
12314
12315
12316
12317
12318
12319
12320
12321
12322
12323
12324
12325
12326
12327
12328
12329
12330
12331
12332
12333
12334
12335
12336
12337
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
12353
12354
12355
12356
12357
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389
12390
12391
12392
12393
12394
12395
12396
12397
12398
12399
12400
12401
12402
12403
12404
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415
12416
12417
12418
12419
12420
12421
12422
12423
12424
12425
12426
12427
12428
12429
12430
12431
12432
12433
12434
12435
12436
12437
12438
12439
12440
12441
12442
12443
12444
12445
12446
12447
12448
12449
12450
12451
12452
12453
12454
12455
12456
12457
12458
12459
12460
12461
12462
12463
12464
12465
12466
12467
12468
12469
12470
12471
12472
12473
12474
12475
12476
12477
12478
12479
12480
12481
12482
12483
12484
12485
12486
12487
12488
12489
12490
12491
12492
12493
12494
12495
12496
12497
12498
12499
12500
12501
12502
12503
12504
12505
12506
12507
12508
12509
12510
12511
12512
12513
12514
12515
12516
12517
12518
12519
12520
12521
12522
12523
12524
12525
12526
12527
12528
12529
12530
12531
12532
12533
12534
12535
12536
12537
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12551
12552
12553
12554
12555
12556
12557
12558
12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12578
12579
12580
12581
12582
12583
12584
12585
12586
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12597
12598
12599
12600
12601
12602
12603
12604
12605
12606
12607
12608
12609
12610
12611
12612
12613
12614
12615
12616
12617
12618
12619
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733
12734
12735
12736
12737
12738
12739
12740
12741
12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12799
12800
12801
12802
12803
12804
12805
12806
12807
12808
12809
12810
12811
12812
12813
12814
12815
12816
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12941
12942
12943
12944
12945
12946
12947
12948
12949
12950
12951
12952
12953
12954
12955
12956
12957
12958
12959
12960
12961
12962
12963
12964
12965
12966
12967
12968
12969
12970
12971
12972
12973
12974
12975
12976
12977
12978
12979
12980
12981
12982
12983
12984
12985
12986
12987
12988
12989
12990
12991
12992
12993
12994
12995
12996
12997
12998
12999
13000
13001
13002
13003
13004
13005
13006
13007
13008
13009
13010
13011
13012
13013
13014
13015
13016
13017
13018
13019
13020
13021
13022
13023
13024
13025
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13047
13048
13049
13050
13051
13052
13053
13054
13055
13056
13057
13058
13059
13060
13061
13062
13063
13064
13065
13066
13067
13068
13069
13070
13071
13072
13073
13074
13075
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13087
13088
13089
13090
13091
13092
13093
13094
13095
13096
13097
13098
13099
13100
13101
13102
13103
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13114
13115
13116
13117
13118
13119
13120
13121
13122
13123
13124
13125
13126
13127
13128
13129
13130
13131
13132
13133
13134
13135
13136
13137
13138
13139
13140
13141
13142
13143
13144
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154
13155
13156
13157
13158
13159
13160
13161
13162
13163
13164
13165
13166
13167
13168
13169
13170
13171
13172
13173
13174
13175
13176
13177
13178
13179
13180
13181
13182
13183
13184
13185
13186
13187
13188
13189
13190
13191
13192
13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203
13204
13205
13206
13207
13208
13209
13210
13211
13212
13213
13214
13215
13216
13217
13218
13219
13220
13221
13222
13223
13224
13225
13226
13227
13228
13229
13230
13231
13232
13233
13234
13235
13236
13237
13238
13239
13240
13241
13242
13243
13244
13245
13246
13247
13248
13249
13250
13251
13252
13253
13254
13255
13256
13257
13258
13259
13260
13261
13262
13263
13264
13265
13266
13267
13268
13269
13270
13271
13272
13273
13274
13275
13276
13277
13278
13279
13280
13281
13282
13283
13284
13285
13286
13287
13288
13289
13290
13291
13292
13293
13294
13295
13296
13297
13298
13299
13300
13301
13302
13303
13304
13305
13306
13307
13308
13309
13310
13311
13312
13313
13314
13315
13316
13317
13318
13319
13320
13321
13322
13323
13324
13325
13326
13327
13328
13329
13330
13331
13332
13333
13334
13335
13336
13337
13338
13339
13340
13341
13342
13343
13344
13345
13346
13347
13348
13349
13350
13351
13352
13353
13354
13355
13356
13357
13358
13359
13360
13361
13362
13363
13364
13365
13366
13367
13368
13369
13370
13371
13372
13373
13374
13375
13376
13377
13378
13379
13380
13381
13382
13383
13384
13385
13386
13387
13388
13389
13390
13391
13392
13393
13394
13395
13396
13397
13398
13399
13400
13401
13402
13403
13404
13405
13406
13407
13408
13409
13410
13411
13412
13413
13414
13415
13416
13417
13418
13419
13420
13421
13422
13423
13424
13425
13426
13427
13428
13429
13430
13431
13432
13433
13434
13435
13436
13437
13438
13439
13440
13441
13442
13443
13444
13445
13446
13447
13448
13449
13450
13451
13452
13453
13454
13455
13456
13457
13458
13459
13460
13461
13462
13463
13464
13465
13466
13467
13468
13469
13470
13471
13472
13473
13474
13475
13476
13477
13478
13479
13480
13481
13482
13483
13484
13485
13486
13487
13488
13489
13490
13491
13492
13493
13494
13495
13496
13497
13498
13499
13500
13501
13502
13503
13504
13505
13506
13507
13508
13509
13510
13511
13512
13513
13514
13515
13516
13517
13518
13519
13520
13521
13522
13523
13524
13525
13526
13527
13528
13529
13530
13531
13532
13533
13534
13535
13536
13537
13538
13539
13540
13541
13542
13543
13544
13545
13546
13547
13548
13549
13550
13551
13552
13553
13554
13555
13556
13557
13558
13559
13560
13561
13562
13563
13564
13565
13566
13567
13568
13569
13570
13571
13572
13573
13574
13575
13576
13577
13578
13579
13580
13581
13582
13583
13584
13585
13586
13587
13588
13589
13590
13591
13592
13593
13594
13595
13596
13597
13598
13599
13600
13601
13602
13603
13604
13605
13606
13607
13608
13609
13610
13611
13612
13613
13614
13615
13616
13617
13618
13619
13620
13621
13622
13623
13624
13625
13626
13627
13628
13629
13630
13631
13632
13633
13634
13635
13636
13637
13638
13639
13640
13641
13642
13643
13644
13645
13646
13647
13648
13649
13650
13651
13652
13653
13654
13655
13656
13657
13658
13659
13660
13661
13662
13663
13664
13665
13666
13667
13668
13669
13670
13671
13672
13673
13674
13675
13676
13677
13678
13679
13680
13681
13682
13683
13684
13685
13686
13687
13688
13689
13690
13691
13692
13693
13694
13695
13696
13697
13698
13699
13700
13701
13702
13703
13704
13705
13706
13707
13708
13709
13710
13711
13712
13713
13714
13715
13716
13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
13727
13728
13729
13730
13731
13732
13733
13734
13735
13736
13737
13738
13739
13740
13741
13742
13743
13744
13745
13746
13747
13748
13749
13750
13751
13752
13753
13754
13755
13756
13757
13758
13759
13760
13761
13762
13763
13764
13765
13766
13767
13768
13769
13770
13771
13772
13773
13774
13775
13776
13777
13778
13779
13780
13781
13782
13783
13784
13785
13786
13787
13788
13789
13790
13791
13792
13793
13794
13795
13796
13797
13798
13799
13800
13801
13802
13803
13804
13805
13806
13807
13808
13809
13810
13811
13812
13813
13814
13815
13816
13817
13818
13819
13820
13821
13822
13823
13824
13825
13826
13827
13828
13829
13830
13831
13832
13833
13834
13835
13836
13837
13838
13839
13840
13841
13842
13843
13844
13845
13846
13847
13848
13849
13850
13851
13852
13853
13854
13855
13856
13857
13858
13859
13860
13861
13862
13863
13864
13865
13866
13867
13868
13869
13870
13871
13872
13873
13874
13875
13876
13877
13878
13879
13880
13881
13882
13883
13884
13885
13886
13887
13888
13889
13890
13891
13892
13893
13894
13895
13896
13897
13898
13899
13900
13901
13902
13903
13904
13905
13906
13907
13908
13909
13910
13911
13912
13913
13914
13915
13916
13917
13918
13919
13920
13921
13922
13923
13924
13925
13926
13927
13928
13929
13930
13931
13932
13933
13934
13935
13936
13937
13938
13939
13940
13941
13942
13943
13944
13945
13946
13947
13948
13949
13950
13951
13952
13953
13954
13955
13956
13957
13958
13959
13960
13961
13962
13963
13964
13965
13966
13967
13968
13969
13970
13971
13972
13973
13974
13975
13976
13977
13978
13979
13980
13981
13982
13983
13984
13985
13986
13987
13988
13989
13990
13991
13992
13993
13994
13995
13996
13997
13998
13999
14000
14001
14002
14003
14004
14005
14006
14007
14008
14009
14010
14011
14012
14013
14014
14015
14016
14017
14018
14019
14020
14021
14022
14023
14024
14025
14026
14027
14028
14029
14030
14031
14032
14033
14034
14035
14036
14037
14038
14039
14040
14041
14042
14043
14044
14045
14046
14047
14048
14049
14050
14051
14052
14053
14054
14055
14056
14057
14058
14059
14060
14061
14062
14063
14064
14065
14066
14067
14068
14069
14070
14071
14072
14073
14074
14075
14076
14077
14078
14079
14080
14081
14082
14083
14084
14085
14086
14087
14088
14089
14090
14091
14092
14093
14094
14095
14096
14097
14098
14099
14100
14101
14102
14103
14104
14105
14106
14107
14108
14109
14110
14111
14112
14113
14114
14115
14116
14117
14118
14119
14120
14121
14122
14123
14124
14125
14126
14127
14128
14129
14130
14131
14132
14133
14134
14135
14136
14137
14138
14139
14140
14141
14142
14143
14144
14145
14146
14147
14148
14149
14150
14151
14152
14153
14154
14155
14156
14157
14158
14159
14160
14161
14162
14163
14164
14165
14166
14167
14168
14169
14170
14171
14172
14173
14174
14175
14176
14177
14178
14179
14180
14181
14182
14183
14184
14185
14186
14187
14188
14189
14190
14191
14192
14193
14194
14195
14196
14197
14198
14199
14200
14201
14202
14203
14204
14205
14206
14207
14208
14209
14210
14211
14212
14213
14214
14215
14216
14217
14218
14219
14220
14221
14222
14223
14224
14225
14226
14227
14228
14229
14230
14231
14232
14233
14234
14235
14236
14237
14238
14239
14240
14241
14242
14243
14244
14245
14246
14247
14248
14249
14250
14251
14252
14253
14254
14255
14256
14257
14258
14259
14260
14261
14262
14263
14264
14265
14266
14267
14268
14269
14270
14271
14272
14273
14274
14275
14276
14277
14278
14279
14280
14281
14282
14283
14284
14285
14286
14287
14288
14289
14290
14291
14292
14293
14294
14295
14296
14297
14298
14299
14300
14301
14302
14303
14304
14305
14306
14307
14308
14309
14310
14311
14312
14313
14314
14315
14316
14317
14318
14319
14320
14321
14322
14323
14324
14325
14326
14327
14328
14329
14330
14331
14332
14333
14334
14335
14336
14337
14338
14339
14340
14341
14342
14343
14344
14345
14346
14347
14348
14349
14350
14351
14352
14353
14354
14355
14356
14357
14358
14359
14360
14361
14362
14363
14364
14365
14366
14367
14368
14369
14370
14371
14372
14373
14374
14375
14376
14377
14378
14379
14380
14381
14382
14383
14384
14385
14386
14387
14388
14389
14390
14391
14392
14393
14394
14395
14396
14397
14398
14399
14400
14401
14402
14403
14404
14405
14406
14407
14408
14409
14410
14411
14412
14413
14414
14415
14416
14417
14418
14419
14420
14421
14422
14423
14424
14425
14426
14427
14428
14429
14430
14431
14432
14433
14434
14435
14436
14437
14438
14439
14440
14441
14442
14443
14444
14445
14446
14447
14448
14449
14450
14451
14452
14453
14454
14455
14456
14457
14458
14459
14460
14461
14462
14463
14464
14465
14466
14467
14468
14469
14470
14471
14472
14473
14474
14475
14476
14477
14478
14479
14480
14481
14482
14483
14484
14485
14486
14487
14488
14489
14490
14491
14492
14493
14494
14495
14496
14497
14498
14499
14500
14501
14502
14503
14504
14505
14506
14507
14508
14509
14510
14511
14512
14513
14514
14515
14516
14517
14518
14519
14520
14521
14522
14523
14524
14525
14526
14527
14528
14529
14530
14531
14532
14533
14534
14535
14536
14537
14538
14539
14540
14541
14542
14543
14544
14545
14546
14547
14548
14549
14550
14551
14552
14553
14554
14555
14556
14557
14558
14559
14560
14561
14562
14563
14564
14565
14566
14567
14568
14569
14570
14571
14572
14573
14574
14575
14576
14577
14578
14579
14580
14581
14582
14583
14584
14585
14586
14587
14588
14589
14590
14591
14592
14593
14594
14595
14596
14597
14598
14599
14600
14601
14602
14603
14604
14605
14606
14607
14608
14609
14610
14611
14612
14613
14614
14615
14616
14617
14618
14619
14620
14621
14622
14623
14624
14625
14626
14627
14628
14629
14630
14631
14632
14633
14634
14635
14636
14637
14638
14639
14640
14641
14642
14643
14644
14645
14646
14647
14648
14649
14650
14651
14652
14653
14654
14655
14656
14657
14658
14659
14660
14661
14662
14663
14664
14665
14666
14667
14668
14669
14670
14671
14672
14673
14674
14675
14676
14677
14678
14679
14680
14681
14682
14683
14684
14685
14686
14687
14688
14689
14690
14691
14692
14693
14694
14695
14696
14697
14698
14699
14700
14701
14702
14703
14704
14705
14706
14707
14708
14709
14710
14711
14712
14713
14714
14715
14716
14717
14718
14719
14720
14721
14722
14723
14724
14725
14726
14727
14728
14729
14730
14731
14732
14733
14734
14735
14736
14737
14738
14739
14740
14741
14742
14743
14744
14745
14746
14747
14748
14749
14750
14751
14752
14753
14754
14755
14756
14757
14758
14759
14760
14761
14762
14763
14764
14765
14766
14767
14768
14769
14770
14771
14772
14773
14774
14775
14776
14777
14778
14779
14780
14781
14782
14783
14784
14785
14786
14787
14788
14789
14790
14791
14792
14793
14794
14795
14796
14797
14798
14799
14800
14801
14802
14803
14804
14805
14806
14807
14808
14809
14810
14811
14812
14813
14814
14815
14816
14817
14818
14819
14820
14821
14822
14823
14824
14825
14826
14827
14828
14829
14830
14831
14832
14833
14834
14835
14836
14837
14838
14839
14840
14841
14842
14843
14844
14845
14846
14847
14848
14849
14850
14851
14852
14853
14854
14855
14856
14857
14858
14859
14860
14861
14862
14863
14864
14865
14866
14867
14868
14869
14870
14871
14872
14873
14874
14875
14876
14877
14878
14879
14880
14881
14882
14883
14884
14885
14886
14887
14888
14889
14890
14891
14892
14893
14894
14895
14896
14897
14898
14899
14900
14901
14902
14903
14904
14905
14906
14907
14908
14909
14910
14911
14912
14913
14914
14915
14916
14917
14918
14919
14920
14921
14922
14923
14924
14925
14926
14927
14928
14929
14930
14931
14932
14933
14934
14935
14936
14937
14938
14939
14940
14941
14942
14943
14944
14945
14946
14947
14948
14949
14950
14951
14952
14953
14954
14955
14956
14957
14958
14959
14960
14961
14962
14963
14964
14965
14966
14967
14968
14969
14970
14971
14972
14973
14974
14975
14976
14977
14978
14979
14980
14981
14982
14983
14984
14985
14986
14987
14988
14989
14990
14991
14992
14993
14994
14995
14996
14997
14998
14999
15000
15001
15002
15003
15004
15005
15006
15007
15008
15009
15010
15011
15012
15013
15014
15015
15016
15017
15018
15019
15020
15021
15022
15023
15024
15025
15026
15027
15028
15029
15030
15031
15032
15033
15034
15035
15036
15037
15038
15039
15040
15041
15042
15043
15044
15045
15046
15047
15048
15049
15050
15051
15052
15053
15054
15055
15056
15057
15058
15059
15060
15061
15062
15063
15064
15065
15066
15067
15068
15069
15070
15071
15072
15073
15074
15075
15076
15077
15078
15079
15080
15081
15082
15083
15084
15085
15086
15087
15088
15089
15090
15091
15092
15093
15094
15095
15096
15097
15098
15099
15100
15101
15102
15103
15104
15105
15106
15107
15108
15109
15110
15111
15112
15113
15114
15115
15116
15117
15118
15119
15120
15121
15122
15123
15124
15125
15126
15127
15128
15129
15130
15131
15132
15133
15134
15135
15136
15137
15138
15139
15140
15141
15142
15143
15144
15145
15146
15147
15148
15149
15150
15151
15152
15153
15154
15155
15156
15157
15158
15159
15160
15161
15162
15163
15164
15165
15166
15167
15168
15169
15170
15171
15172
15173
15174
15175
15176
15177
15178
15179
15180
15181
15182
15183
15184
15185
15186
15187
15188
15189
15190
15191
15192
15193
15194
15195
15196
15197
15198
15199
15200
15201
15202
15203
15204
15205
15206
15207
15208
15209
15210
15211
15212
15213
15214
15215
15216
15217
15218
15219
15220
15221
15222
15223
15224
15225
15226
15227
15228
15229
15230
15231
15232
15233
15234
15235
15236
15237
15238
15239
15240
15241
15242
15243
15244
15245
15246
15247
15248
15249
15250
15251
15252
15253
15254
15255
15256
15257
15258
15259
15260
15261
15262
15263
15264
15265
15266
15267
15268
15269
15270
15271
15272
15273
15274
15275
15276
15277
15278
15279
15280
15281
15282
15283
15284
15285
15286
15287
15288
15289
15290
15291
15292
15293
15294
15295
15296
15297
15298
15299
15300
15301
15302
15303
15304
15305
15306
15307
15308
15309
15310
15311
15312
15313
15314
15315
15316
15317
15318
15319
15320
15321
15322
15323
15324
15325
15326
15327
15328
15329
15330
15331
15332
15333
15334
15335
15336
15337
15338
15339
15340
15341
15342
15343
15344
15345
15346
15347
15348
15349
15350
15351
15352
15353
15354
15355
15356
15357
15358
15359
15360
15361
15362
15363
15364
15365
15366
15367
15368
15369
15370
15371
15372
15373
15374
15375
15376
15377
15378
15379
15380
15381
15382
15383
15384
15385
15386
15387
15388
15389
15390
15391
15392
15393
15394
15395
15396
15397
15398
15399
15400
15401
15402
15403
15404
15405
15406
15407
15408
15409
15410
15411
15412
15413
15414
15415
15416
15417
15418
15419
15420
15421
15422
15423
15424
15425
15426
15427
15428
15429
15430
15431
15432
15433
15434
15435
15436
15437
15438
15439
15440
15441
15442
15443
15444
15445
15446
15447
15448
15449
15450
15451
15452
15453
15454
15455
15456
15457
15458
15459
15460
15461
15462
15463
15464
15465
15466
15467
15468
15469
15470
15471
15472
15473
15474
15475
15476
15477
15478
15479
15480
15481
15482
15483
15484
15485
15486
15487
15488
15489
15490
15491
15492
15493
15494
15495
15496
15497
15498
15499
15500
15501
15502
15503
15504
15505
15506
15507
15508
15509
15510
15511
15512
15513
15514
15515
15516
15517
15518
15519
15520
15521
15522
15523
15524
15525
15526
15527
15528
15529
15530
15531
15532
15533
15534
15535
15536
15537
15538
15539
15540
15541
15542
15543
15544
15545
15546
15547
15548
15549
15550
15551
15552
15553
15554
15555
15556
15557
15558
15559
15560
15561
15562
15563
15564
15565
15566
15567
15568
15569
15570
15571
15572
15573
15574
15575
15576
15577
15578
15579
15580
15581
15582
15583
15584
15585
15586
15587
15588
15589
15590
15591
15592
15593
15594
15595
15596
15597
15598
15599
15600
15601
15602
15603
15604
15605
15606
15607
15608
15609
15610
15611
15612
15613
15614
15615
15616
15617
15618
15619
15620
15621
15622
15623
15624
15625
15626
15627
15628
15629
15630
15631
15632
15633
15634
15635
15636
15637
15638
15639
15640
15641
15642
15643
15644
15645
15646
15647
15648
15649
15650
15651
15652
15653
15654
15655
15656
15657
15658
15659
15660
15661
15662
15663
15664
15665
15666
15667
15668
15669
15670
15671
15672
15673
15674
15675
15676
15677
15678
15679
15680
15681
15682
15683
15684
15685
15686
15687
15688
15689
15690
15691
15692
15693
15694
15695
15696
15697
15698
15699
15700
15701
15702
15703
15704
15705
15706
15707
15708
15709
15710
15711
15712
15713
15714
15715
15716
15717
15718
15719
15720
15721
15722
15723
15724
15725
15726
15727
15728
15729
15730
15731
15732
15733
15734
15735
15736
15737
15738
15739
15740
15741
15742
15743
15744
15745
15746
15747
15748
15749
15750
15751
15752
15753
15754
15755
15756
15757
15758
15759
15760
15761
15762
15763
15764
15765
15766
15767
15768
15769
15770
15771
15772
15773
15774
15775
15776
15777
15778
15779
15780
15781
15782
15783
15784
15785
15786
15787
15788
15789
15790
15791
15792
15793
15794
15795
15796
15797
15798
15799
15800
15801
15802
15803
15804
15805
15806
15807
15808
15809
15810
15811
15812
15813
15814
15815
15816
15817
15818
15819
15820
15821
15822
15823
15824
15825
15826
15827
15828
15829
15830
15831
15832
15833
15834
15835
15836
15837
15838
15839
15840
15841
15842
15843
15844
15845
15846
15847
15848
15849
15850
15851
15852
15853
15854
15855
15856
15857
15858
15859
15860
15861
15862
15863
15864
15865
15866
15867
15868
15869
15870
15871
15872
15873
15874
15875
15876
15877
15878
15879
15880
15881
15882
15883
15884
15885
15886
15887
15888
15889
15890
15891
15892
15893
15894
15895
15896
15897
15898
15899
15900
15901
15902
15903
15904
15905
15906
15907
15908
15909
15910
15911
15912
15913
15914
15915
15916
15917
15918
15919
15920
15921
15922
15923
15924
15925
15926
15927
15928
15929
15930
15931
15932
15933
15934
15935
15936
15937
15938
15939
15940
15941
15942
15943
15944
15945
15946
15947
15948
15949
15950
15951
15952
15953
15954
15955
15956
15957
15958
15959
15960
15961
15962
15963
15964
15965
15966
15967
15968
15969
15970
15971
15972
15973
15974
15975
15976
15977
15978
15979
15980
15981
15982
15983
15984
15985
15986
15987
15988
15989
15990
15991
15992
15993
15994
15995
15996
15997
15998
15999
16000
16001
16002
16003
16004
16005
16006
16007
16008
16009
16010
16011
16012
16013
16014
16015
16016
16017
16018
16019
16020
16021
16022
16023
16024
16025
16026
16027
16028
16029
16030
16031
16032
16033
16034
16035
16036
16037
16038
16039
16040
16041
16042
16043
16044
16045
16046
16047
16048
16049
16050
16051
16052
16053
16054
16055
16056
16057
16058
16059
16060
16061
16062
16063
16064
16065
16066
16067
16068
16069
16070
16071
16072
16073
16074
16075
16076
16077
16078
16079
16080
16081
16082
16083
16084
16085
16086
16087
16088
16089
16090
16091
16092
16093
16094
16095
16096
16097
16098
16099
16100
16101
16102
16103
16104
16105
16106
16107
16108
16109
16110
16111
16112
16113
16114
16115
16116
16117
16118
16119
16120
16121
16122
16123
16124
16125
16126
16127
16128
16129
16130
16131
16132
16133
16134
16135
16136
16137
16138
16139
16140
16141
16142
16143
16144
16145
16146
16147
16148
16149
16150
16151
16152
16153
16154
16155
16156
16157
16158
16159
16160
16161
16162
16163
16164
16165
16166
16167
16168
16169
16170
16171
16172
16173
16174
16175
16176
16177
16178
16179
16180
16181
16182
16183
16184
16185
16186
16187
16188
16189
16190
16191
16192
16193
16194
16195
16196
16197
16198
16199
16200
16201
16202
16203
16204
16205
16206
16207
16208
16209
16210
16211
16212
16213
16214
16215
16216
16217
16218
16219
16220
16221
16222
16223
16224
16225
16226
16227
16228
16229
16230
16231
16232
16233
16234
16235
16236
16237
16238
16239
16240
16241
16242
16243
16244
16245
16246
16247
16248
16249
16250
16251
16252
16253
16254
16255
16256
16257
16258
16259
16260
16261
16262
16263
16264
16265
16266
16267
16268
16269
16270
16271
16272
16273
16274
16275
16276
16277
16278
16279
16280
16281
16282
16283
16284
16285
16286
16287
16288
16289
16290
16291
16292
16293
16294
16295
16296
16297
16298
16299
16300
16301
16302
16303
16304
16305
16306
16307
16308
16309
16310
16311
16312
16313
16314
16315
16316
16317
16318
16319
16320
16321
16322
16323
16324
16325
16326
16327
16328
16329
16330
16331
16332
16333
16334
16335
16336
16337
16338
16339
16340
16341
16342
16343
16344
16345
16346
16347
16348
16349
16350
16351
16352
16353
16354
16355
16356
16357
16358
16359
16360
16361
16362
16363
16364
16365
16366
16367
16368
16369
16370
16371
16372
16373
16374
16375
16376
16377
16378
16379
16380
16381
16382
16383
16384
16385
16386
16387
16388
16389
16390
16391
16392
16393
16394
16395
16396
16397
16398
16399
16400
16401
16402
16403
16404
16405
16406
16407
16408
16409
16410
16411
16412
16413
16414
16415
16416
16417
16418
16419
16420
16421
16422
16423
16424
16425
16426
16427
16428
16429
16430
16431
16432
16433
16434
16435
16436
16437
16438
16439
16440
16441
16442
|
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# uts/common/nfs/Makefile
#
# include global definitions
#
include ../../../Makefile.master
HDRS= export.h lm.h \
mount.h nfs.h nfssys.h nfs_acl.h \
nfs_clnt.h nfs_log.h nfs_sec.h nfs4.h \
nfs4_attr.h nfs4_clnt.h rnode.h rnode4.h \
nfs4_kprot.h nfs4_db_impl.h nfs4_idmap_impl.h \
nfsid_map.h auth.h nfs_cmd.h nfs4x.h
ROOTDIRS= $(ROOT)/usr/include/nfs
ROOTHDRS= $(HDRS:%=$(ROOTDIRS)/%)
CHECKHDRS= $(HDRS:%.h=%.check)
$(ROOTDIRS)/%: %
$(INS.file)
.KEEP_STATE:
.PARALLEL: $(CHECKHDRS)
install_h: $(ROOTDIRS) $(ROOTHDRS)
$(ROOTDIRS):
$(INS.dir)
check: $(CHECKHDRS)
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _AUTH_H
#define _AUTH_H
/*
* nfsauth_prot.x (The NFSAUTH Protocol)
*
* This protocol is used by the kernel to authorize NFS clients. This svc
* lives in the mount daemon and checks the client's access for an export
* with a given authentication flavor.
*
* The status result determines what kind of access the client is permitted.
*
* The result is cached in the kernel, so the authorization call will be
* made only the first time the client mounts the filesystem.
*
* const A_MAXPATH = 1024;
*
* struct auth_req {
* netobj req_client; # client's address
* string req_netid<>; # Netid of address
* string req_path<A_MAXPATH>; # export path
* int req_flavor; # auth flavor
* uid_t req_clnt_uid; # client's uid
* gid_t req_clnt_gid; # client's gid
* gid_t req_clnt_gids<>; # client's supplemental groups
* };
*
* const NFSAUTH_DENIED = 0x01; # Access denied
* const NFSAUTH_RO = 0x02; # Read-only
* const NFSAUTH_RW = 0x04; # Read-write
* const NFSAUTH_ROOT = 0x08; # Root access
* const NFSAUTH_WRONGSEC = 0x10; # Advise NFS v4 clients to
* # try a different flavor
* const NFSAUTH_UIDMAP = 0x100; # uid mapped
* const NFSAUTH_GIDMAP = 0x200; # gid mapped
* const NFSAUTH_GROUPS = 0x400; # translated supplemental groups
* #
* # The following are not part of the protocol.
* #
* const NFSAUTH_DROP = 0x20; # Drop request
* const NFSAUTH_MAPNONE = 0x40; # Mapped flavor to AUTH_NONE
* const NFSAUTH_LIMITED = 0x80; # Access limited to visible nodes
*
* struct auth_res {
* int auth_perm;
* uid_t auth_srv_uid; # translated uid
* gid_t auth_srv_gid; # translated gid
* gid_t auth_srv_gids<>; # translated supplemental groups
* };
*
* program NFSAUTH_PROG {
* version NFSAUTH_VERS {
* #
* # Authorization Request
* #
* auth_res
* NFSAUTH_ACCESS(auth_req) = 1;
*
* } = 1;
* } = 100231;
*/
#ifndef _KERNEL
#include <stddef.h>
#endif
#include <sys/sysmacros.h>
#include <sys/types.h>
#include <rpc/xdr.h>
#ifdef __cplusplus
extern "C" {
#endif
/* --8<-- Start: nfsauth_prot.x definitions --8<-- */
#define A_MAXPATH 1024
#define NFSAUTH_ACCESS 1
#define NFSAUTH_DENIED 0x01
#define NFSAUTH_RO 0x02
#define NFSAUTH_RW 0x04
#define NFSAUTH_ROOT 0x08
#define NFSAUTH_WRONGSEC 0x10
#define NFSAUTH_DROP 0x20
#define NFSAUTH_MAPNONE 0x40
#define NFSAUTH_LIMITED 0x80
#define NFSAUTH_UIDMAP 0x100
#define NFSAUTH_GIDMAP 0x200
#define NFSAUTH_GROUPS 0x400
struct auth_req {
netobj req_client;
char *req_netid;
char *req_path;
int req_flavor;
uid_t req_clnt_uid;
gid_t req_clnt_gid;
struct {
uint_t len;
gid_t *val;
} req_clnt_gids;
};
typedef struct auth_req auth_req;
struct auth_res {
int auth_perm;
uid_t auth_srv_uid;
gid_t auth_srv_gid;
struct {
uint_t len;
gid_t *val;
} auth_srv_gids;
};
typedef struct auth_res auth_res;
/* --8<-- End: nfsauth_prot.x definitions --8<-- */
#define NFSAUTH_DR_OKAY 0x0 /* success */
#define NFSAUTH_DR_BADCMD 0x100 /* NFSAUTH_ACCESS is only cmd allowed */
#define NFSAUTH_DR_DECERR 0x200 /* mountd could not decode arguments */
#define NFSAUTH_DR_EFAIL 0x400 /* mountd could not encode results */
#define NFSAUTH_DR_TRYCNT 5 /* door handle acquisition retry cnt */
#if defined(DEBUG) && !defined(_KERNEL)
#define MOUNTD_DOOR "/var/run/mountd_door"
#endif
/*
* Only cmd is added to the args. We need to know "what" we want
* the daemon to do for us. Also, 'stat' returns the status from
* the daemon down to the kernel in addition to perms.
*/
struct nfsauth_arg {
uint_t cmd;
auth_req areq;
};
typedef struct nfsauth_arg nfsauth_arg_t;
struct nfsauth_res {
uint_t stat;
auth_res ares;
};
typedef struct nfsauth_res nfsauth_res_t;
/*
* For future extensibility, we version the data structures so
* future incantations of mountd(8) will know how to XDR decode
* the arguments.
*/
enum vtypes {
V_ERROR = 0,
V_PROTO = 1
};
typedef enum vtypes vtypes;
typedef struct varg {
uint_t vers;
union {
nfsauth_arg_t arg;
/* additional args versions go here */
} arg_u;
} varg_t;
extern bool_t xdr_varg(XDR *, varg_t *);
extern bool_t xdr_nfsauth_arg(XDR *, nfsauth_arg_t *);
extern bool_t xdr_nfsauth_res(XDR *, nfsauth_res_t *);
#ifdef __cplusplus
}
#endif
#endif /* _AUTH_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2016 Nexenta Systems, Inc. All rights reserved.
* Copyright 2016 Jason King.
* Copyright 2018 Nexenta Systems, Inc. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#ifndef _NFS_EXPORT_H
#define _NFS_EXPORT_H
#include <nfs/nfs_sec.h>
#include <nfs/auth.h>
#include <sys/vnode.h>
#include <nfs/nfs4.h>
#include <sys/kiconv.h>
#include <sys/avl.h>
#include <sys/zone.h>
#ifdef _KERNEL
#include <sys/pkp_hash.h> /* for PKP_HASH_SIZE */
#endif /* _KERNEL */
#ifdef __cplusplus
extern "C" {
#endif
/*
* nfs pseudo flavor number is owned by IANA. Need to make sure the
* Solaris specific NFS_FLAVOR_NOMAP number will not overlap with any
* new IANA defined pseudo flavor numbers. The chance for the overlap
* is very small since the growth of new flavor numbers is expected
* to be limited.
*/
#define NFS_FLAVOR_NOMAP 999999 /* no nfs flavor mapping */
/*
* As duplicate flavors can be passed into exportfs in the arguments, we
* allocate a cleaned up array with non duplicate flavors on the stack.
* So we need to know how much to allocate.
*/
#define MAX_FLAVORS 6 /* none, sys, dh, krb5, krb5i krb5p */
/*
* Note: exported_lock is currently used to ensure the integrity of
* the secinfo fields.
*/
struct secinfo {
seconfig_t s_secinfo; /* /etc/nfssec.conf entry */
unsigned int s_flags; /* flags (see below) */
int32_t s_refcnt; /* reference count for tracking */
/* how many children (self included) */
/* use this flavor. */
int s_window; /* window */
uint_t s_rootid; /* UID to use for authorized roots */
int s_rootcnt; /* count of root names */
caddr_t *s_rootnames; /* array of root names */
/* they are strings for AUTH_DES and */
/* rpc_gss_principal_t for RPCSEC_GSS */
};
#ifdef _SYSCALL32
struct secinfo32 {
seconfig32_t s_secinfo; /* /etc/nfssec.conf entry */
uint32_t s_flags; /* flags (see below) */
int32_t s_refcnt; /* reference count for tracking */
/* how many children (self included) */
/* use this flavor. */
int32_t s_window; /* window */
uint32_t s_rootid; /* UID to use for authorized roots */
int32_t s_rootcnt; /* count of root names */
caddr32_t s_rootnames; /* array of root names */
/* they are strings for AUTH_DES and */
/* rpc_gss_principal_t for RPCSEC_GSS */
};
#endif /* _SYSCALL32 */
/*
* security negotiation related
*/
#define SEC_QUERY 0x01 /* query sec modes */
struct sec_ol {
int sec_flags; /* security nego flags */
uint_t sec_index; /* index into sec flavor array */
};
/*
* Per-mode flags (secinfo.s_flags)
*/
#define M_RO 0x01 /* exported ro to all */
#define M_ROL 0x02 /* exported ro to all listed */
#define M_RW 0x04 /* exported rw to all */
#define M_RWL 0x08 /* exported ro to all listed */
#define M_ROOT 0x10 /* root list is defined */
#define M_4SEC_EXPORTED 0x20 /* this is an explicitly shared flavor */
#define M_NONE 0x40 /* none list is defined */
#define M_MAP 0x80 /* uidmap and/or gidmap is defined */
/* invalid secinfo reference count */
#define SEC_REF_INVALID(p) ((p)->s_refcnt < 1)
/* last secinfo reference */
#define SEC_REF_LAST(p) ((p)->s_refcnt == 1)
/* sec flavor explicitly shared for the exported node */
#define SEC_REF_EXPORTED(p) ((p)->s_flags & M_4SEC_EXPORTED)
/* the only reference count left is for referring itself */
#define SEC_REF_SELF(p) (SEC_REF_LAST(p) && SEC_REF_EXPORTED(p))
/*
* The export information passed to exportfs() (Version 2)
*/
#define EX_CURRENT_VERSION 2 /* current version of exportdata struct */
struct exportdata {
int ex_version; /* structure version */
char *ex_path; /* exported path */
size_t ex_pathlen; /* path length */
int ex_flags; /* flags */
unsigned int ex_anon; /* uid for unauthenticated requests */
int ex_seccnt; /* count of security modes */
struct secinfo *ex_secinfo; /* security mode info */
char *ex_index; /* index file for public filesystem */
char *ex_log_buffer; /* path to logging buffer file */
size_t ex_log_bufferlen; /* buffer file path len */
char *ex_tag; /* tag used to identify log config */
size_t ex_taglen; /* tag length */
};
#ifdef _SYSCALL32
struct exportdata32 {
int32_t ex_version; /* structure version */
caddr32_t ex_path; /* exported path */
int32_t ex_pathlen; /* path length */
int32_t ex_flags; /* flags */
uint32_t ex_anon; /* uid for unauthenticated requests */
int32_t ex_seccnt; /* count of security modes */
caddr32_t ex_secinfo; /* security mode info */
caddr32_t ex_index; /* index file for public filesystem */
caddr32_t ex_log_buffer; /* path to logging buffer file */
int32_t ex_log_bufferlen; /* buffer file path len */
caddr32_t ex_tag; /* tag used to identify log config */
int32_t ex_taglen; /* tag length */
};
#endif /* _SYSCALL32 */
/*
* exported vfs flags.
*/
#define EX_NOSUID 0x01 /* exported with unsetable set[ug]ids */
#define EX_ACLOK 0x02 /* exported with maximal access if acl exists */
#define EX_PUBLIC 0x04 /* exported with public filehandle */
#define EX_NOSUB 0x08 /* no nfs_getfh or MCL below export point */
#define EX_INDEX 0x10 /* exported with index file specified */
#define EX_LOG 0x20 /* logging enabled */
#define EX_LOG_ALLOPS 0x40 /* logging of all RPC operations enabled */
/* by default only operations which affect */
/* transaction logging are enabled */
#define EX_PSEUDO 0x80 /* pseudo filesystem export */
#ifdef VOLATILE_FH_TEST
#define EX_VOLFH 0x100 /* XXX nfsv4 fh may expire anytime */
#define EX_VOLRNM 0x200 /* XXX nfsv4 fh expire at rename */
#define EX_VOLMIG 0x400 /* XXX nfsv4 fh expire at migration */
#define EX_NOEXPOPEN 0x800 /* XXX nfsv4 fh no expire with open */
#endif /* VOLATILE_FH_TEST */
#define EX_CHARMAP 0x1000 /* NFS may need a character set conversion */
#define EX_NOACLFAB 0x2000 /* If set, NFSv2 and v3 servers won't */
/* fabricate an aclent_t ACL on file systems */
/* that don't support aclent_t ACLs */
#define EX_NOHIDE 0x4000 /* traversable from exported parent */
#ifdef _KERNEL
#ifdef VOLATILE_FH_TEST
struct ex_vol_rename {
nfs_fh4_fmt_t vrn_fh_fmt;
struct ex_vol_rename *vrn_next;
};
#endif /* VOLATILE_FH_TEST */
/*
* An auth cache client entry. This is the umbrella structure and contains all
* related auth_cache entries in the authc_tree AVL tree.
*/
struct auth_cache_clnt {
avl_node_t authc_link;
struct netbuf authc_addr; /* address of the client */
krwlock_t authc_lock; /* protects authc_tree */
avl_tree_t authc_tree; /* auth_cache entries */
};
/*
* An auth cache entry can exist in 6 states.
*
* A NEW entry was recently allocated and added to the cache. It does not
* contain the valid auth state yet.
*
* A WAITING entry is one which is actively engaging the user land mountd code
* to authenticate or re-authenticate it. The auth state might not be valid
* yet. The other threads should wait on auth_cv until the retrieving thread
* finishes the retrieval and changes the auth cache entry to FRESH, or NEW (in
* a case this entry had no valid auth state yet).
*
* A REFRESHING entry is one which is actively engaging the user land mountd
* code to re-authenticate the cache entry. There is currently no other thread
* waiting for the results of the refresh.
*
* A FRESH entry is one which is valid (it is either newly retrieved or has
* been refreshed at least once).
*
* A STALE entry is one which has been detected to be too old. The transition
* from FRESH to STALE prevents multiple threads from submitting refresh
* requests.
*
* An INVALID entry is one which was either STALE or REFRESHING and was deleted
* out of the encapsulating exi. Since we can't delete it yet, we mark it as
* INVALID, which lets the refresh thread know not to work on it and free it
* instead.
*
* Note that the auth state of the entry is valid, even if the entry is STALE.
* Just as you can eat stale bread, you can consume a stale cache entry. The
* only time the contents change could be during the transition from REFRESHING
* or WAITING to FRESH.
*
* Valid state transitions:
*
* alloc
* |
* v
* +-----+
* +--->| NEW |------>free
* | +-----+
* | |
* | v
* | +---------+
* +<-| WAITING |
* ^ +---------+
* | |
* | v
* | +<--------------------------+<---------------+
* | | ^ |
* | v | |
* | +-------+ +-------+ +------------+ +---------+
* +---| FRESH |--->| STALE |--->| REFRESHING |--->| WAITING |
* +-------+ +-------+ +------------+ +---------+
* | | |
* | v |
* v +---------+ |
* free<-----| INVALID |<--------+
* +---------+
*/
typedef enum auth_state {
NFS_AUTH_FRESH,
NFS_AUTH_STALE,
NFS_AUTH_REFRESHING,
NFS_AUTH_INVALID,
NFS_AUTH_NEW,
NFS_AUTH_WAITING
} auth_state_t;
/*
* An authorization cache entry
*
* Either the state in auth_state will protect the
* contents or auth_lock must be held.
*/
struct auth_cache {
avl_node_t auth_link;
struct auth_cache_clnt *auth_clnt;
int auth_flavor;
cred_t *auth_clnt_cred;
uid_t auth_srv_uid;
gid_t auth_srv_gid;
uint_t auth_srv_ngids;
gid_t *auth_srv_gids;
int auth_access;
time_t auth_time;
time_t auth_freshness;
auth_state_t auth_state;
kmutex_t auth_lock;
kcondvar_t auth_cv;
};
#define AUTH_TABLESIZE 32
/*
* Structure containing log file meta-data.
*/
struct log_file {
unsigned int lf_flags; /* flags (see below) */
int lf_writers; /* outstanding writers */
int lf_refcnt; /* references to this struct */
caddr_t lf_path; /* buffer file location */
vnode_t *lf_vp; /* vnode for the buffer file */
kmutex_t lf_lock;
kcondvar_t lf_cv_waiters;
};
/*
* log_file and log_buffer flags.
*/
#define L_WAITING 0x01 /* flush of in-core data to stable */
/* storage in progress */
#define L_PRINTED 0x02 /* error message printed to console */
#define L_ERROR 0x04 /* error condition detected */
/*
* The logging buffer information.
* This structure may be shared by multiple exportinfo structures,
* if they share the same buffer file.
* This structure contains the basic information about the buffer, such
* as it's location in the filesystem.
*
* 'lb_lock' protects all the fields in this structure except for 'lb_path',
* and 'lb_next'.
* 'lb_path' is a write-once/read-many field which needs no locking, it is
* set before the structure is linked to any exportinfo structure.
* 'lb_next' is protected by the log_buffer_list_lock.
*/
struct log_buffer {
unsigned int lb_flags; /* L_ONLIST set? */
int lb_refcnt; /* references to this struct */
unsigned int lb_rec_id; /* used to generate unique id */
caddr_t lb_path; /* buffer file pathname */
struct log_file *lb_logfile; /* points to log_file structure */
kmutex_t lb_lock;
struct log_buffer *lb_next;
kcondvar_t lb_cv_waiters;
caddr_t lb_records; /* linked list of records to write */
int lb_num_recs; /* # of records to write */
ssize_t lb_size_queued; /* number of bytes queued for write */
};
#define LOG_BUFFER_HOLD(lbp) { \
mutex_enter(&(lbp)->lb_lock); \
(lbp)->lb_refcnt++; \
mutex_exit(&(lbp)->lb_lock); \
}
#define LOG_BUFFER_RELE(lbp) { \
log_buffer_rele(lbp); \
}
/*
* Structure for character set conversion mapping based on client address.
*/
struct charset_cache {
struct charset_cache *next;
kiconv_t inbound;
kiconv_t outbound;
struct sockaddr client_addr;
};
/* Forward declarations */
struct exportinfo;
struct exp_visible;
struct svc_req;
/*
* Treenodes are used to build tree representing every node which is part
* of nfs server pseudo namespace. They are connected with both exportinfo
* and exp_visible struct. They were introduced to avoid lookup of ".."
* in the underlying file system during unshare, which was failing if the
* file system was forcibly unmounted or if the directory was removed.
* One exp_visible_t can be shared via several treenode_t, i.e.
* different tree_vis can point to the same exp_visible_t.
* This will happen if some directory is on two different shared paths:
* E.g. after share /tmp/a/b1 and share /tmp/a/b2 there will be two treenodes
* corresponding to /tmp/a and both will have same value in tree_vis.
*
*
*
* NEW DATA STRUCT ORIGINAL DATA STRUCT
*
* ns_root +---+ +----------+
* | / | |PSEUDO EXP|-->+---+ +---+ +---+
* +---+--------- ----+----------+ | a |-->| k |-->| b |
* /\ +---+ +---+ +---+
* / \ . . .
* +---+...\......... ..................... . .
* *| a | \ +----------+ . .
* +---+-----\------- ----|REAL EXP a| . .
* / \ +----------+ . .
* / +===+... ............................. .
* / *| k | +----------+ .
* / +===+--- ----|REAL EXP k| .
* / +----------+ .
* +===+................ .....................................
* *| b | +----------+
* +===+---------------- ----|REAL EXP b|-->+---+
* \ +----------+ | d |
* +===+............. ...................+---+
* | d | +----------+
* +===+------------- ----|PSEUDO EXP|-->+---+ +---+
* / +----------+ | e |-->| g |
* +---+................. ...................+---+ +---+
* | e | .
* +---+ .
* \ .
* +---+.............. ............................
* *| g | +----------+
* +---+-------------- ----|REAL EXP g|
* +----------+
*
*
*
* +===+ +---+ +---+
* | b |..mountpoint | e |..directory/file *| a |..node is shared
* +===+ (VROOT) +---+ +---+
*
*
* Bi-directional interconnect:
* treenode_t::tree_exi --------- exportinfo_t::exi_tree
* One-way direction connection:
* treenode_t::tree_vis .........> exp_visible_t
*/
/* Access to treenode_t is under protection of exported_lock RW_LOCK */
typedef struct treenode {
/* support for generic n-ary trees */
struct treenode *tree_parent;
struct treenode *tree_child_first;
struct treenode *tree_sibling; /* next sibling */
/* private, nfs specific part */
struct exportinfo *tree_exi;
struct exp_visible *tree_vis;
} treenode_t;
/*
* Now that we have links to chase, we can get the zone rootvp just from
* an export. No current-zone-context needed.
*/
#define EXI_TO_ZONEROOTVP(exi) ((exi)->exi_ne->exi_root->exi_vp)
/*
* TREE_ROOT checks if the node corresponds to a filesystem root or
* the zone's root directory.
* TREE_EXPORTED checks if the node is explicitly shared
*/
#define TREE_ROOT(t) \
((t)->tree_exi != NULL && \
(((t)->tree_exi->exi_vp->v_flag & VROOT) || \
VN_CMP(EXI_TO_ZONEROOTVP((t)->tree_exi), (t)->tree_exi->exi_vp)))
#define TREE_EXPORTED(t) \
((t)->tree_exi && !PSEUDO((t)->tree_exi))
#define EXPTABLESIZE 256
struct exp_hash {
struct exportinfo *prev; /* ptr to the previous exportinfo */
struct exportinfo *next; /* ptr to the next exportinfo */
struct exportinfo **bckt; /* backpointer to the hash bucket */
};
/*
* A node associated with an export entry on the
* list of exported filesystems.
*
* exi_count+exi_lock protects an individual exportinfo from being freed
* when in use.
*
* You must have the writer lock on exported_lock to add/delete an exportinfo
* structure to/from the list.
*
* exi_volatile_dev maps to VSW_VOLATILEDEV. It means that the
* underlying fs devno can change on each mount. When set, the server
* should not use va_fsid for a GETATTR(FATTR4_FSID) reply. It must
* use exi_fsid because it is guaranteed to be persistent. This isn't
* in any way related to NFS4 volatile filehandles.
*
* The exi_cache_lock protects the exi_cache AVL trees.
*/
struct exportinfo {
struct exportdata exi_export;
fsid_t exi_fsid;
struct fid exi_fid;
struct exp_hash fid_hash;
struct exp_hash path_hash;
struct treenode *exi_tree;
fhandle_t exi_fh;
krwlock_t exi_cache_lock;
kmutex_t exi_lock;
uint_t exi_count;
zoneid_t exi_zoneid;
vnode_t *exi_vp;
vnode_t *exi_dvp;
avl_tree_t *exi_cache[AUTH_TABLESIZE];
struct log_buffer *exi_logbuffer;
struct exp_visible *exi_visible;
struct charset_cache *exi_charset;
unsigned exi_volatile_dev:1;
unsigned exi_moved:1;
int exi_id;
avl_node_t exi_id_link;
/*
* Soft-reference/backpointer to zone's nfs_export_t.
* This allows us access to the zone's rootvp (stored in
* exi_ne->exi_root->exi_vp) even if the current thread isn't in
* same-zone context.
*/
struct nfs_export *exi_ne;
#ifdef VOLATILE_FH_TEST
uint32_t exi_volatile_id;
struct ex_vol_rename *exi_vol_rename;
kmutex_t exi_vol_rename_lock;
#endif /* VOLATILE_FH_TEST -- keep last! */
};
typedef struct exportinfo exportinfo_t;
typedef struct exportdata exportdata_t;
typedef struct secinfo secinfo_t;
/*
* exp_visible is a visible list per filesystem. It is for filesystems
* that may need a limited view of its contents. A pseudo export and
* a real export at the mount point (VROOT) which has a subtree shared
* has a visible list.
*
* The exi_visible field is NULL for normal, non-pseudo filesystems
* which do not have any subtree exported. If the field is non-null,
* it points to a list of visible entries, identified by vis_fid and/or
* vis_ino. The presence of a "visible" list means that if this export
* can only have a limited view, it can only view the entries in the
* exp_visible list. The directories in the fid list comprise paths that
* lead to exported directories.
*
* The vis_count field records the number of paths in this filesystem
* that use this directory. The vis_exported field is non-zero if the
* entry is an exported directory (leaf node).
*
* exp_visible itself is not reference counted. Each exp_visible is
* referenced twice:
* 1) from treenode::tree_vis
* 2) linked from exportinfo::exi_visible
* The 'owner' of exp_visible is the exportinfo structure. exp_visible should
* be always freed only from exportinfo_t, never from treenode::tree_vis.
*/
struct exp_visible {
vnode_t *vis_vp;
fid_t vis_fid;
u_longlong_t vis_ino;
int vis_count;
int vis_exported;
struct exp_visible *vis_next;
struct secinfo *vis_secinfo;
int vis_seccnt;
timespec_t vis_change;
};
typedef struct exp_visible exp_visible_t;
#define PSEUDO(exi) ((exi)->exi_export.ex_flags & EX_PSEUDO)
#define EXP_LINKED(exi) ((exi)->fid_hash.bckt != NULL)
#define EQFSID(fsidp1, fsidp2) \
(((fsidp1)->val[0] == (fsidp2)->val[0]) && \
((fsidp1)->val[1] == (fsidp2)->val[1]))
#define EQFID(fidp1, fidp2) \
((fidp1)->fid_len == (fidp2)->fid_len && \
bcmp((char *)(fidp1)->fid_data, (char *)(fidp2)->fid_data, \
(uint_t)(fidp1)->fid_len) == 0)
#define exportmatch(exi, fsid, fid) \
(EQFSID(&(exi)->exi_fsid, (fsid)) && EQFID(&(exi)->exi_fid, (fid)))
/*
* Returns true iff exported filesystem is read-only to the given host.
*
* Note: this macro should be as fast as possible since it's called
* on each NFS modification request.
*/
#define rdonly(ro, vp) ((ro) || vn_is_readonly(vp))
#define rdonly4(req, cs) \
(vn_is_readonly((cs)->vp) || \
(nfsauth4_access((cs)->exi, (cs)->vp, (req), (cs)->basecr, NULL, \
NULL, NULL, NULL) & (NFSAUTH_RO | NFSAUTH_LIMITED)))
extern int nfsauth4_access(struct exportinfo *, vnode_t *,
struct svc_req *, cred_t *, uid_t *, gid_t *, uint_t *, gid_t **);
extern int nfsauth4_secinfo_access(struct exportinfo *,
struct svc_req *, int, int, cred_t *);
extern int nfsauth_cache_clnt_compar(const void *, const void *);
extern int nfs_fhbcmp(char *, char *, int);
extern void nfs_exportinit(void);
extern void nfs_exportfini(void);
extern void nfs_export_zone_init(nfs_globals_t *);
extern void nfs_export_zone_fini(nfs_globals_t *);
extern void nfs_export_zone_shutdown(nfs_globals_t *);
extern int nfs_export_get_rootfh(nfs_globals_t *);
extern int chk_clnt_sec(struct exportinfo *, struct svc_req *);
extern int makefh(fhandle_t *, struct vnode *, struct exportinfo *);
extern int makefh_ol(fhandle_t *, struct exportinfo *, uint_t);
extern int makefh3(nfs_fh3 *, struct vnode *, struct exportinfo *);
extern int makefh3_ol(nfs_fh3 *, struct exportinfo *, uint_t);
extern vnode_t *nfs_fhtovp(fhandle_t *, struct exportinfo *);
extern vnode_t *nfs3_fhtovp(nfs_fh3 *, struct exportinfo *);
extern struct exportinfo *checkexport(fsid_t *, struct fid *);
extern struct exportinfo *checkexport4(fsid_t *, struct fid *, vnode_t *);
extern void exi_hold(struct exportinfo *);
extern void exi_rele(struct exportinfo *);
extern struct exportinfo *nfs_vptoexi(vnode_t *, vnode_t *, cred_t *, int *,
int *, bool_t);
extern int nfs_check_vpexi(vnode_t *, vnode_t *, cred_t *,
struct exportinfo **);
extern vnode_t *untraverse(vnode_t *, vnode_t *);
extern int vn_is_nfs_reparse(vnode_t *, cred_t *);
extern int client_is_downrev(struct svc_req *);
extern char *build_symlink(vnode_t *, cred_t *, size_t *);
extern fhandle_t nullfh2; /* for comparing V2 filehandles */
typedef struct nfs_export {
/* Root of nfs pseudo namespace */
treenode_t *ns_root;
nfs_globals_t *ne_globals; /* "up" pointer */
struct exportinfo *exptable_path_hash[PKP_HASH_SIZE];
struct exportinfo *exptable[EXPTABLESIZE];
/*
* Read/Write lock that protects the exportinfo list. This lock
* must be held when searching or modifiying the exportinfo list.
*/
krwlock_t exported_lock;
/* "public" and default (root) location for public filehandle */
struct exportinfo *exi_public;
struct exportinfo *exi_root;
/* For checking default public file handle */
fid_t exi_rootfid;
/* For comparing V2 filehandles */
fhandle_t nullfh2;
/* The change attribute value of the root of nfs pseudo namespace */
timespec_t ns_root_change;
} nfs_export_t;
/*
* Functions that handle the NFSv4 server namespace
*/
extern exportinfo_t *vis2exi(treenode_t *);
extern int treeclimb_export(struct exportinfo *);
extern void treeclimb_unexport(nfs_export_t *, struct exportinfo *);
extern int nfs_visible(struct exportinfo *, vnode_t *, int *);
extern int nfs_visible_inode(struct exportinfo *, ino64_t,
struct exp_visible **);
extern int has_visible(struct exportinfo *, vnode_t *);
extern void free_visible(struct exp_visible *);
extern int nfs_exported(struct exportinfo *, vnode_t *);
extern struct exportinfo *pseudo_exportfs(nfs_export_t *, vnode_t *, fid_t *,
struct exp_visible *, struct exportdata *);
extern int vop_fid_pseudo(vnode_t *, fid_t *);
extern int nfs4_vget_pseudo(struct exportinfo *, vnode_t **, fid_t *);
extern bool_t nfs_visible_change(struct exportinfo *, vnode_t *,
timespec_t *);
extern void tree_update_change(nfs_export_t *, treenode_t *, timespec_t *);
extern void rfs4_clean_state_exi(nfs_export_t *, struct exportinfo *);
/*
* Functions that handle the NFSv4 server namespace security flavors
* information.
*/
extern void srv_secinfo_exp2pseu(struct exportdata *, struct exportdata *);
extern void srv_secinfo_list_free(struct secinfo *, int);
extern nfs_export_t *nfs_get_export();
extern void export_link(nfs_export_t *, struct exportinfo *);
extern void export_unlink(nfs_export_t *, struct exportinfo *);
/*
* exi_id support
*/
extern kmutex_t nfs_exi_id_lock;
extern avl_tree_t exi_id_tree;
extern int exi_id_get_next(void);
/*
* Two macros for identifying public filehandles.
* A v2 public filehandle is 32 zero bytes.
* A v3 public filehandle is zero length.
*/
#define PUBLIC_FH2(fh) \
((fh)->fh_fsid.val[1] == 0 && \
bcmp((fh), &nullfh2, sizeof (fhandle_t)) == 0)
#define PUBLIC_FH3(fh) \
((fh)->fh3_length == 0)
extern int makefh4(nfs_fh4 *, struct vnode *, struct exportinfo *);
extern vnode_t *nfs4_fhtovp(nfs_fh4 *, struct exportinfo *, nfsstat4 *);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _NFS_EXPORT_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
*/
#ifndef _NFS_LM_H
#define _NFS_LM_H
/*
* Interface definitions for the NFSv2/v3 lock manager.
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/cred.h>
#include <sys/fcntl.h>
#include <sys/types.h>
#include <sys/vnode.h>
#include <rpc/xdr.h>
#if defined(_KERNEL) || defined(_FAKE_KERNEL)
/*
* Common interfaces.
*/
struct exportinfo;
/*
* The numeric sysid is used to identify a host and transport.
*
* The local locking code uses (pid, sysid) to uniquely identify a process.
* This means that the client-side code must doctor up the sysid before
* registering a lock, so that the local locking code doesn't confuse a
* remote process with a local process just because they have the same pid.
* We currently do this by ORing LM_SYSID_CLIENT into the sysid before
* registering a lock.
*
* If you change LM_SYSID and LM_SYSID_MAX, be sure to pick values so that
* LM_SYSID_MAX > LM_SYSID using signed arithmetic, and don't use zero.
* You may also need a different way to tag lock manager locks that are
* registered locally.
*/
#define LM_SYSID ((sysid_t)0x0001)
#define LM_SYSID_MAX ((sysid_t)0x3FFF)
#define LM_SYSID_CLIENT ((sysid_t)0x4000)
#define LM_NOSYSID ((sysid_t)-1)
/*
* Struct used to represent a host.
*/
struct lm_sysid;
struct knetconfig;
struct netbuf;
/*
* Given a knetconfig and network address, returns a reference to the
* associated lm_sysid. The 3rd argument is the hostname to assign to the
* lm_sysid. The 4th argument is an output parameter. It is set non-zero
* if the returned lm_sysid has a different protocol
* (knetconfig::knc_proto) than what was requested.
*/
extern struct lm_sysid *lm_get_sysid(struct knetconfig *, struct netbuf *,
char *, bool_t *);
extern void lm_rel_sysid(struct lm_sysid *);
/*
* Return the integer sysid for the given lm_sysid.
*/
extern sysid_t lm_sysidt(struct lm_sysid *);
extern void lm_free_config(struct knetconfig *);
extern void lm_cprsuspend(void);
extern void lm_cprresume(void);
/*
* Client-side interfaces.
*/
extern int lm_frlock(struct vnode *vp, int cmd,
struct flock64 *flk, int flag,
u_offset_t offset, struct cred *cr,
netobj *fh, struct flk_callback *);
extern int lm_has_sleep(const struct vnode *);
extern void lm_register_lock_locally(vnode_t *,
struct lm_sysid *, struct flock64 *, int,
u_offset_t);
extern int lm_safelock(vnode_t *, const struct flock64 *,
cred_t *);
extern int lm_safemap(const vnode_t *);
extern int lm_shrlock(struct vnode *vp, int cmd,
struct shrlock *shr, int flag, netobj *fh);
extern int lm4_frlock(struct vnode *vp, int cmd,
struct flock64 *flk, int flag,
u_offset_t offset, struct cred *cr,
netobj *fh, struct flk_callback *);
extern int lm4_shrlock(struct vnode *vp, int cmd,
struct shrlock *shr, int flag, netobj *fh);
/*
* Server-side interfaces.
*/
extern void lm_unexport(struct exportinfo *);
/*
* Clustering: functions to encode the nlmid of the node where this NLM
* server is running in the l_sysid of the flock struct or the s_sysid
* field of the shrlock struct (respectively).
*/
extern void lm_set_nlmid_flk(int *);
extern void lm_set_nlmid_shr(int32_t *);
/* Hook for deleting all mandatory NFSv4 file locks held by a remote client */
extern void (*lm_remove_file_locks)(int);
/*
* The following global variable is the node id of the node where this
* NLM server is running.
*/
extern int lm_global_nlmid;
/*
* End of clustering hooks.
*/
/*
* Return non-zero if the given local vnode is in use.
*/
extern int lm_vp_active(const struct vnode *);
extern sysid_t lm_alloc_sysidt(void);
extern void lm_free_sysidt(sysid_t);
#endif /* _KERNEL */
#ifdef __STDC__
extern int lm_shutdown(void);
#else
extern int lm_shutdown();
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
#endif /* _NFS_LM_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T
* All Rights Reserved
*/
#ifndef _NFS_MOUNT_H
#define _NFS_MOUNT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/pathconf.h> /* static pathconf kludge */
#define NFS_ARGS_EXTA 1
#define NFS_ARGS_EXTB 2
/*
* extension data for nfs_args_ext == NFS_ARGS_EXTA.
*/
struct nfs_args_extA {
struct sec_data *secdata; /* security data */
};
/*
* extension data for nfs_args_ext == NFS_ARGS_EXTB.
*/
struct nfs_args_extB {
struct sec_data *secdata; /* security data */
struct nfs_args *next; /* link for failover */
};
/*
* Union structure for future extension.
*/
union nfs_ext {
struct nfs_args_extA nfs_extA; /* nfs_args extension v1 */
struct nfs_args_extB nfs_extB; /* nfs_args extension v2 */
};
struct nfs_args {
struct netbuf *addr; /* file server address */
struct netbuf *syncaddr; /* secure NFS time sync addr */
struct knetconfig *knconf; /* transport netconfig struct */
char *hostname; /* server's hostname */
char *netname; /* server's netname */
caddr_t fh; /* File handle to be mounted */
int flags; /* flags */
int wsize; /* write size in bytes */
int rsize; /* read size in bytes */
int timeo; /* initial timeout in .1 secs */
int retrans; /* times to retry send */
int acregmin; /* attr cache file min secs */
int acregmax; /* attr cache file max secs */
int acdirmin; /* attr cache dir min secs */
int acdirmax; /* attr cache dir max secs */
struct pathcnf *pathconf; /* static pathconf kludge */
int nfs_args_ext; /* the nfs_args extension id */
union nfs_ext nfs_ext_u; /* extension union structure */
};
#ifdef _SYSCALL32
struct nfs_args_extA32 {
caddr32_t secdata; /* security data */
};
struct nfs_args_extB32 {
caddr32_t secdata; /* security data */
caddr32_t next; /* link for failover */
};
union nfs_ext32 {
struct nfs_args_extA32 nfs_extA; /* nfs_args extension v1 */
struct nfs_args_extB32 nfs_extB; /* nfs_args extension v2 */
};
struct nfs_args32 {
caddr32_t addr; /* file server address */
caddr32_t syncaddr; /* secure NFS time sync addr */
caddr32_t knconf; /* transport netconfig struct */
caddr32_t hostname; /* server's hostname */
caddr32_t netname; /* server's netname */
caddr32_t fh; /* File handle to be mounted */
int32_t flags; /* flags */
int32_t wsize; /* write size in bytes */
int32_t rsize; /* read size in bytes */
int32_t timeo; /* initial timeout in .1 secs */
int32_t retrans; /* times to retry send */
int32_t acregmin; /* attr cache file min secs */
int32_t acregmax; /* attr cache file max secs */
int32_t acdirmin; /* attr cache dir min secs */
int32_t acdirmax; /* attr cache dir max secs */
caddr32_t pathconf; /* static pathconf kludge */
int32_t nfs_args_ext; /* the nfs_args extension id */
union nfs_ext32 nfs_ext_u; /* extension union structure */
};
#endif /* _SYSCALL32 */
/*
* NFS mount option flags
*/
#define NFSMNT_SOFT 0x001 /* soft mount (hard is default) */
#define NFSMNT_WSIZE 0x002 /* set write size */
#define NFSMNT_RSIZE 0x004 /* set read size */
#define NFSMNT_TIMEO 0x008 /* set initial timeout */
#define NFSMNT_RETRANS 0x010 /* set number of request retrys */
#define NFSMNT_HOSTNAME 0x020 /* set hostname for error printf */
#define NFSMNT_INT 0x040 /* allow interrupts on hard mount */
#define NFSMNT_NOAC 0x080 /* don't cache attributes */
#define NFSMNT_ACREGMIN 0x0100 /* set min secs for file attr cache */
#define NFSMNT_ACREGMAX 0x0200 /* set max secs for file attr cache */
#define NFSMNT_ACDIRMIN 0x0400 /* set min secs for dir attr cache */
#define NFSMNT_ACDIRMAX 0x0800 /* set max secs for dir attr cache */
#define NFSMNT_SECURE 0x1000 /* secure mount */
#define NFSMNT_NOCTO 0x2000 /* no close-to-open consistency */
#define NFSMNT_KNCONF 0x4000 /* transport's knetconfig structure */
#define NFSMNT_GRPID 0x8000 /* System V-style gid inheritance */
#define NFSMNT_RPCTIMESYNC 0x10000 /* use RPC to do secure NFS time sync */
#define NFSMNT_KERBEROS 0x20000 /* use kerberos credentials */
#define NFSMNT_POSIX 0x40000 /* static pathconf kludge info */
#define NFSMNT_LLOCK 0x80000 /* Local locking (no lock manager) */
#define NFSMNT_LOOPBACK 0x100000 /* Is a loopback mount */
#define NFSMNT_SEMISOFT 0x200000 /* read soft, modify hard */
#define NFSMNT_NOPRINT 0x400000 /* don't print messages */
#define NFSMNT_NEWARGS 0x800000 /* using nfs_args extented structure */
#define NFSMNT_DIRECTIO 0x1000000 /* do direct I/O */
#define NFSMNT_PUBLIC 0x2000000 /* mount was done with url/public */
#define NFSMNT_SECDEFAULT 0x4000000 /* mount using default sec flavor */
#define NFSMNT_TRYRDMA 0x8000000 /* Try RDMA mount,no proto advised */
#define NFSMNT_DORDMA 0x10000000 /* Do an RDMA mount, regardless */
#define NFSMNT_MIRRORMOUNT 0x20000000 /* Is a mirrormount */
#define NFSMNT_REFERRAL 0x40000000 /* Is a referral */
#define NFSMNT_EPHEMERAL (NFSMNT_MIRRORMOUNT | NFSMNT_REFERRAL)
#ifdef __cplusplus
}
#endif
#endif /* _NFS_MOUNT_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright 2019 Nexenta by DDN, Inc. All rights reserved.
*/
#ifndef _NFS_NFS_H
#define _NFS_NFS_H
#include <sys/isa_defs.h>
#include <sys/vfs.h>
#include <sys/stream.h>
#include <rpc/types.h>
#include <sys/types32.h>
#ifdef _KERNEL
#include <rpc/rpc_rdma.h>
#include <rpc/rpc.h>
#include <sys/fcntl.h>
#include <sys/kstat.h>
#include <sys/dirent.h>
#include <sys/zone.h>
#include <sys/tsol/label.h>
#include <sys/nvpair.h>
#include <nfs/mount.h>
#include <sys/vfs_opreg.h>
#endif
#include <vm/page.h>
#include <rpc/rpc_sztypes.h>
#include <sys/sysmacros.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* remote file service numbers
*/
#define NFS_PROGRAM ((rpcprog_t)100003)
#define NFS_VERSMIN ((rpcvers_t)2)
#define NFS_VERSMAX ((rpcvers_t)4)
#define NFS_VERSION ((rpcvers_t)2)
#define NFS_PORT 2049
/* Protocol versions with internal representation */
typedef enum nfs_prot_vers {
NFS_VERS_2 = 0x200, /* 2 */
NFS_VERS_3 = 0x300, /* 3 */
NFS_VERS_4 = 0x400, /* 4 */
NFS_VERS_4_1 = 0x401, /* 4.1 */
NFS_VERS_4_2 = 0x402, /* 4.2 */
} nfs_prot_vers_t;
#define NFS_PROT_VERSION(x) ((x) >> 8)
#define NFS_PROT_V4_MINORVERSION(x) ((x) & 0xFF)
#define NFS_SRV_VERS_MIN NFS_VERS_2
#define NFS_SRV_VERS_MAX NFS_VERS_4_2
/*
* Used to determine registration and service handling of versions
*/
#define NFS_VERSMIN_DEFAULT ((rpcvers_t)2)
#define NFS_VERSMAX_DEFAULT ((rpcvers_t)4)
#define NFS_SRV_VERSMIN_DEFAULT (NFS_VERS_2)
#define NFS_SRV_VERSMAX_DEFAULT (NFS_VERS_4)
/*
* Used to track the state of the server so that initialization
* can be done properly.
*/
typedef enum {
NFS_SERVER_STOPPED, /* server state destroyed */
NFS_SERVER_STOPPING, /* server state being destroyed */
NFS_SERVER_RUNNING,
NFS_SERVER_QUIESCED, /* server state preserved */
NFS_SERVER_OFFLINE /* server pool offline */
} nfs_server_running_t;
/* Forward declarations for nfs_globals */
struct nfs_export;
struct nfs_srv;
struct nfs3_srv;
struct nfs4_srv;
struct nfsauth_globals;
/*
* Zone globals variables of NFS server
*/
typedef struct nfs_globals {
list_node_t nfs_g_link; /* all globals list */
nfs_prot_vers_t nfs_versmin; /* NFS_VERS_... */
nfs_prot_vers_t nfs_versmax; /* NFS_VERS_... */
/* NFS server locks and state */
nfs_server_running_t nfs_server_upordown;
kmutex_t nfs_server_upordown_lock;
kcondvar_t nfs_server_upordown_cv;
/* RDMA wait variables */
kcondvar_t rdma_wait_cv;
kmutex_t rdma_wait_mutex;
zoneid_t nfs_zoneid;
/* Per-zone data structures private to each module */
struct nfs_export *nfs_export; /* nfs_export.c */
struct nfs_srv *nfs_srv; /* nfs_srv.c */
struct nfs3_srv *nfs3_srv; /* nfs3_srv.c */
struct nfs4_srv *nfs4_srv; /* nfs4_srv.c */
struct nfsauth_globals *nfs_auth; /* nfs_auth.c */
/* statistic: nfs_stat.c, etc. */
kstat_named_t *svstat[NFS_VERSMAX + 1];
kstat_named_t *rfsproccnt[NFS_VERSMAX + 1];
kstat_named_t *aclproccnt[NFS_VERSMAX + 1];
} nfs_globals_t;
/*
* Default delegation setting for the server ==> "on"
*/
#define NFS_SERVER_DELEGATION_DEFAULT (TRUE)
/* Maximum size of data portion of a remote request */
#define NFS_MAXDATA 8192
#define NFS_MAXNAMLEN 255
#define NFS_MAXPATHLEN 1024
/*
* Rpc retransmission parameters
*/
#define NFS_TIMEO 11 /* initial timeout for clts in 10th of a sec */
#define NFS_RETRIES 5 /* times to retry request */
#define NFS_COTS_TIMEO 600 /* initial timeout for cots in 10th of a sec */
/*
* The value of UID_NOBODY/GID_NOBODY presented to the world via NFS.
* UID_NOBODY/GID_NOBODY is translated to NFS_UID_NOBODY/NFS_GID_NOBODY
* when being sent out over the network and NFS_UID_NOBODY/NFS_GID_NOBODY
* is translated to UID_NOBODY/GID_NOBODY when received.
*/
#define NFS_UID_NOBODY -2
#define NFS_GID_NOBODY -2
/*
* maximum transfer size for different interfaces
*/
#define ECTSIZE 2048
#define IETSIZE 8192
/*
* WebNFS error status
*/
enum wnfsstat {
WNFSERR_CLNT_FLAVOR = 20001 /* invalid client sec flavor */
};
/*
* Error status
* Should include all possible net errors.
* For now we just cast errno into an enum nfsstat.
*/
enum nfsstat {
NFS_OK = 0, /* no error */
NFSERR_PERM = 1, /* Not owner */
NFSERR_NOENT = 2, /* No such file or directory */
NFSERR_IO = 5, /* I/O error */
NFSERR_NXIO = 6, /* No such device or address */
NFSERR_ACCES = 13, /* Permission denied */
NFSERR_EXIST = 17, /* File exists */
NFSERR_XDEV = 18, /* Cross-device link */
NFSERR_NODEV = 19, /* No such device */
NFSERR_NOTDIR = 20, /* Not a directory */
NFSERR_ISDIR = 21, /* Is a directory */
NFSERR_INVAL = 22, /* Invalid argument */
NFSERR_FBIG = 27, /* File too large */
NFSERR_NOSPC = 28, /* No space left on device */
NFSERR_ROFS = 30, /* Read-only file system */
NFSERR_OPNOTSUPP = 45, /* Operation not supported */
NFSERR_NAMETOOLONG = 63, /* File name too long */
NFSERR_NOTEMPTY = 66, /* Directory not empty */
NFSERR_DQUOT = 69, /* Disc quota exceeded */
NFSERR_STALE = 70, /* Stale NFS file handle */
NFSERR_REMOTE = 71, /* Object is remote */
NFSERR_WFLUSH = 99 /* write cache flushed */
};
typedef enum nfsstat nfsstat;
/*
* File types
*/
enum nfsftype {
NFNON,
NFREG, /* regular file */
NFDIR, /* directory */
NFBLK, /* block special */
NFCHR, /* character special */
NFLNK, /* symbolic link */
NFSOC /* socket */
};
/*
* Macros for converting device numbers to and from the format
* SunOS 4.x used. SVR4 uses 14 bit majors and 18 bits minors,
* SunOS 4.x used 8 bit majors and 8 bit minors. It isn't sufficient
* to use the cmpdev() and expdev() macros because they only compress
* 7 bit (and smaller) majors. We must compress 8 bit majors too.
* If the major or minor exceeds 8 bits, then we send it out in
* full 32 bit format and hope that the peer can deal with it.
*/
#define SO4_BITSMAJOR 8 /* # of SunOS 4.x major device bits */
#define SO4_BITSMINOR 8 /* # of SunOS 4.x minor device bits */
#define SO4_MAXMAJ 0xff /* SunOS 4.x max major value */
#define SO4_MAXMIN 0xff /* SunOS 4.x max minor value */
/*
* Convert to over-the-wire device number format
*/
#define nfsv2_cmpdev(x) \
((uint32_t) \
((getmajor(x) > SO4_MAXMAJ || getminor(x) > SO4_MAXMIN) ? NODEV : \
((getmajor(x) << SO4_BITSMINOR) | (getminor(x) & SO4_MAXMIN))))
/*
* Convert from over-the-wire format to SVR4 device number format
*/
#define nfsv2_expdev(x) \
makedevice((((x) >> SO4_BITSMINOR) & SO4_MAXMAJ), (x) & SO4_MAXMIN)
/*
* Special kludge for fifos (named pipes) [to adhere to NFS Protocol Spec]
*
* VFIFO is not in the protocol spec (VNON will be replaced by VFIFO)
* so the over-the-wire representation is VCHR with a '-1' device number.
*
* NOTE: This kludge becomes unnecessary with the Protocol Revision,
* but it may be necessary to support it (backwards compatibility).
*/
#define NFS_FIFO_TYPE NFCHR
#define NFS_FIFO_MODE S_IFCHR
#define NFS_FIFO_DEV ((uint32_t)-1)
/* identify fifo in nfs attributes */
#define NA_ISFIFO(NA) (((NA)->na_type == NFS_FIFO_TYPE) && \
((NA)->na_rdev == NFS_FIFO_DEV))
/* set fifo in nfs attributes */
#define NA_SETFIFO(NA) { \
(NA)->na_type = NFS_FIFO_TYPE; \
(NA)->na_rdev = NFS_FIFO_DEV; \
(NA)->na_mode = ((NA)->na_mode & ~S_IFMT) | NFS_FIFO_MODE; \
}
/*
* Check for time overflow using a kernel tunable to determine whether
* we should accept or reject an unsigned 32-bit time value. Time value in NFS
* v2/3 protocol is unsigned 32 bit, but ILP32 kernel only allows 31 bits.
* In nfsv4, time value is a signed 64 bit, so needs to be checked for
* overflow as well (e.g. for setattr). So define the tunable as follows:
* nfs_allow_preepoch_time is TRUE if pre-epoch (negative) times are allowed
* and is FALSE (the default) otherwise. For nfsv2/3 this means that
* if negative times are allowed, the uint32_t time value is interpreted
* as a signed int, otherwise as a large positive number. For nfsv4,
* we use the value as is - except that if negative times are not allowed,
* we will not accept a negative value otw.
*
* So for nfsv2/3 (uint32_t):
*
* If nfs_allow_preepoch_time is
* FALSE, the maximum time value is INT32_MAX for 32-bit kernels and
* UINT32_MAX for 64-bit kernels (to allow times larger than 2038)
* and the minimum is zero. Note that in that case, a 32-bit application
* running on a 64-bit kernel will not be able to access files with
* the larger time values.
* If nfs_allow_preepoch_time is TRUE, the maximum time value is INT32_MAX
* for both kernel configurations and the minimum is INT32_MIN.
*
* And for nfsv4 (int64_t):
*
* nfsv4 allows for negative values in the protocol, and has a 64-bit
* time field, so nfs_allow_preepoch_time can be ignored.
*/
#ifdef _KERNEL
extern bool_t nfs_allow_preepoch_time;
#ifdef _LP64
/*
* If no negative otw values are allowed, may use the full 32-bits of the
* time to represent time later than 2038, by presenting the value as an
* unsigned (but this can only be used by 64-bit apps due to cstat32
* restrictions). If negative values are allowed, cannot represent times
* after 2038. Either way, all 32 bits have a valid representation.
*/
/* Check if nfstime4 seconds (int64_t) can be stored in the system time */
#define NFS4_TIME_OK(tt) TRUE
#define NFS3_TIME_OVERFLOW(tt) (FALSE)
#define NFS2_TIME_OVERFLOW(tt) (FALSE)
/*
* check if a time_t (int64_t) is ok when preepoch times are allowed -
* nfsv2/3: every 32-bit value is accepted, but can't overflow 64->32.
* nfsv4: every value is valid.
*/
#define NFS_PREEPOCH_TIME_T_OK(tt) \
(((tt) >= (time_t)INT32_MIN) && ((tt) <= (time_t)INT32_MAX))
/*
* check if a time_t (int64_t) is ok when preepoch times are not allowed -
* nfsv2/3: every positive 32-bit value is accepted, but can't overflow 64->32.
* nfsv4: every value is valid.
*/
#define NFS_NO_PREEPOCH_TIME_T_OK(tt) \
(((tt) >= 0) && ((tt) <= (time_t)(ulong_t)UINT32_MAX))
#else /* not _LP64 */
/*
* Cannot represent times after 2038 in a 32-bit kernel, but we may wish to
* restrict the use of negative values (which violate the protocol).
* So if negative times allowed, all uint32 time values are valid. Otherwise
* only those which are less than INT32_MAX (msb=0).
*
* NFSv4 uses int64_t for the time, so in a 32-bit kernel the nfsv4 value
* must fit in an int32_t.
*/
/* Only allow signed 32-bit time values */
/* Check if an nfstime4 (int64_t) can be stored in the system time */
#define NFS4_TIME_OK(tt) \
(((tt) <= INT32_MAX) && ((tt) >= INT32_MIN))
#define NFS3_TIME_OVERFLOW(tt) ((tt) > INT32_MAX)
#define NFS2_TIME_OVERFLOW(tt) ((tt) > INT32_MAX)
/*
* check if a time_t (int32_t) is ok when preepoch times are allowed -
* every 32-bit value is accepted
*/
#define NFS_PREEPOCH_TIME_T_OK(tt) TRUE
/*
* check if a time_t (int32_t) is ok when preepoch times are not allowed -
* only positive values are accepted.
*/
#define NFS_NO_PREEPOCH_TIME_T_OK(tt) ((tt) >= 0)
#endif /* _LP64 */
/* Check if an nfstime3 (uint32_t) can be stored in the system time */
#define NFS3_TIME_OK(tt) \
(nfs_allow_preepoch_time || (!NFS3_TIME_OVERFLOW(tt)))
/* Check if an nfs2_timeval (uint32_t) can be stored in the system time. */
#define NFS2_TIME_OK(tt) \
(nfs_allow_preepoch_time || (!NFS2_TIME_OVERFLOW(tt)))
/*
* Test if time_t (signed long) can be sent over the wire - for v2/3 only if:
* 1. The time value can fit in a uint32_t; and
* 2. Either the time value is positive or allow preepoch times.
* No restrictions for nfsv4.
*/
#define NFS_TIME_T_OK(tt) \
(nfs_allow_preepoch_time ? \
NFS_PREEPOCH_TIME_T_OK(tt) : NFS_NO_PREEPOCH_TIME_T_OK(tt))
#define NFS4_TIME_T_OK(tt) TRUE
/* Test if all attr times are valid */
#define NFS_VAP_TIME_OK(vap) \
(nfs_allow_preepoch_time ? \
(NFS_PREEPOCH_TIME_T_OK((vap)->va_atime.tv_sec) && \
NFS_PREEPOCH_TIME_T_OK((vap)->va_mtime.tv_sec) && \
NFS_PREEPOCH_TIME_T_OK((vap)->va_ctime.tv_sec)) : \
(NFS_NO_PREEPOCH_TIME_T_OK((vap)->va_atime.tv_sec) && \
NFS_NO_PREEPOCH_TIME_T_OK((vap)->va_mtime.tv_sec) && \
NFS_NO_PREEPOCH_TIME_T_OK((vap)->va_ctime.tv_sec)))
#define NFS4_VAP_TIME_OK(vap) TRUE
/*
* To extend the sign or not extend the sign, that is the question.
* Note: The correct way is to code a macro:
* #define NFS_TIME_T_CONVERT(tt) \
* (nfs_allow_preepoch_time ? (int32_t)(tt) : (uint32_t)(tt))
* But the 64-bit compiler does not extend the sign in that case (why?)
* so we'll do it the ugly way...
*/
#define NFS_TIME_T_CONVERT(systt, tt) \
if (nfs_allow_preepoch_time) { \
systt = (int32_t)(tt); \
} else { \
systt = (uint32_t)(tt); \
}
/* macro to check for overflowed time attribute fields - version 3 */
#define NFS3_FATTR_TIME_OK(attrs) \
(NFS3_TIME_OK((attrs)->atime.seconds) && \
NFS3_TIME_OK((attrs)->mtime.seconds) && \
NFS3_TIME_OK((attrs)->ctime.seconds))
/* macro to check for overflowed time attribute fields - version 2 */
#define NFS2_FATTR_TIME_OK(attrs) \
(NFS2_TIME_OK((attrs)->na_atime.tv_sec) && \
NFS2_TIME_OK((attrs)->na_mtime.tv_sec) && \
NFS2_TIME_OK((attrs)->na_ctime.tv_sec))
/* Check that a size3 value is not overflowed */
#define NFS3_SIZE_OK(size) ((size) <= MAXOFFSET_T)
#endif /* _KERNEL */
/*
* Size of an fhandle in bytes
*/
#define NFS_FHSIZE 32
struct nfs_fid {
ushort_t nf_len;
ushort_t nf_pad;
char nf_data[NFS_FHSIZE];
};
/*
* "Legacy" filehandles use NFS_FHMAXDATA (10) byte fids. Filesystems that
* return a larger fid than NFS_FHMAXDATA, such as ZFS's .zfs snapshot
* directory, can use up to (((64 - 8) / 2) - 2) bytes for their fid.
* This currently holds for both NFSv3 and NFSv4.
*/
#define NFS_FHMAXDATA 10
#define NFS_FH3MAXDATA 26
#define NFS_FH4MAXDATA 26
/*
* The original nfs file handle size for version 3 was 32 which was
* the same in version 2; now we're making it bigger to to deal with
* ZFS snapshot FIDs.
*
* If the size of fhandle3_t changes or if Version 3 uses some other
* filehandle format, this constant may need to change.
*/
#define NFS3_OLDFHSIZE 32
#define NFS3_MAXFHSIZE 64
/*
* This is the actual definition of a legacy filehandle. There is some
* dependence on this layout in NFS-related code, particularly in the
* user-level lock manager, so be careful about changing it.
*
* Currently only NFSv2 uses this structure.
*/
typedef struct svcfh {
fsid_t fh_fsid; /* filesystem id */
ushort_t fh_len; /* file number length */
char fh_data[NFS_FHMAXDATA]; /* and data */
ushort_t fh_xlen; /* export file number length */
char fh_xdata[NFS_FHMAXDATA]; /* and data */
} fhandle_t;
/*
* This is the in-memory structure for an NFSv3 extended filehandle.
*/
typedef struct {
fsid_t _fh3_fsid; /* filesystem id */
ushort_t _fh3_len; /* file number length */
char _fh3_data[NFS_FH3MAXDATA]; /* and data */
ushort_t _fh3_xlen; /* export file number length */
char _fh3_xdata[NFS_FH3MAXDATA]; /* and data */
} fhandle3_t;
/*
* This is the in-memory structure for an NFSv4 extended filehandle.
*/
typedef struct {
fsid_t fhx_fsid; /* filesystem id */
ushort_t fhx_len; /* file number length */
char fhx_data[NFS_FH4MAXDATA]; /* and data */
ushort_t fhx_xlen; /* export file number length */
char fhx_xdata[NFS_FH4MAXDATA]; /* and data */
} fhandle4_t;
/*
* Arguments to remote write and writecache
*/
/*
* The `over the wire' representation of the first four arguments.
*/
struct otw_nfswriteargs {
fhandle_t otw_wa_fhandle;
uint32_t otw_wa_begoff;
uint32_t otw_wa_offset;
uint32_t otw_wa_totcount;
};
struct nfswriteargs {
struct otw_nfswriteargs *wa_args; /* ptr to the otw arguments */
struct otw_nfswriteargs wa_args_buf; /* space for otw arguments */
uint32_t wa_count;
char *wa_data; /* data to write (up to NFS_MAXDATA) */
mblk_t *wa_mblk; /* pointer to mblks containing data */
#ifdef _KERNEL
/* rdma related info */
struct clist *wa_rlist;
CONN *wa_conn;
#endif /* _KERNEL */
};
#define wa_fhandle wa_args->otw_wa_fhandle
#define wa_begoff wa_args->otw_wa_begoff
#define wa_offset wa_args->otw_wa_offset
#define wa_totcount wa_args->otw_wa_totcount
/*
* NFS timeval struct using unsigned int as specified in V2 protocol.
* tv_sec and tv_usec used to match existing code.
*/
struct nfs2_timeval {
uint32_t tv_sec;
uint32_t tv_usec;
};
typedef struct nfs2_timeval nfs2_timeval;
/*
* File attributes
*/
struct nfsfattr {
enum nfsftype na_type; /* file type */
uint32_t na_mode; /* protection mode bits */
uint32_t na_nlink; /* # hard links */
uint32_t na_uid; /* owner user id */
uint32_t na_gid; /* owner group id */
uint32_t na_size; /* file size in bytes */
uint32_t na_blocksize; /* preferred block size */
uint32_t na_rdev; /* special device # */
uint32_t na_blocks; /* Kb of disk used by file */
uint32_t na_fsid; /* device # */
uint32_t na_nodeid; /* inode # */
struct nfs2_timeval na_atime; /* time of last access */
struct nfs2_timeval na_mtime; /* time of last modification */
struct nfs2_timeval na_ctime; /* time of last change */
};
#define n2v_type(x) (NA_ISFIFO(x) ? VFIFO : nf_to_vt[(x)->na_type])
#define n2v_rdev(x) (NA_ISFIFO(x) ? 0 : (x)->na_rdev)
/*
* Arguments to remote read
*/
struct nfsreadargs {
fhandle_t ra_fhandle; /* handle for file */
uint32_t ra_offset; /* byte offset in file */
uint32_t ra_count; /* immediate read count */
uint32_t ra_totcount; /* total read cnt (from this offset) */
#ifdef _KERNEL
/* used in rdma transports */
caddr_t ra_data; /* destination for read data */
struct clist *ra_wlist;
CONN *ra_conn;
#endif
};
/*
* Status OK portion of remote read reply
*/
struct nfsrrok {
struct nfsfattr rrok_attr; /* attributes, need for pagin */
uint32_t rrok_count; /* bytes of data */
char *rrok_data; /* data (up to NFS_MAXDATA bytes) */
uint_t rrok_bufsize; /* size of kmem_alloc'd buffer */
mblk_t *rrok_mp; /* mblk_t contains data for reply */
#ifdef _KERNEL
uint_t rrok_wlist_len;
struct clist *rrok_wlist;
#endif
};
/*
* Reply from remote read
*/
struct nfsrdresult {
nfsstat rr_status; /* status of read */
union {
struct nfsrrok rr_ok_u; /* attributes, need for pagin */
} rr_u;
};
#define rr_ok rr_u.rr_ok_u
#define rr_attr rr_u.rr_ok_u.rrok_attr
#define rr_count rr_u.rr_ok_u.rrok_count
#define rr_bufsize rr_u.rr_ok_u.rrok_bufsize
#define rr_data rr_u.rr_ok_u.rrok_data
#define rr_mp rr_u.rr_ok_u.rrok_mp
/*
* File attributes which can be set
*/
struct nfssattr {
uint32_t sa_mode; /* protection mode bits */
uint32_t sa_uid; /* owner user id */
uint32_t sa_gid; /* owner group id */
uint32_t sa_size; /* file size in bytes */
struct nfs2_timeval sa_atime; /* time of last access */
struct nfs2_timeval sa_mtime; /* time of last modification */
};
/*
* Reply status with file attributes
*/
struct nfsattrstat {
nfsstat ns_status; /* reply status */
union {
struct nfsfattr ns_attr_u; /* NFS_OK: file attributes */
} ns_u;
};
#define ns_attr ns_u.ns_attr_u
/*
* NFS_OK part of read sym link reply union
*/
struct nfssrok {
uint32_t srok_count; /* size of string */
char *srok_data; /* string (up to NFS_MAXPATHLEN bytes) */
};
/*
* Result of reading symbolic link
*/
struct nfsrdlnres {
nfsstat rl_status; /* status of symlink read */
union {
struct nfssrok rl_srok_u; /* name of linked to */
} rl_u;
};
#define rl_srok rl_u.rl_srok_u
#define rl_count rl_u.rl_srok_u.srok_count
#define rl_data rl_u.rl_srok_u.srok_data
/*
* Arguments to readdir
*/
struct nfsrddirargs {
fhandle_t rda_fh; /* directory handle */
uint32_t rda_offset; /* offset in directory (opaque) */
uint32_t rda_count; /* number of directory bytes to read */
};
/*
* NFS_OK part of readdir result
*/
struct nfsrdok {
uint32_t rdok_offset; /* next offset (opaque) */
uint32_t rdok_size; /* size in bytes of entries */
bool_t rdok_eof; /* true if last entry is in result */
struct dirent64 *rdok_entries; /* variable number of entries */
};
/*
* Readdir result
*/
struct nfsrddirres {
nfsstat rd_status;
uint_t rd_bufsize; /* client request size (not xdr'ed) */
union {
struct nfsrdok rd_rdok_u;
} rd_u;
};
#define rd_rdok rd_u.rd_rdok_u
#define rd_offset rd_u.rd_rdok_u.rdok_offset
#define rd_size rd_u.rd_rdok_u.rdok_size
#define rd_eof rd_u.rd_rdok_u.rdok_eof
#define rd_entries rd_u.rd_rdok_u.rdok_entries
/*
* Arguments for directory operations
*/
struct nfsdiropargs {
fhandle_t *da_fhandle; /* pointer to directory file handle */
char *da_name; /* name (up to NFS_MAXNAMLEN bytes) */
fhandle_t da_fhandle_buf; /* directory file handle */
int da_flags; /* flags, see below */
};
#define DA_FREENAME 1
/*
* NFS_OK part of directory operation result
*/
struct nfsdrok {
fhandle_t drok_fhandle; /* result file handle */
struct nfsfattr drok_attr; /* result file attributes */
};
/*
* Results from directory operation
*/
struct nfsdiropres {
nfsstat dr_status; /* result status */
union {
struct nfsdrok dr_drok_u; /* NFS_OK result */
} dr_u;
};
#define dr_drok dr_u.dr_drok_u
#define dr_fhandle dr_u.dr_drok_u.drok_fhandle
#define dr_attr dr_u.dr_drok_u.drok_attr
/*
* arguments to setattr
*/
struct nfssaargs {
fhandle_t saa_fh; /* fhandle of file to be set */
struct nfssattr saa_sa; /* new attributes */
};
/*
* arguments to create and mkdir
*/
struct nfscreatargs {
struct nfsdiropargs ca_da; /* file name to create and parent dir */
struct nfssattr *ca_sa; /* initial attributes */
struct nfssattr ca_sa_buf; /* space to store attributes */
};
/*
* arguments to link
*/
struct nfslinkargs {
fhandle_t *la_from; /* old file */
fhandle_t la_from_buf; /* old file */
struct nfsdiropargs la_to; /* new file and parent dir */
};
/*
* arguments to rename
*/
struct nfsrnmargs {
struct nfsdiropargs rna_from; /* old file and parent dir */
struct nfsdiropargs rna_to; /* new file and parent dir */
};
/*
* arguments to symlink
*/
struct nfsslargs {
struct nfsdiropargs sla_from; /* old file and parent dir */
char *sla_tnm; /* new name */
int sla_tnm_flags; /* flags for name */
struct nfssattr *sla_sa; /* attributes */
struct nfssattr sla_sa_buf; /* attributes buffer */
};
#define SLA_FREETNM 1
/*
* NFS_OK part of statfs operation
*/
struct nfsstatfsok {
uint32_t fsok_tsize; /* preferred transfer size in bytes */
uint32_t fsok_bsize; /* fundamental file system block size */
uint32_t fsok_blocks; /* total blocks in file system */
uint32_t fsok_bfree; /* free blocks in fs */
uint32_t fsok_bavail; /* free blocks avail to non-superuser */
};
/*
* Results of statfs operation
*/
struct nfsstatfs {
nfsstat fs_status; /* result status */
union {
struct nfsstatfsok fs_fsok_u; /* NFS_OK result */
} fs_u;
};
#define fs_fsok fs_u.fs_fsok_u
#define fs_tsize fs_u.fs_fsok_u.fsok_tsize
#define fs_bsize fs_u.fs_fsok_u.fsok_bsize
#define fs_blocks fs_u.fs_fsok_u.fsok_blocks
#define fs_bfree fs_u.fs_fsok_u.fsok_bfree
#define fs_bavail fs_u.fs_fsok_u.fsok_bavail
#ifdef _KERNEL
/*
* XDR routines for handling structures defined above
*/
extern bool_t xdr_attrstat(XDR *, struct nfsattrstat *);
extern bool_t xdr_fastattrstat(XDR *, struct nfsattrstat *);
extern bool_t xdr_creatargs(XDR *, struct nfscreatargs *);
extern bool_t xdr_diropargs(XDR *, struct nfsdiropargs *);
extern bool_t xdr_diropres(XDR *, struct nfsdiropres *);
extern bool_t xdr_fastdiropres(XDR *, struct nfsdiropres *);
extern bool_t xdr_drok(XDR *, struct nfsdrok *);
#ifdef _LITTLE_ENDIAN
extern bool_t xdr_fastdrok(XDR *, struct nfsdrok *);
extern bool_t xdr_fastfattr(XDR *, struct nfsfattr *);
#endif
extern bool_t xdr_fattr(XDR *, struct nfsfattr *);
extern bool_t xdr_fhandle(XDR *, fhandle_t *);
extern bool_t xdr_fastfhandle(XDR *, fhandle_t **);
extern bool_t xdr_linkargs(XDR *, struct nfslinkargs *);
extern bool_t xdr_rddirargs(XDR *, struct nfsrddirargs *);
extern bool_t xdr_putrddirres(XDR *, struct nfsrddirres *);
extern bool_t xdr_getrddirres(XDR *, struct nfsrddirres *);
extern bool_t xdr_rdlnres(XDR *, struct nfsrdlnres *);
extern bool_t xdr_rdresult(XDR *, struct nfsrdresult *);
extern bool_t xdr_readargs(XDR *, struct nfsreadargs *);
extern bool_t xdr_readlink(XDR *, fhandle_t *);
extern bool_t xdr_rnmargs(XDR *, struct nfsrnmargs *);
extern bool_t xdr_rrok(XDR *, struct nfsrrok *);
extern bool_t xdr_saargs(XDR *, struct nfssaargs *);
extern bool_t xdr_sattr(XDR *, struct nfssattr *);
extern bool_t xdr_slargs(XDR *, struct nfsslargs *);
extern bool_t xdr_srok(XDR *, struct nfssrok *);
extern bool_t xdr_nfs2_timeval(XDR *, struct nfs2_timeval *);
extern bool_t xdr_writeargs(XDR *, struct nfswriteargs *);
extern bool_t xdr_fsok(XDR *, struct nfsstatfsok *);
#ifdef _LITTLE_ENDIAN
extern bool_t xdr_fastfsok(XDR *, struct nfsstatfsok *);
extern bool_t xdr_fastenum(XDR *, enum_t *);
#endif
extern bool_t xdr_statfs(XDR *, struct nfsstatfs *);
extern bool_t xdr_faststatfs(XDR *, struct nfsstatfs *);
#endif
/*
* Remote file service routines
*/
#define RFS_NULL 0
#define RFS_GETATTR 1
#define RFS_SETATTR 2
#define RFS_ROOT 3
#define RFS_LOOKUP 4
#define RFS_READLINK 5
#define RFS_READ 6
#define RFS_WRITECACHE 7
#define RFS_WRITE 8
#define RFS_CREATE 9
#define RFS_REMOVE 10
#define RFS_RENAME 11
#define RFS_LINK 12
#define RFS_SYMLINK 13
#define RFS_MKDIR 14
#define RFS_RMDIR 15
#define RFS_READDIR 16
#define RFS_STATFS 17
#define RFS_NPROC 18
#ifdef _KERNEL
/*
* The NFS Version 2 service procedures
*/
struct exportinfo; /* defined in nfs/export.h */
struct servinfo; /* defined in nfs/nfs_clnt.h */
struct mntinfo; /* defined in nfs/nfs_clnt.h */
extern void rfs_getattr(fhandle_t *, struct nfsattrstat *,
struct exportinfo *, struct svc_req *, cred_t *, bool_t);
extern void *rfs_getattr_getfh(fhandle_t *);
extern void rfs_setattr(struct nfssaargs *, struct nfsattrstat *,
struct exportinfo *, struct svc_req *, cred_t *, bool_t);
extern void *rfs_setattr_getfh(struct nfssaargs *);
extern void rfs_lookup(struct nfsdiropargs *, struct nfsdiropres *,
struct exportinfo *, struct svc_req *, cred_t *, bool_t);
extern void *rfs_lookup_getfh(struct nfsdiropargs *);
extern void rfs_readlink(fhandle_t *, struct nfsrdlnres *,
struct exportinfo *, struct svc_req *, cred_t *, bool_t);
extern void *rfs_readlink_getfh(fhandle_t *);
extern void rfs_rlfree(struct nfsrdlnres *);
extern void rfs_read(struct nfsreadargs *, struct nfsrdresult *,
struct exportinfo *, struct svc_req *, cred_t *, bool_t);
extern void *rfs_read_getfh(struct nfsreadargs *);
extern void rfs_rdfree(struct nfsrdresult *);
extern void rfs_write_sync(struct nfswriteargs *, struct nfsattrstat *,
struct exportinfo *, struct svc_req *, cred_t *, bool_t);
extern void rfs_write(struct nfswriteargs *, struct nfsattrstat *,
struct exportinfo *, struct svc_req *, cred_t *, bool_t);
extern void *rfs_write_getfh(struct nfswriteargs *);
extern void rfs_create(struct nfscreatargs *, struct nfsdiropres *,
struct exportinfo *, struct svc_req *, cred_t *, bool_t);
extern void *rfs_create_getfh(struct nfscreatargs *);
extern void rfs_remove(struct nfsdiropargs *, enum nfsstat *,
struct exportinfo *, struct svc_req *, cred_t *, bool_t);
extern void *rfs_remove_getfh(struct nfsdiropargs *);
extern void rfs_rename(struct nfsrnmargs *, enum nfsstat *,
struct exportinfo *, struct svc_req *, cred_t *, bool_t);
extern void *rfs_rename_getfh(struct nfsrnmargs *);
extern void rfs_link(struct nfslinkargs *, enum nfsstat *,
struct exportinfo *, struct svc_req *, cred_t *, bool_t);
extern void *rfs_link_getfh(struct nfslinkargs *);
extern void rfs_symlink(struct nfsslargs *, enum nfsstat *,
struct exportinfo *, struct svc_req *, cred_t *, bool_t);
extern void *rfs_symlink_getfh(struct nfsslargs *);
extern void rfs_mkdir(struct nfscreatargs *, struct nfsdiropres *,
struct exportinfo *, struct svc_req *, cred_t *, bool_t);
extern void *rfs_mkdir_getfh(struct nfscreatargs *);
extern void rfs_rmdir(struct nfsdiropargs *, enum nfsstat *,
struct exportinfo *, struct svc_req *, cred_t *, bool_t);
extern void *rfs_rmdir_getfh(struct nfsdiropargs *);
extern void rfs_readdir(struct nfsrddirargs *, struct nfsrddirres *,
struct exportinfo *, struct svc_req *, cred_t *, bool_t);
extern void *rfs_readdir_getfh(struct nfsrddirargs *);
extern void rfs_rddirfree(struct nfsrddirres *);
extern void rfs_statfs(fhandle_t *, struct nfsstatfs *, struct exportinfo *,
struct svc_req *, cred_t *, bool_t);
extern void *rfs_statfs_getfh(fhandle_t *);
extern void rfs_srvrinit(void);
extern void rfs_srvrfini(void);
extern void rfs_srv_zone_init(nfs_globals_t *);
extern void rfs_srv_zone_fini(nfs_globals_t *);
/*
* flags to define path types during Multi Component Lookups
* using the public filehandle
*/
#define URLPATH 0x01 /* Universal Resource Locator path */
#define NATIVEPATH 0x02 /* Native path, i.e., via mount protocol */
#define SECURITY_QUERY 0x04 /* Security query */
/* index for svstat_ptr */
enum nfs_svccounts {NFS_CALLS, NFS_BADCALLS, NFS_REFERRALS, NFS_REFERLINKS};
#define NFS_V2 NFS_VERSION
/* function defs for NFS kernel */
extern int nfs_waitfor_purge_complete(vnode_t *);
extern int nfs_validate_caches(vnode_t *, cred_t *);
extern void nfs_purge_caches(vnode_t *, int, cred_t *);
extern void nfs_purge_rddir_cache(vnode_t *);
extern void nfs_attrcache(vnode_t *, struct nfsfattr *, hrtime_t);
extern int nfs_cache_fattr(vnode_t *, struct nfsfattr *, vattr_t *,
hrtime_t, cred_t *);
extern void nfs_attr_cache(vnode_t *, vattr_t *, hrtime_t, cred_t *);
extern void nfs_attrcache_va(vnode_t *, struct vattr *);
extern int nfs_getattr_otw(vnode_t *, struct vattr *, cred_t *);
extern int nfsgetattr(vnode_t *, struct vattr *, cred_t *);
extern int nattr_to_vattr(vnode_t *, struct nfsfattr *, struct vattr *);
extern void nfs_async_manager(struct vfs *);
extern void nfs_async_manager_stop(struct vfs *);
extern void nfs_async_stop(struct vfs *);
extern int nfs_async_stop_sig(struct vfs *);
extern int nfs_clntinit(void);
extern void nfs_clntfini(void);
extern int nfstsize(void);
extern void nfs_srvinit(void);
extern void nfs_srvfini(void);
extern int vattr_to_sattr(struct vattr *, struct nfssattr *);
extern void setdiropargs(struct nfsdiropargs *, char *, vnode_t *);
extern int setdirgid(vnode_t *, gid_t *, cred_t *);
extern int setdirmode(vnode_t *, mode_t *, cred_t *);
extern int newnum(void);
extern char *newname(void);
extern int nfs_subrinit(void);
extern void nfs_subrfini(void);
extern enum nfsstat puterrno(int);
extern int geterrno(enum nfsstat);
extern int nfsinit(int, char *);
extern void nfsfini(void);
extern int nfs_vfsinit(void);
extern void nfs_vfsfini(void);
extern int nfs_dump(vnode_t *, caddr_t, offset_t, offset_t,
caller_context_t *);
extern void nfs_perror(int, char *, ...);
extern void nfs_cmn_err(int, int, char *, ...);
extern int nfs_addcllock(vnode_t *, struct flock64 *);
extern void nfs_rmcllock(vnode_t *, struct flock64 *);
extern void nfs_lockrelease(vnode_t *, int, offset_t, cred_t *);
extern int vattr_to_nattr(struct vattr *, struct nfsfattr *);
extern int mount_root(char *, char *, int, struct nfs_args *, int *);
extern void nfs_lockcompletion(vnode_t *, int);
extern void nfs_add_locking_id(vnode_t *, pid_t, int, char *, int);
extern void nfs3copyfh(caddr_t, vnode_t *);
extern void nfscopyfh(caddr_t, vnode_t *);
extern int nfs3lookup(vnode_t *, char *, vnode_t **, struct pathname *,
int, vnode_t *, cred_t *, int);
extern int nfslookup(vnode_t *, char *, vnode_t **, struct pathname *, int,
vnode_t *, cred_t *, int);
extern void sv_free(struct servinfo *);
extern int nfsauth_access(struct exportinfo *, struct svc_req *, cred_t *,
uid_t *, gid_t *, uint_t *, gid_t **);
extern void nfsauth_init(void);
extern void nfsauth_fini(void);
extern void nfsauth_zone_init(nfs_globals_t *);
extern void nfsauth_zone_fini(nfs_globals_t *);
extern void nfsauth_zone_shutdown(nfs_globals_t *);
extern int nfs_setopts(vnode_t *, model_t, struct nfs_args *);
extern int nfs_mount_label_policy(vfs_t *, struct netbuf *,
struct knetconfig *, cred_t *);
extern boolean_t nfs_has_ctty(void);
extern nfs_globals_t *nfs_srv_getzg(void);
extern void nfs_srv_stop_all(void);
extern void nfs_srv_quiesce_all(void);
extern int rfs4_dss_setpaths(char *, size_t);
extern int nfs_setmod_check(page_t *);
extern time_t rfs4_lease_time;
extern time_t rfs4_grace_period;
extern nvlist_t *rfs4_dss_paths, *rfs4_dss_oldpaths;
extern kstat_named_t *global_svstat_ptr[];
extern zone_key_t nfssrv_zone_key;
extern list_t nfssrv_globals_list;
extern krwlock_t nfssrv_globals_rwl;
extern krwlock_t rroklock;
extern vtype_t nf_to_vt[];
extern kmutex_t nfs_minor_lock;
extern int nfs_major;
extern int nfs_minor;
extern vfsops_t *nfs_vfsops;
extern struct vnodeops *nfs_vnodeops;
extern const struct fs_operation_def nfs_vnodeops_template[];
extern int nfsfstyp;
extern void (*nfs_srv_quiesce_func)(void);
extern int (*nfs_srv_dss_func)(char *, size_t);
/*
* Per-zone stats as consumed by nfsstat(8)
*/
struct nfs_version_stats {
kstat_named_t *aclreqcnt_ptr; /* nfs_acl:0:aclreqcnt_v? */
kstat_named_t *rfsreqcnt_ptr; /* nfs:0:rfsreqcnt_v? */
};
/*
* A bit of asymmetry: nfs:0:nfs_client isn't part of this structure.
*/
struct nfs_stats {
struct nfs_version_stats nfs_stats_v2;
struct nfs_version_stats nfs_stats_v3;
struct nfs_version_stats nfs_stats_v4;
};
/*
* Key used to retrieve counters.
*/
extern zone_key_t nfsstat_zone_key;
/*
* Zone callback functions.
*/
extern void *nfsstat_zone_init(zoneid_t);
extern void nfsstat_zone_fini(zoneid_t, void *);
extern void rfs_stat_zone_init(nfs_globals_t *);
extern void rfs_stat_zone_fini(nfs_globals_t *);
#endif /* _KERNEL */
/*
* Version 3 declarations and definitions.
*/
#define NFS3_FHSIZE 64
#define NFS3_COOKIEVERFSIZE 8
#define NFS3_CREATEVERFSIZE 8
#define NFS3_WRITEVERFSIZE 8
typedef char *filename3;
typedef char *nfspath3;
#define nfs3nametoolong ((char *)-1)
typedef uint64 fileid3;
typedef uint64 cookie3;
typedef uint32 uid3;
typedef uint32 gid3;
typedef uint64 size3;
typedef uint64 offset3;
typedef uint32 mode3;
typedef uint32 count3;
/*
* These three are really opaque arrays, but we treat them as
* uint64 for efficiency sake
*/
typedef uint64 cookieverf3;
typedef uint64 createverf3;
typedef uint64 writeverf3;
typedef struct nfs_fh3 {
uint_t fh3_length;
union nfs_fh3_u {
struct nfs_fh3_i {
fhandle3_t fh3_i;
} nfs_fh3_i;
char data[NFS3_FHSIZE];
} fh3_u;
uint_t fh3_flags;
} nfs_fh3;
#define fh3_fsid fh3_u.nfs_fh3_i.fh3_i._fh3_fsid
#define fh3_len fh3_u.nfs_fh3_i.fh3_i._fh3_len
#define fh3_data fh3_u.nfs_fh3_i.fh3_i._fh3_data
#define fh3_xlen fh3_u.nfs_fh3_i.fh3_i._fh3_xlen
#define fh3_xdata fh3_u.nfs_fh3_i.fh3_i._fh3_xdata
#define FH3TOFIDP(fh) ((fid_t *)&((fh)->fh3_len))
#define FH3TOXFIDP(fh) ((fid_t *)&((fh)->fh3_xlen))
/*
* nfs_fh3.fh3_flags values
*/
#define FH_WEBNFS 0x1 /* fh is WebNFS overloaded - see makefh3_ol() */
/*
* Two elements were added to the
* diropargs3 structure for performance (xdr-inlining).
* They are not included as part of the args
* that are encoded or decoded:
* dirp - ptr to the nfs_fh3
* flag indicating when to free the name that was
* allocated during decode.
*/
struct diropargs3 {
nfs_fh3 *dirp;
nfs_fh3 dir;
filename3 name;
int flags;
};
typedef struct diropargs3 diropargs3;
struct nfstime3 {
uint32 seconds;
uint32 nseconds;
};
typedef struct nfstime3 nfstime3;
struct specdata3 {
uint32 specdata1;
uint32 specdata2;
};
typedef struct specdata3 specdata3;
enum nfsstat3 {
NFS3_OK = 0,
NFS3ERR_PERM = 1,
NFS3ERR_NOENT = 2,
NFS3ERR_IO = 5,
NFS3ERR_NXIO = 6,
NFS3ERR_ACCES = 13,
NFS3ERR_EXIST = 17,
NFS3ERR_XDEV = 18,
NFS3ERR_NODEV = 19,
NFS3ERR_NOTDIR = 20,
NFS3ERR_ISDIR = 21,
NFS3ERR_INVAL = 22,
NFS3ERR_FBIG = 27,
NFS3ERR_NOSPC = 28,
NFS3ERR_ROFS = 30,
NFS3ERR_MLINK = 31,
NFS3ERR_NAMETOOLONG = 63,
NFS3ERR_NOTEMPTY = 66,
NFS3ERR_DQUOT = 69,
NFS3ERR_STALE = 70,
NFS3ERR_REMOTE = 71,
NFS3ERR_BADHANDLE = 10001,
NFS3ERR_NOT_SYNC = 10002,
NFS3ERR_BAD_COOKIE = 10003,
NFS3ERR_NOTSUPP = 10004,
NFS3ERR_TOOSMALL = 10005,
NFS3ERR_SERVERFAULT = 10006,
NFS3ERR_BADTYPE = 10007,
NFS3ERR_JUKEBOX = 10008
};
typedef enum nfsstat3 nfsstat3;
enum ftype3 {
NF3REG = 1,
NF3DIR = 2,
NF3BLK = 3,
NF3CHR = 4,
NF3LNK = 5,
NF3SOCK = 6,
NF3FIFO = 7
};
typedef enum ftype3 ftype3;
struct fattr3 {
ftype3 type;
mode3 mode;
uint32 nlink;
uid3 uid;
gid3 gid;
size3 size;
size3 used;
specdata3 rdev;
uint64 fsid;
fileid3 fileid;
nfstime3 atime;
nfstime3 mtime;
nfstime3 ctime;
};
typedef struct fattr3 fattr3;
#define NFS3_SIZEOF_FATTR3 (21)
#ifdef _KERNEL
struct fattr3_res {
nfsstat3 status;
vattr_t *vap;
vnode_t *vp;
};
typedef struct fattr3_res fattr3_res;
#endif /* _KERNEL */
struct post_op_attr {
bool_t attributes;
fattr3 attr;
};
typedef struct post_op_attr post_op_attr;
#ifdef _KERNEL
struct post_op_vattr {
bool_t attributes;
fattr3_res fres;
};
typedef struct post_op_vattr post_op_vattr;
#endif /* _KERNEL */
struct wcc_attr {
size3 size;
nfstime3 mtime;
nfstime3 ctime;
};
typedef struct wcc_attr wcc_attr;
struct pre_op_attr {
bool_t attributes;
wcc_attr attr;
};
typedef struct pre_op_attr pre_op_attr;
struct wcc_data {
pre_op_attr before;
post_op_attr after;
};
typedef struct wcc_data wcc_data;
struct post_op_fh3 {
bool_t handle_follows;
nfs_fh3 handle;
};
typedef struct post_op_fh3 post_op_fh3;
enum time_how {
DONT_CHANGE = 0,
SET_TO_SERVER_TIME = 1,
SET_TO_CLIENT_TIME = 2
};
typedef enum time_how time_how;
struct set_mode3 {
bool_t set_it;
mode3 mode;
};
typedef struct set_mode3 set_mode3;
struct set_uid3 {
bool_t set_it;
uid3 uid;
};
typedef struct set_uid3 set_uid3;
struct set_gid3 {
bool_t set_it;
gid3 gid;
};
typedef struct set_gid3 set_gid3;
struct set_size3 {
bool_t set_it;
size3 size;
};
typedef struct set_size3 set_size3;
struct set_atime {
time_how set_it;
nfstime3 atime;
};
typedef struct set_atime set_atime;
struct set_mtime {
time_how set_it;
nfstime3 mtime;
};
typedef struct set_mtime set_mtime;
struct sattr3 {
set_mode3 mode;
set_uid3 uid;
set_gid3 gid;
set_size3 size;
set_atime atime;
set_mtime mtime;
};
typedef struct sattr3 sattr3;
/*
* A couple of defines to make resok and resfail look like the
* correct things in a response type independent manner.
*/
#define resok res_u.ok
#define resfail res_u.fail
struct GETATTR3args {
nfs_fh3 object;
};
typedef struct GETATTR3args GETATTR3args;
struct GETATTR3resok {
fattr3 obj_attributes;
};
typedef struct GETATTR3resok GETATTR3resok;
struct GETATTR3res {
nfsstat3 status;
union {
GETATTR3resok ok;
} res_u;
};
typedef struct GETATTR3res GETATTR3res;
#ifdef _KERNEL
struct GETATTR3vres {
nfsstat3 status;
fattr3_res fres;
};
typedef struct GETATTR3vres GETATTR3vres;
#endif /* _KERNEL */
struct sattrguard3 {
bool_t check;
nfstime3 obj_ctime;
};
typedef struct sattrguard3 sattrguard3;
struct SETATTR3args {
nfs_fh3 object;
sattr3 new_attributes;
sattrguard3 guard;
};
typedef struct SETATTR3args SETATTR3args;
struct SETATTR3resok {
wcc_data obj_wcc;
};
typedef struct SETATTR3resok SETATTR3resok;
struct SETATTR3resfail {
wcc_data obj_wcc;
};
typedef struct SETATTR3resfail SETATTR3resfail;
struct SETATTR3res {
nfsstat3 status;
union {
SETATTR3resok ok;
SETATTR3resfail fail;
} res_u;
};
typedef struct SETATTR3res SETATTR3res;
struct LOOKUP3args {
diropargs3 what;
};
typedef struct LOOKUP3args LOOKUP3args;
struct LOOKUP3resok {
nfs_fh3 object;
post_op_attr obj_attributes;
post_op_attr dir_attributes;
};
typedef struct LOOKUP3resok LOOKUP3resok;
struct LOOKUP3resfail {
post_op_attr dir_attributes;
};
typedef struct LOOKUP3resfail LOOKUP3resfail;
struct LOOKUP3res {
nfsstat3 status;
union {
LOOKUP3resok ok;
LOOKUP3resfail fail;
} res_u;
};
typedef struct LOOKUP3res LOOKUP3res;
#ifdef _KERNEL
struct LOOKUP3vres {
nfsstat3 status;
nfs_fh3 object;
post_op_vattr dir_attributes;
post_op_vattr obj_attributes;
};
typedef struct LOOKUP3vres LOOKUP3vres;
#endif /* _KERNEL */
struct ACCESS3args {
nfs_fh3 object;
uint32 access;
};
typedef struct ACCESS3args ACCESS3args;
#define ACCESS3_READ 0x1
#define ACCESS3_LOOKUP 0x2
#define ACCESS3_MODIFY 0x4
#define ACCESS3_EXTEND 0x8
#define ACCESS3_DELETE 0x10
#define ACCESS3_EXECUTE 0x20
struct ACCESS3resok {
post_op_attr obj_attributes;
uint32 access;
};
typedef struct ACCESS3resok ACCESS3resok;
struct ACCESS3resfail {
post_op_attr obj_attributes;
};
typedef struct ACCESS3resfail ACCESS3resfail;
struct ACCESS3res {
nfsstat3 status;
union {
ACCESS3resok ok;
ACCESS3resfail fail;
} res_u;
};
typedef struct ACCESS3res ACCESS3res;
struct READLINK3args {
nfs_fh3 symlink;
};
typedef struct READLINK3args READLINK3args;
struct READLINK3resok {
post_op_attr symlink_attributes;
nfspath3 data;
};
typedef struct READLINK3resok READLINK3resok;
struct READLINK3resfail {
post_op_attr symlink_attributes;
};
typedef struct READLINK3resfail READLINK3resfail;
struct READLINK3res {
nfsstat3 status;
union {
READLINK3resok ok;
READLINK3resfail fail;
} res_u;
};
typedef struct READLINK3res READLINK3res;
struct READ3args {
nfs_fh3 file;
offset3 offset;
count3 count;
#ifdef _KERNEL
/* for read using rdma */
char *res_data_val_alt;
struct uio *res_uiop;
struct clist *wlist;
CONN *conn;
#endif
};
typedef struct READ3args READ3args;
struct READ3resok {
post_op_attr file_attributes;
count3 count;
bool_t eof;
struct {
uint_t data_len;
char *data_val;
mblk_t *mp;
} data;
uint_t size;
#ifdef _KERNEL
uint_t wlist_len;
struct clist *wlist;
frtn_t zcopy;
#endif
};
typedef struct READ3resok READ3resok;
struct READ3resfail {
post_op_attr file_attributes;
};
typedef struct READ3resfail READ3resfail;
struct READ3res {
nfsstat3 status;
union {
READ3resok ok;
READ3resfail fail;
} res_u;
};
typedef struct READ3res READ3res;
#ifdef _KERNEL
/*
* READ3 reply that directly decodes fattr3 directly into vattr
*/
struct READ3vres {
nfsstat3 status;
struct post_op_vattr pov;
count3 count;
bool_t eof;
struct {
uint_t data_len;
char *data_val;
} data;
uint_t size;
uint_t wlist_len;
struct clist *wlist;
};
typedef struct READ3vres READ3vres;
#endif /* _KERNEL */
/*
* READ3 reply that uiomoves data directly into a struct uio
* ignores any attributes returned
*/
struct READ3uiores {
nfsstat3 status;
count3 count;
bool_t eof;
struct uio *uiop;
uint_t size; /* maximum reply size */
#ifdef _KERNEL
uint_t wlist_len;
struct clist *wlist;
#endif
};
typedef struct READ3uiores READ3uiores;
enum stable_how {
UNSTABLE = 0,
DATA_SYNC = 1,
FILE_SYNC = 2
};
typedef enum stable_how stable_how;
struct WRITE3args {
nfs_fh3 file;
offset3 offset;
count3 count;
stable_how stable;
struct {
uint_t data_len;
char *data_val;
} data;
mblk_t *mblk;
#ifdef _KERNEL
struct clist *rlist;
CONN *conn;
#endif
};
typedef struct WRITE3args WRITE3args;
struct WRITE3resok {
wcc_data file_wcc;
count3 count;
stable_how committed;
writeverf3 verf;
};
typedef struct WRITE3resok WRITE3resok;
struct WRITE3resfail {
wcc_data file_wcc;
};
typedef struct WRITE3resfail WRITE3resfail;
struct WRITE3res {
nfsstat3 status;
union {
WRITE3resok ok;
WRITE3resfail fail;
} res_u;
};
typedef struct WRITE3res WRITE3res;
enum createmode3 {
UNCHECKED = 0,
GUARDED = 1,
EXCLUSIVE = 2
};
typedef enum createmode3 createmode3;
struct createhow3 {
createmode3 mode;
union {
sattr3 obj_attributes;
createverf3 verf;
} createhow3_u;
};
typedef struct createhow3 createhow3;
struct CREATE3args {
diropargs3 where;
createhow3 how;
};
typedef struct CREATE3args CREATE3args;
struct CREATE3resok {
post_op_fh3 obj;
post_op_attr obj_attributes;
wcc_data dir_wcc;
};
typedef struct CREATE3resok CREATE3resok;
struct CREATE3resfail {
wcc_data dir_wcc;
};
typedef struct CREATE3resfail CREATE3resfail;
struct CREATE3res {
nfsstat3 status;
union {
CREATE3resok ok;
CREATE3resfail fail;
} res_u;
};
typedef struct CREATE3res CREATE3res;
struct MKDIR3args {
diropargs3 where;
sattr3 attributes;
};
typedef struct MKDIR3args MKDIR3args;
struct MKDIR3resok {
post_op_fh3 obj;
post_op_attr obj_attributes;
wcc_data dir_wcc;
};
typedef struct MKDIR3resok MKDIR3resok;
struct MKDIR3resfail {
wcc_data dir_wcc;
};
typedef struct MKDIR3resfail MKDIR3resfail;
struct MKDIR3res {
nfsstat3 status;
union {
MKDIR3resok ok;
MKDIR3resfail fail;
} res_u;
};
typedef struct MKDIR3res MKDIR3res;
struct symlinkdata3 {
sattr3 symlink_attributes;
nfspath3 symlink_data;
};
typedef struct symlinkdata3 symlinkdata3;
struct SYMLINK3args {
diropargs3 where;
symlinkdata3 symlink;
};
typedef struct SYMLINK3args SYMLINK3args;
struct SYMLINK3resok {
post_op_fh3 obj;
post_op_attr obj_attributes;
wcc_data dir_wcc;
};
typedef struct SYMLINK3resok SYMLINK3resok;
struct SYMLINK3resfail {
wcc_data dir_wcc;
};
typedef struct SYMLINK3resfail SYMLINK3resfail;
struct SYMLINK3res {
nfsstat3 status;
union {
SYMLINK3resok ok;
SYMLINK3resfail fail;
} res_u;
};
typedef struct SYMLINK3res SYMLINK3res;
struct devicedata3 {
sattr3 dev_attributes;
specdata3 spec;
};
typedef struct devicedata3 devicedata3;
struct mknoddata3 {
ftype3 type;
union {
devicedata3 device;
sattr3 pipe_attributes;
} mknoddata3_u;
};
typedef struct mknoddata3 mknoddata3;
struct MKNOD3args {
diropargs3 where;
mknoddata3 what;
};
typedef struct MKNOD3args MKNOD3args;
struct MKNOD3resok {
post_op_fh3 obj;
post_op_attr obj_attributes;
wcc_data dir_wcc;
};
typedef struct MKNOD3resok MKNOD3resok;
struct MKNOD3resfail {
wcc_data dir_wcc;
};
typedef struct MKNOD3resfail MKNOD3resfail;
struct MKNOD3res {
nfsstat3 status;
union {
MKNOD3resok ok;
MKNOD3resfail fail;
} res_u;
};
typedef struct MKNOD3res MKNOD3res;
struct REMOVE3args {
diropargs3 object;
};
typedef struct REMOVE3args REMOVE3args;
struct REMOVE3resok {
wcc_data dir_wcc;
};
typedef struct REMOVE3resok REMOVE3resok;
struct REMOVE3resfail {
wcc_data dir_wcc;
};
typedef struct REMOVE3resfail REMOVE3resfail;
struct REMOVE3res {
nfsstat3 status;
union {
REMOVE3resok ok;
REMOVE3resfail fail;
} res_u;
};
typedef struct REMOVE3res REMOVE3res;
struct RMDIR3args {
diropargs3 object;
};
typedef struct RMDIR3args RMDIR3args;
struct RMDIR3resok {
wcc_data dir_wcc;
};
typedef struct RMDIR3resok RMDIR3resok;
struct RMDIR3resfail {
wcc_data dir_wcc;
};
typedef struct RMDIR3resfail RMDIR3resfail;
struct RMDIR3res {
nfsstat3 status;
union {
RMDIR3resok ok;
RMDIR3resfail fail;
} res_u;
};
typedef struct RMDIR3res RMDIR3res;
struct RENAME3args {
diropargs3 from;
diropargs3 to;
};
typedef struct RENAME3args RENAME3args;
struct RENAME3resok {
wcc_data fromdir_wcc;
wcc_data todir_wcc;
};
typedef struct RENAME3resok RENAME3resok;
struct RENAME3resfail {
wcc_data fromdir_wcc;
wcc_data todir_wcc;
};
typedef struct RENAME3resfail RENAME3resfail;
struct RENAME3res {
nfsstat3 status;
union {
RENAME3resok ok;
RENAME3resfail fail;
} res_u;
};
typedef struct RENAME3res RENAME3res;
struct LINK3args {
nfs_fh3 file;
diropargs3 link;
};
typedef struct LINK3args LINK3args;
struct LINK3resok {
post_op_attr file_attributes;
wcc_data linkdir_wcc;
};
typedef struct LINK3resok LINK3resok;
struct LINK3resfail {
post_op_attr file_attributes;
wcc_data linkdir_wcc;
};
typedef struct LINK3resfail LINK3resfail;
struct LINK3res {
nfsstat3 status;
union {
LINK3resok ok;
LINK3resfail fail;
} res_u;
};
typedef struct LINK3res LINK3res;
struct READDIR3args {
nfs_fh3 dir;
cookie3 cookie;
cookieverf3 cookieverf;
count3 count;
};
typedef struct READDIR3args READDIR3args;
struct entry3 {
fileid3 fileid;
filename3 name;
cookie3 cookie;
struct entry3 *nextentry;
};
typedef struct entry3 entry3;
struct dirlist3 {
entry3 *entries;
bool_t eof;
};
typedef struct dirlist3 dirlist3;
struct READDIR3resok {
post_op_attr dir_attributes;
cookieverf3 cookieverf;
dirlist3 reply;
uint_t size;
uint_t count;
uint_t freecount;
cookie3 cookie;
};
typedef struct READDIR3resok READDIR3resok;
struct READDIR3resfail {
post_op_attr dir_attributes;
};
typedef struct READDIR3resfail READDIR3resfail;
struct READDIR3res {
nfsstat3 status;
union {
READDIR3resok ok;
READDIR3resfail fail;
} res_u;
};
typedef struct READDIR3res READDIR3res;
#ifdef _KERNEL
struct READDIR3vres {
nfsstat3 status;
post_op_vattr dir_attributes;
cookieverf3 cookieverf;
dirent64_t *entries; /* decoded dirent64s */
uint_t size; /* actual size of entries */
uint_t entries_size; /* max size of entries */
off64_t loff; /* last offset/cookie */
bool_t eof; /* End of directory */
};
typedef struct READDIR3vres READDIR3vres;
#endif /* _KERNEL */
struct READDIRPLUS3args {
nfs_fh3 dir;
cookie3 cookie;
cookieverf3 cookieverf;
count3 dircount;
count3 maxcount;
};
typedef struct READDIRPLUS3args READDIRPLUS3args;
struct entryplus3 {
fileid3 fileid;
filename3 name;
cookie3 cookie;
post_op_attr name_attributes;
post_op_fh3 name_handle;
struct entryplus3 *nextentry;
};
typedef struct entryplus3 entryplus3;
struct dirlistplus3 {
entryplus3 *entries;
bool_t eof;
};
typedef struct dirlistplus3 dirlistplus3;
struct entryplus3_info {
post_op_attr attr;
post_op_fh3 fh;
uint_t namelen;
};
typedef struct entryplus3_info entryplus3_info;
struct READDIRPLUS3resok {
post_op_attr dir_attributes;
cookieverf3 cookieverf;
dirlistplus3 reply;
uint_t size;
uint_t count;
uint_t maxcount;
entryplus3_info *infop;
};
typedef struct READDIRPLUS3resok READDIRPLUS3resok;
struct READDIRPLUS3resfail {
post_op_attr dir_attributes;
};
typedef struct READDIRPLUS3resfail READDIRPLUS3resfail;
struct READDIRPLUS3res {
nfsstat3 status;
union {
READDIRPLUS3resok ok;
READDIRPLUS3resfail fail;
} res_u;
};
typedef struct READDIRPLUS3res READDIRPLUS3res;
#ifdef _KERNEL
struct entryplus3_va_fh {
int va_valid;
int fh_valid;
vattr_t va;
nfs_fh3 fh;
char *d_name; /* back pointer into entries */
};
struct READDIRPLUS3vres {
nfsstat3 status;
post_op_vattr dir_attributes;
cookieverf3 cookieverf;
dirent64_t *entries; /* decoded dirent64s */
uint_t size; /* actual size of entries */
uint_t entries_size; /* max size of entries */
bool_t eof; /* End of directory */
off64_t loff; /* last offset/cookie */
cred_t *credentials; /* caller's credentials */
hrtime_t time; /* time of READDIRPLUS call */
};
typedef struct READDIRPLUS3vres READDIRPLUS3vres;
#endif /* _KERNEL */
struct FSSTAT3args {
nfs_fh3 fsroot;
};
typedef struct FSSTAT3args FSSTAT3args;
struct FSSTAT3resok {
post_op_attr obj_attributes;
size3 tbytes;
size3 fbytes;
size3 abytes;
size3 tfiles;
size3 ffiles;
size3 afiles;
uint32 invarsec;
};
typedef struct FSSTAT3resok FSSTAT3resok;
struct FSSTAT3resfail {
post_op_attr obj_attributes;
};
typedef struct FSSTAT3resfail FSSTAT3resfail;
struct FSSTAT3res {
nfsstat3 status;
union {
FSSTAT3resok ok;
FSSTAT3resfail fail;
} res_u;
};
typedef struct FSSTAT3res FSSTAT3res;
struct FSINFO3args {
nfs_fh3 fsroot;
};
typedef struct FSINFO3args FSINFO3args;
struct FSINFO3resok {
post_op_attr obj_attributes;
uint32 rtmax;
uint32 rtpref;
uint32 rtmult;
uint32 wtmax;
uint32 wtpref;
uint32 wtmult;
uint32 dtpref;
size3 maxfilesize;
nfstime3 time_delta;
uint32 properties;
};
typedef struct FSINFO3resok FSINFO3resok;
struct FSINFO3resfail {
post_op_attr obj_attributes;
};
typedef struct FSINFO3resfail FSINFO3resfail;
#define FSF3_LINK 0x1
#define FSF3_SYMLINK 0x2
#define FSF3_HOMOGENEOUS 0x8
#define FSF3_CANSETTIME 0x10
struct FSINFO3res {
nfsstat3 status;
union {
FSINFO3resok ok;
FSINFO3resfail fail;
} res_u;
};
typedef struct FSINFO3res FSINFO3res;
struct PATHCONF3args {
nfs_fh3 object;
};
typedef struct PATHCONF3args PATHCONF3args;
struct nfs3_pathconf_info {
uint32 link_max;
uint32 name_max;
bool_t no_trunc;
bool_t chown_restricted;
bool_t case_insensitive;
bool_t case_preserving;
};
typedef struct nfs3_pathconf_info nfs3_pathconf_info;
struct PATHCONF3resok {
post_op_attr obj_attributes;
nfs3_pathconf_info info;
};
typedef struct PATHCONF3resok PATHCONF3resok;
struct PATHCONF3resfail {
post_op_attr obj_attributes;
};
typedef struct PATHCONF3resfail PATHCONF3resfail;
struct PATHCONF3res {
nfsstat3 status;
union {
PATHCONF3resok ok;
PATHCONF3resfail fail;
} res_u;
};
typedef struct PATHCONF3res PATHCONF3res;
struct COMMIT3args {
nfs_fh3 file;
offset3 offset;
count3 count;
};
typedef struct COMMIT3args COMMIT3args;
struct COMMIT3resok {
wcc_data file_wcc;
writeverf3 verf;
};
typedef struct COMMIT3resok COMMIT3resok;
struct COMMIT3resfail {
wcc_data file_wcc;
};
typedef struct COMMIT3resfail COMMIT3resfail;
struct COMMIT3res {
nfsstat3 status;
union {
COMMIT3resok ok;
COMMIT3resfail fail;
} res_u;
};
typedef struct COMMIT3res COMMIT3res;
#define NFS3_PROGRAM ((rpcprog_t)100003)
#define NFS_V3 ((rpcvers_t)3)
#define NFSPROC3_NULL ((rpcproc_t)0)
#define NFSPROC3_GETATTR ((rpcproc_t)1)
#define NFSPROC3_SETATTR ((rpcproc_t)2)
#define NFSPROC3_LOOKUP ((rpcproc_t)3)
#define NFSPROC3_ACCESS ((rpcproc_t)4)
#define NFSPROC3_READLINK ((rpcproc_t)5)
#define NFSPROC3_READ ((rpcproc_t)6)
#define NFSPROC3_WRITE ((rpcproc_t)7)
#define NFSPROC3_CREATE ((rpcproc_t)8)
#define NFSPROC3_MKDIR ((rpcproc_t)9)
#define NFSPROC3_SYMLINK ((rpcproc_t)10)
#define NFSPROC3_MKNOD ((rpcproc_t)11)
#define NFSPROC3_REMOVE ((rpcproc_t)12)
#define NFSPROC3_RMDIR ((rpcproc_t)13)
#define NFSPROC3_RENAME ((rpcproc_t)14)
#define NFSPROC3_LINK ((rpcproc_t)15)
#define NFSPROC3_READDIR ((rpcproc_t)16)
#define NFSPROC3_READDIRPLUS ((rpcproc_t)17)
#define NFSPROC3_FSSTAT ((rpcproc_t)18)
#define NFSPROC3_FSINFO ((rpcproc_t)19)
#define NFSPROC3_PATHCONF ((rpcproc_t)20)
#define NFSPROC3_COMMIT ((rpcproc_t)21)
#ifndef _KERNEL
extern void *nfsproc3_null_3();
extern GETATTR3res *nfsproc3_getattr_3();
extern SETATTR3res *nfsproc3_setattr_3();
extern LOOKUP3res *nfsproc3_lookup_3();
extern ACCESS3res *nfsproc3_access_3();
extern READLINK3res *nfsproc3_readlink_3();
extern READ3res *nfsproc3_read_3();
extern WRITE3res *nfsproc3_write_3();
extern CREATE3res *nfsproc3_create_3();
extern MKDIR3res *nfsproc3_mkdir_3();
extern SYMLINK3res *nfsproc3_symlink_3();
extern MKNOD3res *nfsproc3_mknod_3();
extern REMOVE3res *nfsproc3_remove_3();
extern RMDIR3res *nfsproc3_rmdir_3();
extern RENAME3res *nfsproc3_rename_3();
extern LINK3res *nfsproc3_link_3();
extern READDIR3res *nfsproc3_readdir_3();
extern READDIRPLUS3res *nfsproc3_readdirplus_3();
extern FSSTAT3res *nfsproc3_fsstat_3();
extern FSINFO3res *nfsproc3_fsinfo_3();
extern PATHCONF3res *nfsproc3_pathconf_3();
extern COMMIT3res *nfsproc3_commit_3();
#endif /* !_KERNEL */
#ifdef _KERNEL
/* the NFS Version 3 XDR functions */
extern bool_t xdr_nfs_fh3(XDR *, nfs_fh3 *);
extern bool_t xdr_nfslog_nfs_fh3(XDR *, nfs_fh3 *);
extern bool_t xdr_nfs_fh3_server(XDR *, nfs_fh3 *);
extern bool_t xdr_diropargs3(XDR *, diropargs3 *);
extern bool_t xdr_post_op_attr(XDR *, post_op_attr *);
extern bool_t xdr_post_op_fh3(XDR *, post_op_fh3 *);
extern bool_t xdr_GETATTR3res(XDR *, GETATTR3res *);
extern bool_t xdr_GETATTR3vres(XDR *, GETATTR3vres *);
extern bool_t xdr_SETATTR3args(XDR *, SETATTR3args *);
extern bool_t xdr_SETATTR3res(XDR *, SETATTR3res *);
extern bool_t xdr_LOOKUP3res(XDR *, LOOKUP3res *);
extern bool_t xdr_LOOKUP3vres(XDR *, LOOKUP3vres *);
extern bool_t xdr_ACCESS3args(XDR *, ACCESS3args *);
extern bool_t xdr_ACCESS3res(XDR *, ACCESS3res *);
extern bool_t xdr_READLINK3args(XDR *, READLINK3args *);
extern bool_t xdr_READLINK3res(XDR *, READLINK3res *);
extern bool_t xdr_READ3args(XDR *, READ3args *);
extern bool_t xdr_READ3res(XDR *, READ3res *);
extern bool_t xdr_READ3vres(XDR *, READ3vres *);
extern bool_t xdr_READ3uiores(XDR *, READ3uiores *);
extern bool_t xdr_WRITE3args(XDR *, WRITE3args *);
extern bool_t xdr_WRITE3res(XDR *, WRITE3res *);
extern bool_t xdr_CREATE3args(XDR *, CREATE3args *);
extern bool_t xdr_CREATE3res(XDR *, CREATE3res *);
extern bool_t xdr_MKDIR3args(XDR *, MKDIR3args *);
extern bool_t xdr_MKDIR3res(XDR *, MKDIR3res *);
extern bool_t xdr_SYMLINK3args(XDR *, SYMLINK3args *);
extern bool_t xdr_SYMLINK3res(XDR *, SYMLINK3res *);
extern bool_t xdr_MKNOD3args(XDR *, MKNOD3args *);
extern bool_t xdr_MKNOD3res(XDR *, MKNOD3res *);
extern bool_t xdr_REMOVE3res(XDR *, REMOVE3res *);
extern bool_t xdr_RMDIR3resfail(XDR *, RMDIR3resfail *);
extern bool_t xdr_RMDIR3res(XDR *, RMDIR3res *);
extern bool_t xdr_RENAME3args(XDR *, RENAME3args *);
extern bool_t xdr_RENAME3res(XDR *, RENAME3res *);
extern bool_t xdr_LINK3args(XDR *, LINK3args *);
extern bool_t xdr_LINK3res(XDR *, LINK3res *);
extern bool_t xdr_READDIR3args(XDR *, READDIR3args *);
extern bool_t xdr_READDIR3res(XDR *, READDIR3res *);
extern bool_t xdr_READDIR3vres(XDR *, READDIR3vres *);
extern bool_t xdr_READDIRPLUS3args(XDR *, READDIRPLUS3args *);
extern bool_t xdr_READDIRPLUS3res(XDR *, READDIRPLUS3res *);
extern bool_t xdr_READDIRPLUS3vres(XDR *, READDIRPLUS3vres *);
extern bool_t xdr_FSSTAT3res(XDR *, FSSTAT3res *);
extern bool_t xdr_FSINFO3res(XDR *, FSINFO3res *);
extern bool_t xdr_PATHCONF3res(XDR *, PATHCONF3res *);
extern bool_t xdr_COMMIT3args(XDR *, COMMIT3args *);
extern bool_t xdr_COMMIT3res(XDR *, COMMIT3res *);
extern bool_t xdr_fastnfs_fh3(XDR *, nfs_fh3 **);
/*
* The NFS Version 3 service procedures.
*/
struct exportinfo; /* defined in nfs/export.h */
struct servinfo; /* defined in nfs/nfs_clnt.h */
struct mntinfo; /* defined in nfs/nfs_clnt.h */
struct sec_ol; /* defined in nfs/export.h */
extern void rfs3_getattr(GETATTR3args *, GETATTR3res *, struct exportinfo *,
struct svc_req *, cred_t *, bool_t);
extern void *rfs3_getattr_getfh(GETATTR3args *);
extern void rfs3_setattr(SETATTR3args *, SETATTR3res *, struct exportinfo *,
struct svc_req *, cred_t *, bool_t);
extern void *rfs3_setattr_getfh(SETATTR3args *);
extern void rfs3_lookup(LOOKUP3args *, LOOKUP3res *, struct exportinfo *,
struct svc_req *, cred_t *, bool_t);
extern void *rfs3_lookup_getfh(LOOKUP3args *);
extern void rfs3_access(ACCESS3args *, ACCESS3res *, struct exportinfo *,
struct svc_req *, cred_t *, bool_t);
extern void *rfs3_access_getfh(ACCESS3args *);
extern void rfs3_readlink(READLINK3args *, READLINK3res *,
struct exportinfo *, struct svc_req *, cred_t *, bool_t);
extern void *rfs3_readlink_getfh(READLINK3args *);
extern void rfs3_readlink_free(READLINK3res *);
extern void rfs3_read(READ3args *, READ3res *, struct exportinfo *,
struct svc_req *, cred_t *, bool_t);
extern void *rfs3_read_getfh(READ3args *);
extern void rfs3_read_free(READ3res *);
extern void rfs3_write(WRITE3args *, WRITE3res *, struct exportinfo *,
struct svc_req *, cred_t *, bool_t);
extern void *rfs3_write_getfh(WRITE3args *);
extern void rfs3_create(CREATE3args *, CREATE3res *, struct exportinfo *,
struct svc_req *, cred_t *, bool_t);
extern void *rfs3_create_getfh(CREATE3args *);
extern void rfs3_mkdir(MKDIR3args *, MKDIR3res *, struct exportinfo *,
struct svc_req *, cred_t *, bool_t);
extern void *rfs3_mkdir_getfh(MKDIR3args *);
extern void rfs3_symlink(SYMLINK3args *, SYMLINK3res *, struct exportinfo *,
struct svc_req *, cred_t *, bool_t);
extern void *rfs3_symlink_getfh(SYMLINK3args *);
extern void rfs3_mknod(MKNOD3args *, MKNOD3res *, struct exportinfo *,
struct svc_req *, cred_t *, bool_t);
extern void *rfs3_mknod_getfh(MKNOD3args *);
extern void rfs3_remove(REMOVE3args *, REMOVE3res *, struct exportinfo *,
struct svc_req *, cred_t *, bool_t);
extern void *rfs3_remove_getfh(REMOVE3args *);
extern void rfs3_rmdir(RMDIR3args *, RMDIR3res *, struct exportinfo *,
struct svc_req *, cred_t *, bool_t);
extern void *rfs3_rmdir_getfh(RMDIR3args *);
extern void rfs3_rename(RENAME3args *, RENAME3res *, struct exportinfo *,
struct svc_req *, cred_t *, bool_t);
extern void *rfs3_rename_getfh(RENAME3args *);
extern void rfs3_link(LINK3args *, LINK3res *, struct exportinfo *,
struct svc_req *, cred_t *, bool_t);
extern void *rfs3_link_getfh(LINK3args *);
extern void rfs3_readdir(READDIR3args *, READDIR3res *, struct exportinfo *,
struct svc_req *, cred_t *, bool_t);
extern void *rfs3_readdir_getfh(READDIR3args *);
extern void rfs3_readdir_free(READDIR3res *);
extern void rfs3_readdirplus(READDIRPLUS3args *, READDIRPLUS3res *,
struct exportinfo *, struct svc_req *, cred_t *, bool_t);
extern void *rfs3_readdirplus_getfh(READDIRPLUS3args *);
extern void rfs3_readdirplus_free(READDIRPLUS3res *);
extern void rfs3_fsstat(FSSTAT3args *, FSSTAT3res *, struct exportinfo *,
struct svc_req *, cred_t *, bool_t);
extern void *rfs3_fsstat_getfh(FSSTAT3args *);
extern void rfs3_fsinfo(FSINFO3args *, FSINFO3res *, struct exportinfo *,
struct svc_req *, cred_t *, bool_t);
extern void *rfs3_fsinfo_getfh(FSINFO3args *);
extern void rfs3_pathconf(PATHCONF3args *, PATHCONF3res *,
struct exportinfo *, struct svc_req *, cred_t *, bool_t);
extern void *rfs3_pathconf_getfh(PATHCONF3args *);
extern void rfs3_commit(COMMIT3args *, COMMIT3res *, struct exportinfo *,
struct svc_req *, cred_t *, bool_t);
extern void *rfs3_commit_getfh(COMMIT3args *);
extern void rfs3_srvrinit(void);
extern void rfs3_srvrfini(void);
extern void rfs3_srv_zone_init(nfs_globals_t *);
extern void rfs3_srv_zone_fini(nfs_globals_t *);
extern int nfs3_validate_caches(vnode_t *, cred_t *);
extern void nfs3_cache_post_op_attr(vnode_t *, post_op_attr *, hrtime_t,
cred_t *);
extern void nfs3_cache_post_op_vattr(vnode_t *, post_op_vattr *, hrtime_t,
cred_t *);
extern void nfs3_cache_wcc_data(vnode_t *, wcc_data *, hrtime_t, cred_t *);
extern void nfs3_attrcache(vnode_t *, fattr3 *, hrtime_t);
extern int nfs3_cache_fattr3(vnode_t *, fattr3 *, vattr_t *, hrtime_t,
cred_t *);
extern int nfs3_getattr_otw(vnode_t *, struct vattr *, cred_t *);
extern int nfs3getattr(vnode_t *, struct vattr *, cred_t *);
extern int fattr3_to_vattr(vnode_t *, fattr3 *, struct vattr *);
extern int nfs3tsize(void);
extern uint_t nfs3_tsize(struct knetconfig *);
extern uint_t rfs3_tsize(struct svc_req *);
extern int vattr_to_sattr3(struct vattr *, sattr3 *);
extern void setdiropargs3(diropargs3 *, char *, vnode_t *);
extern enum nfsstat3 puterrno3(int);
extern int geterrno3(enum nfsstat3);
extern int nfs3init(int, char *);
extern void nfs3fini(void);
extern int nfs3_vfsinit(void);
extern void nfs3_vfsfini(void);
extern void vattr_to_post_op_attr(struct vattr *, post_op_attr *);
extern void mblk_to_iov(mblk_t *, int, struct iovec *);
extern int rfs_publicfh_mclookup(char *, vnode_t *, cred_t *, vnode_t **,
struct exportinfo **, struct sec_ol *);
extern int rfs_pathname(char *, vnode_t **, vnode_t **, vnode_t *,
cred_t *, int);
extern int rfs_cross_mnt(vnode_t **, struct exportinfo **);
extern int rfs_climb_crossmnt(vnode_t **, struct exportinfo **, cred_t *);
extern vtype_t nf3_to_vt[];
extern vfsops_t *nfs3_vfsops;
extern struct vnodeops *nfs3_vnodeops;
extern const struct fs_operation_def nfs3_vnodeops_template[];
/*
* Some servers do not properly update the attributes of the
* directory when changes are made. To allow interoperability
* with these broken servers, the nfs_disable_rddir_cache
* parameter can be used to disable readdir response caching.
*/
extern int nfs_disable_rddir_cache;
/*
* External functions called by the v2/v3 code into the v4 code
*/
extern void nfs4_clnt_init(void);
extern void nfs4_clnt_fini(void);
/*
* Does NFS4 server have a vnode delegated? TRUE if so, FALSE if not.
*/
extern bool_t rfs4_check_delegated(int mode, vnode_t *, bool_t trunc);
/*
* VOP_GETATTR call. If a NFS4 delegation is present on the supplied vnode
* call back to the delegated client to get attributes for AT_MTIME and
* AT_SIZE. Invoke VOP_GETATTR to get all other attributes or all attributes
* if no delegation is present.
*/
extern int rfs4_delegated_getattr(vnode_t *, vattr_t *, int, cred_t *);
extern int do_xattr_exists_check(vnode_t *, ulong_t *, cred_t *);
extern int protect_zfs_mntpt(vnode_t *);
extern ts_label_t *nfs_getflabel(vnode_t *, struct exportinfo *);
extern boolean_t do_rfs_label_check(bslabel_t *, vnode_t *, int,
struct exportinfo *);
/*
* Copy Reduction support.
* xuio_t wrapper with additional private data.
*/
typedef struct nfs_xuio {
xuio_t nu_uio;
vnode_t *nu_vp;
uint_t nu_ref;
frtn_t nu_frtn;
} nfs_xuio_t;
extern xuio_t *rfs_setup_xuio(vnode_t *);
extern mblk_t *uio_to_mblk(uio_t *);
extern mblk_t *rfs_read_alloc(uint_t, struct iovec **, int *);
extern void rfs_rndup_mblks(mblk_t *, uint_t, int);
extern void rfs_free_xuio(void *);
extern time_t nfs_sys_uptime(void);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _NFS_NFS_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright 2018 Nexenta Systems, Inc.
* Copyright 2019 Nexenta by DDN, Inc.
* Copyright 2025 RackTop Systems, Inc.
*/
#ifndef _NFS4_H
#define _NFS4_H
#include <sys/types.h>
#include <sys/vnode.h>
#include <sys/fem.h>
#include <rpc/rpc.h>
#include <nfs/nfs.h>
#ifdef _KERNEL
#include <nfs/nfs4_kprot.h>
#include <sys/nvpair.h>
#else
#include <rpcsvc/nfs4_prot.h>
#endif
#include <nfs/nfs4_attr.h>
#include <sys/acl.h>
#include <sys/list.h>
#include <nfs/nfs4x.h>
#ifdef __cplusplus
extern "C" {
#endif
#define NFS4_MAX_SECOID4 65536
#define NFS4_MAX_UTF8STRING 65536
#define NFS4_MAX_LINKTEXT4 65536
#define NFS4_MAX_PATHNAME4 65536
struct nfs_fsl_info {
uint_t netbuf_len;
uint_t netnm_len;
uint_t knconf_len;
char *netname;
struct netbuf *addr;
struct knetconfig *knconf;
};
#ifdef _KERNEL
typedef struct nfs4_fhandle {
int fh_len;
char fh_buf[NFS4_FHSIZE];
} nfs4_fhandle_t;
typedef uint8_t nfs4_minor_t;
#define NFS4_MINORVERSION 0
#define CB4_MINORVERSION_v0 0
#define CB4_MINORVERSION_v1 1
#define FIRST_NFS4_OP OP_ACCESS
#define LAST_NFS40_OP OP_RELEASE_LOCKOWNER
#define LAST_NFS41_OP OP_RECLAIM_COMPLETE
#define LAST_NFS42_OP OP_CLONE
#define LAST_NFS4_OP LAST_NFS42_OP
/*
* Set the fattr4_change variable using a time struct. Note that change
* is 64 bits, but timestruc_t is 128 bits in a 64-bit kernel.
*/
#define NFS4_SET_FATTR4_CHANGE(change, ts) \
{ \
change = (ts).tv_sec; \
change <<= 32; \
change |= (uint32_t)((ts).tv_nsec); \
}
/*
* Server lease period. Value is in seconds; Also used for grace period
*/
extern time_t rfs4_lease_time;
/*
* This set of typedefs and interfaces represent the core or base set
* of functionality that backs the NFSv4 server's state related data
* structures. Since the NFSv4 server needs inter-RPC state to be
* available that is unrelated to the filesystem (in other words,
* soft-state), this functionality is needed to maintain that and is
* written to be somewhat flexible to adapt to the various types of
* data structures contained within the server.
*
* The basic structure at this level is that the server maintains a
* global "database" which consists of a set of tables. Each table
* contains a set of like data structures. Each table is indexed by
* at least one hash function and in most cases two hashes. Each
* table's characteristics is set when it is created at run-time via
* rfs4_table_create(). All table creation and related functions are
* located in nfs4_state.c. The generic database functionality is
* located in nfs4_db.c.
*/
typedef struct rfs4_dbe rfs4_dbe_t; /* basic opaque db entry */
typedef struct rfs4_table rfs4_table_t; /* basic table type */
typedef struct rfs4_index rfs4_index_t; /* index */
typedef struct rfs4_database rfs4_database_t; /* and database */
typedef struct { /* opaque entry type for later use */
rfs4_dbe_t *dbe;
} *rfs4_entry_t;
/*
* NFSv4 server state databases
*
* Initialized when the module is loaded and used by NFSv4 state tables.
* These kmem_cache free pools are used globally, the NFSv4 state tables
* which make use of these kmem_cache free pools are per zone.
*/
extern kmem_cache_t *rfs4_client_mem_cache;
extern kmem_cache_t *rfs4_clntIP_mem_cache;
extern kmem_cache_t *rfs4_openown_mem_cache;
extern kmem_cache_t *rfs4_openstID_mem_cache;
extern kmem_cache_t *rfs4_lockstID_mem_cache;
extern kmem_cache_t *rfs4_lockown_mem_cache;
extern kmem_cache_t *rfs4_file_mem_cache;
extern kmem_cache_t *rfs4_delegstID_mem_cache;
extern kmem_cache_t *rfs4_session_mem_cache;
/* database, table, index creation entry points */
extern rfs4_database_t *rfs4_database_create(uint32_t);
extern void rfs4_database_shutdown(rfs4_database_t *);
extern void rfs4_database_destroy(rfs4_database_t *);
extern void rfs4_database_destroy(rfs4_database_t *);
extern kmem_cache_t *nfs4_init_mem_cache(char *, uint32_t, uint32_t,
uint32_t);
extern rfs4_table_t *rfs4_table_create(rfs4_database_t *, char *,
time_t, uint32_t,
bool_t (*create)(rfs4_entry_t, void *),
void (*destroy)(rfs4_entry_t),
bool_t (*expiry)(rfs4_entry_t),
uint32_t, uint32_t, uint32_t, id_t);
extern void rfs4_table_destroy(rfs4_database_t *, rfs4_table_t *);
extern rfs4_index_t *rfs4_index_create(rfs4_table_t *, char *,
uint32_t (*hash)(void *),
bool_t (compare)(rfs4_entry_t, void *),
void *(*mkkey)(rfs4_entry_t), bool_t);
extern void rfs4_index_destroy(rfs4_index_t *);
/* Type used to direct rfs4_dbsearch() in what types of records to inspect */
typedef enum {RFS4_DBS_VALID, RFS4_DBS_INVALID} rfs4_dbsearch_type_t;
/* search and db entry manipulation entry points */
extern rfs4_entry_t rfs4_dbsearch(rfs4_index_t *, void *,
bool_t *, void *, rfs4_dbsearch_type_t);
extern void rfs4_dbe_lock(rfs4_dbe_t *);
extern void rfs4_dbe_unlock(rfs4_dbe_t *);
extern clock_t rfs4_dbe_twait(rfs4_dbe_t *, clock_t);
extern void rfs4_dbe_cv_broadcast(rfs4_dbe_t *);
extern void rfs4_dbe_hold(rfs4_dbe_t *);
extern void rfs4_dbe_hold_nolock(rfs4_dbe_t *);
extern void rfs4_dbe_rele_nolock(rfs4_dbe_t *);
extern void rfs4_dbe_rele(rfs4_dbe_t *);
extern uint32_t rfs4_dbe_refcnt(rfs4_dbe_t *);
extern id_t rfs4_dbe_getid(rfs4_dbe_t *);
extern void rfs4_dbe_invalidate(rfs4_dbe_t *);
extern bool_t rfs4_dbe_is_invalid(rfs4_dbe_t *);
extern time_t rfs4_dbe_get_timerele(rfs4_dbe_t *);
extern void rfs4_dbe_hide(rfs4_dbe_t *);
extern void rfs4_dbe_unhide(rfs4_dbe_t *);
#ifdef DEBUG
extern bool_t rfs4_dbe_islocked(rfs4_dbe_t *);
#endif
extern void rfs4_dbe_walk(rfs4_table_t *,
void (*callout)(rfs4_entry_t, void *), void *);
extern void rfs4_dbsearch_cb(rfs4_index_t *idx, void *key,
int maxcount, void (*callout)(rfs4_entry_t));
/*
* Minimal server stable storage.
*
* Currently the NFSv4 server will only save the client
* ID (the long version) so that it will be able to
* grant possible reclaim requests during the infamous
* grace_period.
*/
#define RFS4_SS_DIRSIZE 64 * 1024
#define NFS4_SS_VERSION 1
/* handy pathname structure */
typedef struct ss_pn {
char *leaf;
char pn[MAXPATHLEN];
} rfs4_ss_pn_t;
/*
* The server will build this link list on startup. It represents the
* clients that have had valid state on the server in a prior instance.
*
*/
typedef struct rfs4_oldstate {
struct rfs4_oldstate *next;
struct rfs4_oldstate *prev;
rfs4_ss_pn_t *ss_pn;
nfs_client_id4 cl_id4;
} rfs4_oldstate_t;
/*
* This union is used to overlay the server's internal treatment of
* the protocols stateid4 datatype. Therefore, "bits" must not exceed
* the size of stateid4 and more importantly should match the size of
* stateid4. The chgseq field must the first entry since it overlays
* stateid4.seqid.
*/
typedef union {
stateid4 stateid;
struct {
uint32_t chgseq; /* State changes / protocol's seqid */
uint32_t boottime; /* boot time */
uint32_t type:2; /* stateid_type_t as define below */
uint32_t clnodeid:8; /* cluster server nodeid */
uint32_t ident:22; /* 2^22-1 openowner x fhs */
pid_t pid; /* pid of corresponding lock owner */
} bits;
} stateid_t;
/*
* Note that the way the type field above is defined, this enum must
* not have more than 4 members.
*/
typedef enum {OPENID, LOCKID, DELEGID} stateid_type_t;
/*
* "wait" struct for use in the open open and lock owner state
* structures to provide serialization between server threads that are
* handling requests for the same open owner or lock stateid. This
* way only one thread will be updating things like sequence ids,
* replay cache and stateid at a time.
*/
typedef struct rfs4_state_wait {
uint32_t sw_active;
uint32_t sw_wait_count;
kmutex_t sw_cv_lock[1];
kcondvar_t sw_cv[1];
} rfs4_state_wait_t;
extern void rfs4_sw_enter(rfs4_state_wait_t *);
extern void rfs4_sw_exit(rfs4_state_wait_t *);
/*
* This enum and the following rfs4_cbinfo_t struct are used to
* maintain information about the callback path used from the server
* to client for operations like CB_GETATTR and CB_RECALL. The
* rfs4_cbinfo_t struct is meant to be encompassed in the client
* struct and managed within that structure's locking scheme.
*
* The various states of the callback path are used by the server to
* determine if delegations should initially be provided to a client
* and then later on if connectivity has been lost and delegations
* should be revoked.
*/
/*
* CB_NOCHANGE - Special value used for interfaces within the delegation
* code to signify that "no change" has occurred to the
* callback path
* CB_UNINIT - No callback info provided by the client
* CB_NONE - Callback info provided but CB_NULL call
* has yet to be attempted
* CB_OK - Callback path tested with CB_NULL with success
* CB_INPROG - Callback path currently being tested with CB_NULL
* CB_FAILED - Callback path was == CB_OK but has failed
* with timeout/rpc error
* CB_BAD - Callback info provided but CB_NULL failed
*/
typedef enum {
CB_NOCHANGE = 0,
CB_UNINIT = 1,
CB_NONE = 2,
CB_OK = 3,
CB_INPROG = 4,
CB_FAILED = 5,
CB_BAD = 6
} rfs4_cbstate_t;
#define RFS4_CBCH_MAX 10 /* size callback client handle cache */
/*
* Callback info for a client.
* Client only provides: cb_client4 and cb_ident
* The rest of the information is used to track callback path status
* and usage.
*
* cb_state - used as comments for the rfs4_cbstate_t enum indicate
* cb_notified_of_cb_path_down - if the callback path was once CB_OK and
* has hence CB_FAILED, the client needs to be notified via RENEW.
* cb_timefailed - current time when cb_state transitioned from
* CB_OK -> CB_FAILED. Meant for observability. When did that happen?
* cb_chc_free/cb_chc - cache of client handles for the callback path
* cb_ident - SETCLIENTID provided callback_ident value
* callback - SETCLIENTID provided cb_client4 value
* cb_refcnt - current number of users of this structure's content
* protected by cb_lock
* cb_badbehavior - how many times did a client do something we didn't like?
* cb_lock - lock for contents of cbinfo
* cb_cv - used to allow threads to wait on CB_NULL completion
* cb_nullcaller - is there a thread currently taking care of
* new callback information?
* cb_cv_nullcaller - used by the thread doing CB_NULL to wait on
* threads that may be using client handles of the current
* client handle cache.
* newer - new callback info provided by a client and awaiting
* CB_NULL testing and move to regular cbinfo.
*/
typedef struct {
rfs4_cbstate_t cb_state;
unsigned cb_notified_of_cb_path_down:1;
time_t cb_timefailed;
int cb_chc_free;
CLIENT *cb_chc[RFS4_CBCH_MAX];
uint32_t cb_ident;
cb_client4 cb_callback;
uint32_t cb_refcnt;
uint32_t cb_badbehavior;
kmutex_t cb_lock[1];
kcondvar_t cb_cv[1];
bool_t cb_nullcaller;
kcondvar_t cb_cv_nullcaller[1];
struct {
bool_t cb_new;
bool_t cb_confirmed;
uint32_t cb_ident;
cb_client4 cb_callback;
} cb_newer;
} rfs4_cbinfo_t;
/*
* A server instance. We can associate sets of clients - via a pointer in
* rfs4_client_t - with a given server instance, allowing us to treat clients
* in the set differently to clients in other sets.
*
* Currently used only for Sun Cluster HA-NFS support, to group clients
* on NFS resource failover so each set of clients gets its own dedicated
* grace period and distributed stable storage data.
*/
typedef struct rfs4_servinst {
int dss_npaths;
krwlock_t rwlock;
krwlock_t oldstate_lock;
time_t start_time;
time_t grace_period;
uint_t nreclaim; /* number reclaim clients */
rfs4_oldstate_t *oldstate;
struct rfs4_dss_path **dss_paths;
struct rfs4_servinst *next;
struct rfs4_servinst *prev;
} rfs4_servinst_t;
/*
* DSS: distributed stable storage
*/
typedef struct rfs4_dss_path {
struct rfs4_dss_path *next; /* for insque/remque */
struct rfs4_dss_path *prev; /* for insque/remque */
char *path;
struct rfs4_servinst *sip;
unsigned index; /* offset in servinst's array */
} rfs4_dss_path_t;
/* array of paths passed-in from nfsd command-line; stored in nvlist */
extern char **rfs4_dss_newpaths;
extern uint_t rfs4_dss_numnewpaths;
/* nvlists of all DSS paths: current, and before last warmstart */
extern nvlist_t *rfs4_dss_paths, *rfs4_dss_oldpaths;
/*
* The server maintains a set of state on a per client basis that
* matches that of the protocol requirements. A client's state is
* rooted with the rfs4_client_t struct of which there is one per
* client and is created when SETCLIENTID/SETCLIENTID_CONFIRM are
* received. From there, the server then creates rfs4_openowner_t
* structs for each new open owner from that client and are initiated
* at OPEN/OPEN_CONFIRM (when the open owner is new to the server).
* At OPEN, at least two other structures are created, and potentially a
* third. rfs4_state_t is created to track the association between an
* open owner and a particular file. An rfs4_file_t struct may be
* created (if the file is not already open) at OPEN as well. The
* rfs4_file_t struct is the only one that is per server and not per
* client. The rfs4_deleg_state_t struct is created in the
* instance that the server is going to provide a delegation for the
* file being OPENed. Finally, the rfs4_lockowner_t is created at the
* first use of a lock owner at the server and is a result of the LOCK
* operation. The rfs4_lo_state_t struct is then created to represent
* the relation between the lock owner and the file.
*
*/
/*
* The following ascii art represents each of these data structs and
* their references to each other. Note: "<-(x)->" represents the
* doubly link lists (list_t).
*
* ____________________
* | |
* | rfs4_client_t |
* ->| (1) |<-
* / |____________________| \
* / ^ \
* / | \
* ____________________ ____________________ ____________________
* | | | | | |
* | rfs4_lockowner_t | | rfs4_openowner_t | | rfs4_deleg_state_t |
* | | | (3) <-(1)-> | | <-(2)-> |
* |____________________| |____________________| |____________________|
* ^ ^ |
* | | V
* ____________________ ____________________ ____________________
* | | | | | |
* | rfs4_lo_state_t |->| rfs4_state_t |->| rfs4_file_t |
* | <-(4)-> | | (4) <-(3)-> | | (2) |
* |____________________| |____________________| |____________________|
*/
/*
* Each of these data types are kept in a separate rfs4_table_t and is
* actually encapsulated within a rfs4_dbe_t struct. The various
* tables and their construction is done in nfs4_state.c but
* documented here to completeness.
*
* Table Data struct stored Indexed by
* ----- ------------------ ----------
* rfs4_client_tab rfs4_client_t nfs_client_id4
* clientid4
*
* rfs4_openowner_tab rfs4_openowner_t open_owner4
*
* rfs4_state_tab rfs4_state_t open_owner4 | file
* stateid
*
* rfs4_lo_state_tab rfs4_lo_state_t lockowner | stateid
* lock_stateid
*
* rfs4_lockowner_tab rfs4_lockowner_t lockowner
* pid
*
* rfs4_file_tab rfs4_file_t filehandle
*
* rfs4_deleg_state_tab rfs4_deleg_state_t clientid4 | file
* deleg_stateid
*/
/*
* The client struct, it is the root of all state for a particular
* client. The client is identified by the nfs_client_id4 via
* SETCLIENTID and the server returns the clientid4 as short hand reference
*/
/*
* Client struct - as mentioned above it is the root of all state for
* a single client as identified by the client supplied nfs_client_id4
*
* dbe - encapsulation struct
* clientid - server assigned short hand reference to client
* nfs_client - client supplied identifier for itself
* confirm_verf - the value provided to the client for SETCLIENTID_CONFIRM
* need_confirm - does this client need to be SETCLIENTID_CONFIRMed?
*
* unlksys_completed - has an F_UNLKSYS been done for this client which
* says that the use of cleanlocks() on individual files
* is not required?
* can_reclaim - indicates if client is allowed to reclaim after server
* start-up (client had previous state at server)
* ss_remove - indicates that the rfs4_client_destroy function should
* clean up stable storage file.
* forced_expire - set if the sysadmin has used clear_locks for this client.
* no_referrals - set if the client is Solaris and pre-dates referrals
* deleg_revoked - how many delegations have been revoked for this client?
*
* cp_confirmed - this refers to a confirmed client struct that has
* the same nfs_client_id4 as this client struct. When/if this client
* struct is confirmed via SETCLINETID_CONFIRM, the previously
* confirmed client struct will be "closed" and hence this reference.
*
* last_access - used to determine if the client has let its lease expire
* cbinfo - struct containing all callback related information
* cr_set - credentials used for the SETCLIENTID/SETCLIENTID_CONFIRM pair
* sysid - the lock manager sysid allocated for this client's file locks
* openownerlist - root of openowners list associated with this client
* ss_pn - Pathname to the stable storage file.
* cl_addr - Clients network address.
* server_instance - pointer to the currently associated server instance
*/
typedef struct rfs4_client {
rfs4_dbe_t *rc_dbe;
clientid4 rc_clientid;
nfs_client_id4 rc_nfs_client;
verifier4 rc_confirm_verf;
uint8_t rc_minorversion;
unsigned rc_need_confirm:1;
unsigned rc_unlksys_completed:1;
unsigned rc_can_reclaim:1;
unsigned rc_ss_remove:1;
unsigned rc_forced_expire:1;
unsigned rc_reclaim_completed:1;
uint_t rc_deleg_revoked;
struct rfs4_client *rc_cp_confirmed;
time_t rc_last_access;
rfs4_cbinfo_t rc_cbinfo;
cred_set_t rc_cr_set;
sysid_t rc_sysidt;
list_t rc_openownerlist;
rfs4_ss_pn_t *rc_ss_pn;
struct sockaddr_storage rc_addr;
rfs4_servinst_t *rc_server_instance;
/* nfsv4.1 */
rfs41_csr_t rc_contrived;
rfs41_sprot_t rc_state_prot;
list_t rc_sessions;
unsigned rc_destroying:1; /* flag: going to destroy */
} rfs4_client_t;
/*
* ClntIP struct - holds the diagnosis about whether the client
* cannot support referrals. Set to true for old Solaris clients.
*/
typedef struct rfs4_clntip {
rfs4_dbe_t *ri_dbe;
struct sockaddr_storage ri_addr;
unsigned ri_no_referrals:1;
} rfs4_clntip_t;
/*
* The openowner contains the client supplied open_owner4 as well as
* the matching sequence id and is used to track the client's usage of
* the open_owner4. Note that a reply is saved here as well for
* processing of retransmissions.
*
* dbe - encapsulation struct
* client - reference to rfs4_client_t for this openowner
* owner - actual client supplied open_owner4
* need_confirm - does this openowner need to be OPEN_CONFIRMed
* postpone_confirm - set if error received on first use of open_owner
* state2confirm - what stateid4 should be used on the OPEN_CONFIRM
* open_seqid - what is the next open_seqid expected for this openowner
* oo_sw - used to serialize access to the open seqid/reply handling
* statelist - root of state struct list associated with this openowner
* node - node for client struct list of openowners
* reply_fh - open replay processing needs the filehandle so that it is
* able to reset the current filehandle for appropriate compound
* processing and reply.
* reply - last reply sent in relation to this openowner
*/
typedef struct rfs4_openowner {
rfs4_dbe_t *ro_dbe;
rfs4_client_t *ro_client;
open_owner4 ro_owner;
unsigned ro_need_confirm:1;
unsigned ro_postpone_confirm:1;
seqid4 ro_open_seqid;
rfs4_state_wait_t ro_sw;
list_t ro_statelist;
list_node_t ro_node;
nfs_fh4 ro_reply_fh;
nfs_resop4 ro_reply;
} rfs4_openowner_t;
/*
* This state struct represents the association between an openowner
* and a file that has been OPENed by that openowner.
*
* dbe - encapsulation struct
* stateid - server provided stateid
* owner - reference back to the openowner for this state
* finfo - reference to the open file for this state
* open_access - how did the openowner OPEN the file (access)
* open_deny - how did the openowner OPEN the file (deny)
* share_access - what share reservation is on the file (access)
* share_deny - what share reservation is on the file (deny)
* closed - has this file been closed?
* lostatelist - root of list of lo_state associated with this state/file
* node - node for state struct list of states
*/
typedef struct rfs4_state {
rfs4_dbe_t *rs_dbe;
stateid_t rs_stateid;
rfs4_openowner_t *rs_owner;
struct rfs4_file *rs_finfo;
uint32_t rs_open_access;
uint32_t rs_open_deny;
uint32_t rs_share_access;
uint32_t rs_share_deny;
unsigned rs_closed:1;
list_t rs_lostatelist;
list_node_t rs_node;
} rfs4_state_t;
/*
* Lockowner - track the lockowner and its related info
*
* dbe - encapsulation struct
* client - reference to the client
* owner - lockowner supplied by the client
* pid - local identifier used for file locking
*/
typedef struct rfs4_lockowner {
rfs4_dbe_t *rl_dbe;
rfs4_client_t *rl_client;
lock_owner4 rl_owner;
pid_t rl_pid;
} rfs4_lockowner_t;
/*
* Lockowner_state associated with a state struct and lockowner
*
* dbe - encapsulation struct
* state - reference back to state struct for open file
* lockid - stateid for this lockowner/state
* locker - reference to lockowner
* seqid - sequence id for this lockowner/state
* skip_seqid_check - used on initialization of struct
* locks_cleaned - have all locks been released for this lockowner/file?
* lock_completed - successful LOCK with lockowner/file?
* ls_sw - used to serialize update seqid/reply/stateid handling
* node - node for state struct list of lo_states
* reply - last reply sent in relation to this lockowner/state
*/
typedef struct rfs4_lo_state {
rfs4_dbe_t *rls_dbe;
rfs4_state_t *rls_state;
stateid_t rls_lockid;
rfs4_lockowner_t *rls_locker;
seqid4 rls_seqid;
unsigned rls_skip_seqid_check:1;
unsigned rls_locks_cleaned:1;
unsigned rls_lock_completed:1;
rfs4_state_wait_t rls_sw;
list_node_t rls_node;
nfs_resop4 rls_reply;
} rfs4_lo_state_t;
/*
* Delegation state - per client
*
* dbe - encapsulation struct
* dtype - type of delegation (NONE, READ, WRITE)
* delegid - stateid for this delegation
* time_granted - time this delegation was assigned to client
* time_recalled - time when the server started recall process
* time_revoked - if revoked, time that the revoke occurred
* revoked - v4.1 delegation returned, awaiting FREE_STATEID
* closed - v4.0 delegation returned, reaper will destroy
* finfo - reference to the file associated with this delegation
* client - reference to client for which this delegation is associated
* node - list of delegations for the file (WRITE == 1, READ == )
*/
typedef struct rfs4_deleg_state {
rfs4_dbe_t *rds_dbe;
open_delegation_type4 rds_dtype;
stateid_t rds_delegid;
time_t rds_time_granted;
time_t rds_time_recalled;
time_t rds_time_revoked;
bool_t rds_revoked;
bool_t rds_closed;
struct rfs4_file *rds_finfo;
rfs4_client_t *rds_client;
list_node_t rds_node;
rfs41_drs_info_t rds_rs; /* 4.1 only */
} rfs4_deleg_state_t;
/*
* Delegation info associated with the file
*
* dtype - type of delegation for file (NONE, READ, WRITE)
* time_returned - time that last delegation was returned for file
* time_recalled - time that recall sequence started
* time_lastgrant - time that last delegation was provided to a client
* time_lastwrite - time of last write to use the delegation stateid
* time_rm_delayed - time of last remove/rename which was DELAYed
* rdgrants - how many read delegations have been provided for this file
* wrgrants - how many write delegations provided (can only be one)
* recall_count - how many recall threads are outstanding
* recall_lock - lock to protect contents of this struct
* recall_cv - condition var for the "parent" thread to wait upon
* deleg_change_grant - value for change attribute at time of write grant
* deleg_change - most recent value of change obtained from client
* deleg_change_ts - time of last deleg_change update
* ever_recalled - has this particular delegation ever been recalled?
* dont_grant - file deletion is impending, don't grant a delegation
* conflicted_client - clientid of the client that caused a CB_RECALL
* to occur. This is used for delegation policy (should a delegation
* be granted shortly after it has been returned?)
*/
typedef struct rfs4_dinfo {
open_delegation_type4 rd_dtype;
time_t rd_time_returned;
time_t rd_time_recalled;
time_t rd_time_lastgrant;
time_t rd_time_lastwrite;
time_t rd_time_rm_delayed;
uint32_t rd_rdgrants;
uint32_t rd_wrgrants;
int32_t rd_recall_count;
kmutex_t rd_recall_lock[1];
kcondvar_t rd_recall_cv[1];
bool_t rd_ever_recalled;
uint32_t rd_hold_grant;
clientid4 rd_conflicted_client;
} rfs4_dinfo_t;
/*
* File
*
* dbe - encapsulation struct
* vp - vnode for the file that is open or has a delegation
* filehandle - the filehandle generated by the server for this file
* delegstatelist - root of delegation list for this file
* dinfo - see struct definition above
* share_deny - union of all deny modes on file
* share_access - union of all access modes on file
* access_read - count of read access
* access_write - count of write access
* deny_read - count of deny reads
* deny_write - count of deny writes
* file_rwlock - lock for serializing the removal of a file while
* the state structures are active within the server
*
* The only requirement for locking file_rwlock is that the
* caller have a reference to the containing rfs4_file. The dbe
* lock may or may not be held for lock/unlock of file_rwlock.
* As mentioned above, the file_rwlock is used for serialization
* of file removal and more specifically reference to the held
* vnode (e.g. vp).
*/
typedef struct rfs4_file {
rfs4_dbe_t *rf_dbe;
vnode_t *rf_vp;
nfs_fh4 rf_filehandle;
list_t rf_delegstatelist;
rfs4_dinfo_t rf_dinfo;
uint32_t rf_share_deny;
uint32_t rf_share_access;
uint32_t rf_access_read;
uint32_t rf_access_write;
uint32_t rf_deny_read;
uint32_t rf_deny_write;
krwlock_t rf_file_rwlock;
} rfs4_file_t;
/*
* nfs4_deleg_policy is used to signify the server's global delegation
* policy. The default is to NEVER delegate files and the
* administrator must configure the server to enable delegations.
*
* The disable/enable delegation functions are used to eliminate a
* race with exclusive creates.
*/
typedef enum {
SRV_NEVER_DELEGATE = 0,
SRV_NORMAL_DELEGATE = 1
} srv_deleg_policy_t;
extern void rfs4_disable_delegation(void), rfs4_enable_delegation(void);
/*
* Delegation want type. The values DELEG_WANT_NO_PREF through
* DELEG_WANT_CANCEL correspond to the OPEN4_SHARE_WANT_* wire flags
* (see nfs4x_share_to_delegreq()). DELEG_DISABLE is a server-side
* sentinel meaning "do not attempt a delegation at this call site"
* (e.g. CLAIM_DELEGATE_CUR, unconfirmed open owner).
*/
typedef enum {
DELEG_WANT_NO_PREF = 0, /* server chooses type freely */
DELEG_WANT_READ = 1, /* client prefers read delegation */
DELEG_WANT_WRITE = 2, /* client prefers write delegation */
DELEG_WANT_ANY = 3, /* client accepts any delegation */
DELEG_WANT_NONE = 4, /* client does not want a delegation */
DELEG_WANT_CANCEL = 5, /* client cancels a prior want */
DELEG_DISABLE = -1 /* caller suppresses delegation */
} delegreq_t;
/*
* Zone global variables of NFSv4 server
*/
typedef struct nfs4_srv {
/* Unique write verifier */
verifier4 write4verf;
/* Delegation lock */
kmutex_t deleg_lock;
/* Used to serialize create/destroy of nfs4_server_state database */
kmutex_t state_lock;
rfs4_database_t *nfs4_server_state;
/* Used to manage access to server instance linked list */
kmutex_t servinst_lock;
rfs4_servinst_t *nfs4_cur_servinst;
/* Used to manage access to nfs4_deleg_policy */
krwlock_t deleg_policy_lock;
srv_deleg_policy_t nfs4_deleg_policy;
/* Allowed minors, nfs4 minors start from 0, which is always allowed */
nfs4_minor_t nfs4_minor_max;
/* Set first time we see one */
int seen_first_compound;
/*
* Circular double-linked list of paths for currently-served RGs.
* No locking required -- only changed on server start.
* Managed with insque/remque.
*/
rfs4_dss_path_t *dss_pathlist;
/* Duplicate request cache */
struct rfs4_drc *nfs4_drc;
/* nfsv4 server start time */
time_t rfs4_start_time;
/* Used to serialize lookups of clientids */
krwlock_t rfs4_findclient_lock;
/* NFSv4 server state client tables */
/* table expiry times */
time_t rfs4_client_cache_time;
time_t rfs4_openowner_cache_time;
time_t rfs4_state_cache_time;
time_t rfs4_lo_state_cache_time;
time_t rfs4_lockowner_cache_time;
time_t rfs4_file_cache_time;
time_t rfs4_deleg_state_cache_time;
time_t rfs4_clntip_cache_time;
/* tables and indexes */
/* client table */
rfs4_table_t *rfs4_client_tab;
rfs4_index_t *rfs4_clientid_idx;
rfs4_index_t *rfs4_nfsclnt_idx;
/* client IP table */
rfs4_table_t *rfs4_clntip_tab;
rfs4_index_t *rfs4_clntip_idx;
/* Open Owner table */
rfs4_table_t *rfs4_openowner_tab;
rfs4_index_t *rfs4_openowner_idx;
/* Open State ID table */
rfs4_table_t *rfs4_state_tab;
rfs4_index_t *rfs4_state_idx;
rfs4_index_t *rfs4_state_owner_file_idx;
rfs4_index_t *rfs4_state_file_idx;
/* Lock State ID table */
rfs4_table_t *rfs4_lo_state_tab;
rfs4_index_t *rfs4_lo_state_idx;
rfs4_index_t *rfs4_lo_state_owner_idx;
/* Lock owner table */
rfs4_table_t *rfs4_lockowner_tab;
rfs4_index_t *rfs4_lockowner_idx;
rfs4_index_t *rfs4_lockowner_pid_idx;
/* File table */
rfs4_table_t *rfs4_file_tab;
rfs4_index_t *rfs4_file_idx;
/* Deleg State table */
rfs4_table_t *rfs4_deleg_state_tab;
rfs4_index_t *rfs4_deleg_idx;
rfs4_index_t *rfs4_deleg_state_idx;
/* nfs4.x */
rfs4_table_t *rfs4_session_tab;
rfs4_index_t *rfs4_session_idx;
rfs4_index_t *rfs4_session_clid_idx;
/* client stable storage */
int rfs4_ss_enabled;
} nfs4_srv_t;
/*
* max length of the NFSv4 server database name
*/
#define RFS4_MAX_MEM_CACHE_NAME 48
/*
* global NFSv4 server kmem caches
* r_db_name - The name of the state database and the table that will use it
* These tables are defined in nfs4_srv_t
* r_db_mem_cache - The kmem cache associated with the state database name
*/
typedef struct rfs4_db_mem_cache {
char r_db_name[RFS4_MAX_MEM_CACHE_NAME];
kmem_cache_t *r_db_mem_cache;
} rfs4_db_mem_cache_t;
#define RFS4_DB_MEM_CACHE_NUM 9
extern rfs4_db_mem_cache_t rfs4_db_mem_cache_table[RFS4_DB_MEM_CACHE_NUM];
extern srv_deleg_policy_t nfs4_get_deleg_policy();
extern void rfs4_servinst_create(nfs4_srv_t *, int, int, char **);
extern void rfs4_servinst_destroy_all(nfs4_srv_t *);
extern void rfs4_servinst_assign(nfs4_srv_t *, rfs4_client_t *,
rfs4_servinst_t *);
extern rfs4_servinst_t *rfs4_servinst(rfs4_client_t *);
extern int rfs4_clnt_in_grace(rfs4_client_t *);
extern int rfs4_servinst_in_grace(rfs4_servinst_t *);
extern int rfs4_servinst_grace_new(rfs4_servinst_t *);
extern void rfs4_grace_start(rfs4_servinst_t *);
extern void rfs4_grace_start_new(nfs4_srv_t *);
extern void rfs4_grace_reset_all(nfs4_srv_t *);
extern void rfs4_dss_readstate(nfs4_srv_t *, int, char **);
extern rfs4_session_t *rfs4x_findsession_by_clid(clientid4);
extern rfs4_cbstate_t rfs4x_cbcheck(rfs4_state_t *);
extern rfs4_cbstate_t rfs4_cbcheck(rfs4_state_t *);
/*
* Various interfaces to manipulate the state structures introduced
* above
*/
extern void rfs4_free_reply(nfs_resop4 *);
extern void rfs4_copy_reply(nfs_resop4 *, nfs_resop4 *);
/* rfs4_client_t handling */
extern rfs4_client_t *rfs4_findclient(nfs_client_id4 *,
bool_t *, rfs4_client_t *);
extern rfs4_client_t *rfs4_findclient_by_id(clientid4, bool_t);
extern rfs4_client_t *rfs4_findclient_by_addr(struct sockaddr *);
extern void rfs4_client_rele(rfs4_client_t *);
extern void rfs4_client_close(rfs4_client_t *);
extern void rfs4_client_state_remove(rfs4_client_t *);
extern void rfs4_client_scv_next(rfs4_client_t *);
extern void rfs4_update_lease(rfs4_client_t *);
extern bool_t rfs4_lease_expired(rfs4_client_t *);
extern nfsstat4 rfs4_check_clientid(clientid4 *, int);
/* rfs4_clntip_t handling */
extern rfs4_clntip_t *rfs4_find_clntip(struct sockaddr *, bool_t *);
extern void rfs4_invalidate_clntip(struct sockaddr *);
/* rfs4_openowner_t handling */
extern rfs4_openowner_t *rfs4_findopenowner(open_owner4 *, bool_t *, seqid4);
extern void rfs4_update_open_sequence(rfs4_openowner_t *);
extern void rfs4_update_open_resp(rfs4_openowner_t *,
nfs_resop4 *, nfs_fh4 *);
extern void rfs4_openowner_rele(rfs4_openowner_t *);
extern void rfs4_free_opens(rfs4_openowner_t *, bool_t, bool_t);
/* rfs4_lockowner_t handling */
extern rfs4_lockowner_t *rfs4_findlockowner(lock_owner4 *, bool_t *);
extern rfs4_lockowner_t *rfs4_findlockowner_by_pid(pid_t);
extern void rfs4_lockowner_rele(rfs4_lockowner_t *);
/* rfs4_state_t handling */
extern rfs4_state_t *rfs4_findstate_by_owner_file(rfs4_openowner_t *,
rfs4_file_t *, bool_t *);
extern void rfs4_state_rele(rfs4_state_t *);
extern void rfs4_state_close(rfs4_state_t *, bool_t,
bool_t, cred_t *);
extern void rfs4_release_share_lock_state(rfs4_state_t *,
cred_t *, bool_t);
extern void rfs4_close_all_state(rfs4_file_t *);
/* rfs4_lo_state_t handling */
extern rfs4_lo_state_t *rfs4_findlo_state_by_owner(rfs4_lockowner_t *,
rfs4_state_t *, bool_t *);
extern void rfs4_lo_state_rele(rfs4_lo_state_t *, bool_t);
extern void rfs4_update_lock_sequence(rfs4_lo_state_t *);
extern void rfs4_update_lock_resp(rfs4_lo_state_t *,
nfs_resop4 *);
/* rfs4_file_t handling */
extern rfs4_file_t *rfs4_findfile(vnode_t *, nfs_fh4 *, bool_t *);
extern rfs4_file_t *rfs4_findfile_withlock(vnode_t *, nfs_fh4 *,
bool_t *);
extern void rfs4_file_rele(rfs4_file_t *);
/* General collection of "get state" functions */
extern nfsstat4 rfs4_get_state(stateid4 *, rfs4_state_t **,
rfs4_dbsearch_type_t);
extern nfsstat4 rfs4_get_state_nolock(stateid4 *, rfs4_state_t **,
rfs4_dbsearch_type_t);
extern void rfs4_state_rele_nounlock(rfs4_state_t *);
extern nfsstat4 rfs4_get_deleg_any(stateid4 *,
rfs4_deleg_state_t **);
extern nfsstat4 rfs4_get_deleg_state(stateid4 *,
rfs4_deleg_state_t **);
extern nfsstat4 rfs4_get_lo_state(stateid4 *, rfs4_lo_state_t **,
bool_t);
extern nfsstat4 rfs4_get_all_state(stateid4 *, rfs4_state_t **,
rfs4_deleg_state_t **, rfs4_lo_state_t **);
struct compound_state;
extern nfsstat4 rfs4_check_stateid(int, vnode_t *, stateid4 *,
bool_t, bool_t *, bool_t,
caller_context_t *,
struct compound_state *);
extern int rfs4_check_stateid_seqid(rfs4_state_t *, stateid4 *,
const struct compound_state *);
extern int rfs4_check_lo_stateid_seqid(rfs4_lo_state_t *,
stateid4 *,
const struct compound_state *);
/* return values for rfs4_check_stateid_seqid() */
#define NFS4_CHECK_STATEID_OKAY 1
#define NFS4_CHECK_STATEID_OLD 2
#define NFS4_CHECK_STATEID_BAD 3
#define NFS4_CHECK_STATEID_EXPIRED 4
#define NFS4_CHECK_STATEID_REPLAY 5
#define NFS4_CHECK_STATEID_CLOSED 6
#define NFS4_CHECK_STATEID_UNCONFIRMED 7
/* delay() time that server is willing to briefly wait for a delegreturn */
#define NFS4_DELEGATION_CONFLICT_DELAY (hz/10)
/*
* Interfaces for handling of callback's client handle cache and
* callback interfaces themselves.
*/
extern void rfs4_cbinfo_free(rfs4_cbinfo_t *);
extern void rfs4_client_setcb(rfs4_client_t *, cb_client4 *,
uint32_t);
extern void rfs4_deleg_cb_check(rfs4_client_t *);
extern nfsstat4 rfs4_vop_getattr(vnode_t *, vattr_t *, int, cred_t *);
/* rfs4_deleg_state_t handling and other delegation interfaces */
extern rfs4_deleg_state_t *rfs4_finddeleg(rfs4_state_t *, bool_t *);
extern rfs4_deleg_state_t *rfs4_finddelegstate(stateid_t *);
extern bool_t rfs4_check_recall(rfs4_state_t *, uint32_t);
extern void rfs4_recall_deleg(rfs4_file_t *,
bool_t, rfs4_client_t *);
extern int rfs4_get_deleg(rfs4_state_t *, open_delegation_type4,
open_delegation_type4 (*policy)(rfs4_state_t *,
open_delegation_type4 dtype));
extern rfs4_deleg_state_t *rfs4_grant_delegation(delegreq_t, rfs4_state_t *,
int *, bool_t);
extern void rfs4_set_deleg_response(rfs4_deleg_state_t *,
open_delegation4 *, nfsace4 *, int);
extern void rfs4_return_deleg(rfs4_deleg_state_t *, bool_t);
extern bool_t rfs4_is_deleg(rfs4_state_t *);
extern void rfs4_deleg_state_rele(rfs4_deleg_state_t *);
extern bool_t rfs4_check_delegated_byfp(int, rfs4_file_t *,
bool_t, bool_t, bool_t, clientid4 *);
extern void rfs4_clear_dont_grant(rfs4_file_t *);
extern delegreq_t nfs4x_share_to_delegreq(uint32_t);
extern void rfs4x_rs_erase(void *);
extern void rfs4x_rs_record(struct compound_state *,
rfs4_deleg_state_t *);
extern bool_t rfs4_find_write_deleg_byfp(rfs4_file_t *,
rfs4_deleg_state_t **);
extern bool_t rfs4_find_write_deleg(vnode_t *, rfs4_deleg_state_t **);
extern void rfs4_cb_getattr(rfs4_deleg_state_t *,
fattr4_change *, fattr4_size *);
/*
* nfs4 monitored operations.
*/
extern int deleg_rd_open(femarg_t *, int, cred_t *, caller_context_t *);
extern int deleg_wr_open(femarg_t *, int, cred_t *, caller_context_t *);
extern int deleg_wr_read(femarg_t *, uio_t *, int, cred_t *,
caller_context_t *);
extern int deleg_rd_write(femarg_t *, uio_t *, int, cred_t *,
caller_context_t *);
extern int deleg_wr_write(femarg_t *, uio_t *, int, cred_t *,
caller_context_t *);
extern int deleg_rd_setattr(femarg_t *, vattr_t *, int, cred_t *,
caller_context_t *);
extern int deleg_wr_setattr(femarg_t *, vattr_t *, int, cred_t *,
caller_context_t *);
extern int deleg_rd_rwlock(femarg_t *, int, caller_context_t *);
extern int deleg_wr_rwlock(femarg_t *, int, caller_context_t *);
extern int deleg_rd_space(femarg_t *, int, flock64_t *, int, offset_t, cred_t *,
caller_context_t *);
extern int deleg_wr_space(femarg_t *, int, flock64_t *, int, offset_t, cred_t *,
caller_context_t *);
extern int deleg_rd_setsecattr(femarg_t *, vsecattr_t *, int, cred_t *,
caller_context_t *);
extern int deleg_wr_setsecattr(femarg_t *, vsecattr_t *, int, cred_t *,
caller_context_t *);
extern int deleg_rd_vnevent(femarg_t *, vnevent_t, vnode_t *, char *,
caller_context_t *);
extern int deleg_wr_vnevent(femarg_t *, vnevent_t, vnode_t *, char *,
caller_context_t *);
extern void rfs4_mon_hold(void *);
extern void rfs4_mon_rele(void *);
extern fem_t *deleg_rdops;
extern fem_t *deleg_wrops;
extern int rfs4_share(rfs4_state_t *, uint32_t, uint32_t);
extern int rfs4_unshare(rfs4_state_t *);
extern void rfs4_set_deleg_policy(nfs4_srv_t *, srv_deleg_policy_t);
extern void rfs4_hold_deleg_policy(nfs4_srv_t *);
extern void rfs4_rele_deleg_policy(nfs4_srv_t *);
#ifdef DEBUG
#define NFS4_DEBUG(var, args) if (var) cmn_err args
extern int rfs4_debug;
extern int nfs4_client_attr_debug;
extern int nfs4_client_state_debug;
extern int nfs4_client_shadow_debug;
extern int nfs4_client_lock_debug;
extern int nfs4_client_lease_debug;
extern int nfs4_seqid_sync;
extern int nfs4_client_map_debug;
extern int nfs4_client_inactive_debug;
extern int nfs4_client_recov_debug;
extern int nfs4_client_failover_debug;
extern int nfs4_client_call_debug;
extern int nfs4_client_foo_debug;
extern int nfs4_client_zone_debug;
extern int nfs4_lost_rqst_debug;
extern int nfs4_open_stream_debug;
extern int nfs4_client_open_dg;
extern int nfs4_srvmnt_debug;
extern int nfs4_utf8_debug;
void rfs4_dbe_debug(rfs4_dbe_t *e);
#ifdef NFS4_DEBUG_MUTEX
void nfs4_debug_mutex_enter(kmutex_t *, char *, int);
void nfs4_debug_mutex_exit(kmutex_t *, char *, int);
#define mutex_enter(m) nfs4_debug_mutex_enter((m), __FILE__, __LINE__)
#define mutex_exit(m) nfs4_debug_mutex_exit((m), __FILE__, __LINE__)
#endif /* NFS4_DEBUG_MUTEX */
#else /* ! DEBUG */
#define NFS4_DEBUG(var, args)
#endif /* DEBUG */
/*
* XXX - temporary for testing of volatile fh
*/
#ifdef VOLATILE_FH_TEST
struct nfs_fh4_fmt {
fhandle4_t fh4_i;
uint32_t fh4_flag;
uint32_t fh4_volatile_id;
};
#else /* VOLATILE_FH_TEST */
struct nfs_fh4_fmt {
fhandle4_t fh4_i;
uint32_t fh4_flag;
};
#endif /* VOLATILE_FH_TEST */
#define FH4_NAMEDATTR 1
#define FH4_ATTRDIR 2
#define fh4_fsid fh4_i.fhx_fsid
#define fh4_len fh4_i.fhx_len /* fid length */
#define fh4_data fh4_i.fhx_data /* fid bytes */
#define fh4_xlen fh4_i.fhx_xlen
#define fh4_xdata fh4_i.fhx_xdata
typedef struct nfs_fh4_fmt nfs_fh4_fmt_t;
#define fh4_to_fmt4(fh4p) ((nfs_fh4_fmt_t *)(fh4p)->nfs_fh4_val)
#define get_fh4_flag(fh4p, flag) ((fh4_to_fmt4(fh4p)->fh4_flag) & (flag))
#define set_fh4_flag(fh4p, flag) ((fh4_to_fmt4(fh4p)->fh4_flag) |= (flag))
#define clr_fh4_flag(fh4p, flag) ((fh4_to_fmt4(fh4p)->fh4_flag) &= ~(flag))
#define NFS_FH4_LEN sizeof (nfs_fh4_fmt_t)
/*
* Copy fields from external (fhandle_t) to in-memory (nfs_fh4_fmt_t)
* format to support export info checking. It does not copy over
* the complete filehandle, just the fsid, xlen and xdata. It may
* need to be changed to be used in other places.
*
* NOTE: The macro expects the space to be pre-allocated for
* the contents of nfs_fh4_fmt_t.
*/
#define FH_TO_FMT4(exifh, nfs_fmt) { \
bzero((nfs_fmt), NFS_FH4_LEN); \
(nfs_fmt)->fh4_fsid = (exifh)->fh_fsid; \
(nfs_fmt)->fh4_xlen = (exifh)->fh_xlen; \
bcopy((exifh)->fh_xdata, (nfs_fmt)->fh4_xdata, \
(exifh)->fh_xlen); \
}
/*
* A few definitions of repeatedly used constructs for nfsv4
*/
#define UTF8STRING_FREE(str) { \
kmem_free((str).utf8string_val, (str).utf8string_len); \
(str).utf8string_val = NULL; \
(str).utf8string_len = 0; \
}
/*
* NFS4_VOLATILE_FH yields non-zero if the filesystem uses non-persistent
* filehandles.
*/
#define NFS4_VOLATILE_FH(mi) \
((mi)->mi_fh_expire_type & \
(FH4_VOLATILE_ANY | FH4_VOL_MIGRATION | FH4_VOL_RENAME))
/*
* NFS_IS_DOTNAME checks if the name given represents a dot or dotdot entry
*/
#define NFS_IS_DOTNAME(name) \
(((name)[0] == '.') && \
(((name)[1] == '\0') || (((name)[1] == '.') && ((name)[2] == '\0'))))
/*
* Define the number of bits in a bitmap word (uint32)
*/
#define NFS4_BITMAP4_BITSPERWORD (sizeof (uint32_t) * 8)
/*
* Define the value for the access field of the compound_state structure
* based on the result of nfsauth access checking.
*/
#define CS_ACCESS_OK 0x1
#define CS_ACCESS_DENIED 0x2
#define CS_ACCESS_LIMITED 0x4
/*
* compound state in nfsv4 server
*/
struct compound_state {
struct exportinfo *exi;
struct exportinfo *saved_exi; /* export struct for saved_vp */
cred_t *basecr; /* UNIX cred: only RPC request */
caddr_t principal;
int nfsflavor;
cred_t *cr; /* UNIX cred: RPC request and */
/* target export */
bool_t cont;
uint_t access; /* access perm on vp per request */
bool_t deleg; /* TRUE if current fh has */
/* write delegated */
vnode_t *vp; /* modified by PUTFH, and by ops that */
/* input to GETFH */
bool_t mandlock; /* Is mandatory locking in effect */
/* for vp */
vnode_t *saved_vp; /* modified by SAVEFH, copied to */
/* vp by RESTOREFH */
nfsstat4 *statusp;
nfs_fh4 fh; /* ditto. valid only if vp != NULL */
nfs_fh4 saved_fh; /* ditto. valid only if */
/* saved_vp != NULL */
struct svc_req *req;
char fhbuf[NFS4_FHSIZE];
/* NFSv4.1 */
uint8_t minorversion; /* NFS4 minor version */
rfs4_session_t *sp; /* OP_SEQUENCE set it */
slotid4 slotno;
rfs4_slot_t *slot;
rfs4_client_t *client;
uint16_t op_pos;
uint16_t op_len; /* number operations in compound req */
#define RFS4_DISPATCH_DONE (1 << 0)
#define RFS4_CURRENT_STATEID (1 << 1)
#define RFS4_SAVED_STATEID (1 << 2)
uint8_t cs_flags;
bool_t cachethis;
COMPOUND4res *cmpresp;
stateid4 current_stateid;
stateid4 save_stateid;
};
typedef struct compound_state compound_state_t;
static inline bool_t
rfs4_has_session(const compound_state_t *cs)
{
return (cs->slot != NULL);
}
extern stateid4 invalid_stateid;
#define INVALID_STATEID(x) (!memcmp((x), &invalid_stateid, sizeof (stateid4))
/*
* Conversion commands for nfsv4 server attr checking
*/
enum nfs4_attr_cmd {
NFS4ATTR_SUPPORTED = 0, /* check which attrs supported */
NFS4ATTR_GETIT = 1, /* getattr - sys to fattr4 (r) */
NFS4ATTR_SETIT = 2, /* setattr - fattr4 to sys (w) */
NFS4ATTR_VERIT = 3, /* verify - fattr4 to sys (r) */
NFS4ATTR_FREEIT = 4 /* free any alloc'd space for attr */
};
typedef enum nfs4_attr_cmd nfs4_attr_cmd_t;
struct nfs4_svgetit_arg {
nfs4_attr_cmd_t op; /* getit or setit */
struct compound_state *cs;
struct statvfs64 *sbp;
uint_t flag; /* VOP_GETATTR/VOP_SETATTR flag */
uint_t xattr; /* object is xattr */
bool_t rdattr_error_req; /* if readdir & client wants */
/* rdattr_error */
nfsstat4 rdattr_error; /* used for per-entry status */
/* (if rdattr_err) */
bool_t is_referral; /* because sometimes we tell lies */
bool_t mntdfid_set;
fattr4_mounted_on_fileid
mounted_on_fileid;
/* readdir op can always return */
/* d_ino from server fs dirent */
/* for mounted_on_fileid attr. */
/* This field holds d_ino so */
/* srv attr conv code can avoid */
/* doing an untraverse. */
vattr_t vap[1];
};
struct nfs4_ntov_map {
bitmap4 fbit; /* FATTR4_XXX_MASKY */
uint_t vbit; /* AT_XXX */
bool_t vfsstat;
bool_t mandatory; /* attribute mandatory to implement? */
uint_t nval;
int xdr_size; /* Size of XDR'd attr */
xdrproc_t xfunc;
int (*sv_getit)(nfs4_attr_cmd_t, struct nfs4_svgetit_arg *,
union nfs4_attr_u *); /* subroutine for getting attr. */
char *prtstr; /* string attr for printing */
};
struct nfs4attr_to_vattr {
vnode_t *vp;
vattr_t *vap;
nfs_fh4 *fhp;
nfsstat4 rdattr_error;
uint32_t flag;
fattr4_change change;
fattr4_fsid srv_fsid;
fattr4_mounted_on_fileid mntd_fid;
};
typedef struct nfs4attr_to_vattr ntov4_t;
/*
* nfs4attr_to_vattr flags
*/
#define NTOV_FHP_VALID 0x01
#define NTOV_RDATTR_ERROR_VALID 0x02
#define NTOV_CHANGE_VALID 0x04
#define NTOV_SUPP_VALID 0x08
#define NTOV_SRV_FSID_VALID 0x10
#define NTOV_MOUNTED_ON_FILEID_VALID 0x20
#define FATTR4_MANDATTR_MASK ( \
FATTR4_SUPPORTED_ATTRS_MASK | \
FATTR4_TYPE_MASK | \
FATTR4_FH_EXPIRE_TYPE_MASK | \
FATTR4_CHANGE_MASK | \
FATTR4_SIZE_MASK | \
FATTR4_LINK_SUPPORT_MASK | \
FATTR4_SYMLINK_SUPPORT_MASK | \
FATTR4_NAMED_ATTR_MASK | \
FATTR4_FSID_MASK | \
FATTR4_UNIQUE_HANDLES_MASK | \
FATTR4_LEASE_TIME_MASK | \
FATTR4_RDATTR_ERROR_MASK | \
FATTR4_FILEHANDLE_MASK)
struct nfs4attr_to_osattr {
void *attrconv_arg;
uint_t mask;
};
struct mntinfo4;
/*
* lkp4_attr_setup lists the different options for attributes when calling
* nfs4lookup_setup - either no attributes (just lookups - e.g., secinfo),
* one component only (normal component lookup), get attributes for the
* last component (e.g., mount), attributes for each component (e.g.,
* failovers later), just the filehandle for the last component (e.g.,
* volatile filehandle recovery), or stuff that needs OPENATTR (e.g.
* looking up a named attribute or it's hidden directory).
*/
enum lkp4_attr_setup {
LKP4_NO_ATTRIBUTES = 0, /* no attrs or filehandles */
LKP4_ALL_ATTRIBUTES = 3, /* multi-comp: attrs for all comps */
LKP4_LAST_NAMED_ATTR = 5, /* multi-comp: named attr & attrdir */
LKP4_LAST_ATTRDIR = 6, /* multi-comp: just attrdir */
LKP4_ALL_ATTR_SECINFO = 7 /* multi-comp: attrs for all comp and */
/* secinfo for last comp */
};
/*
* lookup4_param a set of parameters to nfs4lookup_setup -
* used to setup a path lookup compound request.
*/
typedef struct lookup4_param {
enum lkp4_attr_setup l4_getattrs; /* (in) get attrs in the lookup? */
int header_len; /* (in) num ops before first lookup */
int trailer_len; /* (in) num ops after last */
/* Lookup/Getattr */
bitmap4 ga_bits; /* (in) Which attributes for Getattr */
COMPOUND4args_clnt *argsp; /* (in/out) args for compound struct */
COMPOUND4res_clnt *resp; /* (in/out) res for compound struct */
int arglen; /* (out) argop buffer alloc'd length */
struct mntinfo4 *mi;
} lookup4_param_t;
#define NFS4_FATTR4_FINISH -1 /* fattr4 index indicating finish */
typedef int (*nfs4attr_to_os_t)(int, union nfs4_attr_u *,
struct nfs4attr_to_osattr *);
/*
* The nfs4_error_t is the basic structure to return error values
* from rfs4call. It encapsulates the unix errno
* value, the nfsstat4 value and the rpc status value into a single
* structure.
*
* If error is set, then stat is ignored and rpc_status may be
* set if the error occurred as the result of a CLNT_CALL. If
* stat is set, then rpc request succeeded, error and
* rpc_status are set to 0 and stat contains the result of
* operation, NFS4_OK or one of the NFS4ERR_* values.
*
* Functions which want to generate errors independently from
* rfs4call should set error to the desired errno value and
* set stat and rpc_status to 0. nfs4_error_init() is a
* convenient function to do this.
*/
typedef struct {
int error;
nfsstat4 stat;
enum clnt_stat rpc_status;
} nfs4_error_t;
/*
* Shared functions
*/
extern void rfs4_op_readdir(nfs_argop4 *, nfs_resop4 *,
struct svc_req *, struct compound_state *);
extern void nfs_fh4_copy(nfs_fh4 *, nfs_fh4 *);
extern void nfs4_fattr4_free(fattr4 *);
extern int nfs4lookup_setup(char *, lookup4_param_t *, int);
extern void nfs4_getattr_otw_norecovery(vnode_t *,
nfs4_ga_res_t *, nfs4_error_t *, cred_t *, int);
extern int nfs4_getattr_otw(vnode_t *, nfs4_ga_res_t *, cred_t *, int);
extern int nfs4cmpfh(const nfs_fh4 *, const nfs_fh4 *);
extern int nfs4cmpfhandle(nfs4_fhandle_t *, nfs4_fhandle_t *);
extern int nfs4getattr(vnode_t *, struct vattr *, cred_t *);
extern int nfs4_waitfor_purge_complete(vnode_t *);
extern int nfs4_validate_caches(vnode_t *, cred_t *);
extern int nfs4init(int, char *);
extern void nfs4fini(void);
extern int nfs4_vfsinit(void);
extern void nfs4_vfsfini(void);
extern void nfs4_vnops_init(void);
extern void nfs4_vnops_fini(void);
extern void nfs_idmap_init(void);
extern void nfs_idmap_flush(int);
extern void nfs_idmap_fini(void);
extern int nfs4_rnode_init(void);
extern int nfs4_rnode_fini(void);
extern int nfs4_shadow_init(void);
extern int nfs4_shadow_fini(void);
extern int nfs4_acache_init(void);
extern int nfs4_acache_fini(void);
extern int nfs4_subr_init(void);
extern int nfs4_subr_fini(void);
extern void nfs4_acl_init(void);
extern void nfs4_acl_free_cache(vsecattr_t *);
extern int geterrno4(nfsstat4);
extern nfsstat4 puterrno4(int);
extern int nfs4_need_to_bump_seqid(COMPOUND4res_clnt *);
extern int nfs4tsize(void);
extern int checkauth4(struct compound_state *, struct svc_req *);
extern nfsstat4 call_checkauth4(struct compound_state *, struct svc_req *);
extern int is_exported_sec(int, struct exportinfo *);
extern void nfs4_vmask_to_nmask(uint_t, bitmap4 *);
extern void nfs4_vmask_to_nmask_set(uint_t, bitmap4 *);
extern int nfs_idmap_str_uid(utf8string *u8s, uid_t *, bool_t);
extern int nfs_idmap_str_gid(utf8string *u8s, gid_t *, bool_t);
extern int nfs_idmap_uid_str(uid_t, utf8string *u8s, bool_t);
extern int nfs_idmap_gid_str(gid_t gid, utf8string *u8s, bool_t);
extern int nfs4_time_ntov(nfstime4 *, timestruc_t *);
extern int nfs4_time_vton(timestruc_t *, nfstime4 *);
extern char *utf8_to_str(utf8string *, uint_t *, char *);
extern char *utf8_to_fn(utf8string *, uint_t *, char *);
extern utf8string *str_to_utf8(char *, utf8string *);
extern utf8string *utf8_copy(utf8string *, utf8string *);
extern int utf8_compare(const utf8string *, const utf8string *);
extern nfsstat4 utf8_dir_verify(utf8string *);
extern char *utf8_strchr(utf8string *, const char);
extern int ln_ace4_cmp(nfsace4 *, nfsace4 *, int);
extern int vs_aent_to_ace4(vsecattr_t *, vsecattr_t *, int, int);
extern int vs_ace4_to_aent(vsecattr_t *, vsecattr_t *, uid_t, gid_t,
int, int);
extern int vs_ace4_to_acet(vsecattr_t *, vsecattr_t *, uid_t, gid_t,
int);
extern int vs_acet_to_ace4(vsecattr_t *, vsecattr_t *, int);
extern void vs_acet_destroy(vsecattr_t *);
extern void vs_ace4_destroy(vsecattr_t *);
extern void vs_aent_destroy(vsecattr_t *);
extern int vn_find_nfs_record(vnode_t *, nvlist_t **, char **, char **);
extern int vn_is_nfs_reparse(vnode_t *, cred_t *);
extern fs_locations4 *fetch_referral(vnode_t *, cred_t *);
extern char *build_symlink(vnode_t *, cred_t *, size_t *);
extern int stateid4_cmp(stateid4 *, stateid4 *);
extern vtype_t nf4_to_vt[];
extern struct nfs4_ntov_map nfs4_ntov_map[];
extern uint_t nfs4_ntov_map_size;
extern struct vfsops *nfs4_vfsops;
extern struct vnodeops *nfs4_vnodeops;
extern const struct fs_operation_def nfs4_vnodeops_template[];
extern vnodeops_t *nfs4_trigger_vnodeops;
extern const struct fs_operation_def nfs4_trigger_vnodeops_template[];
extern uint_t nfs4_tsize(struct knetconfig *);
extern uint_t rfs4_tsize(struct svc_req *);
extern bool_t xdr_inline_decode_nfs_fh4(uint32_t *, nfs_fh4_fmt_t *,
uint32_t);
extern bool_t xdr_inline_encode_nfs_fh4(uint32_t **, uint32_t *,
nfs_fh4_fmt_t *);
#ifdef DEBUG
extern int rfs4_do_pre_op_attr;
extern int rfs4_do_post_op_attr;
#endif
extern stateid4 clnt_special0;
extern stateid4 clnt_special1;
#define CLNT_ISSPECIAL(id) (stateid4_cmp(id, &clnt_special0) || \
stateid4_cmp(id, &clnt_special1))
/*
* callers of CTO*SD macros MUST have cn_lock acquired
*/
#define CTOBSD(c) ((sess_bcsd_t *)c->cn_csd)
#define SNTOBC(s) ((sess_channel_t *)(((rfs4_session_t *)(s))->sn_back))
/* State's functions */
extern void rfs4_ss_clid(nfs4_srv_t *nsrv4, rfs4_client_t *);
extern void rfs4_ss_chkclid(nfs4_srv_t *nsrv4, rfs4_client_t *);
/* Declarations for nfs4.x */
nfsstat4 do_rfs4_op_secinfo(struct compound_state *, char *, SECINFO4res *);
/*
* The NFS Version 4 service procedures.
*/
extern void rfs4_do_server_start(int, int, nfs4_minor_t, int);
extern void rfs4_compound(COMPOUND4args *, COMPOUND4res *,
compound_state_t *, struct svc_req *, int *);
extern void rfs4_init_compound_state(struct compound_state *);
extern void rfs4_fini_compound_state(struct compound_state *);
struct rpcdisp;
extern int rfs4_dispatch(struct rpcdisp *, struct svc_req *, SVCXPRT *, char *);
extern void rfs4_compound_free(COMPOUND4res *);
extern bool_t rfs4_idempotent_req(const COMPOUND4args *);
extern void rfs4_srvrinit(void);
extern void rfs4_srvrfini(void);
extern void rfs4_srv_zone_init(nfs_globals_t *);
extern void rfs4_srv_zone_fini(nfs_globals_t *);
extern void rfs4_state_g_init(void);
extern void rfs4_state_zone_init(nfs4_srv_t *);
extern void rfs4_state_g_fini(void);
extern void rfs4_state_zone_fini(void);
extern nfs4_srv_t *nfs4_get_srv(void);
extern CLIENT *rfs4_cb_getch(rfs4_cbinfo_t *);
extern CLIENT *rfs4x_cb_getch(rfs4_session_t *);
extern void rfs4_cb_freech(rfs4_cbinfo_t *, CLIENT *, bool_t);
extern void rfs4x_cb_freech(rfs4_session_t *, CLIENT *);
void put_stateid4(struct compound_state *, stateid4 *);
void get_stateid4(struct compound_state *, stateid4 *);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _NFS4_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _NFS4_ATTR_H
#define _NFS4_ATTR_H
#ifdef __cplusplus
extern "C" {
#endif
#define FATTR4_WORD0 32
#define FATTR4_WORD1 0
/*
* Attributes
*/
#define FATTR4_SUPPORTED_ATTRS_MASK (1ULL << (FATTR4_WORD0 + 0))
#define FATTR4_TYPE_MASK (1ULL << (FATTR4_WORD0 + 1))
#define FATTR4_FH_EXPIRE_TYPE_MASK (1ULL << (FATTR4_WORD0 + 2))
#define FATTR4_CHANGE_MASK (1ULL << (FATTR4_WORD0 + 3))
#define FATTR4_SIZE_MASK (1ULL << (FATTR4_WORD0 + 4))
#define FATTR4_LINK_SUPPORT_MASK (1ULL << (FATTR4_WORD0 + 5))
#define FATTR4_SYMLINK_SUPPORT_MASK (1ULL << (FATTR4_WORD0 + 6))
#define FATTR4_NAMED_ATTR_MASK (1ULL << (FATTR4_WORD0 + 7))
#define FATTR4_FSID_MASK (1ULL << (FATTR4_WORD0 + 8))
#define FATTR4_UNIQUE_HANDLES_MASK (1ULL << (FATTR4_WORD0 + 9))
#define FATTR4_LEASE_TIME_MASK (1ULL << (FATTR4_WORD0 + 10))
#define FATTR4_RDATTR_ERROR_MASK (1ULL << (FATTR4_WORD0 + 11))
#define FATTR4_ACL_MASK (1ULL << (FATTR4_WORD0 + 12))
#define FATTR4_ACLSUPPORT_MASK (1ULL << (FATTR4_WORD0 + 13))
#define FATTR4_ARCHIVE_MASK (1ULL << (FATTR4_WORD0 + 14))
#define FATTR4_CANSETTIME_MASK (1ULL << (FATTR4_WORD0 + 15))
#define FATTR4_CASE_INSENSITIVE_MASK (1ULL << (FATTR4_WORD0 + 16))
#define FATTR4_CASE_PRESERVING_MASK (1ULL << (FATTR4_WORD0 + 17))
#define FATTR4_CHOWN_RESTRICTED_MASK (1ULL << (FATTR4_WORD0 + 18))
#define FATTR4_FILEHANDLE_MASK (1ULL << (FATTR4_WORD0 + 19))
#define FATTR4_FILEID_MASK (1ULL << (FATTR4_WORD0 + 20))
#define FATTR4_FILES_AVAIL_MASK (1ULL << (FATTR4_WORD0 + 21))
#define FATTR4_FILES_FREE_MASK (1ULL << (FATTR4_WORD0 + 22))
#define FATTR4_FILES_TOTAL_MASK (1ULL << (FATTR4_WORD0 + 23))
#define FATTR4_FS_LOCATIONS_MASK (1ULL << (FATTR4_WORD0 + 24))
#define FATTR4_HIDDEN_MASK (1ULL << (FATTR4_WORD0 + 25))
#define FATTR4_HOMOGENEOUS_MASK (1ULL << (FATTR4_WORD0 + 26))
#define FATTR4_MAXFILESIZE_MASK (1ULL << (FATTR4_WORD0 + 27))
#define FATTR4_MAXLINK_MASK (1ULL << (FATTR4_WORD0 + 28))
#define FATTR4_MAXNAME_MASK (1ULL << (FATTR4_WORD0 + 29))
#define FATTR4_MAXREAD_MASK (1ULL << (FATTR4_WORD0 + 30))
#define FATTR4_MAXWRITE_MASK (1ULL << (FATTR4_WORD0 + 31))
#define FATTR4_MIMETYPE_MASK (1ULL << (FATTR4_WORD1 + 0))
#define FATTR4_MODE_MASK (1ULL << (FATTR4_WORD1 + 1))
#define FATTR4_NO_TRUNC_MASK (1ULL << (FATTR4_WORD1 + 2))
#define FATTR4_NUMLINKS_MASK (1ULL << (FATTR4_WORD1 + 3))
#define FATTR4_OWNER_MASK (1ULL << (FATTR4_WORD1 + 4))
#define FATTR4_OWNER_GROUP_MASK (1ULL << (FATTR4_WORD1 + 5))
#define FATTR4_QUOTA_AVAIL_HARD_MASK (1ULL << (FATTR4_WORD1 + 6))
#define FATTR4_QUOTA_AVAIL_SOFT_MASK (1ULL << (FATTR4_WORD1 + 7))
#define FATTR4_QUOTA_USED_MASK (1ULL << (FATTR4_WORD1 + 8))
#define FATTR4_RAWDEV_MASK (1ULL << (FATTR4_WORD1 + 9))
#define FATTR4_SPACE_AVAIL_MASK (1ULL << (FATTR4_WORD1 + 10))
#define FATTR4_SPACE_FREE_MASK (1ULL << (FATTR4_WORD1 + 11))
#define FATTR4_SPACE_TOTAL_MASK (1ULL << (FATTR4_WORD1 + 12))
#define FATTR4_SPACE_USED_MASK (1ULL << (FATTR4_WORD1 + 13))
#define FATTR4_SYSTEM_MASK (1ULL << (FATTR4_WORD1 + 14))
#define FATTR4_TIME_ACCESS_MASK (1ULL << (FATTR4_WORD1 + 15))
#define FATTR4_TIME_ACCESS_SET_MASK (1ULL << (FATTR4_WORD1 + 16))
#define FATTR4_TIME_BACKUP_MASK (1ULL << (FATTR4_WORD1 + 17))
#define FATTR4_TIME_CREATE_MASK (1ULL << (FATTR4_WORD1 + 18))
#define FATTR4_TIME_DELTA_MASK (1ULL << (FATTR4_WORD1 + 19))
#define FATTR4_TIME_METADATA_MASK (1ULL << (FATTR4_WORD1 + 20))
#define FATTR4_TIME_MODIFY_MASK (1ULL << (FATTR4_WORD1 + 21))
#define FATTR4_TIME_MODIFY_SET_MASK (1ULL << (FATTR4_WORD1 + 22))
#define FATTR4_MOUNTED_ON_FILEID_MASK (1ULL << (FATTR4_WORD1 + 23))
/* nfsv4.1 */
/* Overload to fit to 64-bits bitmap4 */
#define FATTR4_SUPPATTR_EXCLCREAT_MASK_LOCAL (1ULL << (FATTR4_WORD1 + 24))
#define FATTR4_SEC_LABEL_MASK_LOCAL (1ULL << (FATTR4_WORD1 + 25))
/*
* Common bitmap4 of file attributes to be gathered
*/
#define NFS4_NTOV_ATTR_MASK ( \
FATTR4_TYPE_MASK | \
FATTR4_CHANGE_MASK | \
FATTR4_SIZE_MASK | \
FATTR4_FSID_MASK | \
FATTR4_FILEID_MASK | \
FATTR4_MODE_MASK | \
FATTR4_OWNER_MASK | \
FATTR4_OWNER_GROUP_MASK | \
FATTR4_NUMLINKS_MASK | \
FATTR4_TIME_ACCESS_MASK | \
FATTR4_TIME_MODIFY_MASK | \
FATTR4_TIME_METADATA_MASK | \
FATTR4_RAWDEV_MASK | \
FATTR4_SPACE_USED_MASK | \
FATTR4_MOUNTED_ON_FILEID_MASK)
#define NFS4_VATTR_MASK ( \
FATTR4_TYPE_MASK | \
FATTR4_CHANGE_MASK | \
FATTR4_SIZE_MASK | \
FATTR4_FSID_MASK | \
FATTR4_FILEID_MASK | \
FATTR4_MODE_MASK | \
FATTR4_OWNER_MASK | \
FATTR4_OWNER_GROUP_MASK | \
FATTR4_NUMLINKS_MASK | \
FATTR4_TIME_ACCESS_MASK | \
FATTR4_TIME_MODIFY_MASK | \
FATTR4_TIME_METADATA_MASK | \
FATTR4_RAWDEV_MASK | \
FATTR4_SPACE_USED_MASK | \
FATTR4_MOUNTED_ON_FILEID_MASK)
#define NFS4_PATHCONF_MASK ( \
NFS4_VATTR_MASK | \
FATTR4_NO_TRUNC_MASK | \
FATTR4_CHOWN_RESTRICTED_MASK | \
FATTR4_CASE_INSENSITIVE_MASK | \
FATTR4_CASE_PRESERVING_MASK | \
FATTR4_NAMED_ATTR_MASK | \
FATTR4_LINK_SUPPORT_MASK | \
FATTR4_SYMLINK_SUPPORT_MASK | \
FATTR4_UNIQUE_HANDLES_MASK | \
FATTR4_CANSETTIME_MASK | \
FATTR4_HOMOGENEOUS_MASK | \
FATTR4_MAXLINK_MASK | \
FATTR4_MAXNAME_MASK | \
FATTR4_MAXFILESIZE_MASK)
/*
* The corresponding AT_MASK
*/
#define NFS4_NTOV_ATTR_AT_MASK ( \
AT_TYPE | \
AT_SIZE | \
AT_FSID | \
AT_NODEID | \
AT_MODE | \
AT_UID | \
AT_GID | \
AT_NLINK | \
AT_ATIME | \
AT_MTIME | \
AT_CTIME | \
AT_RDEV | \
AT_NBLOCKS)
/*
* Common bitmap4 of filesystem attributes to be gathered
*/
#define NFS4_FS_ATTR_MASK ( \
FATTR4_FILES_AVAIL_MASK | \
FATTR4_FILES_FREE_MASK | \
FATTR4_FILES_TOTAL_MASK | \
FATTR4_SPACE_AVAIL_MASK | \
FATTR4_SPACE_FREE_MASK | \
FATTR4_SPACE_TOTAL_MASK)
#define NFS4_STATFS_ATTR_MASK ( \
FATTR4_FILES_AVAIL_MASK | \
FATTR4_FILES_FREE_MASK | \
FATTR4_FILES_TOTAL_MASK | \
FATTR4_SPACE_AVAIL_MASK | \
FATTR4_SPACE_FREE_MASK | \
FATTR4_SPACE_TOTAL_MASK | \
FATTR4_MAXNAME_MASK)
/*
* The corresponding AT_MASK
*/
#define NFS4_FS_ATTR_AT_MASK 0
/*
* Common bitmap4 to gather attr cache state
*/
#define NFS4_NTOV_ATTR_CACHE_MASK ( \
FATTR4_TIME_METADATA_MASK | \
FATTR4_TIME_MODIFY_MASK | \
FATTR4_SIZE_MASK)
/*
* The corresponding AT_MASK
*/
#define NFS4_NTOV_ATTR_CACHE_AT_MASK ( \
AT_CTIME | \
AT_MTIME | \
AT_SIZE)
#define NFS4_VTON_ATTR_MASK ( \
AT_TYPE | \
AT_MODE | \
AT_UID | \
AT_GID | \
AT_NODEID | \
AT_SIZE | \
AT_NLINK | \
AT_ATIME | \
AT_MTIME | \
AT_CTIME | \
AT_RDEV | \
AT_NBLOCKS | \
AT_FSID)
#define NFS4_VTON_ATTR_MASK_SET ( \
AT_MODE | \
AT_UID | \
AT_GID | \
AT_SIZE | \
AT_ATIME | \
AT_MTIME)
/* solaris-supported, non-vattr_t per-vnode scoped attrs */
#define NFS4_VP_ATTR_MASK ( \
FATTR4_CHANGE_MASK | \
FATTR4_CHOWN_RESTRICTED_MASK | \
FATTR4_FILEHANDLE_MASK | \
FATTR4_MAXFILESIZE_MASK | \
FATTR4_MAXLINK_MASK | \
FATTR4_MAXNAME_MASK | \
FATTR4_MOUNTED_ON_FILEID_MASK)
#define FATTR4_FSINFO_MASK ( \
FATTR4_SUPPORTED_ATTRS_MASK | \
FATTR4_TYPE_MASK | \
FATTR4_FH_EXPIRE_TYPE_MASK | \
FATTR4_LINK_SUPPORT_MASK | \
FATTR4_SYMLINK_SUPPORT_MASK | \
FATTR4_FSID_MASK | \
FATTR4_MAXFILESIZE_MASK | \
FATTR4_MAXREAD_MASK | \
FATTR4_MAXWRITE_MASK)
/*
* These are the support attributes for the NFSv4 server
*/
#define NFS4_SRV_RDDIR_SUPPORTED_ATTRS ( \
FATTR4_SUPPORTED_ATTRS_MASK | \
FATTR4_TYPE_MASK | \
FATTR4_FH_EXPIRE_TYPE_MASK | \
FATTR4_CHANGE_MASK | \
FATTR4_SIZE_MASK | \
FATTR4_LINK_SUPPORT_MASK | \
FATTR4_SYMLINK_SUPPORT_MASK | \
FATTR4_NAMED_ATTR_MASK | \
FATTR4_FSID_MASK | \
FATTR4_UNIQUE_HANDLES_MASK | \
FATTR4_LEASE_TIME_MASK | \
FATTR4_RDATTR_ERROR_MASK | \
FATTR4_CANSETTIME_MASK | \
FATTR4_CASE_INSENSITIVE_MASK | \
FATTR4_CASE_PRESERVING_MASK | \
FATTR4_CHOWN_RESTRICTED_MASK | \
FATTR4_FILEHANDLE_MASK | \
FATTR4_FILEID_MASK | \
FATTR4_FILES_AVAIL_MASK | \
FATTR4_FILES_FREE_MASK | \
FATTR4_FILES_TOTAL_MASK | \
FATTR4_FS_LOCATIONS_MASK | \
FATTR4_HOMOGENEOUS_MASK | \
FATTR4_MAXFILESIZE_MASK | \
FATTR4_MAXLINK_MASK | \
FATTR4_MAXNAME_MASK | \
FATTR4_MAXREAD_MASK | \
FATTR4_MAXWRITE_MASK | \
FATTR4_MODE_MASK | \
FATTR4_NO_TRUNC_MASK | \
FATTR4_NUMLINKS_MASK | \
FATTR4_OWNER_MASK | \
FATTR4_OWNER_GROUP_MASK | \
FATTR4_RAWDEV_MASK | \
FATTR4_SPACE_AVAIL_MASK | \
FATTR4_SPACE_FREE_MASK | \
FATTR4_SPACE_TOTAL_MASK | \
FATTR4_SPACE_USED_MASK | \
FATTR4_TIME_ACCESS_MASK | \
FATTR4_TIME_DELTA_MASK | \
FATTR4_TIME_METADATA_MASK | \
FATTR4_TIME_MODIFY_MASK | \
FATTR4_MOUNTED_ON_FILEID_MASK \
)
/* nfsv4.1 */
#define RFS4_SUPPATTR_EXCLCREAT ( \
FATTR4_SIZE_MASK | \
FATTR4_MODE_MASK | \
FATTR4_ACL_MASK | \
FATTR4_OWNER_MASK | \
FATTR4_OWNER_GROUP_MASK | \
FATTR4_TIME_ACCESS_SET_MASK)
#define FATTR4_FSID_EQ(a, b) \
((a)->major == (b)->major && (a)->minor == (b)->minor)
#define NFS4_MAXNUM_BITWORDS 2
#define NFS4_MAXNUM_ATTRS 57
union nfs4_attr_u {
fattr4_supported_attrs supported_attrs;
fattr4_type type;
fattr4_fh_expire_type fh_expire_type;
fattr4_change change;
fattr4_size size;
fattr4_link_support link_support;
fattr4_symlink_support symlink_support;
fattr4_named_attr named_attr;
fattr4_fsid fsid;
fattr4_unique_handles unique_handles;
fattr4_lease_time lease_time;
fattr4_rdattr_error rdattr_error;
fattr4_acl acl;
fattr4_aclsupport aclsupport;
fattr4_archive archive;
fattr4_cansettime cansettime;
fattr4_case_insensitive case_insensitive;
fattr4_case_preserving case_preserving;
fattr4_chown_restricted chown_restricted;
fattr4_fileid fileid;
fattr4_files_avail files_avail;
fattr4_filehandle filehandle;
fattr4_files_free files_free;
fattr4_files_total files_total;
fattr4_fs_locations fs_locations;
fattr4_hidden hidden;
fattr4_homogeneous homogeneous;
fattr4_maxfilesize maxfilesize;
fattr4_maxlink maxlink;
fattr4_maxname maxname;
fattr4_maxread maxread;
fattr4_maxwrite maxwrite;
fattr4_mimetype mimetype;
fattr4_mode mode;
fattr4_no_trunc no_trunc;
fattr4_numlinks numlinks;
fattr4_owner owner;
fattr4_owner_group owner_group;
fattr4_quota_avail_hard quota_avail_hard;
fattr4_quota_avail_soft quota_avail_soft;
fattr4_quota_used quota_used;
fattr4_rawdev rawdev;
fattr4_space_avail space_avail;
fattr4_space_free space_free;
fattr4_space_total space_total;
fattr4_space_used space_used;
fattr4_system system;
fattr4_time_access time_access;
fattr4_time_access_set time_access_set;
fattr4_time_backup time_backup;
fattr4_time_create time_create;
fattr4_time_delta time_delta;
fattr4_time_metadata time_metadata;
fattr4_time_modify time_modify;
fattr4_time_modify_set time_modify_set;
fattr4_mounted_on_fileid mounted_on_fileid;
fattr4_suppattr_exclcreat supp_exclcreat;
};
/*
* Error details when processing the getattr response.
*/
#define NFS4_GETATTR_OP_OK 0
#define NFS4_GETATTR_STATUS_ERR 1
#define NFS4_GETATTR_MANDATTR_ERR 2
#define NFS4_GETATTR_BITMAP_ERR 3
#define NFS4_GETATTR_ATSIZE_ERR 4
#define NFS4_GETATTR_ATUID_ERR 5
#define NFS4_GETATTR_ATGID_ERR 6
#define NFS4_GETATTR_ATATIME_ERR 7
#define NFS4_GETATTR_ATMTIME_ERR 8
#define NFS4_GETATTR_ATCTIME_ERR 9
#define NFS4_GETATTR_RAWDEV_ERR 10
#define NFS4_GETATTR_ATNBLOCK_ERR 11
#define NFS4_GETATTR_MAXFILESIZE_ERR 12
#define NFS4_GETATTR_FHANDLE_ERR 13
#define NFS4_GETATTR_MAXREAD_ERR 14
#define NFS4_GETATTR_MAXWRITE_ERR 15
#define NFS4_GETATTR_NOCACHE_OK 16
typedef struct nfs4_pathconf_info {
unsigned pc4_cache_valid:1; /* When in rnode4, is data valid? */
unsigned pc4_no_trunc:1;
unsigned pc4_chown_restricted:1;
unsigned pc4_case_insensitive:1;
unsigned pc4_case_preserving:1;
unsigned pc4_xattr_valid:1;
unsigned pc4_xattr_exists:1;
unsigned pc4_link_support:1;
unsigned pc4_symlink_support:1;
unsigned pc4_unique_handles:1;
unsigned pc4_cansettime:1;
unsigned pc4_homogeneous:1;
uint_t pc4_link_max;
uint_t pc4_name_max;
uint_t pc4_filesizebits;
} nfs4_pathconf_info_t;
/*
* Used for client only to process incoming getattr results.
*/
typedef struct nfs4_ga_ext_res {
bitmap4 n4g_suppattrs;
nfsstat4 n4g_rdattr_error;
fattr4_fh_expire_type n4g_fet;
fattr4_lease_time n4g_leasetime;
uint64_t n4g_maxfilesize;
uint64_t n4g_maxread;
uint64_t n4g_maxwrite;
nfstime4 n4g_delta;
nfs4_pathconf_info_t n4g_pc4;
struct statvfs64 n4g_sb;
union {
nfs_fh4 n4g_fh;
struct {
uint_t len;
char *val;
char data[NFS4_FHSIZE];
} nfs_fh4_alt;
} n4g_fh_u;
/*
* Bitmask with valid fields being:
* ACL4_SUPPORT_ALLOW_ACL
* ACL4_SUPPORT_DENY_ACL
* ACL4_SUPPORT_AUDIT_ACL
* ACL4_SUPPORT_ALARM_ACL
*/
fattr4_aclsupport n4g_aclsupport;
fattr4_fs_locations n4g_fslocations;
} nfs4_ga_ext_res_t;
extern bitmap4 rfs4_supported_attrs;
#ifdef __cplusplus
}
#endif
#endif /* _NFS4_ATTR_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Portions of this source code were derived from Berkeley 4.3 BSD
* under license from the Regents of the University of California.
*/
#ifndef _NFS4_CLNT_H
#define _NFS4_CLNT_H
#include <sys/errno.h>
#include <sys/types.h>
#include <sys/kstat.h>
#include <sys/time.h>
#include <sys/flock.h>
#include <vm/page.h>
#include <nfs/nfs4_kprot.h>
#include <nfs/nfs4.h>
#include <nfs/rnode.h>
#include <sys/avl.h>
#include <sys/list.h>
#include <rpc/auth.h>
#include <sys/door.h>
#include <sys/condvar_impl.h>
#include <sys/zone.h>
#ifdef __cplusplus
extern "C" {
#endif
#define NFS4_SIZE_OK(size) ((size) <= MAXOFFSET_T)
/* Four states of nfs4_server's lease_valid */
#define NFS4_LEASE_INVALID 0
#define NFS4_LEASE_VALID 1
#define NFS4_LEASE_UNINITIALIZED 2
#define NFS4_LEASE_NOT_STARTED 3
/* flag to tell the renew thread it should exit */
#define NFS4_THREAD_EXIT 1
/* Default number of seconds to wait on GRACE and DELAY errors */
#define NFS4ERR_DELAY_TIME 10
/* Number of hash buckets for open owners for each nfs4_server */
#define NFS4_NUM_OO_BUCKETS 53
/* Number of freed open owners (per mntinfo4_t) to keep around */
#define NFS4_NUM_FREED_OPEN_OWNERS 8
/* Number of seconds to wait before retrying a SETCLIENTID(_CONFIRM) op */
#define NFS4_RETRY_SCLID_DELAY 10
/* Number of times we should retry a SETCLIENTID(_CONFIRM) op */
#define NFS4_NUM_SCLID_RETRIES 3
/* Number of times we should retry on open after getting NFS4ERR_BAD_SEQID */
#define NFS4_NUM_RETRY_BAD_SEQID 3
/*
* Macro to wakeup sleeping async worker threads.
*/
#define NFS4_WAKE_ASYNC_WORKER(work_cv) { \
if (CV_HAS_WAITERS(&work_cv[NFS4_ASYNC_QUEUE])) \
cv_signal(&work_cv[NFS4_ASYNC_QUEUE]); \
else if (CV_HAS_WAITERS(&work_cv[NFS4_ASYNC_PGOPS_QUEUE])) \
cv_signal(&work_cv[NFS4_ASYNC_PGOPS_QUEUE]); \
}
#define NFS4_WAKEALL_ASYNC_WORKERS(work_cv) { \
cv_broadcast(&work_cv[NFS4_ASYNC_QUEUE]); \
cv_broadcast(&work_cv[NFS4_ASYNC_PGOPS_QUEUE]); \
}
/*
* Is the attribute cache valid? If client holds a delegation, then attrs
* are by definition valid. If not, then check to see if attrs have timed out.
*/
#define ATTRCACHE4_VALID(vp) (VTOR4(vp)->r_deleg_type != OPEN_DELEGATE_NONE || \
gethrtime() < VTOR4(vp)->r_time_attr_inval)
/*
* Flags to indicate whether to purge the DNLC for non-directory vnodes
* in a call to nfs_purge_caches.
*/
#define NFS4_NOPURGE_DNLC 0
#define NFS4_PURGE_DNLC 1
/*
* Is cache valid?
* Swap is always valid, if no attributes (attrtime == 0) or
* if mtime matches cached mtime it is valid
* NOTE: mtime is now a timestruc_t.
* Caller should be holding the rnode r_statelock mutex.
*/
#define CACHE4_VALID(rp, mtime, fsize) \
((RTOV4(rp)->v_flag & VISSWAP) == VISSWAP || \
(((mtime).tv_sec == (rp)->r_attr.va_mtime.tv_sec && \
(mtime).tv_nsec == (rp)->r_attr.va_mtime.tv_nsec) && \
((fsize) == (rp)->r_attr.va_size)))
/*
* Macro to detect forced unmount or a zone shutdown.
*/
#define FS_OR_ZONE_GONE4(vfsp) \
(((vfsp)->vfs_flag & VFS_UNMOUNTED) || \
zone_status_get(curproc->p_zone) >= ZONE_IS_SHUTTING_DOWN)
/*
* Macro to help determine whether a request failed because the underlying
* filesystem has been forcibly unmounted or because of zone shutdown.
*/
#define NFS4_FRC_UNMT_ERR(err, vfsp) \
((err) == EIO && FS_OR_ZONE_GONE4((vfsp)))
/*
* Due to the way the address space callbacks are used to execute a delmap,
* we must keep track of how many times the same thread has called
* VOP_DELMAP()->nfs4_delmap(). This is done by having a list of
* nfs4_delmapcall_t's associated with each rnode4_t. This list is protected
* by the rnode4_t's r_statelock. The individual elements do not need to be
* protected as they will only ever be created, modified and destroyed by
* one thread (the call_id).
* See nfs4_delmap() for further explanation.
*/
typedef struct nfs4_delmapcall {
kthread_t *call_id;
int error; /* error from delmap */
list_node_t call_node;
} nfs4_delmapcall_t;
/*
* delmap address space callback args
*/
typedef struct nfs4_delmap_args {
vnode_t *vp;
offset_t off;
caddr_t addr;
size_t len;
uint_t prot;
uint_t maxprot;
uint_t flags;
cred_t *cr;
nfs4_delmapcall_t *caller; /* to retrieve errors from the cb */
} nfs4_delmap_args_t;
/*
* client side statistics
*/
/*
* Per-zone counters
*/
struct clstat4 {
kstat_named_t calls; /* client requests */
kstat_named_t badcalls; /* rpc failures */
kstat_named_t referrals; /* referrals */
kstat_named_t referlinks; /* referrals as symlinks */
kstat_named_t clgets; /* client handle gets */
kstat_named_t cltoomany; /* client handle cache misses */
#ifdef DEBUG
kstat_named_t clalloc; /* number of client handles */
kstat_named_t noresponse; /* server not responding cnt */
kstat_named_t failover; /* server failover count */
kstat_named_t remap; /* server remap count */
#endif
};
#ifdef DEBUG
/*
* The following are statistics that describe the behavior of the system as a
* whole and don't correspond to any particular zone.
*/
struct clstat4_debug {
kstat_named_t nrnode; /* number of allocated rnodes */
kstat_named_t access; /* size of access cache */
kstat_named_t dirent; /* size of readdir cache */
kstat_named_t dirents; /* size of readdir buf cache */
kstat_named_t reclaim; /* number of reclaims */
kstat_named_t clreclaim; /* number of cl reclaims */
kstat_named_t f_reclaim; /* number of free reclaims */
kstat_named_t a_reclaim; /* number of active reclaims */
kstat_named_t r_reclaim; /* number of rnode reclaims */
kstat_named_t rpath; /* bytes used to store rpaths */
};
extern struct clstat4_debug clstat4_debug;
#endif
/*
* The NFS specific async_reqs structure. iotype4 is grouped to support two
* types of async thread pools, please read comments section of mntinfo4_t
* definition for more information. Care should be taken while adding new
* members to this group.
*/
enum iotype4 {
NFS4_PUTAPAGE,
NFS4_PAGEIO,
NFS4_COMMIT,
NFS4_READ_AHEAD,
NFS4_READDIR,
NFS4_INACTIVE,
NFS4_ASYNC_TYPES
};
#define NFS4_ASYNC_PGOPS_TYPES (NFS4_COMMIT + 1)
/*
* NFS async requests queue type.
*/
enum ioqtype4 {
NFS4_ASYNC_QUEUE,
NFS4_ASYNC_PGOPS_QUEUE,
NFS4_MAX_ASYNC_QUEUES
};
/*
* Number of NFS async threads operating exclusively on page op requests.
*/
#define NUM_ASYNC_PGOPS_THREADS 0x2
struct nfs4_async_read_req {
void (*readahead)(); /* pointer to readahead function */
u_offset_t blkoff; /* offset in file */
struct seg *seg; /* segment to do i/o to */
caddr_t addr; /* address to do i/o to */
};
struct nfs4_pageio_req {
int (*pageio)(); /* pointer to pageio function */
page_t *pp; /* page list */
u_offset_t io_off; /* offset in file */
uint_t io_len; /* size of request */
int flags;
};
struct nfs4_readdir_req {
int (*readdir)(); /* pointer to readdir function */
struct rddir4_cache *rdc; /* pointer to cache entry to fill */
};
struct nfs4_commit_req {
void (*commit)(); /* pointer to commit function */
page_t *plist; /* page list */
offset4 offset; /* starting offset */
count4 count; /* size of range to be commited */
};
struct nfs4_async_reqs {
struct nfs4_async_reqs *a_next; /* pointer to next arg struct */
#ifdef DEBUG
kthread_t *a_queuer; /* thread id of queueing thread */
#endif
struct vnode *a_vp; /* vnode pointer */
struct cred *a_cred; /* cred pointer */
enum iotype4 a_io; /* i/o type */
union {
struct nfs4_async_read_req a_read_args;
struct nfs4_pageio_req a_pageio_args;
struct nfs4_readdir_req a_readdir_args;
struct nfs4_commit_req a_commit_args;
} a_args;
};
#define a_nfs4_readahead a_args.a_read_args.readahead
#define a_nfs4_blkoff a_args.a_read_args.blkoff
#define a_nfs4_seg a_args.a_read_args.seg
#define a_nfs4_addr a_args.a_read_args.addr
#define a_nfs4_putapage a_args.a_pageio_args.pageio
#define a_nfs4_pageio a_args.a_pageio_args.pageio
#define a_nfs4_pp a_args.a_pageio_args.pp
#define a_nfs4_off a_args.a_pageio_args.io_off
#define a_nfs4_len a_args.a_pageio_args.io_len
#define a_nfs4_flags a_args.a_pageio_args.flags
#define a_nfs4_readdir a_args.a_readdir_args.readdir
#define a_nfs4_rdc a_args.a_readdir_args.rdc
#define a_nfs4_commit a_args.a_commit_args.commit
#define a_nfs4_plist a_args.a_commit_args.plist
#define a_nfs4_offset a_args.a_commit_args.offset
#define a_nfs4_count a_args.a_commit_args.count
/*
* Security information
*/
typedef struct sv_secinfo {
uint_t count; /* how many sdata there are */
uint_t index; /* which sdata[index] */
struct sec_data *sdata;
} sv_secinfo_t;
/*
* Hash bucket for the mi's open owner list (mi_oo_list).
*/
typedef struct nfs4_oo_hash_bucket {
list_t b_oo_hash_list;
kmutex_t b_lock;
} nfs4_oo_hash_bucket_t;
/*
* Global array of ctags.
*/
extern ctag_t nfs4_ctags[];
typedef enum nfs4_tag_type {
TAG_NONE,
TAG_ACCESS,
TAG_CLOSE,
TAG_CLOSE_LOST,
TAG_CLOSE_UNDO,
TAG_COMMIT,
TAG_DELEGRETURN,
TAG_FSINFO,
TAG_GET_SYMLINK,
TAG_GETATTR,
TAG_GETATTR_FSLOCATION,
TAG_INACTIVE,
TAG_LINK,
TAG_LOCK,
TAG_LOCK_RECLAIM,
TAG_LOCK_RESEND,
TAG_LOCK_REINSTATE,
TAG_LOCK_UNKNOWN,
TAG_LOCKT,
TAG_LOCKU,
TAG_LOCKU_RESEND,
TAG_LOCKU_REINSTATE,
TAG_LOOKUP,
TAG_LOOKUP_PARENT,
TAG_LOOKUP_VALID,
TAG_LOOKUP_VPARENT,
TAG_MKDIR,
TAG_MKNOD,
TAG_MOUNT,
TAG_OPEN,
TAG_OPEN_CONFIRM,
TAG_OPEN_CONFIRM_LOST,
TAG_OPEN_DG,
TAG_OPEN_DG_LOST,
TAG_OPEN_LOST,
TAG_OPENATTR,
TAG_PATHCONF,
TAG_PUTROOTFH,
TAG_READ,
TAG_READAHEAD,
TAG_READDIR,
TAG_READLINK,
TAG_RELOCK,
TAG_REMAP_LOOKUP,
TAG_REMAP_LOOKUP_AD,
TAG_REMAP_LOOKUP_NA,
TAG_REMAP_MOUNT,
TAG_RMDIR,
TAG_REMOVE,
TAG_RENAME,
TAG_RENAME_VFH,
TAG_RENEW,
TAG_REOPEN,
TAG_REOPEN_LOST,
TAG_SECINFO,
TAG_SETATTR,
TAG_SETCLIENTID,
TAG_SETCLIENTID_CF,
TAG_SYMLINK,
TAG_WRITE
} nfs4_tag_type_t;
#define NFS4_TAG_INITIALIZER { \
{TAG_NONE, "", \
{0x20202020, 0x20202020, 0x20202020}}, \
{TAG_ACCESS, "access", \
{0x61636365, 0x73732020, 0x20202020}}, \
{TAG_CLOSE, "close", \
{0x636c6f73, 0x65202020, 0x20202020}}, \
{TAG_CLOSE_LOST, "lost close", \
{0x6c6f7374, 0x20636c6f, 0x73652020}}, \
{TAG_CLOSE_UNDO, "undo close", \
{0x756e646f, 0x20636c6f, 0x73652020}}, \
{TAG_COMMIT, "commit", \
{0x636f6d6d, 0x69742020, 0x20202020}}, \
{TAG_DELEGRETURN, "delegreturn", \
{0x64656c65, 0x67726574, 0x75726e20}}, \
{TAG_FSINFO, "fsinfo", \
{0x6673696e, 0x666f2020, 0x20202020}}, \
{TAG_GET_SYMLINK, "get symlink text", \
{0x67657420, 0x736c6e6b, 0x20747874}}, \
{TAG_GETATTR, "getattr", \
{0x67657461, 0x74747220, 0x20202020}}, \
{TAG_GETATTR_FSLOCATION, "getattr fslocation", \
{0x67657461, 0x74747220, 0x66736c6f}}, \
{TAG_INACTIVE, "inactive", \
{0x696e6163, 0x74697665, 0x20202020}}, \
{TAG_LINK, "link", \
{0x6c696e6b, 0x20202020, 0x20202020}}, \
{TAG_LOCK, "lock", \
{0x6c6f636b, 0x20202020, 0x20202020}}, \
{TAG_LOCK_RECLAIM, "reclaim lock", \
{0x7265636c, 0x61696d20, 0x6c6f636b}}, \
{TAG_LOCK_RESEND, "resend lock", \
{0x72657365, 0x6e64206c, 0x6f636b20}}, \
{TAG_LOCK_REINSTATE, "reinstate lock", \
{0x7265696e, 0x7374206c, 0x6f636b20}}, \
{TAG_LOCK_UNKNOWN, "unknown lock", \
{0x756e6b6e, 0x6f776e20, 0x6c6f636b}}, \
{TAG_LOCKT, "lock test", \
{0x6c6f636b, 0x5f746573, 0x74202020}}, \
{TAG_LOCKU, "unlock", \
{0x756e6c6f, 0x636b2020, 0x20202020}}, \
{TAG_LOCKU_RESEND, "resend locku", \
{0x72657365, 0x6e64206c, 0x6f636b75}}, \
{TAG_LOCKU_REINSTATE, "reinstate unlock", \
{0x7265696e, 0x73742075, 0x6e6c636b}}, \
{TAG_LOOKUP, "lookup", \
{0x6c6f6f6b, 0x75702020, 0x20202020}}, \
{TAG_LOOKUP_PARENT, "lookup parent", \
{0x6c6f6f6b, 0x75702070, 0x6172656e}}, \
{TAG_LOOKUP_VALID, "lookup valid", \
{0x6c6f6f6b, 0x75702076, 0x616c6964}}, \
{TAG_LOOKUP_VPARENT, "lookup valid parent", \
{0x6c6f6f6b, 0x766c6420, 0x7061726e}}, \
{TAG_MKDIR, "mkdir", \
{0x6d6b6469, 0x72202020, 0x20202020}}, \
{TAG_MKNOD, "mknod", \
{0x6d6b6e6f, 0x64202020, 0x20202020}}, \
{TAG_MOUNT, "mount", \
{0x6d6f756e, 0x74202020, 0x20202020}}, \
{TAG_OPEN, "open", \
{0x6f70656e, 0x20202020, 0x20202020}}, \
{TAG_OPEN_CONFIRM, "open confirm", \
{0x6f70656e, 0x5f636f6e, 0x6669726d}}, \
{TAG_OPEN_CONFIRM_LOST, "lost open confirm", \
{0x6c6f7374, 0x206f7065, 0x6e5f636f}}, \
{TAG_OPEN_DG, "open downgrade", \
{0x6f70656e, 0x20646772, 0x61646520}}, \
{TAG_OPEN_DG_LOST, "lost open downgrade", \
{0x6c737420, 0x6f70656e, 0x20646772}}, \
{TAG_OPEN_LOST, "lost open", \
{0x6c6f7374, 0x206f7065, 0x6e202020}}, \
{TAG_OPENATTR, "openattr", \
{0x6f70656e, 0x61747472, 0x20202020}}, \
{TAG_PATHCONF, "pathconf", \
{0x70617468, 0x636f6e66, 0x20202020}}, \
{TAG_PUTROOTFH, "putrootfh", \
{0x70757472, 0x6f6f7466, 0x68202020}}, \
{TAG_READ, "read", \
{0x72656164, 0x20202020, 0x20202020}}, \
{TAG_READAHEAD, "readahead", \
{0x72656164, 0x61686561, 0x64202020}}, \
{TAG_READDIR, "readdir", \
{0x72656164, 0x64697220, 0x20202020}}, \
{TAG_READLINK, "readlink", \
{0x72656164, 0x6c696e6b, 0x20202020}}, \
{TAG_RELOCK, "relock", \
{0x72656c6f, 0x636b2020, 0x20202020}}, \
{TAG_REMAP_LOOKUP, "remap lookup", \
{0x72656d61, 0x70206c6f, 0x6f6b7570}}, \
{TAG_REMAP_LOOKUP_AD, "remap lookup attr dir", \
{0x72656d70, 0x206c6b75, 0x70206164}}, \
{TAG_REMAP_LOOKUP_NA, "remap lookup named attrs", \
{0x72656d70, 0x206c6b75, 0x70206e61}}, \
{TAG_REMAP_MOUNT, "remap mount", \
{0x72656d61, 0x70206d6f, 0x756e7420}}, \
{TAG_RMDIR, "rmdir", \
{0x726d6469, 0x72202020, 0x20202020}}, \
{TAG_REMOVE, "remove", \
{0x72656d6f, 0x76652020, 0x20202020}}, \
{TAG_RENAME, "rename", \
{0x72656e61, 0x6d652020, 0x20202020}}, \
{TAG_RENAME_VFH, "rename volatile fh", \
{0x72656e61, 0x6d652028, 0x76666829}}, \
{TAG_RENEW, "renew", \
{0x72656e65, 0x77202020, 0x20202020}}, \
{TAG_REOPEN, "reopen", \
{0x72656f70, 0x656e2020, 0x20202020}}, \
{TAG_REOPEN_LOST, "lost reopen", \
{0x6c6f7374, 0x2072656f, 0x70656e20}}, \
{TAG_SECINFO, "secinfo", \
{0x73656369, 0x6e666f20, 0x20202020}}, \
{TAG_SETATTR, "setattr", \
{0x73657461, 0x74747220, 0x20202020}}, \
{TAG_SETCLIENTID, "setclientid", \
{0x73657463, 0x6c69656e, 0x74696420}}, \
{TAG_SETCLIENTID_CF, "setclientid_confirm", \
{0x73636c6e, 0x7469645f, 0x636f6e66}}, \
{TAG_SYMLINK, "symlink", \
{0x73796d6c, 0x696e6b20, 0x20202020}}, \
{TAG_WRITE, "write", \
{0x77726974, 0x65202020, 0x20202020}} \
}
/*
* These flags are for differentiating the search criterian for
* find_open_owner(). The comparison is done with the open_owners's
* 'oo_just_created' flag.
*/
#define NFS4_PERM_CREATED 0x0
#define NFS4_JUST_CREATED 0x1
/*
* Hashed by the cr_uid and cr_ruid of credential 'oo_cred'. 'oo_cred_otw'
* is stored upon a successful OPEN. This is needed when the user's effective
* and real uid's don't match. The 'oo_cred_otw' overrides the credential
* passed down by VFS for async read/write, commit, lock, and close operations.
*
* The oo_ref_count keeps track the number of active references on this
* data structure + number of nfs4_open_streams point to this structure.
*
* 'oo_valid' tells whether this stuct is about to be freed or not.
*
* 'oo_just_created' tells us whether this struct has just been created but
* not been fully finalized (that is created upon an OPEN request and
* finalized upon the OPEN success).
*
* The 'oo_seqid_inuse' is for the open seqid synchronization. If a thread
* is currently using the open owner and it's open_seqid, then it sets the
* oo_seqid_inuse to true if it currently is not set. If it is set then it
* does a cv_wait on the oo_cv_seqid_sync condition variable. When the thread
* is done it unsets the oo_seqid_inuse and does a cv_signal to wake a process
* waiting on the condition variable.
*
* 'oo_last_good_seqid' is the last valid seqid this open owner sent OTW,
* and 'oo_last_good_op' is the operation that issued the last valid seqid.
*
* Lock ordering:
* mntinfo4_t::mi_lock > oo_lock (for searching mi_oo_list)
*
* oo_seqid_inuse > mntinfo4_t::mi_lock
* oo_seqid_inuse > rnode4_t::r_statelock
* oo_seqid_inuse > rnode4_t::r_statev4_lock
* oo_seqid_inuse > nfs4_open_stream_t::os_sync_lock
*
* The 'oo_seqid_inuse'/'oo_cv_seqid_sync' protects:
* oo_last_good_op
* oo_last_good_seqid
* oo_name
* oo_seqid
*
* The 'oo_lock' protects:
* oo_cred
* oo_cred_otw
* oo_foo_node
* oo_hash_node
* oo_just_created
* oo_ref_count
* oo_valid
*/
typedef struct nfs4_open_owner {
cred_t *oo_cred;
int oo_ref_count;
int oo_valid;
int oo_just_created;
seqid4 oo_seqid;
seqid4 oo_last_good_seqid;
nfs4_tag_type_t oo_last_good_op;
unsigned oo_seqid_inuse:1;
cred_t *oo_cred_otw;
kcondvar_t oo_cv_seqid_sync;
/*
* Fix this to always be 8 bytes
*/
uint64_t oo_name;
list_node_t oo_hash_node;
list_node_t oo_foo_node;
kmutex_t oo_lock;
} nfs4_open_owner_t;
/*
* Static server information.
* These fields are read-only once they are initialized; sv_lock
* should be held as writer if they are changed during mount:
* sv_addr
* sv_dhsec
* sv_hostname
* sv_hostnamelen
* sv_knconf
* sv_next
* sv_origknconf
*
* These fields are protected by sv_lock:
* sv_currsec
* sv_fhandle
* sv_flags
* sv_fsid
* sv_path
* sv_pathlen
* sv_pfhandle
* sv_save_secinfo
* sv_savesec
* sv_secdata
* sv_secinfo
* sv_supp_attrs
*
* Lock ordering:
* nfs_rtable4_lock > sv_lock
* rnode4_t::r_statelock > sv_lock
*/
typedef struct servinfo4 {
struct knetconfig *sv_knconf; /* bound TLI fd */
struct knetconfig *sv_origknconf; /* For RDMA save orig knconf */
struct netbuf sv_addr; /* server's address */
nfs4_fhandle_t sv_fhandle; /* this server's filehandle */
nfs4_fhandle_t sv_pfhandle; /* parent dir filehandle */
int sv_pathlen; /* Length of server path */
char *sv_path; /* Path name on server */
uint32_t sv_flags; /* flags for this server */
sec_data_t *sv_secdata; /* client initiated security data */
sv_secinfo_t *sv_secinfo; /* server security information */
sec_data_t *sv_currsec; /* security data currently used; */
/* points to one of the sec_data */
/* entries in sv_secinfo */
sv_secinfo_t *sv_save_secinfo; /* saved secinfo */
sec_data_t *sv_savesec; /* saved security data */
sec_data_t *sv_dhsec; /* AUTH_DH data from the user land */
char *sv_hostname; /* server's hostname */
int sv_hostnamelen; /* server's hostname length */
fattr4_fsid sv_fsid; /* fsid of shared obj */
fattr4_supported_attrs sv_supp_attrs;
struct servinfo4 *sv_next; /* next in list */
nfs_rwlock_t sv_lock;
} servinfo4_t;
/* sv_flags fields */
#define SV4_TRYSECINFO 0x001 /* try secinfo data from the server */
#define SV4_TRYSECDEFAULT 0x002 /* try a default flavor */
#define SV4_NOTINUSE 0x004 /* servinfo4_t had fatal errors */
#define SV4_ROOT_STALE 0x008 /* root vnode got ESTALE */
/*
* Lock call types. See nfs4frlock().
*/
typedef enum nfs4_lock_call_type {
NFS4_LCK_CTYPE_NORM,
NFS4_LCK_CTYPE_RECLAIM,
NFS4_LCK_CTYPE_RESEND,
NFS4_LCK_CTYPE_REINSTATE
} nfs4_lock_call_type_t;
/*
* This structure holds the information for a lost open/close/open downgrade/
* lock/locku request. It is also used for requests that are queued up so
* that the recovery thread can release server state after a forced
* unmount.
* "lr_op" is 0 if the struct is uninitialized. Otherwise, it is set to
* the proper OP_* nfs_opnum4 number. The other fields contain information
* to reconstruct the call.
*
* lr_dvp is used for OPENs with CREATE, so that we can do a PUTFH of the
* parent directroy without relying on vtodv (since we may not have a vp
* for the file we wish to create).
*
* lr_putfirst means that the request should go to the front of the resend
* queue, rather than the end.
*/
typedef struct nfs4_lost_rqst {
list_node_t lr_node;
nfs_opnum4 lr_op;
vnode_t *lr_vp;
vnode_t *lr_dvp;
nfs4_open_owner_t *lr_oop;
struct nfs4_open_stream *lr_osp;
struct nfs4_lock_owner *lr_lop;
cred_t *lr_cr;
flock64_t *lr_flk;
bool_t lr_putfirst;
union {
struct {
nfs4_lock_call_type_t lru_ctype;
nfs_lock_type4 lru_locktype;
} lru_lockargs; /* LOCK, LOCKU */
struct {
uint32_t lru_oaccess;
uint32_t lru_odeny;
enum open_claim_type4 lru_oclaim;
stateid4 lru_ostateid; /* reopen only */
component4 lru_ofile;
} lru_open_args;
struct {
uint32_t lru_dg_access;
uint32_t lru_dg_deny;
} lru_open_dg_args;
} nfs4_lr_u;
} nfs4_lost_rqst_t;
#define lr_oacc nfs4_lr_u.lru_open_args.lru_oaccess
#define lr_odeny nfs4_lr_u.lru_open_args.lru_odeny
#define lr_oclaim nfs4_lr_u.lru_open_args.lru_oclaim
#define lr_ostateid nfs4_lr_u.lru_open_args.lru_ostateid
#define lr_ofile nfs4_lr_u.lru_open_args.lru_ofile
#define lr_dg_acc nfs4_lr_u.lru_open_dg_args.lru_dg_access
#define lr_dg_deny nfs4_lr_u.lru_open_dg_args.lru_dg_deny
#define lr_ctype nfs4_lr_u.lru_lockargs.lru_ctype
#define lr_locktype nfs4_lr_u.lru_lockargs.lru_locktype
/*
* Recovery actions. Some actions can imply further recovery using a
* different recovery action (e.g., recovering the clientid leads to
* recovering open files and locks).
*/
typedef enum {
NR_UNUSED,
NR_CLIENTID,
NR_OPENFILES,
NR_FHEXPIRED,
NR_FAILOVER,
NR_WRONGSEC,
NR_EXPIRED,
NR_BAD_STATEID,
NR_BADHANDLE,
NR_BAD_SEQID,
NR_OLDSTATEID,
NR_GRACE,
NR_DELAY,
NR_LOST_LOCK,
NR_LOST_STATE_RQST,
NR_STALE,
NR_MOVED
} nfs4_recov_t;
/*
* Administrative and debug message framework.
*/
#define NFS4_MSG_MAX 100
extern int nfs4_msg_max;
#define NFS4_REFERRAL_LOOP_MAX 20
typedef enum {
RE_BAD_SEQID,
RE_BADHANDLE,
RE_CLIENTID,
RE_DEAD_FILE,
RE_END,
RE_FAIL_RELOCK,
RE_FAIL_REMAP_LEN,
RE_FAIL_REMAP_OP,
RE_FAILOVER,
RE_FILE_DIFF,
RE_LOST_STATE,
RE_OPENS_CHANGED,
RE_SIGLOST,
RE_SIGLOST_NO_DUMP,
RE_START,
RE_UNEXPECTED_ACTION,
RE_UNEXPECTED_ERRNO,
RE_UNEXPECTED_STATUS,
RE_WRONGSEC,
RE_LOST_STATE_BAD_OP,
RE_REFERRAL
} nfs4_event_type_t;
typedef enum {
RFS_NO_INSPECT,
RFS_INSPECT
} nfs4_fact_status_t;
typedef enum {
RF_BADOWNER,
RF_ERR,
RF_RENEW_EXPIRED,
RF_SRV_NOT_RESPOND,
RF_SRV_OK,
RF_SRVS_NOT_RESPOND,
RF_SRVS_OK,
RF_DELMAP_CB_ERR,
RF_SENDQ_FULL
} nfs4_fact_type_t;
typedef enum {
NFS4_MS_DUMP,
NFS4_MS_NO_DUMP
} nfs4_msg_status_t;
typedef struct nfs4_rfact {
nfs4_fact_type_t rf_type;
nfs4_fact_status_t rf_status;
bool_t rf_reboot;
nfs4_recov_t rf_action;
nfs_opnum4 rf_op;
nfsstat4 rf_stat4;
timespec_t rf_time;
int rf_error;
struct rnode4 *rf_rp1;
char *rf_char1;
} nfs4_rfact_t;
typedef struct nfs4_revent {
nfs4_event_type_t re_type;
nfsstat4 re_stat4;
uint_t re_uint;
pid_t re_pid;
struct mntinfo4 *re_mi;
struct rnode4 *re_rp1;
struct rnode4 *re_rp2;
char *re_char1;
char *re_char2;
nfs4_tag_type_t re_tag1;
nfs4_tag_type_t re_tag2;
seqid4 re_seqid1;
seqid4 re_seqid2;
} nfs4_revent_t;
typedef enum {
RM_EVENT,
RM_FACT
} nfs4_msg_type_t;
typedef struct nfs4_debug_msg {
timespec_t msg_time;
nfs4_msg_type_t msg_type;
char *msg_srv;
char *msg_mntpt;
union {
nfs4_rfact_t msg_fact;
nfs4_revent_t msg_event;
} rmsg_u;
nfs4_msg_status_t msg_status;
list_node_t msg_node;
} nfs4_debug_msg_t;
/*
* NFS private data per mounted file system
* The mi_lock mutex protects the following fields:
* mi_flags
* mi_in_recovery
* mi_recovflags
* mi_recovthread
* mi_error
* mi_printed
* mi_down
* mi_stsize
* mi_curread
* mi_curwrite
* mi_timers
* mi_curr_serv
* mi_klmconfig
* mi_oo_list
* mi_foo_list
* mi_foo_num
* mi_foo_max
* mi_lost_state
* mi_bseqid_list
* mi_ephemeral
* mi_ephemeral_tree
*
* Normally the netconfig information for the mount comes from
* mi_curr_serv and mi_klmconfig is NULL. If NLM calls need to use a
* different transport, mi_klmconfig contains the necessary netconfig
* information.
*
* The mi_async_lock mutex protects the following fields:
* mi_async_reqs
* mi_async_req_count
* mi_async_tail
* mi_async_curr[NFS4_MAX_ASYNC_QUEUES]
* mi_async_clusters
* mi_async_init_clusters
* mi_threads[NFS4_MAX_ASYNC_QUEUES]
* mi_inactive_thread
* mi_manager_thread
*
* The nfs4_server_t::s_lock protects the following fields:
* mi_clientid
* mi_clientid_next
* mi_clientid_prev
* mi_open_files
*
* The mntinfo4_t::mi_recovlock protects the following fields:
* mi_srvsettime
* mi_srvset_cnt
* mi_srv
*
* Changing mi_srv from one nfs4_server_t to a different one requires
* holding the mi_recovlock as RW_WRITER.
* Exception: setting mi_srv the first time in mount/mountroot is done
* holding the mi_recovlock as RW_READER.
*
* Locking order:
* mi4_globals::mig_lock > mi_async_lock
* mi_async_lock > nfs4_server_t::s_lock > mi_lock
* mi_recovlock > mi_rename_lock > nfs_rtable4_lock
* nfs4_server_t::s_recovlock > mi_recovlock
* rnode4_t::r_rwlock > mi_rename_lock
* nfs_rtable4_lock > mi_lock
* nfs4_server_t::s_lock > mi_msg_list_lock
* mi_recovlock > nfs4_server_t::s_lock
* mi_recovlock > nfs4_server_lst_lock
*
* The 'mi_oo_list' represents the hash buckets that contain the
* nfs4_open_owenrs for this particular mntinfo4.
*
* The 'mi_foo_list' represents the freed nfs4_open_owners for this mntinfo4.
* 'mi_foo_num' is the current number of freed open owners on the list,
* 'mi_foo_max' is the maximum number of freed open owners that are allowable
* on the list.
*
* mi_rootfh and mi_srvparentfh are read-only once created, but that just
* refers to the pointer. The contents must be updated to keep in sync
* with mi_curr_serv.
*
* The mi_msg_list_lock protects against adding/deleting entries to the
* mi_msg_list, and also the updating/retrieving of mi_lease_period;
*
* 'mi_zone' is initialized at structure creation time, and never
* changes; it may be read without a lock.
*
* mi_zone_node is linkage into the mi4_globals.mig_list, and is
* protected by mi4_globals.mig_list_lock.
*
* If MI4_EPHEMERAL is set in mi_flags, then mi_ephemeral points to an
* ephemeral structure for this ephemeral mount point. It can not be
* NULL. Also, mi_ephemeral_tree points to the root of the ephemeral
* tree.
*
* If MI4_EPHEMERAL is not set in mi_flags, then mi_ephemeral has
* to be NULL. If mi_ephemeral_tree is non-NULL, then this node
* is the enclosing mntinfo4 for the ephemeral tree.
*/
struct zone;
struct nfs4_ephemeral;
struct nfs4_ephemeral_tree;
struct nfs4_server;
typedef struct mntinfo4 {
kmutex_t mi_lock; /* protects mntinfo4 fields */
struct servinfo4 *mi_servers; /* server list */
struct servinfo4 *mi_curr_serv; /* current server */
struct nfs4_sharedfh *mi_rootfh; /* root filehandle */
struct nfs4_sharedfh *mi_srvparentfh; /* root's parent on server */
kcondvar_t mi_failover_cv; /* failover synchronization */
struct vfs *mi_vfsp; /* back pointer to vfs */
enum vtype mi_type; /* file type of the root vnode */
uint_t mi_flags; /* see below */
uint_t mi_recovflags; /* if recovery active; see below */
kthread_t *mi_recovthread; /* active recov thread or NULL */
uint_t mi_error; /* only set/valid when MI4_RECOV_FAIL */
/* is set in mi_flags */
int mi_tsize; /* transfer size (bytes) */
/* really read size */
int mi_stsize; /* server's max transfer size (bytes) */
/* really write size */
int mi_timeo; /* inital timeout in 10th sec */
int mi_retrans; /* times to retry request */
hrtime_t mi_acregmin; /* min time to hold cached file attr */
hrtime_t mi_acregmax; /* max time to hold cached file attr */
hrtime_t mi_acdirmin; /* min time to hold cached dir attr */
hrtime_t mi_acdirmax; /* max time to hold cached dir attr */
len_t mi_maxfilesize; /* for pathconf _PC_FILESIZEBITS */
int mi_curread; /* current read size */
int mi_curwrite; /* current write size */
uint_t mi_count; /* ref count */
/*
* Async I/O management
* We have 2 pools of threads working on async I/O:
* (1) Threads which work on all async queues. Default number of
* threads in this queue is 8. Threads in this pool work on async
* queue pointed by mi_async_curr[NFS4_ASYNC_QUEUE]. Number of
* active threads in this pool is tracked by
* mi_threads[NFS4_ASYNC_QUEUE].
* (ii)Threads which work only on page op async queues.
* Page ops queue comprises of NFS4_PUTAPAGE, NFS4_PAGEIO &
* NFS4_COMMIT. Default number of threads in this queue is 2
* (NUM_ASYNC_PGOPS_THREADS). Threads in this pool work on async
* queue pointed by mi_async_curr[NFS4_ASYNC_PGOPS_QUEUE]. Number
* of active threads in this pool is tracked by
* mi_threads[NFS4_ASYNC_PGOPS_QUEUE].
*
* In addition to above two pools, there is always one thread that
* handles over-the-wire requests for VOP_INACTIVE.
*/
struct nfs4_async_reqs *mi_async_reqs[NFS4_ASYNC_TYPES];
struct nfs4_async_reqs *mi_async_tail[NFS4_ASYNC_TYPES];
struct nfs4_async_reqs **mi_async_curr[NFS4_MAX_ASYNC_QUEUES];
/* current async queue */
uint_t mi_async_clusters[NFS4_ASYNC_TYPES];
uint_t mi_async_init_clusters;
uint_t mi_async_req_count; /* # outstanding work requests */
kcondvar_t mi_async_reqs_cv; /* signaled when there's work */
ushort_t mi_threads[NFS4_MAX_ASYNC_QUEUES];
/* number of active async threads */
ushort_t mi_max_threads; /* max number of async threads */
kthread_t *mi_manager_thread; /* async manager thread id */
kthread_t *mi_inactive_thread; /* inactive thread id */
kcondvar_t mi_inact_req_cv; /* notify VOP_INACTIVE thread */
kcondvar_t mi_async_work_cv[NFS4_MAX_ASYNC_QUEUES];
/* tell workers to work */
kcondvar_t mi_async_cv; /* all pool threads exited */
kmutex_t mi_async_lock;
/*
* Other stuff
*/
struct pathcnf *mi_pathconf; /* static pathconf kludge */
rpcprog_t mi_prog; /* RPC program number */
rpcvers_t mi_vers; /* RPC program version number */
char **mi_rfsnames; /* mapping to proc names */
kstat_named_t *mi_reqs; /* count of requests */
clock_t mi_printftime; /* last error printf time */
nfs_rwlock_t mi_recovlock; /* separate ops from recovery (v4) */
time_t mi_grace_wait; /* non-zero represents time to wait */
/* when we switched nfs4_server_t - only for observability purposes */
time_t mi_srvsettime;
nfs_rwlock_t mi_rename_lock; /* atomic volfh rename */
struct nfs4_fname *mi_fname; /* root fname */
list_t mi_lost_state; /* resend list */
list_t mi_bseqid_list; /* bad seqid list */
/*
* Client Side Failover stats
*/
uint_t mi_noresponse; /* server not responding count */
uint_t mi_failover; /* failover to new server count */
uint_t mi_remap; /* remap to new server count */
/*
* Kstat statistics
*/
struct kstat *mi_io_kstats;
struct kstat *mi_ro_kstats;
kstat_t *mi_recov_ksp; /* ptr to the recovery kstat */
/*
* Volatile fh flags (nfsv4)
*/
uint32_t mi_fh_expire_type;
/*
* Lease Management
*/
struct mntinfo4 *mi_clientid_next;
struct mntinfo4 *mi_clientid_prev;
clientid4 mi_clientid; /* redundant info found in nfs4_server */
int mi_open_files; /* count of open files */
int mi_in_recovery; /* count of recovery instances */
kcondvar_t mi_cv_in_recov; /* cv for recovery threads */
/*
* Open owner stuff.
*/
struct nfs4_oo_hash_bucket mi_oo_list[NFS4_NUM_OO_BUCKETS];
list_t mi_foo_list;
int mi_foo_num;
int mi_foo_max;
/*
* Shared filehandle pool.
*/
nfs_rwlock_t mi_fh_lock;
avl_tree_t mi_filehandles;
/*
* Debug message queue.
*/
list_t mi_msg_list;
int mi_msg_count;
time_t mi_lease_period;
/*
* not guaranteed to be accurate.
* only should be used by debug queue.
*/
kmutex_t mi_msg_list_lock;
/*
* Zones support.
*/
struct zone *mi_zone; /* Zone in which FS is mounted */
zone_ref_t mi_zone_ref; /* Reference to aforementioned zone */
list_node_t mi_zone_node; /* linkage into per-zone mi list */
/*
* Links for unmounting ephemeral mounts.
*/
struct nfs4_ephemeral *mi_ephemeral;
struct nfs4_ephemeral_tree *mi_ephemeral_tree;
uint_t mi_srvset_cnt; /* increment when changing the nfs4_server_t */
struct nfs4_server *mi_srv; /* backpointer to nfs4_server_t */
/*
* Referral related info.
*/
int mi_vfs_referral_loop_cnt;
/*
* List of rnode4_t structures that belongs to this mntinfo4
*/
kmutex_t mi_rnodes_lock; /* protects the mi_rnodes list */
list_t mi_rnodes; /* the list */
} mntinfo4_t;
/*
* The values for mi_flags.
*
* MI4_HARD hard or soft mount
* MI4_PRINTED responding message printed
* MI4_INT allow INTR on hard mount
* MI4_DOWN server is down
* MI4_NOAC don't cache attributes
* MI4_NOCTO no close-to-open consistency
* MI4_LLOCK local locking only (no lockmgr)
* MI4_GRPID System V group id inheritance
* MI4_SHUTDOWN System is rebooting or shutting down
* MI4_LINK server supports link
* MI4_SYMLINK server supports symlink
* MI4_EPHEMERAL_RECURSED an ephemeral mount being unmounted
* due to a recursive call - no need
* for additional recursion
* MI4_ACL server supports NFSv4 ACLs
* MI4_MIRRORMOUNT is a mirrormount
* MI4_NOPRINT don't print messages
* MI4_DIRECTIO do direct I/O
* MI4_RECOV_ACTIV filesystem has recovery a thread
* MI4_REMOVE_ON_LAST_CLOSE remove from server's list
* MI4_RECOV_FAIL client recovery failed
* MI4_PUBLIC public/url option used
* MI4_MOUNTING mount in progress, don't failover
* MI4_POSIX_LOCK if server is using POSIX locking
* MI4_LOCK_DEBUG cmn_err'd posix lock err msg
* MI4_DEAD zone has released it
* MI4_INACTIVE_IDLE inactive thread idle
* MI4_BADOWNER_DEBUG badowner error msg per mount
* MI4_ASYNC_MGR_STOP tell async manager to die
* MI4_TIMEDOUT saw a timeout during zone shutdown
* MI4_EPHEMERAL is an ephemeral mount
*/
#define MI4_HARD 0x1
#define MI4_PRINTED 0x2
#define MI4_INT 0x4
#define MI4_DOWN 0x8
#define MI4_NOAC 0x10
#define MI4_NOCTO 0x20
#define MI4_LLOCK 0x80
#define MI4_GRPID 0x100
#define MI4_SHUTDOWN 0x200
#define MI4_LINK 0x400
#define MI4_SYMLINK 0x800
#define MI4_EPHEMERAL_RECURSED 0x1000
#define MI4_ACL 0x2000
/* MI4_MIRRORMOUNT is also defined in nfsstat.c */
#define MI4_MIRRORMOUNT 0x4000
#define MI4_REFERRAL 0x8000
/* 0x10000 is available */
#define MI4_NOPRINT 0x20000
#define MI4_DIRECTIO 0x40000
/* 0x80000 is available */
#define MI4_RECOV_ACTIV 0x100000
#define MI4_REMOVE_ON_LAST_CLOSE 0x200000
#define MI4_RECOV_FAIL 0x400000
#define MI4_PUBLIC 0x800000
#define MI4_MOUNTING 0x1000000
#define MI4_POSIX_LOCK 0x2000000
#define MI4_LOCK_DEBUG 0x4000000
#define MI4_DEAD 0x8000000
#define MI4_INACTIVE_IDLE 0x10000000
#define MI4_BADOWNER_DEBUG 0x20000000
#define MI4_ASYNC_MGR_STOP 0x40000000
#define MI4_TIMEDOUT 0x80000000
#define MI4_EPHEMERAL (MI4_MIRRORMOUNT | MI4_REFERRAL)
#define INTR4(vp) (VTOMI4(vp)->mi_flags & MI4_INT)
#define FAILOVER_MOUNT4(mi) (mi->mi_servers->sv_next)
/*
* Recovery flags.
*
* MI4R_NEED_CLIENTID is sort of redundant (it's the nfs4_server_t flag
* that's important), but some flag is needed to indicate that recovery is
* going on for the filesystem.
*/
#define MI4R_NEED_CLIENTID 0x1
#define MI4R_REOPEN_FILES 0x2
#define MI4R_NEED_SECINFO 0x4
#define MI4R_NEED_NEW_SERVER 0x8
#define MI4R_REMAP_FILES 0x10
#define MI4R_SRV_REBOOT 0x20 /* server has rebooted */
#define MI4R_LOST_STATE 0x40
#define MI4R_BAD_SEQID 0x80
#define MI4R_MOVED 0x100
#define MI4_HOLD(mi) { \
mi_hold(mi); \
}
#define MI4_RELE(mi) { \
mi_rele(mi); \
}
/*
* vfs pointer to mount info
*/
#define VFTOMI4(vfsp) ((mntinfo4_t *)((vfsp)->vfs_data))
/*
* vnode pointer to mount info
*/
#define VTOMI4(vp) ((mntinfo4_t *)(((vp)->v_vfsp)->vfs_data))
/*
* Lease Management
*
* lease_valid is initially set to NFS4_LEASE_NOT_STARTED. This is when the
* nfs4_server is first created. lease_valid is then set to
* NFS4_LEASE_UNITIALIZED when the renew thread is started. The extra state of
* NFS4_LEASE_NOT_STARTED is needed for client recovery (so we know if a thread
* already exists when we do SETCLIENTID). lease_valid is then set to
* NFS4_LEASE_VALID (if it is at NFS4_LEASE_UNITIALIZED) when a state creating
* operation (OPEN) is done. lease_valid stays at NFS4_LEASE_VALID as long as
* the lease is renewed. It is set to NFS4_LEASE_INVALID when the lease
* expires. Client recovery is needed to set the lease back to
* NFS4_LEASE_VALID from NFS4_LEASE_INVALID.
*
* The s_cred is the credential used to mount the first file system for this
* server. It used as the credential for the renew thread's calls to the
* server.
*
* The renew thread waits on the condition variable cv_thread_exit. If the cv
* is signalled, then the thread knows it must check s_thread_exit to see if
* it should exit. The cv is signaled when the last file system is unmounted
* from a particular server. s_thread_exit is set to 0 upon thread startup,
* and set to NFS4_THREAD_EXIT, when the last file system is unmounted thereby
* telling the thread to exit. s_thread_exit is needed to avoid spurious
* wakeups.
*
* state_ref_count is incremented every time a new file is opened and
* decremented every time a file is closed otw. This keeps track of whether
* the nfs4_server has state associated with it or not.
*
* s_refcnt is the reference count for storage management of the struct
* itself.
*
* mntinfo4_list points to the doubly linked list of mntinfo4s that share
* this nfs4_server (ie: <clientid, saddr> pair) in the current zone. This is
* needed for a nfs4_server to get a mntinfo4 for use in rfs4call.
*
* s_recovlock is used to synchronize recovery operations. The thread
* that is recovering the client must acquire it as a writer. If the
* thread is using the clientid (including recovery operations on other
* state), acquire it as a reader.
*
* The 's_otw_call_count' keeps track of the number of outstanding over the
* wire requests for this structure. The struct will not go away as long
* as this is non-zero (or s_refcnt is non-zero).
*
* The 's_cv_otw_count' is used in conjuntion with the 's_otw_call_count'
* variable to let the renew thread when an outstanding otw request has
* finished.
*
* 'zoneid' and 'zone_globals' are set at creation of this structure
* and are read-only after that; no lock is required to read them.
*
* s_lock protects: everything except cv_thread_exit and s_recovlock.
*
* s_program is used as the index into the nfs4_callback_globals's
* nfs4prog2server table. When a callback request comes in, we can
* use that request's program number (minus NFS4_CALLBACK) as an index
* into the nfs4prog2server. That entry will hold the nfs4_server_t ptr.
* We can then access that nfs4_server_t and its 's_deleg_list' (its list of
* delegated rnode4_ts).
*
* Lock order:
* nfs4_server::s_lock > mntinfo4::mi_lock
* nfs_rtable4_lock > s_lock
* nfs4_server_lst_lock > s_lock
* s_recovlock > s_lock
*/
struct nfs4_callback_globals;
typedef struct nfs4_server {
struct nfs4_server *forw;
struct nfs4_server *back;
struct netbuf saddr;
uint_t s_flags; /* see below */
uint_t s_refcnt;
clientid4 clientid; /* what we get from server */
nfs_client_id4 clidtosend; /* what we send to server */
mntinfo4_t *mntinfo4_list;
int lease_valid;
time_t s_lease_time;
time_t last_renewal_time;
timespec_t propagation_delay;
cred_t *s_cred;
kcondvar_t cv_thread_exit;
int s_thread_exit;
int state_ref_count;
int s_otw_call_count;
kcondvar_t s_cv_otw_count;
kcondvar_t s_clientid_pend;
kmutex_t s_lock;
list_t s_deleg_list;
rpcprog_t s_program;
nfs_rwlock_t s_recovlock;
kcondvar_t wait_cb_null; /* used to wait for CB_NULL */
zoneid_t zoneid; /* zone using this nfs4_server_t */
struct nfs4_callback_globals *zone_globals; /* globals */
} nfs4_server_t;
/* nfs4_server flags */
#define N4S_CLIENTID_SET 1 /* server has our clientid */
#define N4S_CLIENTID_PEND 0x2 /* server doesn't have clientid */
#define N4S_CB_PINGED 0x4 /* server has sent us a CB_NULL */
#define N4S_CB_WAITER 0x8 /* is/has wait{ing/ed} for cb_null */
#define N4S_INSERTED 0x10 /* list has reference for server */
#define N4S_BADOWNER_DEBUG 0x20 /* bad owner err msg per client */
#define N4S_CB_PAUSE_TIME 10000 /* Amount of time to pause (10ms) */
struct lease_time_arg {
time_t lease_time;
};
enum nfs4_delegreturn_policy {
IMMEDIATE,
FIRSTCLOSE,
LASTCLOSE,
INACTIVE
};
/*
* Operation hints for the recovery framework (mostly).
*
* EXCEPTIONS:
* OH_ACCESS, OH_GETACL, OH_GETATTR, OH_LOOKUP, OH_READDIR
* These hints exist to allow user visit/readdir a R4SRVSTUB dir.
* (dir represents the root of a server fs that has not yet been
* mounted at client)
*/
typedef enum {
OH_OTHER,
OH_READ,
OH_WRITE,
OH_COMMIT,
OH_VFH_RENAME,
OH_MOUNT,
OH_CLOSE,
OH_LOCKU,
OH_DELEGRETURN,
OH_ACCESS,
OH_GETACL,
OH_GETATTR,
OH_LOOKUP,
OH_READDIR
} nfs4_op_hint_t;
/*
* This data structure is used to track ephemeral mounts for both
* mirror mounts and referrals.
*
* Note that each nfs4_ephemeral can only have one other nfs4_ephemeral
* pointing at it. So we don't need two backpointers to walk
* back up the tree.
*
* An ephemeral tree is pointed to by an enclosing non-ephemeral
* mntinfo4. The root is also pointed to by its ephemeral
* mntinfo4. ne_child will get us back to it, while ne_prior
* will get us back to the non-ephemeral mntinfo4. This is an
* edge case we will need to be wary of when walking back up the
* tree.
*
* The way we handle this edge case is to have ne_prior be NULL
* for the root nfs4_ephemeral node.
*/
typedef struct nfs4_ephemeral {
mntinfo4_t *ne_mount; /* who encloses us */
struct nfs4_ephemeral *ne_child; /* first child node */
struct nfs4_ephemeral *ne_peer; /* next sibling */
struct nfs4_ephemeral *ne_prior; /* who points at us */
time_t ne_ref_time; /* time last referenced */
uint_t ne_mount_to; /* timeout at */
int ne_state; /* used to traverse */
} nfs4_ephemeral_t;
/*
* State for the node (set in ne_state):
*/
#define NFS4_EPHEMERAL_OK 0x0
#define NFS4_EPHEMERAL_VISIT_CHILD 0x1
#define NFS4_EPHEMERAL_VISIT_SIBLING 0x2
#define NFS4_EPHEMERAL_PROCESS_ME 0x4
#define NFS4_EPHEMERAL_CHILD_ERROR 0x8
#define NFS4_EPHEMERAL_PEER_ERROR 0x10
/*
* These are the locks used in processing ephemeral data:
*
* mi->mi_lock
*
* net->net_tree_lock
* This lock is used to gate all tree operations.
* If it is held, then no other process may
* traverse the tree. This allows us to not
* throw a hold on each vfs_t in the tree.
* Can be held for a "long" time.
*
* net->net_cnt_lock
* Used to protect refcnt and status.
* Must be held for a really short time.
*
* nfs4_ephemeral_thread_lock
* Is only held to create the harvester for the zone.
* There is no ordering imposed on it.
* Held for a really short time.
*
* Some further detail on the interactions:
*
* net_tree_lock controls access to net_root. Access needs to first be
* attempted in a non-blocking check.
*
* net_cnt_lock controls access to net_refcnt and net_status. It must only be
* held for very short periods of time, unless the refcnt is 0 and the status
* is INVALID.
*
* Before a caller can grab net_tree_lock, it must first grab net_cnt_lock
* to bump the net_refcnt. It then releases it and does the action specific
* algorithm to get the net_tree_lock. Once it has that, then it is okay to
* grab the net_cnt_lock and change the status. The status can only be
* changed if the caller has the net_tree_lock held as well.
*
* Note that the initial grab of net_cnt_lock must occur whilst
* mi_lock is being held. This prevents stale data in that if the
* ephemeral tree is non-NULL, then the harvester can not remove
* the tree from the mntinfo node until it grabs that lock. I.e.,
* we get the pointer to the tree and hold the lock atomically
* with respect to being in mi_lock.
*
* When a caller is done with net_tree_lock, it can decrement the net_refcnt
* either before it releases net_tree_lock or after.
*
* In either event, to decrement net_refcnt, it must hold net_cnt_lock.
*
* Note that the overall locking scheme for the nodes is to control access
* via the tree. The current scheme could easily be extended such that
* the enclosing root referenced a "forest" of trees. The underlying trees
* would be autonomous with respect to locks.
*
* Note that net_next is controlled by external locks
* particular to the data structure that the tree is being added to.
*/
typedef struct nfs4_ephemeral_tree {
mntinfo4_t *net_mount;
nfs4_ephemeral_t *net_root;
struct nfs4_ephemeral_tree *net_next;
kmutex_t net_tree_lock;
kmutex_t net_cnt_lock;
uint_t net_status;
uint_t net_refcnt;
} nfs4_ephemeral_tree_t;
/*
* State for the tree (set in net_status):
*/
#define NFS4_EPHEMERAL_TREE_OK 0x0
#define NFS4_EPHEMERAL_TREE_BUILDING 0x1
#define NFS4_EPHEMERAL_TREE_DEROOTING 0x2
#define NFS4_EPHEMERAL_TREE_INVALID 0x4
#define NFS4_EPHEMERAL_TREE_MOUNTING 0x8
#define NFS4_EPHEMERAL_TREE_UMOUNTING 0x10
#define NFS4_EPHEMERAL_TREE_LOCKED 0x20
#define NFS4_EPHEMERAL_TREE_PROCESSING (NFS4_EPHEMERAL_TREE_DEROOTING | \
NFS4_EPHEMERAL_TREE_INVALID | NFS4_EPHEMERAL_TREE_UMOUNTING | \
NFS4_EPHEMERAL_TREE_LOCKED)
/*
* This macro evaluates to non-zero if the given op releases state at the
* server.
*/
#define OH_IS_STATE_RELE(op) ((op) == OH_CLOSE || (op) == OH_LOCKU || \
(op) == OH_DELEGRETURN)
#ifdef _KERNEL
extern void nfs4_async_manager(struct vfs *);
extern void nfs4_async_manager_stop(struct vfs *);
extern void nfs4_async_stop(struct vfs *);
extern int nfs4_async_stop_sig(struct vfs *);
extern int nfs4_async_readahead(vnode_t *, u_offset_t, caddr_t,
struct seg *, cred_t *,
void (*)(vnode_t *, u_offset_t,
caddr_t, struct seg *, cred_t *));
extern int nfs4_async_putapage(vnode_t *, page_t *, u_offset_t, size_t,
int, cred_t *, int (*)(vnode_t *, page_t *,
u_offset_t, size_t, int, cred_t *));
extern int nfs4_async_pageio(vnode_t *, page_t *, u_offset_t, size_t,
int, cred_t *, int (*)(vnode_t *, page_t *,
u_offset_t, size_t, int, cred_t *));
extern void nfs4_async_commit(vnode_t *, page_t *, offset3, count3,
cred_t *, void (*)(vnode_t *, page_t *,
offset3, count3, cred_t *));
extern void nfs4_async_inactive(vnode_t *, cred_t *);
extern void nfs4_inactive_thread(mntinfo4_t *mi);
extern void nfs4_inactive_otw(vnode_t *, cred_t *);
extern int nfs4_putpages(vnode_t *, u_offset_t, size_t, int, cred_t *);
extern int nfs4_setopts(vnode_t *, model_t, struct nfs_args *);
extern void nfs4_mnt_kstat_init(struct vfs *);
extern void rfs4call(struct mntinfo4 *, struct COMPOUND4args_clnt *,
struct COMPOUND4res_clnt *, cred_t *, int *, int,
nfs4_error_t *);
extern void nfs4_acl_fill_cache(struct rnode4 *, vsecattr_t *);
extern int nfs4_attr_otw(vnode_t *, nfs4_tag_type_t,
nfs4_ga_res_t *, bitmap4, cred_t *);
extern void nfs4_attrcache_noinval(vnode_t *, nfs4_ga_res_t *, hrtime_t);
extern void nfs4_attr_cache(vnode_t *, nfs4_ga_res_t *,
hrtime_t, cred_t *, int,
change_info4 *);
extern void nfs4_purge_rddir_cache(vnode_t *);
extern void nfs4_invalidate_pages(vnode_t *, u_offset_t, cred_t *);
extern void nfs4_purge_caches(vnode_t *, int, cred_t *, int);
extern void nfs4_purge_stale_fh(int, vnode_t *, cred_t *);
extern void nfs4_flush_pages(vnode_t *vp, cred_t *cr);
extern void nfs4rename_update(vnode_t *, vnode_t *, nfs_fh4 *, char *);
extern void nfs4_update_paths(vnode_t *, char *, vnode_t *, char *,
vnode_t *);
extern void nfs4args_lookup_free(nfs_argop4 *, int);
extern void nfs4args_copen_free(OPEN4cargs *);
extern void nfs4_printfhandle(nfs4_fhandle_t *);
extern void nfs_free_mi4(mntinfo4_t *);
extern void sv4_free(servinfo4_t *);
extern void nfs4_mi_zonelist_add(mntinfo4_t *);
extern int nfs4_mi_zonelist_remove(mntinfo4_t *);
extern int nfs4_secinfo_recov(mntinfo4_t *, vnode_t *, vnode_t *);
extern void nfs4_secinfo_init(void);
extern void nfs4_secinfo_fini(void);
extern int nfs4_secinfo_path(mntinfo4_t *, cred_t *, int);
extern int nfs4_secinfo_vnode_otw(vnode_t *, char *, cred_t *);
extern void secinfo_free(sv_secinfo_t *);
extern void save_mnt_secinfo(servinfo4_t *);
extern void check_mnt_secinfo(servinfo4_t *, vnode_t *);
extern int vattr_to_fattr4(vattr_t *, vsecattr_t *, fattr4 *, int,
enum nfs_opnum4, bitmap4 supp_mask);
extern int nfs4_putapage(vnode_t *, page_t *, u_offset_t *, size_t *,
int, cred_t *);
extern void nfs4_write_error(vnode_t *, int, cred_t *);
extern void nfs4_lockcompletion(vnode_t *, int);
extern bool_t nfs4_map_lost_lock_conflict(vnode_t *);
extern int vtodv(vnode_t *, vnode_t **, cred_t *, bool_t);
extern int vtoname(vnode_t *, char *, ssize_t);
extern void nfs4open_confirm(vnode_t *, seqid4*, stateid4 *, cred_t *,
bool_t, bool_t *, nfs4_open_owner_t *, bool_t,
nfs4_error_t *, int *);
extern void nfs4_error_zinit(nfs4_error_t *);
extern void nfs4_error_init(nfs4_error_t *, int);
extern void nfs4_free_args(struct nfs_args *);
extern void mi_hold(mntinfo4_t *);
extern void mi_rele(mntinfo4_t *);
extern vnode_t *find_referral_stubvp(vnode_t *, char *, cred_t *);
extern int nfs4_setup_referral(vnode_t *, char *, vnode_t **, cred_t *);
extern sec_data_t *copy_sec_data(sec_data_t *);
extern gss_clntdata_t *copy_sec_data_gss(gss_clntdata_t *);
#ifdef DEBUG
extern int nfs4_consistent_type(vnode_t *);
#endif
extern void nfs4_init_dot_entries(void);
extern void nfs4_destroy_dot_entries(void);
extern struct nfs4_callback_globals *nfs4_get_callback_globals(void);
extern struct nfs4_server nfs4_server_lst;
extern clock_t nfs_write_error_interval;
#endif /* _KERNEL */
/*
* Flags for nfs4getfh_otw.
*/
#define NFS4_GETFH_PUBLIC 0x01
#define NFS4_GETFH_NEEDSOP 0x02
/*
* Found through rnodes.
*
* The os_open_ref_count keeps track the number of open file descriptor
* references on this data structure. It will be bumped for any successful
* OTW OPEN call and any OPEN call that determines the OTW call is not
* necessary and the open stream hasn't just been created (see
* nfs4_is_otw_open_necessary).
*
* os_mapcnt is a count of the number of mmapped pages for a particular
* open stream; this in conjunction w/ os_open_ref_count is used to
* determine when to do a close to the server. This is necessary because
* of the semantics of doing open, mmap, close; the OTW close must be wait
* until all open and mmap references have vanished.
*
* 'os_valid' tells us whether this structure is about to be freed or not,
* if it is then don't return it in find_open_stream().
*
* 'os_final_close' is set when a CLOSE OTW was attempted. This is needed
* so we can properly count the os_open_ref_count in cases where we VOP_CLOSE
* without a VOP_OPEN, and have nfs4_inactive() drive the OTW CLOSE. It
* also helps differentiate the VOP_OPEN/VN_RELE case from the VOP_CLOSE
* that tried to close OTW but failed, and left the state cleanup to
* nfs4_inactive/CLOSE_FORCE.
*
* 'os_force_close' is used to let us know if an intervening thread came
* and reopened the open stream after we decided to issue a CLOSE_FORCE,
* but before we could actually process the CLOSE_FORCE.
*
* 'os_pending_close' is set when an over-the-wire CLOSE is deferred to the
* lost state queue.
*
* 'open_stateid' is set to the last open stateid returned by the server unless
* 'os_delegation' is 1, in which case 'open_stateid' refers to the
* delegation stateid returned by the server. This is used in cases where the
* client tries to OPEN a file but already has a suitable delegation, so we
* just stick the delegation stateid in the open stream.
*
* os_dc_openacc are open access bits which have been granted to the
* open stream by virtue of a delegation, but which have not been seen
* by the server. This applies even if the open stream does not have
* os_delegation set. These bits are used when setting file locks to
* determine whether an open with CLAIM_DELEGATE_CUR needs to be done
* before the lock request can be sent to the server. See
* nfs4frlock_check_deleg().
*
* 'os_mmap_read/write' keep track of the read and write access our memory
* maps require. We need to keep track of this so we can provide the proper
* access bits in the open/mmap/close/reboot/reopen case.
*
* 'os_failed_reopen' tells us that we failed to successfully reopen this
* open stream; therefore, we should not use this open stateid as it is
* not valid anymore. This flag is also used to indicate an unsuccessful
* attempt to reopen a delegation open stream with CLAIM_DELEGATE_CUR.
*
* If 'os_orig_oo_name' is different than os_open_owner's oo_name
* then this tells us that this open stream's open owner used a
* bad seqid (that is, got NFS4ERR_BAD_SEQID). If different, this open
* stream will no longer be used for future OTW state releasing calls.
*
* Lock ordering:
* rnode4_t::r_os_lock > os_sync_lock
* os_sync_lock > rnode4_t::r_statelock
* os_sync_lock > rnode4_t::r_statev4_lock
* os_sync_lock > mntinfo4_t::mi_lock (via hold over rfs4call)
*
* The 'os_sync_lock' protects:
* open_stateid
* os_dc_openacc
* os_delegation
* os_failed_reopen
* os_final_close
* os_force_close
* os_mapcnt
* os_mmap_read
* os_mmap_write
* os_open_ref_count
* os_pending_close
* os_share_acc_read
* os_share_acc_write
* os_share_deny_none
* os_share_deny_read
* os_share_deny_write
* os_ref_count
* os_valid
*
* The rnode4_t::r_os_lock protects:
* os_node
*
* These fields are set at creation time and
* read only after that:
* os_open_owner
* os_orig_oo_name
*/
typedef struct nfs4_open_stream {
uint64_t os_share_acc_read;
uint64_t os_share_acc_write;
uint64_t os_mmap_read;
uint64_t os_mmap_write;
uint32_t os_share_deny_none;
uint32_t os_share_deny_read;
uint32_t os_share_deny_write;
stateid4 open_stateid;
int os_dc_openacc;
int os_ref_count;
unsigned os_valid:1;
unsigned os_delegation:1;
unsigned os_final_close:1;
unsigned os_pending_close:1;
unsigned os_failed_reopen:1;
unsigned os_force_close:1;
int os_open_ref_count;
long os_mapcnt;
list_node_t os_node;
struct nfs4_open_owner *os_open_owner;
uint64_t os_orig_oo_name;
kmutex_t os_sync_lock;
} nfs4_open_stream_t;
/*
* This structure describes the format of the lock_owner_name
* field of the lock owner.
*/
typedef struct nfs4_lo_name {
uint64_t ln_seq_num;
pid_t ln_pid;
} nfs4_lo_name_t;
/*
* Flags for lo_flags.
*/
#define NFS4_LOCK_SEQID_INUSE 0x1
#define NFS4_BAD_SEQID_LOCK 0x2
/*
* The lo_prev_rnode and lo_next_rnode are for a circular list that hangs
* off the rnode. If the links are NULL it means this object is not on the
* list.
*
* 'lo_pending_rqsts' is non-zero if we ever tried to send a request and
* didn't get a response back. This is used to figure out if we have
* possible remote v4 locks, so that we can clean up at process exit. In
* theory, the client should be able to figure out if the server received
* the request (based on what seqid works), so maybe we can get rid of this
* flag someday.
*
* 'lo_ref_count' tells us how many processes/threads are using this data
* structure. The rnode's list accounts for one reference.
*
* 'lo_just_created' is set to NFS4_JUST_CREATED when we first create the
* data structure. It is then set to NFS4_PERM_CREATED when a lock request
* is successful using this lock owner structure. We need to keep 'temporary'
* lock owners around so we can properly keep the lock seqid synchronization
* when multiple processes/threads are trying to create the lock owner for the
* first time (especially with the DENIED error case). Once
* 'lo_just_created' is set to NFS4_PERM_CREATED, it doesn't change.
*
* 'lo_valid' tells us whether this structure is about to be freed or not,
* if it is then don't return it from find_lock_owner().
*
* Retrieving and setting of 'lock_seqid' is protected by the
* NFS4_LOCK_SEQID_INUSE flag. Waiters for NFS4_LOCK_SEQID_INUSE should
* use 'lo_cv_seqid_sync'.
*
* The setting of 'lock_stateid' is protected by the
* NFS4_LOCK_SEQID_INUSE flag and 'lo_lock'. The retrieving of the
* 'lock_stateid' is protected by 'lo_lock', with the additional
* requirement that the calling function can handle NFS4ERR_OLD_STATEID and
* NFS4ERR_BAD_STATEID as appropiate.
*
* The setting of NFS4_BAD_SEQID_LOCK to lo_flags tells us whether this lock
* owner used a bad seqid (that is, got NFS4ERR_BAD_SEQID). With this set,
* this lock owner will no longer be used for future OTW calls. Once set,
* it is never unset.
*
* Lock ordering:
* rnode4_t::r_statev4_lock > lo_lock
*/
typedef struct nfs4_lock_owner {
struct nfs4_lock_owner *lo_next_rnode;
struct nfs4_lock_owner *lo_prev_rnode;
int lo_pid;
stateid4 lock_stateid;
seqid4 lock_seqid;
/*
* Fix this to always be 12 bytes
*/
nfs4_lo_name_t lock_owner_name;
int lo_ref_count;
int lo_valid;
int lo_pending_rqsts;
int lo_just_created;
int lo_flags;
kcondvar_t lo_cv_seqid_sync;
kmutex_t lo_lock;
kthread_t *lo_seqid_holder; /* debugging aid */
} nfs4_lock_owner_t;
/* for nfs4_lock_owner_t lookups */
typedef enum {LOWN_ANY, LOWN_VALID_STATEID} lown_which_t;
/* Number of times to retry a call that fails with state independent error */
#define NFS4_NUM_RECOV_RETRIES 3
typedef enum {
NO_SID,
DEL_SID,
LOCK_SID,
OPEN_SID,
SPEC_SID
} nfs4_stateid_type_t;
typedef struct nfs4_stateid_types {
stateid4 d_sid;
stateid4 l_sid;
stateid4 o_sid;
nfs4_stateid_type_t cur_sid_type;
} nfs4_stateid_types_t;
/*
* Per-zone data for dealing with callbacks. Included here solely for the
* benefit of MDB.
*/
struct nfs4_callback_stats {
kstat_named_t delegations;
kstat_named_t cb_getattr;
kstat_named_t cb_recall;
kstat_named_t cb_null;
kstat_named_t cb_dispatch;
kstat_named_t delegaccept_r;
kstat_named_t delegaccept_rw;
kstat_named_t delegreturn;
kstat_named_t callbacks;
kstat_named_t claim_cur;
kstat_named_t claim_cur_ok;
kstat_named_t recall_trunc;
kstat_named_t recall_failed;
kstat_named_t return_limit_write;
kstat_named_t return_limit_addmap;
kstat_named_t deleg_recover;
kstat_named_t cb_illegal;
};
struct nfs4_callback_globals {
kmutex_t nfs4_cb_lock;
kmutex_t nfs4_dlist_lock;
int nfs4_program_hint;
/* this table maps the program number to the nfs4_server structure */
struct nfs4_server **nfs4prog2server;
list_t nfs4_dlist;
list_t nfs4_cb_ports;
struct nfs4_callback_stats nfs4_callback_stats;
#ifdef DEBUG
int nfs4_dlistadd_c;
int nfs4_dlistclean_c;
#endif
};
typedef enum {
CLOSE_NORM,
CLOSE_DELMAP,
CLOSE_FORCE,
CLOSE_RESEND,
CLOSE_AFTER_RESEND
} nfs4_close_type_t;
/*
* Structure to hold the bad seqid information that is passed
* to the recovery framework.
*/
typedef struct nfs4_bseqid_entry {
nfs4_open_owner_t *bs_oop;
nfs4_lock_owner_t *bs_lop;
vnode_t *bs_vp;
pid_t bs_pid;
nfs4_tag_type_t bs_tag;
seqid4 bs_seqid;
list_node_t bs_node;
} nfs4_bseqid_entry_t;
#ifdef _KERNEL
extern void nfs4close_one(vnode_t *, nfs4_open_stream_t *, cred_t *, int,
nfs4_lost_rqst_t *, nfs4_error_t *, nfs4_close_type_t,
size_t, uint_t, uint_t);
extern void nfs4close_notw(vnode_t *, nfs4_open_stream_t *, int *);
extern void nfs4_set_lock_stateid(nfs4_lock_owner_t *, stateid4);
extern void open_owner_hold(nfs4_open_owner_t *);
extern void open_owner_rele(nfs4_open_owner_t *);
extern nfs4_open_stream_t *find_or_create_open_stream(nfs4_open_owner_t *,
struct rnode4 *, int *);
extern nfs4_open_stream_t *find_open_stream(nfs4_open_owner_t *,
struct rnode4 *);
extern nfs4_open_stream_t *create_open_stream(nfs4_open_owner_t *oop,
struct rnode4 *rp);
extern void open_stream_hold(nfs4_open_stream_t *);
extern void open_stream_rele(nfs4_open_stream_t *, struct rnode4 *);
extern int nfs4close_all(vnode_t *, cred_t *);
extern void lock_owner_hold(nfs4_lock_owner_t *);
extern void lock_owner_rele(nfs4_lock_owner_t *);
extern nfs4_lock_owner_t *create_lock_owner(struct rnode4 *, pid_t);
extern nfs4_lock_owner_t *find_lock_owner(struct rnode4 *, pid_t, lown_which_t);
extern void nfs4_rnode_remove_lock_owner(struct rnode4 *,
nfs4_lock_owner_t *);
extern void nfs4_flush_lock_owners(struct rnode4 *);
extern void nfs4_setlockowner_args(lock_owner4 *, struct rnode4 *, pid_t);
extern void nfs4_set_open_seqid(seqid4, nfs4_open_owner_t *,
nfs4_tag_type_t);
extern void nfs4_set_lock_seqid(seqid4, nfs4_lock_owner_t *);
extern void nfs4_get_and_set_next_open_seqid(nfs4_open_owner_t *,
nfs4_tag_type_t);
extern void nfs4_end_open_seqid_sync(nfs4_open_owner_t *);
extern int nfs4_start_open_seqid_sync(nfs4_open_owner_t *, mntinfo4_t *);
extern void nfs4_end_lock_seqid_sync(nfs4_lock_owner_t *);
extern int nfs4_start_lock_seqid_sync(nfs4_lock_owner_t *, mntinfo4_t *);
extern void nfs4_setup_lock_args(nfs4_lock_owner_t *, nfs4_open_owner_t *,
nfs4_open_stream_t *, clientid4, locker4 *);
extern void nfs4_destroy_open_owner(nfs4_open_owner_t *);
extern void nfs4_renew_lease_thread(nfs4_server_t *);
extern nfs4_server_t *find_nfs4_server(mntinfo4_t *);
extern nfs4_server_t *find_nfs4_server_all(mntinfo4_t *, int all);
extern nfs4_server_t *new_nfs4_server(servinfo4_t *, cred_t *);
extern void nfs4_mark_srv_dead(nfs4_server_t *);
extern nfs4_server_t *servinfo4_to_nfs4_server(servinfo4_t *);
extern void nfs4_inc_state_ref_count(mntinfo4_t *);
extern void nfs4_inc_state_ref_count_nolock(nfs4_server_t *,
mntinfo4_t *);
extern void nfs4_dec_state_ref_count(mntinfo4_t *);
extern void nfs4_dec_state_ref_count_nolock(nfs4_server_t *,
mntinfo4_t *);
extern clientid4 mi2clientid(mntinfo4_t *);
extern int nfs4_server_in_recovery(nfs4_server_t *);
extern bool_t nfs4_server_vlock(nfs4_server_t *, int);
extern nfs4_open_owner_t *create_open_owner(cred_t *, mntinfo4_t *);
extern uint64_t nfs4_get_new_oo_name(void);
extern nfs4_open_owner_t *find_open_owner(cred_t *, int, mntinfo4_t *);
extern nfs4_open_owner_t *find_open_owner_nolock(cred_t *, int, mntinfo4_t *);
extern void nfs4frlock(nfs4_lock_call_type_t, vnode_t *, int, flock64_t *,
int, u_offset_t, cred_t *, nfs4_error_t *,
nfs4_lost_rqst_t *, int *);
extern void nfs4open_dg_save_lost_rqst(int, nfs4_lost_rqst_t *,
nfs4_open_owner_t *, nfs4_open_stream_t *, cred_t *,
vnode_t *, int, int);
extern void nfs4_open_downgrade(int, int, nfs4_open_owner_t *,
nfs4_open_stream_t *, vnode_t *, cred_t *,
nfs4_lost_rqst_t *, nfs4_error_t *, cred_t **, seqid4 *);
extern seqid4 nfs4_get_open_seqid(nfs4_open_owner_t *);
extern cred_t *nfs4_get_otw_cred(cred_t *, mntinfo4_t *, nfs4_open_owner_t *);
extern void nfs4_init_stateid_types(nfs4_stateid_types_t *);
extern void nfs4_save_stateid(stateid4 *, nfs4_stateid_types_t *);
extern kmutex_t nfs4_server_lst_lock;
extern void nfs4callback_destroy(nfs4_server_t *);
extern void nfs4_callback_init(void);
extern void nfs4_callback_fini(void);
extern void nfs4_cb_args(nfs4_server_t *, struct knetconfig *,
SETCLIENTID4args *);
extern void nfs4delegreturn_async(struct rnode4 *, int, bool_t);
extern enum nfs4_delegreturn_policy nfs4_delegreturn_policy;
extern void nfs4_add_mi_to_server(nfs4_server_t *, mntinfo4_t *);
extern void nfs4_remove_mi_from_server(mntinfo4_t *, nfs4_server_t *);
extern nfs4_server_t *nfs4_move_mi(mntinfo4_t *, servinfo4_t *, servinfo4_t *);
extern bool_t nfs4_fs_active(nfs4_server_t *);
extern void nfs4_server_rele(nfs4_server_t *);
extern bool_t inlease(nfs4_server_t *);
extern bool_t nfs4_has_pages(vnode_t *);
extern void nfs4_log_badowner(mntinfo4_t *, nfs_opnum4);
#endif /* _KERNEL */
/*
* Client State Recovery
*/
/*
* The following defines are used for rs_flags in
* a nfs4_recov_state_t structure.
*
* NFS4_RS_RENAME_HELD Indicates that the mi_rename_lock was held.
* NFS4_RS_GRACE_MSG Set once we have uprintf'ed a grace message.
* NFS4_RS_DELAY_MSG Set once we have uprintf'ed a delay message.
* NFS4_RS_RECALL_HELD1 r_deleg_recall_lock for vp1 was held.
* NFS4_RS_RECALL_HELD2 r_deleg_recall_lock for vp2 was held.
*/
#define NFS4_RS_RENAME_HELD 0x000000001
#define NFS4_RS_GRACE_MSG 0x000000002
#define NFS4_RS_DELAY_MSG 0x000000004
#define NFS4_RS_RECALL_HELD1 0x000000008
#define NFS4_RS_RECALL_HELD2 0x000000010
/*
* Information that is retrieved from nfs4_start_op() and that is
* passed into nfs4_end_op().
*
* rs_sp is a reference to the nfs4_server that was found, or NULL.
*
* rs_num_retry_despite_err is the number times client retried an
* OTW op despite a recovery error. It is only incremented for hints
* exempt to normal R4RECOVERR processing
* (OH_CLOSE/OH_LOCKU/OH_DELEGRETURN). (XXX this special-case code
* needs review for possible removal.)
* It is initialized wherever nfs4_recov_state_t is declared -- usually
* very near initialization of rs_flags.
*/
typedef struct {
nfs4_server_t *rs_sp;
int rs_flags;
int rs_num_retry_despite_err;
} nfs4_recov_state_t;
/*
* Flags for nfs4_check_remap, nfs4_remap_file and nfs4_remap_root.
*/
#define NFS4_REMAP_CKATTRS 1
#define NFS4_REMAP_NEEDSOP 2
#ifdef _KERNEL
extern int nfs4_is_otw_open_necessary(nfs4_open_owner_t *, int,
vnode_t *, int, int *, int, nfs4_recov_state_t *);
extern void nfs4setclientid(struct mntinfo4 *, struct cred *, bool_t,
nfs4_error_t *);
extern void nfs4_reopen(vnode_t *, nfs4_open_stream_t *, nfs4_error_t *,
open_claim_type4, bool_t, bool_t);
extern void nfs4_remap_root(struct mntinfo4 *, nfs4_error_t *, int);
extern void nfs4_check_remap(mntinfo4_t *mi, vnode_t *vp, int,
nfs4_error_t *);
extern void nfs4_remap_file(mntinfo4_t *mi, vnode_t *vp, int,
nfs4_error_t *);
extern int nfs4_make_dotdot(struct nfs4_sharedfh *, hrtime_t,
vnode_t *, cred_t *, vnode_t **, int);
extern void nfs4_fail_recov(vnode_t *, char *, int, nfsstat4);
extern int nfs4_needs_recovery(nfs4_error_t *, bool_t, vfs_t *);
extern int nfs4_recov_marks_dead(nfsstat4);
extern bool_t nfs4_start_recovery(nfs4_error_t *, struct mntinfo4 *,
vnode_t *, vnode_t *, stateid4 *,
nfs4_lost_rqst_t *, nfs_opnum4, nfs4_bseqid_entry_t *,
vnode_t *, char *);
extern int nfs4_start_op(struct mntinfo4 *, vnode_t *, vnode_t *,
nfs4_recov_state_t *);
extern void nfs4_end_op(struct mntinfo4 *, vnode_t *, vnode_t *,
nfs4_recov_state_t *, bool_t);
extern int nfs4_start_fop(struct mntinfo4 *, vnode_t *, vnode_t *,
nfs4_op_hint_t, nfs4_recov_state_t *, bool_t *);
extern void nfs4_end_fop(struct mntinfo4 *, vnode_t *, vnode_t *,
nfs4_op_hint_t, nfs4_recov_state_t *, bool_t);
extern char *nfs4_recov_action_to_str(nfs4_recov_t);
/*
* In sequence, code desiring to unmount an ephemeral tree must
* call nfs4_ephemeral_umount, nfs4_ephemeral_umount_activate,
* and nfs4_ephemeral_umount_unlock. The _unlock must also be
* called on all error paths that occur before it would naturally
* be invoked.
*
* The caller must also provde a pointer to a boolean to keep track
* of whether or not the code in _unlock is to be ran.
*/
extern void nfs4_ephemeral_umount_activate(mntinfo4_t *,
bool_t *, nfs4_ephemeral_tree_t **);
extern int nfs4_ephemeral_umount(mntinfo4_t *, int, cred_t *,
bool_t *, nfs4_ephemeral_tree_t **);
extern void nfs4_ephemeral_umount_unlock(bool_t *,
nfs4_ephemeral_tree_t **);
extern int nfs4_record_ephemeral_mount(mntinfo4_t *mi, vnode_t *mvp);
extern int nfs4_callmapid(utf8string *, struct nfs_fsl_info *);
extern int nfs4_fetch_locations(mntinfo4_t *, struct nfs4_sharedfh *,
char *, cred_t *, nfs4_ga_res_t *, COMPOUND4res_clnt *, bool_t);
extern int wait_for_recall(vnode_t *, vnode_t *, nfs4_op_hint_t,
nfs4_recov_state_t *);
extern void nfs4_end_op_recall(vnode_t *, vnode_t *, nfs4_recov_state_t *);
extern void nfs4_send_siglost(pid_t, mntinfo4_t *mi, vnode_t *vp, bool_t,
int, nfsstat4);
extern time_t nfs4err_delay_time;
extern void nfs4_set_grace_wait(mntinfo4_t *);
extern void nfs4_set_delay_wait(vnode_t *);
extern int nfs4_wait_for_grace(mntinfo4_t *, nfs4_recov_state_t *);
extern int nfs4_wait_for_delay(vnode_t *, nfs4_recov_state_t *);
extern nfs4_bseqid_entry_t *nfs4_create_bseqid_entry(nfs4_open_owner_t *,
nfs4_lock_owner_t *, vnode_t *, pid_t, nfs4_tag_type_t,
seqid4);
extern void nfs4_resend_open_otw(vnode_t **, nfs4_lost_rqst_t *,
nfs4_error_t *);
extern void nfs4_resend_delegreturn(nfs4_lost_rqst_t *, nfs4_error_t *,
nfs4_server_t *);
extern int nfs4_rpc_retry_error(int);
extern int nfs4_try_failover(nfs4_error_t *);
extern void nfs4_free_msg(nfs4_debug_msg_t *);
extern void nfs4_mnt_recov_kstat_init(vfs_t *);
extern void nfs4_mi_kstat_inc_delay(mntinfo4_t *);
extern void nfs4_mi_kstat_inc_no_grace(mntinfo4_t *);
extern char *nfs4_stat_to_str(nfsstat4);
extern char *nfs4_op_to_str(nfs_opnum4);
extern void nfs4_queue_event(nfs4_event_type_t, mntinfo4_t *, char *,
uint_t, vnode_t *, vnode_t *, nfsstat4, char *, pid_t,
nfs4_tag_type_t, nfs4_tag_type_t, seqid4, seqid4);
extern void nfs4_queue_fact(nfs4_fact_type_t, mntinfo4_t *, nfsstat4,
nfs4_recov_t, nfs_opnum4, bool_t, char *, int, vnode_t *);
/* Used for preformed "." and ".." dirents */
extern char *nfs4_dot_entries;
extern char *nfs4_dot_dot_entry;
#ifdef DEBUG
extern uint_t nfs4_tsd_key;
#endif
#endif /* _KERNEL */
/*
* Filehandle management.
*
* Filehandles can change in v4, so rather than storing the filehandle
* directly in the rnode, etc., we manage the filehandle through one of
* these objects.
* Locking: sfh_fh and sfh_tree is protected by the filesystem's
* mi_fh_lock. The reference count and flags are protected by sfh_lock.
* sfh_mi is read-only.
*
* mntinfo4_t::mi_fh_lock > sfh_lock.
*/
typedef struct nfs4_sharedfh {
nfs_fh4 sfh_fh; /* key and current filehandle */
kmutex_t sfh_lock;
uint_t sfh_refcnt; /* reference count */
uint_t sfh_flags;
mntinfo4_t *sfh_mi; /* backptr to filesystem */
avl_node_t sfh_tree; /* used by avl package */
} nfs4_sharedfh_t;
#define SFH4_SAME(sfh1, sfh2) ((sfh1) == (sfh2))
/*
* Flags.
*/
#define SFH4_IN_TREE 0x1 /* currently in an AVL tree */
#ifdef _KERNEL
extern void sfh4_createtab(avl_tree_t *);
extern nfs4_sharedfh_t *sfh4_get(const nfs_fh4 *, mntinfo4_t *);
extern nfs4_sharedfh_t *sfh4_put(const nfs_fh4 *, mntinfo4_t *,
nfs4_sharedfh_t *);
extern void sfh4_update(nfs4_sharedfh_t *, const nfs_fh4 *);
extern void sfh4_copyval(const nfs4_sharedfh_t *, nfs4_fhandle_t *);
extern void sfh4_hold(nfs4_sharedfh_t *);
extern void sfh4_rele(nfs4_sharedfh_t **);
extern void sfh4_printfhandle(const nfs4_sharedfh_t *);
#endif
/*
* Path and file name management.
*
* This type stores the name of an entry in the filesystem and keeps enough
* information that it can provide a complete path. All fields are
* protected by fn_lock, except for the reference count, which is managed
* using atomic add/subtract.
*
* Additionally shared filehandle for this fname is stored.
* Normally, fn_get() when it creates this fname stores the passed in
* shared fh in fn_sfh by doing sfh_hold. Similarly the path which
* destroys this fname releases the reference on this fh by doing sfh_rele.
*
* fn_get uses the fn_sfh to refine the comparision in cases
* where we have matched the name but have differing file handles,
* this normally happens due to
*
* 1. Server side rename of a file/directory.
* 2. Another client renaming a file/directory on the server.
*
* Differing names but same filehandle is possible as in the case of hardlinks,
* but differing filehandles with same name component will later confuse
* the client and can cause various panics.
*
* Lock order: child and then parent.
*/
typedef struct nfs4_fname {
struct nfs4_fname *fn_parent; /* parent name; null if fs root */
char *fn_name; /* the actual name */
ssize_t fn_len; /* strlen(fn_name) */
uint32_t fn_refcnt; /* reference count */
kmutex_t fn_lock;
avl_node_t fn_tree;
avl_tree_t fn_children; /* children, if any */
nfs4_sharedfh_t *fn_sfh; /* The fh for this fname */
} nfs4_fname_t;
#ifdef _KERNEL
extern vnode_t nfs4_xattr_notsupp_vnode;
#define NFS4_XATTR_DIR_NOTSUPP &nfs4_xattr_notsupp_vnode
extern nfs4_fname_t *fn_get(nfs4_fname_t *, char *, nfs4_sharedfh_t *);
extern void fn_hold(nfs4_fname_t *);
extern void fn_rele(nfs4_fname_t **);
extern char *fn_name(nfs4_fname_t *);
extern char *fn_path(nfs4_fname_t *);
extern void fn_move(nfs4_fname_t *, nfs4_fname_t *, char *);
extern nfs4_fname_t *fn_parent(nfs4_fname_t *);
/* Referral Support */
extern int nfs4_process_referral(mntinfo4_t *, nfs4_sharedfh_t *, char *,
cred_t *, nfs4_ga_res_t *, COMPOUND4res_clnt *, struct nfs_fsl_info *);
#endif
/*
* Per-zone data for managing client handles, included in this file for the
* benefit of MDB.
*/
struct nfs4_clnt {
struct chhead *nfscl_chtable4;
kmutex_t nfscl_chtable4_lock;
zoneid_t nfscl_zoneid;
list_node_t nfscl_node;
struct clstat4 nfscl_stat;
};
#ifdef __cplusplus
}
#endif
#endif /* _NFS4_CLNT_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _NFS4_DB_IMPL_H
#define _NFS4_DB_IMPL_H
/*
* This is a private header file. Applications should not directly include
* this file.
*/
#ifdef __cplusplus
extern "C" {
#endif
#define SEARCH_DEBUG 0x0001
#define CREATE_DEBUG 0x0002
#define CACHED_DEBUG 0x0004
#define DESTROY_DEBUG 0x0008
#define REAP_DEBUG 0x0010
#define OTHER_DEBUG 0x0020
#define WALK_DEBUG 0x0040
/*
* A database is made up of a collection of tables.
* Tables are in turn made up of a collection of
* entries. Each table may haveone or more indices
* associtated with it.
*/
/* Private implementation */
typedef struct rfs4_link {
struct rfs4_link *next;
struct rfs4_link *prev;
rfs4_dbe_t *entry;
} rfs4_link_t;
struct rfs4_dbe {
kmutex_t dbe_lock[1]; /* Exclusive lock for entry */
uint32_t dbe_refcnt; /* # of references */
unsigned dbe_skipsearch:1; /* skip search */
unsigned dbe_invalid:1; /* invalid/"freed" entry */
unsigned dbe_reserved:31;
time_t dbe_time_rele; /* Time of last rele */
id_t dbe_id; /* unique identifier */
kcondvar_t dbe_cv[1];
rfs4_entry_t dbe_data;
rfs4_table_t *dbe_table;
rfs4_link_t dbe_indices[1]; /* Array of indices for entry */
};
typedef struct rfs4_bucket {
krwlock_t dbk_lock[1]; /* lock hash chain */
rfs4_link_t *dbk_head;
} rfs4_bucket_t;
struct rfs4_index {
uint32_t dbi_tblidx; /* which indice in entry */
bool_t dbi_createable; /* Can create entries */
rfs4_table_t *dbi_table; /* Pointer to table */
char *dbi_keyname; /* String rep of key */
rfs4_bucket_t *dbi_buckets; /* Hash buckets */
uint32_t (*dbi_hash)(void *); /* Given key find bucket */
bool_t (*dbi_compare)(rfs4_entry_t, void *); /* Key match entry? */
void *(*dbi_mkkey)(rfs4_entry_t); /* Given data generate a key */
struct rfs4_index *dbi_inext; /* next index on table */
};
struct rfs4_table {
rfs4_table_t *dbt_tnext; /* next table in db */
struct rfs4_database *dbt_db; /* db that holds this table */
krwlock_t dbt_t_lock[1]; /* lock table for resize */
kmutex_t dbt_lock[1]; /* mutex for count and cached */
char *dbt_name; /* Table name */
id_space_t *dbt_id_space; /* space for unique entry ids */
time_t dbt_min_cache_time; /* How long to cache entries */
time_t dbt_max_cache_time; /* How long to cache entries */
uint32_t dbt_usize; /* User entry size */
uint32_t dbt_maxentries; /* max # of entries in table */
uint32_t dbt_len; /* # of buckets in table */
uint32_t dbt_count; /* # of entries in table */
uint32_t dbt_idxcnt; /* # of indices in table */
uint32_t dbt_maxcnt; /* max # of indices */
uint32_t dbt_ccnt; /* # of creatable entries */
uint32_t dbt_id_lwat; /* lo wtrmrk; 50% ids in use */
uint32_t dbt_id_hwat; /* hi wtrmrk; 75% ids in use */
time_t dbt_id_reap; /* table's reap interval */
rfs4_index_t *dbt_indices; /* list of indices */
/* Given entry and data construct entry */
bool_t (*dbt_create)(rfs4_entry_t, void *data);
void (*dbt_destroy)(rfs4_entry_t); /* Destroy entry */
bool_t (*dbt_expiry)(rfs4_entry_t); /* Has this entry expired */
kmem_cache_t *dbt_mem_cache; /* Cache for table entries */
uint32_t dbt_debug; /* Debug Flags */
/* set of vars used for managing the reaper thread */
unsigned dbt_reaper_shutdown:1; /* table shutting down? */
kcondvar_t dbt_reaper_wait; /* reaper thread waits here */
kmutex_t dbt_reaper_cv_lock; /* lock used for cpr wait */
callb_cpr_t dbt_reaper_cpr_info; /* cpr the reaper thread */
};
struct rfs4_database {
kmutex_t db_lock[1];
uint32_t db_debug_flags; /* Table debug flags to set */
uint32_t db_shutdown_count; /* count to manage shutdown */
kcondvar_t db_shutdown_wait; /* where the shutdown waits */
rfs4_table_t *db_tables; /* list of tables in db */
};
#define RFS4_RECLAIM_PERCENT 10
#define RFS4_REAP_INTERVAL 300
#define HASH(idx, key) (idx->dbi_hash(key) % idx->dbi_table->dbt_len)
#define ENQUEUE(head, l) { \
(l)->prev = NULL; \
(l)->next = (head); \
if ((l)->next) \
(l)->next->prev = (l); \
(head) = (l); \
}
#define DEQUEUE(head, l) { \
if ((l)->prev) \
(l)->prev->next = (l)->next; \
else \
(head) = (l)->next; \
if ((l)->next) \
(l)->next->prev = (l)->prev; \
}
#define INVALIDATE_ADDR(a) ((a) = (void *)((unsigned long)(a) | 1L))
#define VALIDATE_ADDR(a) ((a) = (void *)((unsigned long)(a) & ~1L))
#define INVALID_ADDR(a) (((unsigned long)(a) & 1L))
#define INVALID_LINK(l) (INVALID_ADDR(l->entry))
#define ENQUEUE_IDX(bp, l) { \
rw_enter((bp)->dbk_lock, RW_WRITER); \
ENQUEUE((bp)->dbk_head, l); \
VALIDATE_ADDR((l)->entry); \
rw_exit((bp)->dbk_lock); \
}
#define DEQUEUE_IDX(bp, l) { \
rw_enter((bp)->dbk_lock, RW_WRITER); \
INVALIDATE_ADDR((l)->entry); \
DEQUEUE((bp)->dbk_head, l); \
rw_exit((bp)->dbk_lock); \
}
#ifdef __cplusplus
}
#endif
#endif /* _NFS4_DB_IMPL_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright 2018 Nexenta Systems, Inc.
*/
#ifndef _NFS4_DRC_H
#define _NFS4_DRC_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* NFSv4 Duplicate Request cache.
*/
typedef struct rfs4_drc {
kmutex_t lock;
uint32_t dr_hash;
uint32_t max_size;
uint32_t in_use;
list_t dr_cache;
list_t *dr_buckets;
} rfs4_drc_t;
/*
* NFSv4 Duplicate request cache entry.
*/
typedef struct rfs4_dupreq {
list_node_t dr_bkt_next;
list_node_t dr_next;
list_t *dr_bkt;
rfs4_drc_t *drc;
int dr_state;
uint32_t dr_xid;
struct netbuf dr_addr;
COMPOUND4res dr_res;
} rfs4_dupreq_t;
/*
* State of rfs4_dupreq.
*/
#define NFS4_DUP_ERROR -1
#define NFS4_NOT_DUP 0
#define NFS4_DUP_NEW 1
#define NFS4_DUP_PENDING 2
#define NFS4_DUP_FREE 3
#define NFS4_DUP_REPLAY 4
#define NFS4_DUP_INUSE 5
extern uint32_t nfs4_drc_max;
extern uint32_t nfs4_drc_hash;
rfs4_drc_t *rfs4_init_drc(uint32_t, uint32_t);
void rfs4_fini_drc(void);
void rfs4_dr_chstate(rfs4_dupreq_t *, int);
rfs4_dupreq_t *rfs4_alloc_dr(rfs4_drc_t *);
int rfs4_find_dr(struct svc_req *, rfs4_drc_t *, rfs4_dupreq_t **);
#ifdef __cplusplus
}
#endif
#endif /* _NFS4_DRC_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
*/
#ifndef _NFS4_IDMAP_IMPL_H
#define _NFS4_IDMAP_IMPL_H
#include <sys/list.h>
#include <sys/door.h>
#include <sys/pkp_hash.h>
/*
* This is a private header file. Applications should not directly include
* this file.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* Cache Entry Definitions
*/
#define NFSID_CACHE_ANCHORS PKP_HASH_SIZE
typedef struct nfsidmap {
struct nfsidmap *id_chain[2]; /* must be first */
time_t id_time; /* time stamp */
uid_t id_no; /* uid/gid */
utf8string id_str; /* user@domain string */
} nfsidmap_t;
#define id_forw id_chain[0]
#define id_back id_chain[1]
#define id_len id_str.utf8string_len
#define id_val id_str.utf8string_val
typedef struct nfsidhq {
union {
struct nfsidhq *hq_head[2]; /* for empty queue */
struct nfsidmap *hq_chain[2]; /* for LRU list */
} hq_link;
kmutex_t hq_lock; /* protects hash queue */
} nfsidhq_t;
#define hq_que_forw hq_link.hq_head[0]
#define hq_que_back hq_link.hq_head[1]
#define hq_lru_forw hq_link.hq_chain[0]
#define hq_lru_back hq_link.hq_chain[1]
typedef struct {
const char *name; /* cache name */
nfsidhq_t *table; /* hash table */
/*
* Since we need to know the status of nfsmapid from random functions
* that deal with idmap caches, we keep a pointer to the relevant fields
* in the zone's globals so we don't have to keep passing them around.
*/
door_handle_t *nfsidmap_daemon_dh;
} idmap_cache_info_t;
typedef enum hash_stat { HQ_HASH_HINT, HQ_HASH_FIND } hash_stat;
/*
* Per-zone modular globals
*/
struct nfsidmap_globals {
list_node_t nig_link; /* linkage into global list */
enum clnt_stat nig_last_stat; /* status of last RPC call */
int nig_msg_done; /* have we printed a message? */
idmap_cache_info_t u2s_ci; /* table mapping uid-to-string */
idmap_cache_info_t s2u_ci; /* table mapping string-to-uid */
idmap_cache_info_t g2s_ci; /* table mapping groupid-to-string */
idmap_cache_info_t s2g_ci; /* table mapping string-to-groupid */
pid_t nfsidmap_pid;
kmutex_t nfsidmap_daemon_lock;
/*
* nfsidmap_daemon_lock protects the following:
* nfsidmap_daemon_dh
*/
door_handle_t nfsidmap_daemon_dh;
};
#ifdef __cplusplus
}
#endif
#endif /* _NFS4_IDMAP_IMPL_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
* Copyright 2020-2025 RackTop Systems, Inc.
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _NFS4_KPROT_H
#define _NFS4_KPROT_H
/*
* Kernel specific version.
* NFS Version 4 protocol definitions. From nfs4_prot.x RFC 5662
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <rpc/rpc.h>
#ifdef _KERNEL
#include <rpc/rpc_rdma.h>
#endif
#include <sys/stream.h>
#include <rpc/auth_sys.h>
typedef struct authsys_parms authsys_parms;
#define NFS4_FHSIZE 128
#define NFS4_VERIFIER_SIZE 8
#define NFS4_OTHER_SIZE 12
/*
* Reasonable upper bounds to catch badly behaving partners
*/
#define NFS4_OPAQUE_LIMIT 1024
#define NFS4_COMPOUND_LIMIT 2048
#define NFS4_FS_LOCATIONS_LIMIT 65536
#define NFS4_ACL_LIMIT 65536
#define NFS4_SECINFO_LIMIT 65536
#define NFS4_FATTR4_LIMIT 1048576
#define NFS4_DATA_LIMIT 134217728
#define NFS4_SESSIONID_SIZE 16
enum nfs_ftype4 {
NF4REG = 1,
NF4DIR = 2,
NF4BLK = 3,
NF4CHR = 4,
NF4LNK = 5,
NF4SOCK = 6,
NF4FIFO = 7,
NF4ATTRDIR = 8,
NF4NAMEDATTR = 9
};
typedef enum nfs_ftype4 nfs_ftype4;
enum nfsstat4 {
NFS4_OK = 0,
NFS4ERR_PERM = 1,
NFS4ERR_NOENT = 2,
NFS4ERR_IO = 5,
NFS4ERR_NXIO = 6,
NFS4ERR_ACCESS = 13,
NFS4ERR_EXIST = 17,
NFS4ERR_XDEV = 18,
NFS4ERR_NOTDIR = 20,
NFS4ERR_ISDIR = 21,
NFS4ERR_INVAL = 22,
NFS4ERR_FBIG = 27,
NFS4ERR_NOSPC = 28,
NFS4ERR_ROFS = 30,
NFS4ERR_MLINK = 31,
NFS4ERR_NAMETOOLONG = 63,
NFS4ERR_NOTEMPTY = 66,
NFS4ERR_DQUOT = 69,
NFS4ERR_STALE = 70,
NFS4ERR_BADHANDLE = 10001,
NFS4ERR_BAD_COOKIE = 10003,
NFS4ERR_NOTSUPP = 10004,
NFS4ERR_TOOSMALL = 10005,
NFS4ERR_SERVERFAULT = 10006,
NFS4ERR_BADTYPE = 10007,
NFS4ERR_DELAY = 10008,
NFS4ERR_SAME = 10009,
NFS4ERR_DENIED = 10010,
NFS4ERR_EXPIRED = 10011,
NFS4ERR_LOCKED = 10012,
NFS4ERR_GRACE = 10013,
NFS4ERR_FHEXPIRED = 10014,
NFS4ERR_SHARE_DENIED = 10015,
NFS4ERR_WRONGSEC = 10016,
NFS4ERR_CLID_INUSE = 10017,
NFS4ERR_RESOURCE = 10018,
NFS4ERR_MOVED = 10019,
NFS4ERR_NOFILEHANDLE = 10020,
NFS4ERR_MINOR_VERS_MISMATCH = 10021,
NFS4ERR_STALE_CLIENTID = 10022,
NFS4ERR_STALE_STATEID = 10023,
NFS4ERR_OLD_STATEID = 10024,
NFS4ERR_BAD_STATEID = 10025,
NFS4ERR_BAD_SEQID = 10026,
NFS4ERR_NOT_SAME = 10027,
NFS4ERR_LOCK_RANGE = 10028,
NFS4ERR_SYMLINK = 10029,
NFS4ERR_RESTOREFH = 10030,
NFS4ERR_LEASE_MOVED = 10031,
NFS4ERR_ATTRNOTSUPP = 10032,
NFS4ERR_NO_GRACE = 10033,
NFS4ERR_RECLAIM_BAD = 10034,
NFS4ERR_RECLAIM_CONFLICT = 10035,
NFS4ERR_BADXDR = 10036,
NFS4ERR_LOCKS_HELD = 10037,
NFS4ERR_OPENMODE = 10038,
NFS4ERR_BADOWNER = 10039,
NFS4ERR_BADCHAR = 10040,
NFS4ERR_BADNAME = 10041,
NFS4ERR_BAD_RANGE = 10042,
NFS4ERR_LOCK_NOTSUPP = 10043,
NFS4ERR_OP_ILLEGAL = 10044,
NFS4ERR_DEADLOCK = 10045,
NFS4ERR_FILE_OPEN = 10046,
NFS4ERR_ADMIN_REVOKED = 10047,
NFS4ERR_CB_PATH_DOWN = 10048,
NFS4ERR_BADIOMODE = 10049, /* nfsv4.1 */
NFS4ERR_BADLAYOUT = 10050,
NFS4ERR_BAD_SESSION_DIGEST = 10051,
NFS4ERR_BADSESSION = 10052,
NFS4ERR_BADSLOT = 10053,
NFS4ERR_COMPLETE_ALREADY = 10054,
NFS4ERR_CONN_NOT_BOUND_TO_SESSION = 10055,
NFS4ERR_DELEG_ALREADY_WANTED = 10056,
NFS4ERR_BACK_CHAN_BUSY = 10057,
NFS4ERR_LAYOUTTRYLATER = 10058,
NFS4ERR_LAYOUTUNAVAILABLE = 10059,
NFS4ERR_NOMATCHING_LAYOUT = 10060,
NFS4ERR_RECALLCONFLICT = 10061,
NFS4ERR_UNKNOWN_LAYOUTTYPE = 10062,
NFS4ERR_SEQ_MISORDERED = 10063,
NFS4ERR_SEQUENCE_POS = 10064,
NFS4ERR_REQ_TOO_BIG = 10065,
NFS4ERR_REP_TOO_BIG = 10066,
NFS4ERR_REP_TOO_BIG_TO_CACHE = 10067,
NFS4ERR_RETRY_UNCACHED_REP = 10068,
NFS4ERR_UNSAFE_COMPOUND = 10069,
NFS4ERR_TOO_MANY_OPS = 10070,
NFS4ERR_OP_NOT_IN_SESSION = 10071,
NFS4ERR_HASH_ALG_UNSUPP = 10072,
NFS4ERR_CLIENTID_BUSY = 10074,
NFS4ERR_PNFS_IO_HOLE = 10075,
NFS4ERR_SEQ_FALSE_RETRY = 10076,
NFS4ERR_BAD_HIGH_SLOT = 10077,
NFS4ERR_DEADSESSION = 10078,
NFS4ERR_ENCR_ALG_UNSUPP = 10079,
NFS4ERR_PNFS_NO_LAYOUT = 10080,
NFS4ERR_NOT_ONLY_OP = 10081,
NFS4ERR_WRONG_CRED = 10082,
NFS4ERR_WRONG_TYPE = 10083,
NFS4ERR_DIRDELEG_UNAVAIL = 10084,
NFS4ERR_REJECT_DELEG = 10085,
NFS4ERR_RETURNCONFLICT = 10086,
NFS4ERR_DELEG_REVOKED = 10087,
NFS4ERR_PARTNER_NOTSUPP = 10088,
NFS4ERR_PARTNER_NO_AUTH = 10089,
NFS4ERR_UNION_NOTSUPP = 10090,
NFS4ERR_OFFLOAD_DENIED = 10091,
NFS4ERR_WRONG_LFS = 10092,
NFS4ERR_BADLABEL = 10093,
NFS4ERR_OFFLOAD_NO_REQS = 10094,
/* for internal use */
NFS4ERR_REPLAY_CACHE = 30000
};
typedef enum nfsstat4 nfsstat4;
/*
* A bitmap can only be 56 bits, treat it as a uint64_t for now
*/
typedef uint64_t bitmap4;
typedef struct {
uint_t attrlist4_len;
char *attrlist4_val;
} attrlist4;
typedef uint64_t offset4;
typedef uint32_t count4;
typedef uint64_t length4;
typedef uint64_t clientid4;
typedef uint32_t nfs_lease4;
typedef uint32_t seqid4;
typedef uint32_t sequenceid4;
typedef char sessionid4[NFS4_SESSIONID_SIZE];
typedef uint32_t slotid4;
typedef struct {
uint_t utf8string_len;
char *utf8string_val;
} utf8string;
typedef utf8string component4;
typedef utf8string utf8str_cis;
typedef utf8string utf8str_cs;
typedef utf8string utf8str_mixed;
typedef struct {
uint_t pathname4_len;
component4 *pathname4_val;
} pathname4;
typedef uint64_t nfs_cookie4;
typedef struct {
uint_t linktext4_len;
char *linktext4_val;
} linktext4;
typedef utf8string ascii_REQUIRED4;
typedef struct {
uint_t sec_oid4_len;
char *sec_oid4_val;
} sec_oid4;
typedef uint32_t qop4;
typedef uint32_t mode4;
typedef uint64_t changeid4;
typedef uint64_t verifier4;
struct nfstime4 {
int64_t seconds;
uint32_t nseconds;
};
typedef struct nfstime4 nfstime4;
enum time_how4 {
SET_TO_SERVER_TIME4 = 0,
SET_TO_CLIENT_TIME4 = 1
};
typedef enum time_how4 time_how4;
struct settime4 {
time_how4 set_it;
nfstime4 time;
};
typedef struct settime4 settime4;
typedef struct {
uint_t nfs_fh4_len;
char *nfs_fh4_val;
} nfs_fh4;
struct fsid4 {
uint64_t major;
uint64_t minor;
};
typedef struct fsid4 fsid4;
struct change_policy4 {
uint64_t cp_major;
uint64_t cp_minor;
};
typedef struct change_policy4 change_policy4;
struct fs_location4 {
uint_t server_len;
utf8string *server_val;
pathname4 rootpath;
};
typedef struct fs_location4 fs_location4;
struct fs_locations4 {
pathname4 fs_root;
uint_t locations_len;
fs_location4 *locations_val;
};
typedef struct fs_locations4 fs_locations4;
/*
* This structure is declared in nfs4.h
*/
struct nfs_fsl_info;
/*
* ACL support
*/
#define ACL4_SUPPORT_ALLOW_ACL 0x00000001
#define ACL4_SUPPORT_DENY_ACL 0x00000002
#define ACL4_SUPPORT_AUDIT_ACL 0x00000004
#define ACL4_SUPPORT_ALARM_ACL 0x00000008
typedef uint32_t acetype4;
#define ACE4_ACCESS_ALLOWED_ACE_TYPE 0x00000000
#define ACE4_ACCESS_DENIED_ACE_TYPE 0x00000001
#define ACE4_SYSTEM_AUDIT_ACE_TYPE 0x00000002
#define ACE4_SYSTEM_ALARM_ACE_TYPE 0x00000003
typedef uint32_t aceflag4;
#define ACE4_FILE_INHERIT_ACE 0x00000001
#define ACE4_DIRECTORY_INHERIT_ACE 0x00000002
#define ACE4_NO_PROPAGATE_INHERIT_ACE 0x00000004
#define ACE4_INHERIT_ONLY_ACE 0x00000008
#define ACE4_SUCCESSFUL_ACCESS_ACE_FLAG 0x00000010
#define ACE4_FAILED_ACCESS_ACE_FLAG 0x00000020
#define ACE4_IDENTIFIER_GROUP 0x00000040
#define ACE4_INHERITED_ACE 0x00000080
/*
* This defines all valid flag bits, as defined by RFC 7530. If
* any additional flag bits are deemed part of the NFSv4 spec,
* you must also add them to the definition below.
*/
#define ACE4_VALID_FLAG_BITS (\
ACE4_FILE_INHERIT_ACE | \
ACE4_DIRECTORY_INHERIT_ACE | \
ACE4_NO_PROPAGATE_INHERIT_ACE | \
ACE4_INHERIT_ONLY_ACE | \
ACE4_SUCCESSFUL_ACCESS_ACE_FLAG | \
ACE4_FAILED_ACCESS_ACE_FLAG | \
ACE4_IDENTIFIER_GROUP)
typedef uint32_t acemask4;
#define ACE4_READ_DATA 0x00000001
#define ACE4_LIST_DIRECTORY 0x00000001
#define ACE4_WRITE_DATA 0x00000002
#define ACE4_ADD_FILE 0x00000002
#define ACE4_APPEND_DATA 0x00000004
#define ACE4_ADD_SUBDIRECTORY 0x00000004
#define ACE4_READ_NAMED_ATTRS 0x00000008
#define ACE4_WRITE_NAMED_ATTRS 0x00000010
#define ACE4_EXECUTE 0x00000020
#define ACE4_DELETE_CHILD 0x00000040
#define ACE4_READ_ATTRIBUTES 0x00000080
#define ACE4_WRITE_ATTRIBUTES 0x00000100
#define ACE4_WRITE_RETENTION 0x00000200
#define ACE4_WRITE_RETENTION_HOLD 0x00000400
#define ACE4_DELETE 0x00010000
#define ACE4_READ_ACL 0x00020000
#define ACE4_WRITE_ACL 0x00040000
#define ACE4_WRITE_OWNER 0x00080000
#define ACE4_SYNCHRONIZE 0x00100000
#define ACE4_GENERIC_READ 0x00120081
#define ACE4_GENERIC_WRITE 0x00160106
#define ACE4_GENERIC_EXECUTE 0x001200A0
/*
* This defines all valid access mask bits, as defined by RFC 7530. If
* any additional access mask bits are deemed part of the NFSv4 spec,
* you must also add them to the definition below.
*/
#define ACE4_VALID_MASK_BITS (\
ACE4_READ_DATA | \
ACE4_LIST_DIRECTORY | \
ACE4_WRITE_DATA | \
ACE4_ADD_FILE | \
ACE4_APPEND_DATA | \
ACE4_ADD_SUBDIRECTORY | \
ACE4_READ_NAMED_ATTRS | \
ACE4_WRITE_NAMED_ATTRS | \
ACE4_EXECUTE | \
ACE4_DELETE_CHILD | \
ACE4_READ_ATTRIBUTES | \
ACE4_WRITE_ATTRIBUTES | \
ACE4_DELETE | \
ACE4_READ_ACL | \
ACE4_WRITE_ACL | \
ACE4_WRITE_OWNER | \
ACE4_SYNCHRONIZE)
/* Used to signify an undefined value for an acemask4 */
#define ACE4_MASK_UNDEFINED 0x80000000
#define ACE4_WHO_OWNER "OWNER@"
#define ACE4_WHO_GROUP "GROUP@"
#define ACE4_WHO_EVERYONE "EVERYONE@"
struct nfsace4 {
acetype4 type;
aceflag4 flag;
acemask4 access_mask;
utf8string who;
};
typedef struct nfsace4 nfsace4;
typedef uint32_t aclflag4; /* 4.1 */
#define ACL4_AUTO_INHERIT 0x00000001
#define ACL4_PROTECTED 0x00000002
#define ACL4_DEFAULTED 0x00000004
struct nfsacl41 { /* 4.1 */
aclflag4 na41_flag;
struct {
uint_t na41_aces_len;
nfsace4 *na41_aces_val;
} na41_aces;
};
typedef struct nfsacl41 nfsacl41;
#define MODE4_SUID 0x800
#define MODE4_SGID 0x400
#define MODE4_SVTX 0x200
#define MODE4_RUSR 0x100
#define MODE4_WUSR 0x080
#define MODE4_XUSR 0x040
#define MODE4_RGRP 0x020
#define MODE4_WGRP 0x010
#define MODE4_XGRP 0x008
#define MODE4_ROTH 0x004
#define MODE4_WOTH 0x002
#define MODE4_XOTH 0x001
struct mode_masked4 { /* 4.1 */
mode4 mm_value_to_set;
mode4 mm_mask_bits;
};
typedef struct mode_masked4 mode_masked4;
/*
* ACL conversion helpers
*/
typedef enum {
ace4_unused,
ace4_user_obj,
ace4_user,
ace4_group, /* includes GROUP and GROUP_OBJ */
ace4_other_obj
} ace4_to_aent_state_t;
typedef struct ace4vals {
utf8string *key; /* NB: not allocated here; points to existing utf8 */
avl_node_t avl;
acemask4 mask;
acemask4 allowed;
acemask4 denied;
int aent_type;
} ace4vals_t;
typedef struct ace4_list {
ace4vals_t user_obj;
avl_tree_t user;
int numusers;
ace4vals_t group_obj;
avl_tree_t group;
int numgroups;
ace4vals_t other_obj;
acemask4 acl_mask;
int hasmask;
int dfacl_flag;
ace4_to_aent_state_t state;
int seen; /* bitmask of all aclent_t a_type values seen */
} ace4_list_t;
struct specdata4 {
uint32_t specdata1;
uint32_t specdata2;
};
typedef struct specdata4 specdata4;
#define FH4_PERSISTENT 0x00000000
#define FH4_NOEXPIRE_WITH_OPEN 0x00000001
#define FH4_VOLATILE_ANY 0x00000002
#define FH4_VOL_MIGRATION 0x00000004
#define FH4_VOL_RENAME 0x00000008
/*
* nfsv4.1
*/
struct netaddr4 {
char *na_r_netid;
char *na_r_addr;
};
typedef struct netaddr4 netaddr4;
struct nfs_impl_id4 {
utf8str_cis nii_domain;
utf8str_cs nii_name;
nfstime4 nii_date;
};
typedef struct nfs_impl_id4 nfs_impl_id4;
struct stateid4 {
uint32_t seqid;
char other[NFS4_OTHER_SIZE];
};
typedef struct stateid4 stateid4;
enum layouttype4 {
LAYOUT4_NFSV4_1_FILES = 0x1,
LAYOUT4_OSD2_OBJECTS = 0x2,
LAYOUT4_BLOCK_VOLUME = 0x3
};
typedef enum layouttype4 layouttype4;
struct layout_content4 {
layouttype4 loc_type;
struct {
uint_t loc_body_len;
char *loc_body_val;
} loc_body;
};
typedef struct layout_content4 layout_content4;
/*
* LAYOUT4_OSD2_OBJECTS loc_body description
* is in a separate .x file
*/
/*
* LAYOUT4_BLOCK_VOLUME loc_body description
* is in a separate .x file
*/
struct layouthint4 {
layouttype4 loh_type;
struct {
uint_t loh_body_len;
char *loh_body_val;
} loh_body;
};
typedef struct layouthint4 layouthint4;
enum layoutiomode4 {
LAYOUTIOMODE4_READ = 1,
LAYOUTIOMODE4_RW = 2,
LAYOUTIOMODE4_ANY = 3
};
typedef enum layoutiomode4 layoutiomode4;
struct layout4 {
offset4 lo_offset;
length4 lo_length;
layoutiomode4 lo_iomode;
layout_content4 lo_content;
};
typedef struct layout4 layout4;
#define NFS4_DEVICEID4_SIZE 16
typedef char deviceid4[NFS4_DEVICEID4_SIZE];
struct device_addr4 {
layouttype4 da_layout_type;
struct {
uint_t da_addr_body_len;
char *da_addr_body_val;
} da_addr_body;
};
typedef struct device_addr4 device_addr4;
struct layoutupdate4 {
layouttype4 lou_type;
struct {
uint_t lou_body_len;
char *lou_body_val;
} lou_body;
};
typedef struct layoutupdate4 layoutupdate4;
#define LAYOUT4_RET_REC_FILE 1
#define LAYOUT4_RET_REC_FSID 2
#define LAYOUT4_RET_REC_ALL 3
enum layoutreturn_type4 {
LAYOUTRETURN4_FILE = LAYOUT4_RET_REC_FILE,
LAYOUTRETURN4_FSID = LAYOUT4_RET_REC_FSID,
LAYOUTRETURN4_ALL = LAYOUT4_RET_REC_ALL
};
typedef enum layoutreturn_type4 layoutreturn_type4;
/* layouttype4 specific data */
struct layoutreturn_file4 {
offset4 lrf_offset;
length4 lrf_length;
stateid4 lrf_stateid;
struct {
uint_t lrf_body_len;
char *lrf_body_val;
} lrf_body;
};
typedef struct layoutreturn_file4 layoutreturn_file4;
struct layoutreturn4 {
layoutreturn_type4 lr_returntype;
union {
layoutreturn_file4 lr_layout;
} layoutreturn4_u;
};
typedef struct layoutreturn4 layoutreturn4;
enum fs4_status_type {
STATUS4_FIXED = 1,
STATUS4_UPDATED = 2,
STATUS4_VERSIONED = 3,
STATUS4_WRITABLE = 4,
STATUS4_REFERRAL = 5
};
typedef enum fs4_status_type fs4_status_type;
struct fs4_status {
bool_t fss_absent;
fs4_status_type fss_type;
utf8str_cs fss_source;
utf8str_cs fss_current;
int32_t fss_age;
nfstime4 fss_version;
};
typedef struct fs4_status fs4_status;
#define TH4_READ_SIZE 0
#define TH4_WRITE_SIZE 1
#define TH4_READ_IOSIZE 2
#define TH4_WRITE_IOSIZE 3
typedef length4 threshold4_read_size;
typedef length4 threshold4_write_size;
typedef length4 threshold4_read_iosize;
typedef length4 threshold4_write_iosize;
struct threshold_item4 {
layouttype4 thi_layout_type;
bitmap4 thi_hintset;
struct {
uint_t thi_hintlist_len;
char *thi_hintlist_val;
} thi_hintlist;
};
typedef struct threshold_item4 threshold_item4;
struct mdsthreshold4 {
struct {
uint_t mth_hints_len;
threshold_item4 *mth_hints_val;
} mth_hints;
};
typedef struct mdsthreshold4 mdsthreshold4;
#define RET4_DURATION_INFINITE 0xffffffffffffffff
struct retention_get4 {
uint64_t rg_duration;
struct {
uint_t rg_begin_time_len;
nfstime4 *rg_begin_time_val;
} rg_begin_time;
};
typedef struct retention_get4 retention_get4;
struct retention_set4 {
bool_t rs_enable;
struct {
uint_t rs_duration_len;
uint64_t *rs_duration_val;
} rs_duration;
};
typedef struct retention_set4 retention_set4;
#define FSCHARSET_CAP4_CONTAINS_NON_UTF8 0x1
#define FSCHARSET_CAP4_ALLOWS_ONLY_UTF8 0x2
typedef uint32_t fs_charset_cap4;
/* nfsv4.1 end, nfsv4.2 additions */
enum netloc_type4 {
NL4_NAME = 1,
NL4_URL = 2,
NL4_NETADDR = 3
};
typedef enum netloc_type4 netloc_type4;
struct netloc4 {
netloc_type4 nl_type;
union {
utf8str_cis nl_name;
utf8str_cis nl_url;
netaddr4 nl_addr;
} netloc4_u;
};
typedef struct netloc4 netloc4;
enum change_attr_type4 {
NFS4_CHANGE_TYPE_IS_MONOTONIC_INCR = 0,
NFS4_CHANGE_TYPE_IS_VERSION_COUNTER = 1,
NFS4_CHANGE_TYPE_IS_VERSION_COUNTER_NOPNFS = 2,
NFS4_CHANGE_TYPE_IS_TIME_METADATA = 3,
NFS4_CHANGE_TYPE_IS_UNDEFINED = 4
};
typedef enum change_attr_type4 change_attr_type4;
/*
* Note that rpcgen would have put here:
* typedef struct labelformat_spec4 {...}
* typedef struct sec_label4 {...}
* but this implementation is using a hand-coded replacment.
*/
/* nfsv4.2 by-hand version */
struct sec_label4 {
uint_t slai_len;
char *slai_val;
};
typedef struct sec_label4 sec_label4;
/*
* Note that rpcgen would have put here:
* typedef struct copy_from_auth_priv {...}
* typedef struct copy_to_auth_priv {...}
* typedef struct copy_confirm_auth_priv {...}
* not currently used.
*/
struct app_data_block4 {
offset4 adb_offset;
length4 adb_block_size;
length4 adb_block_count;
length4 adb_reloff_blocknum;
count4 adb_block_num;
length4 adb_reloff_pattern;
struct {
uint_t adb_pattern_len;
char *adb_pattern_val;
} adb_pattern;
};
typedef struct app_data_block4 app_data_block4;
struct data4 {
offset4 d_offset;
struct {
uint_t d_data_len;
char *d_data_val;
} d_data;
};
typedef struct data4 data4;
struct data_info4 {
offset4 di_offset;
length4 di_length;
};
typedef struct data_info4 data_info4;
enum data_content4 {
NFS4_CONTENT_DATA = 0,
NFS4_CONTENT_HOLE = 1
};
typedef enum data_content4 data_content4;
enum stable_how4 {
UNSTABLE4 = 0,
DATA_SYNC4 = 1,
FILE_SYNC4 = 2
};
typedef enum stable_how4 stable_how4;
struct write_response4 {
struct {
uint_t wr_callback_id_len;
stateid4 *wr_callback_id_val;
} wr_callback_id;
length4 wr_count;
stable_how4 wr_committed;
verifier4 wr_writeverf;
};
typedef struct write_response4 write_response4;
/* nfsv4.2 end */
typedef bitmap4 fattr4_supported_attrs;
typedef nfs_ftype4 fattr4_type;
typedef uint32_t fattr4_fh_expire_type;
typedef changeid4 fattr4_change;
typedef uint64_t fattr4_size;
typedef bool_t fattr4_link_support;
typedef bool_t fattr4_symlink_support;
typedef bool_t fattr4_named_attr;
typedef fsid4 fattr4_fsid;
typedef bool_t fattr4_unique_handles;
typedef nfs_lease4 fattr4_lease_time;
typedef nfsstat4 fattr4_rdattr_error;
typedef struct {
uint_t fattr4_acl_len;
nfsace4 *fattr4_acl_val;
} fattr4_acl;
typedef uint32_t fattr4_aclsupport;
typedef bool_t fattr4_archive;
typedef bool_t fattr4_cansettime;
typedef bool_t fattr4_case_insensitive;
typedef bool_t fattr4_case_preserving;
typedef bool_t fattr4_chown_restricted;
typedef uint64_t fattr4_fileid;
typedef uint64_t fattr4_files_avail;
typedef nfs_fh4 fattr4_filehandle;
typedef uint64_t fattr4_files_free;
typedef uint64_t fattr4_files_total;
typedef fs_locations4 fattr4_fs_locations;
typedef bool_t fattr4_hidden;
typedef bool_t fattr4_homogeneous;
typedef uint64_t fattr4_maxfilesize;
typedef uint32_t fattr4_maxlink;
typedef uint32_t fattr4_maxname;
typedef uint64_t fattr4_maxread;
typedef uint64_t fattr4_maxwrite;
typedef ascii_REQUIRED4 fattr4_mimetype;
typedef mode4 fattr4_mode;
typedef mode_masked4 fattr4_mode_set_masked;
typedef uint64_t fattr4_mounted_on_fileid;
typedef bool_t fattr4_no_trunc;
typedef uint32_t fattr4_numlinks;
typedef utf8string fattr4_owner;
typedef utf8string fattr4_owner_group;
typedef uint64_t fattr4_quota_avail_hard;
typedef uint64_t fattr4_quota_avail_soft;
typedef uint64_t fattr4_quota_used;
typedef specdata4 fattr4_rawdev;
typedef uint64_t fattr4_space_avail;
typedef uint64_t fattr4_space_free;
typedef uint64_t fattr4_space_total;
typedef uint64_t fattr4_space_used;
typedef bool_t fattr4_system;
typedef nfstime4 fattr4_time_access;
typedef settime4 fattr4_time_access_set;
typedef nfstime4 fattr4_time_backup;
typedef nfstime4 fattr4_time_create;
typedef nfstime4 fattr4_time_delta;
typedef nfstime4 fattr4_time_metadata;
typedef nfstime4 fattr4_time_modify;
typedef settime4 fattr4_time_modify_set;
/* nfsv4.1 */
typedef bitmap4 fattr4_suppattr_exclcreat;
typedef nfstime4 fattr4_dir_notif_delay;
typedef nfstime4 fattr4_dirent_notif_delay;
typedef struct {
uint_t fattr4_fs_layout_types_len;
layouttype4 *fattr4_fs_layout_types_val;
} fattr4_fs_layout_types;
typedef fs4_status fattr4_fs_status;
typedef fs_charset_cap4 fattr4_fs_charset_cap;
typedef uint32_t fattr4_layout_alignment;
typedef uint32_t fattr4_layout_blksize;
typedef layouthint4 fattr4_layout_hint;
typedef struct {
uint_t fattr4_layout_types_len;
layouttype4 *fattr4_layout_types_val;
} fattr4_layout_types;
typedef mdsthreshold4 fattr4_mdsthreshold;
typedef retention_get4 fattr4_retention_get;
typedef retention_set4 fattr4_retention_set;
typedef retention_get4 fattr4_retentevt_get;
typedef retention_set4 fattr4_retentevt_set;
typedef uint64_t fattr4_retention_hold;
typedef nfsacl41 fattr4_dacl;
typedef nfsacl41 fattr4_sacl;
typedef change_policy4 fattr4_change_policy;
/* nfsv4.1 end, nfsv4.2 begin */
typedef uint64_t fattr4_space_freed;
typedef change_attr_type4 fattr4_change_attr_type;
typedef sec_label4 fattr4_sec_label;
typedef uint32_t fattr4_clone_blksize;
/* nfsv4.2 end */
/*
* REQUIRED Attributes
*/
#define FATTR4_SUPPORTED_ATTRS 0
#define FATTR4_TYPE 1
#define FATTR4_FH_EXPIRE_TYPE 2
#define FATTR4_CHANGE 3
#define FATTR4_SIZE 4
#define FATTR4_LINK_SUPPORT 5
#define FATTR4_SYMLINK_SUPPORT 6
#define FATTR4_NAMED_ATTR 7
#define FATTR4_FSID 8
#define FATTR4_UNIQUE_HANDLES 9
#define FATTR4_LEASE_TIME 10
#define FATTR4_RDATTR_ERROR 11
#define FATTR4_FILEHANDLE 19
/* new to NFSV4.1 */
#define FATTR4_SUPPATTR_EXCLCREAT 75
/*
* RECOMMENDED Attributes
*/
#define FATTR4_ACL 12
#define FATTR4_ACLSUPPORT 13
#define FATTR4_ARCHIVE 14
#define FATTR4_CANSETTIME 15
#define FATTR4_CASE_INSENSITIVE 16
#define FATTR4_CASE_PRESERVING 17
#define FATTR4_CHOWN_RESTRICTED 18
#define FATTR4_FILEID 20
#define FATTR4_FILES_AVAIL 21
#define FATTR4_FILES_FREE 22
#define FATTR4_FILES_TOTAL 23
#define FATTR4_FS_LOCATIONS 24
#define FATTR4_HIDDEN 25
#define FATTR4_HOMOGENEOUS 26
#define FATTR4_MAXFILESIZE 27
#define FATTR4_MAXLINK 28
#define FATTR4_MAXNAME 29
#define FATTR4_MAXREAD 30
#define FATTR4_MAXWRITE 31
#define FATTR4_MIMETYPE 32
#define FATTR4_MODE 33
#define FATTR4_NO_TRUNC 34
#define FATTR4_NUMLINKS 35
#define FATTR4_OWNER 36
#define FATTR4_OWNER_GROUP 37
#define FATTR4_QUOTA_AVAIL_HARD 38
#define FATTR4_QUOTA_AVAIL_SOFT 39
#define FATTR4_QUOTA_USED 40
#define FATTR4_RAWDEV 41
#define FATTR4_SPACE_AVAIL 42
#define FATTR4_SPACE_FREE 43
#define FATTR4_SPACE_TOTAL 44
#define FATTR4_SPACE_USED 45
#define FATTR4_SYSTEM 46
#define FATTR4_TIME_ACCESS 47
#define FATTR4_TIME_ACCESS_SET 48
#define FATTR4_TIME_BACKUP 49
#define FATTR4_TIME_CREATE 50
#define FATTR4_TIME_DELTA 51
#define FATTR4_TIME_METADATA 52
#define FATTR4_TIME_MODIFY 53
#define FATTR4_TIME_MODIFY_SET 54
#define FATTR4_MOUNTED_ON_FILEID 55
/* new to NFSV4.1 */
#define FATTR4_DIR_NOTIF_DELAY 56
#define FATTR4_DIRENT_NOTIF_DELAY 57
#define FATTR4_DACL 58
#define FATTR4_SACL 59
#define FATTR4_CHANGE_POLICY 60
#define FATTR4_FS_STATUS 61
#define FATTR4_FS_LAYOUT_TYPES 62
#define FATTR4_LAYOUT_HINT 63
#define FATTR4_LAYOUT_TYPES 64
#define FATTR4_LAYOUT_BLKSIZE 65
#define FATTR4_LAYOUT_ALIGNMENT 66
#define FATTR4_FS_LOCATIONS_INFO 67
#define FATTR4_MDSTHRESHOLD 68
#define FATTR4_RETENTION_GET 69
#define FATTR4_RETENTION_SET 70
#define FATTR4_RETENTEVT_GET 71
#define FATTR4_RETENTEVT_SET 72
#define FATTR4_RETENTION_HOLD 73
#define FATTR4_MODE_SET_MASKED 74
/* FATTR4_SUPPATTR_EXCLCREAT (75) is required. See above. */
#define FATTR4_FS_CHARSET_CAP 76
/* new to NFSv4.2 */
#define FATTR4_CLONE_BLKSIZE 77
#define FATTR4_SPACE_FREED 78
#define FATTR4_CHANGE_ATTR_TYPE 79
#define FATTR4_SEC_LABEL 80
struct fattr4 {
bitmap4 attrmask;
char *attrlist4;
uint_t attrlist4_len;
};
typedef struct fattr4 fattr4;
struct change_info4 {
bool_t atomic;
changeid4 before;
changeid4 after;
};
typedef struct change_info4 change_info4;
struct clientaddr4 {
char *r_netid;
char *r_addr;
};
typedef struct clientaddr4 clientaddr4;
struct cb_client4 {
uint_t cb_program;
clientaddr4 cb_location;
};
typedef struct cb_client4 cb_client4;
struct nfs_client_id4 {
verifier4 verifier;
uint_t id_len;
char *id_val;
struct sockaddr *cl_addr;
};
typedef struct nfs_client_id4 nfs_client_id4;
struct client_owner4 {
verifier4 co_verifier;
struct {
uint_t co_ownerid_len;
char *co_ownerid_val;
} co_ownerid;
};
typedef struct client_owner4 client_owner4;
struct server_owner4 {
uint64_t so_minor_id;
struct {
uint_t so_major_id_len;
char *so_major_id_val;
} so_major_id;
};
typedef struct server_owner4 server_owner4;
struct state_owner4 {
clientid4 clientid;
struct {
uint_t owner_len;
char *owner_val;
} owner;
};
typedef struct state_owner4 state_owner4;
struct open_owner4 {
clientid4 clientid;
uint_t owner_len;
char *owner_val;
};
typedef struct open_owner4 open_owner4;
struct lock_owner4 {
clientid4 clientid;
uint_t owner_len;
char *owner_val;
};
typedef struct lock_owner4 lock_owner4;
enum nfs_lock_type4 {
READ_LT = 1,
WRITE_LT = 2,
READW_LT = 3,
WRITEW_LT = 4
};
typedef enum nfs_lock_type4 nfs_lock_type4;
/*
* nfsv4.1
*/
/* Input for computing subkeys */
enum ssv_subkey4 {
SSV4_SUBKEY_MIC_I2T = 1,
SSV4_SUBKEY_MIC_T2I = 2,
SSV4_SUBKEY_SEAL_I2T = 3,
SSV4_SUBKEY_SEAL_T2I = 4
};
typedef enum ssv_subkey4 ssv_subkey4;
/* Input for computing smt_hmac */
struct ssv_mic_plain_tkn4 {
uint32_t smpt_ssv_seq;
struct {
uint_t smpt_orig_plain_len;
char *smpt_orig_plain_val;
} smpt_orig_plain;
};
typedef struct ssv_mic_plain_tkn4 ssv_mic_plain_tkn4;
/* SSV GSS PerMsgToken token */
struct ssv_mic_tkn4 {
uint32_t smt_ssv_seq;
struct {
uint_t smt_hmac_len;
char *smt_hmac_val;
} smt_hmac;
};
typedef struct ssv_mic_tkn4 ssv_mic_tkn4;
/* Input for computing ssct_encr_data and ssct_hmac */
struct ssv_seal_plain_tkn4 {
struct {
uint_t sspt_confounder_len;
char *sspt_confounder_val;
} sspt_confounder;
uint32_t sspt_ssv_seq;
struct {
uint_t sspt_orig_plain_len;
char *sspt_orig_plain_val;
} sspt_orig_plain;
struct {
uint_t sspt_pad_len;
char *sspt_pad_val;
} sspt_pad;
};
typedef struct ssv_seal_plain_tkn4 ssv_seal_plain_tkn4;
/* SSV GSS SealedMessage token */
struct ssv_seal_cipher_tkn4 {
uint32_t ssct_ssv_seq;
struct {
uint_t ssct_iv_len;
char *ssct_iv_val;
} ssct_iv;
struct {
uint_t ssct_encr_data_len;
char *ssct_encr_data_val;
} ssct_encr_data;
struct {
uint_t ssct_hmac_len;
char *ssct_hmac_val;
} ssct_hmac;
};
typedef struct ssv_seal_cipher_tkn4 ssv_seal_cipher_tkn4;
struct fs_locations_server4 {
int32_t fls_currency;
struct {
uint_t fls_info_len;
char *fls_info_val;
} fls_info;
utf8str_cis fls_server;
};
typedef struct fs_locations_server4 fs_locations_server4;
#define FSLI4BX_GFLAGS 0
#define FSLI4BX_TFLAGS 1
#define FSLI4BX_CLSIMUL 2
#define FSLI4BX_CLHANDLE 3
#define FSLI4BX_CLFILEID 4
#define FSLI4BX_CLWRITEVER 5
#define FSLI4BX_CLCHANGE 6
#define FSLI4BX_CLREADDIR 7
#define FSLI4BX_READRANK 8
#define FSLI4BX_WRITERANK 9
#define FSLI4BX_READORDER 10
#define FSLI4BX_WRITEORDER 11
#define FSLI4GF_WRITABLE 0x01
#define FSLI4GF_CUR_REQ 0x02
#define FSLI4GF_ABSENT 0x04
#define FSLI4GF_GOING 0x08
#define FSLI4GF_SPLIT 0x10
#define FSLI4TF_RDMA 0x01
struct fs_locations_item4 {
struct {
uint_t fli_entries_len;
fs_locations_server4 *fli_entries_val;
} fli_entries;
pathname4 fli_rootpath;
};
typedef struct fs_locations_item4 fs_locations_item4;
struct fs_locations_info4 {
uint32_t fli_flags;
int32_t fli_valid_for;
pathname4 fli_fs_root;
struct {
uint_t fli_items_len;
fs_locations_item4 *fli_items_val;
} fli_items;
};
typedef struct fs_locations_info4 fs_locations_info4;
#define FSLI4IF_VAR_SUB 0x00000001
typedef fs_locations_info4 fattr4_fs_locations_info;
#define NFL4_UFLG_MASK 0x0000003F
#define NFL4_UFLG_DENSE 0x00000001
#define NFL4_UFLG_COMMIT_THRU_MDS 0x00000002
#define NFL4_UFLG_STRIPE_UNIT_SIZE_MASK 0xFFFFFFC0
typedef uint32_t nfl_util4;
enum filelayout_hint_care4 {
NFLH4_CARE_DENSE = NFL4_UFLG_DENSE,
NFLH4_CARE_COMMIT_THRU_MDS = NFL4_UFLG_COMMIT_THRU_MDS,
NFLH4_CARE_STRIPE_UNIT_SIZE = 0x00000040,
NFLH4_CARE_STRIPE_COUNT = 0x00000080
};
typedef enum filelayout_hint_care4 filelayout_hint_care4;
/* Encoded in the loh_body field of data type layouthint4: */
struct nfsv4_1_file_layouthint4 {
uint32_t nflh_care;
nfl_util4 nflh_util;
count4 nflh_stripe_count;
};
typedef struct nfsv4_1_file_layouthint4 nfsv4_1_file_layouthint4;
typedef struct {
uint_t multipath_list4_len;
netaddr4 *multipath_list4_val;
} multipath_list4;
/*
* Encoded in the da_addr_body field of
* data type device_addr4:
*/
struct nfsv4_1_file_layout_ds_addr4 {
struct {
uint_t nflda_stripe_indices_len;
uint32_t *nflda_stripe_indices_val;
} nflda_stripe_indices;
struct {
uint_t nflda_multipath_ds_list_len;
multipath_list4 *nflda_multipath_ds_list_val;
} nflda_multipath_ds_list;
};
typedef struct nfsv4_1_file_layout_ds_addr4 nfsv4_1_file_layout_ds_addr4;
/*
* Encoded in the loc_body field of
* data type layout_content4:
*/
struct nfsv4_1_file_layout4 {
deviceid4 nfl_deviceid;
nfl_util4 nfl_util;
uint32_t nfl_first_stripe_index;
offset4 nfl_pattern_offset;
struct {
uint_t nfl_fh_list_len;
nfs_fh4 *nfl_fh_list_val;
} nfl_fh_list;
};
typedef struct nfsv4_1_file_layout4 nfsv4_1_file_layout4;
/*
* Encoded in the lou_body field of data type layoutupdate4:
* Nothing. lou_body is a zero length array of bytes.
*/
/*
* Encoded in the lrf_body field of
* data type layoutreturn_file4:
* Nothing. lrf_body is a zero length array of bytes.
*/
/* nfsv4.1 end */
enum nfs_opnum4 {
OP_ACCESS = 3,
OP_CLOSE = 4,
OP_COMMIT = 5,
OP_CREATE = 6,
OP_DELEGPURGE = 7,
OP_DELEGRETURN = 8,
OP_GETATTR = 9,
OP_GETFH = 10,
OP_LINK = 11,
OP_LOCK = 12,
OP_LOCKT = 13,
OP_LOCKU = 14,
OP_LOOKUP = 15,
OP_LOOKUPP = 16,
OP_NVERIFY = 17,
OP_OPEN = 18,
OP_OPENATTR = 19,
OP_OPEN_CONFIRM = 20,
OP_OPEN_DOWNGRADE = 21,
OP_PUTFH = 22,
OP_PUTPUBFH = 23,
OP_PUTROOTFH = 24,
OP_READ = 25,
OP_READDIR = 26,
OP_READLINK = 27,
OP_REMOVE = 28,
OP_RENAME = 29,
OP_RENEW = 30,
OP_RESTOREFH = 31,
OP_SAVEFH = 32,
OP_SECINFO = 33,
OP_SETATTR = 34,
OP_SETCLIENTID = 35,
OP_SETCLIENTID_CONFIRM = 36,
OP_VERIFY = 37,
OP_WRITE = 38,
OP_RELEASE_LOCKOWNER = 39,
/* nfsv4.1 */
OP_BACKCHANNEL_CTL = 40,
OP_BIND_CONN_TO_SESSION = 41,
OP_EXCHANGE_ID = 42,
OP_CREATE_SESSION = 43,
OP_DESTROY_SESSION = 44,
OP_FREE_STATEID = 45,
OP_GET_DIR_DELEGATION = 46,
OP_GETDEVICEINFO = 47,
OP_GETDEVICELIST = 48,
OP_LAYOUTCOMMIT = 49,
OP_LAYOUTGET = 50,
OP_LAYOUTRETURN = 51,
OP_SECINFO_NO_NAME = 52,
OP_SEQUENCE = 53,
OP_SET_SSV = 54,
OP_TEST_STATEID = 55,
OP_WANT_DELEGATION = 56,
OP_DESTROY_CLIENTID = 57,
OP_RECLAIM_COMPLETE = 58,
/* NFSv4.2 */
OP_ALLOCATE = 59,
OP_COPY = 60,
OP_COPY_NOTIFY = 61,
OP_DEALLOCATE = 62,
OP_IO_ADVISE = 63,
OP_LAYOUTERROR = 64,
OP_LAYOUTSTATS = 65,
OP_OFFLOAD_CANCEL = 66,
OP_OFFLOAD_STATUS = 67,
OP_READ_PLUS = 68,
OP_SEEK = 69,
OP_WRITE_SAME = 70,
OP_CLONE = 71,
OP_ILLEGAL = 10044,
/*
* These are internal client pseudo ops that *MUST* never go over the wire
*/
#define SUNW_PRIVATE_OP 0x10000000
#define REAL_OP4(op) ((op) & ~SUNW_PRIVATE_OP)
OP_CCREATE = OP_CREATE | SUNW_PRIVATE_OP,
OP_CLINK = OP_LINK | SUNW_PRIVATE_OP,
OP_CLOOKUP = OP_LOOKUP | SUNW_PRIVATE_OP,
OP_COPEN = OP_OPEN | SUNW_PRIVATE_OP,
OP_CPUTFH = OP_PUTFH | SUNW_PRIVATE_OP,
OP_CREMOVE = OP_REMOVE | SUNW_PRIVATE_OP,
OP_CRENAME = OP_RENAME | SUNW_PRIVATE_OP,
OP_CSECINFO = OP_SECINFO | SUNW_PRIVATE_OP
};
typedef enum nfs_opnum4 nfs_opnum4;
/* Args & res. structs */
#define ACCESS4_READ 0x00000001
#define ACCESS4_LOOKUP 0x00000002
#define ACCESS4_MODIFY 0x00000004
#define ACCESS4_EXTEND 0x00000008
#define ACCESS4_DELETE 0x00000010
#define ACCESS4_EXECUTE 0x00000020
struct ACCESS4args {
uint32_t access;
};
typedef struct ACCESS4args ACCESS4args;
struct ACCESS4res {
nfsstat4 status;
uint32_t supported;
uint32_t access;
};
typedef struct ACCESS4res ACCESS4res;
struct CLOSE4args {
seqid4 seqid;
stateid4 open_stateid;
};
typedef struct CLOSE4args CLOSE4args;
struct CLOSE4res {
nfsstat4 status;
stateid4 open_stateid;
};
typedef struct CLOSE4res CLOSE4res;
struct COMMIT4args {
offset4 offset;
count4 count;
};
typedef struct COMMIT4args COMMIT4args;
struct COMMIT4res {
nfsstat4 status;
verifier4 writeverf;
};
typedef struct COMMIT4res COMMIT4res;
struct CREATE4args {
nfs_ftype4 type;
union {
linktext4 linkdata;
specdata4 devdata;
} ftype4_u;
component4 objname;
fattr4 createattrs;
};
typedef struct CREATE4args CREATE4args;
struct CREATE4cargs {
nfs_ftype4 type;
union {
char *clinkdata;
specdata4 devdata;
} ftype4_u;
char *cname;
fattr4 createattrs;
};
typedef struct CREATE4cargs CREATE4cargs;
struct CREATE4res {
nfsstat4 status;
change_info4 cinfo;
bitmap4 attrset;
};
typedef struct CREATE4res CREATE4res;
struct DELEGPURGE4args {
clientid4 clientid;
};
typedef struct DELEGPURGE4args DELEGPURGE4args;
struct DELEGPURGE4res {
nfsstat4 status;
};
typedef struct DELEGPURGE4res DELEGPURGE4res;
struct DELEGRETURN4args {
stateid4 deleg_stateid;
};
typedef struct DELEGRETURN4args DELEGRETURN4args;
struct DELEGRETURN4res {
nfsstat4 status;
};
typedef struct DELEGRETURN4res DELEGRETURN4res;
struct mntinfo4;
struct GETATTR4args {
bitmap4 attr_request;
struct mntinfo4 *mi;
};
typedef struct GETATTR4args GETATTR4args;
struct nfs4_ga_ext_res;
struct nfs4_ga_res {
vattr_t n4g_va;
unsigned n4g_change_valid:1;
unsigned n4g_mon_fid_valid:1;
unsigned n4g_fsid_valid:1;
uint_t n4g_attrerr;
uint_t n4g_attrwhy;
bitmap4 n4g_resbmap;
fattr4_change n4g_change;
fattr4_fsid n4g_fsid;
fattr4_mounted_on_fileid n4g_mon_fid;
struct nfs4_ga_ext_res *n4g_ext_res;
vsecattr_t n4g_vsa;
};
typedef struct nfs4_ga_res nfs4_ga_res_t;
struct GETATTR4res {
nfsstat4 status;
fattr4 obj_attributes;
nfsstat4 ga_status;
struct nfs4_ga_res ga_res;
};
typedef struct GETATTR4res GETATTR4res;
struct GETFH4res {
nfsstat4 status;
nfs_fh4 object;
};
typedef struct GETFH4res GETFH4res;
struct LINK4args {
component4 newname;
};
typedef struct LINK4args LINK4args;
struct LINK4cargs {
char *cnewname;
};
typedef struct LINK4cargs LINK4cargs;
struct LINK4res {
nfsstat4 status;
change_info4 cinfo;
};
typedef struct LINK4res LINK4res;
struct open_to_lock_owner4 {
seqid4 open_seqid;
stateid4 open_stateid;
seqid4 lock_seqid;
lock_owner4 lock_owner;
};
typedef struct open_to_lock_owner4 open_to_lock_owner4;
struct exist_lock_owner4 {
stateid4 lock_stateid;
seqid4 lock_seqid;
};
typedef struct exist_lock_owner4 exist_lock_owner4;
struct locker4 {
bool_t new_lock_owner;
union {
open_to_lock_owner4 open_owner;
exist_lock_owner4 lock_owner;
} locker4_u;
};
typedef struct locker4 locker4;
struct LOCK4args {
nfs_lock_type4 locktype;
bool_t reclaim;
offset4 offset;
length4 length;
locker4 locker;
};
typedef struct LOCK4args LOCK4args;
struct LOCK4denied {
offset4 offset;
length4 length;
nfs_lock_type4 locktype;
lock_owner4 owner;
};
typedef struct LOCK4denied LOCK4denied;
struct LOCK4res {
nfsstat4 status;
union {
stateid4 lock_stateid;
LOCK4denied denied;
} LOCK4res_u;
};
typedef struct LOCK4res LOCK4res;
struct LOCKT4args {
nfs_lock_type4 locktype;
offset4 offset;
length4 length;
lock_owner4 owner;
};
typedef struct LOCKT4args LOCKT4args;
struct LOCKT4res {
nfsstat4 status;
LOCK4denied denied;
};
typedef struct LOCKT4res LOCKT4res;
struct LOCKU4args {
nfs_lock_type4 locktype;
seqid4 seqid;
stateid4 lock_stateid;
offset4 offset;
length4 length;
};
typedef struct LOCKU4args LOCKU4args;
struct LOCKU4res {
nfsstat4 status;
stateid4 lock_stateid;
};
typedef struct LOCKU4res LOCKU4res;
struct LOOKUP4args {
component4 objname;
};
typedef struct LOOKUP4args LOOKUP4args;
struct LOOKUP4cargs {
char *cname;
};
typedef struct LOOKUP4cargs LOOKUP4cargs;
struct LOOKUP4res {
nfsstat4 status;
};
typedef struct LOOKUP4res LOOKUP4res;
struct LOOKUPP4res {
nfsstat4 status;
};
typedef struct LOOKUPP4res LOOKUPP4res;
struct NVERIFY4args {
fattr4 obj_attributes;
};
typedef struct NVERIFY4args NVERIFY4args;
struct NVERIFY4res {
nfsstat4 status;
};
typedef struct NVERIFY4res NVERIFY4res;
enum createmode4 {
UNCHECKED4 = 0,
GUARDED4 = 1,
EXCLUSIVE4 = 2,
EXCLUSIVE4_1 = 3
};
typedef enum createmode4 createmode4;
struct creatverfattr {
verifier4 cva_verf;
fattr4 cva_attrs;
};
typedef struct creatverfattr creatverfattr;
struct createhow4 {
createmode4 mode;
union {
fattr4 createattrs;
verifier4 createverf;
creatverfattr ch_createboth;
} createhow4_u;
};
typedef struct createhow4 createhow4;
enum opentype4 {
OPEN4_NOCREATE = 0,
OPEN4_CREATE = 1
};
typedef enum opentype4 opentype4;
struct openflag4 {
opentype4 opentype;
union {
createhow4 how;
} openflag4_u;
};
typedef struct openflag4 openflag4;
enum limit_by4 {
NFS_LIMIT_SIZE = 1,
NFS_LIMIT_BLOCKS = 2
};
typedef enum limit_by4 limit_by4;
struct nfs_modified_limit4 {
uint32_t num_blocks;
uint32_t bytes_per_block;
};
typedef struct nfs_modified_limit4 nfs_modified_limit4;
struct nfs_space_limit4 {
limit_by4 limitby;
union {
uint64_t filesize;
nfs_modified_limit4 mod_blocks;
} nfs_space_limit4_u;
};
typedef struct nfs_space_limit4 nfs_space_limit4;
#define OPEN4_SHARE_ACCESS_MASK 0x00FF
#define OPEN4_SHARE_ACCESS_READ 0x00000001
#define OPEN4_SHARE_ACCESS_WRITE 0x00000002
#define OPEN4_SHARE_ACCESS_BOTH 0x00000003
#define OPEN4_SHARE_DENY_NONE 0x00000000
#define OPEN4_SHARE_DENY_READ 0x00000001
#define OPEN4_SHARE_DENY_WRITE 0x00000002
#define OPEN4_SHARE_DENY_BOTH 0x00000003
/* nfsv4.1 */
#define OPEN4_SHARE_WANT_MASK 0xFF00
#define OPEN4_SHARE_WANT_NO_PREFERENCE 0x0000
#define OPEN4_SHARE_WANT_READ_DELEG 0x0100
#define OPEN4_SHARE_WANT_WRITE_DELEG 0x0200
#define OPEN4_SHARE_WANT_ANY_DELEG 0x0300
#define OPEN4_SHARE_WANT_NO_DELEG 0x0400
#define OPEN4_SHARE_WANT_CANCEL 0x0500
#define OPEN4_SHARE_WHEN_MASK 0xF0000
#define OPEN4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL 0x10000
#define OPEN4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED 0x20000
enum open_delegation_type4 {
OPEN_DELEGATE_NONE = 0,
OPEN_DELEGATE_READ = 1,
OPEN_DELEGATE_WRITE = 2,
OPEN_DELEGATE_NONE_EXT = 3
};
typedef enum open_delegation_type4 open_delegation_type4;
enum open_claim_type4 {
CLAIM_NULL = 0,
CLAIM_PREVIOUS = 1,
CLAIM_DELEGATE_CUR = 2,
CLAIM_DELEGATE_PREV = 3,
CLAIM_FH = 4,
CLAIM_DELEG_CUR_FH = 5,
CLAIM_DELEG_PREV_FH = 6
};
typedef enum open_claim_type4 open_claim_type4;
struct open_claim_delegate_cur4 {
stateid4 delegate_stateid;
component4 file;
};
typedef struct open_claim_delegate_cur4 open_claim_delegate_cur4;
struct copen_claim_delegate_cur4 {
stateid4 delegate_stateid;
char *cfile;
};
typedef struct copen_claim_delegate_cur4 copen_claim_delegate_cur4;
struct open_claim4 {
open_claim_type4 claim;
union {
component4 file;
open_delegation_type4 delegate_type;
open_claim_delegate_cur4 delegate_cur_info;
component4 file_delegate_prev;
stateid4 oc_delegate_stateid;
} open_claim4_u;
};
typedef struct open_claim4 open_claim4;
struct OPEN4args {
seqid4 seqid;
uint32_t share_access;
uint32_t deleg_want; /* nfsv4.1 */
uint32_t share_deny;
open_owner4 owner;
opentype4 opentype;
createmode4 mode;
union {
fattr4 createattrs;
verifier4 createverf;
creatverfattr ch_createboth; /* for nfsv4.1 */
} createhow4_u;
open_claim4 claim;
};
typedef struct OPEN4args OPEN4args;
struct OPEN4cargs {
seqid4 seqid;
uint32_t share_access;
uint32_t share_deny;
open_owner4 owner;
opentype4 opentype;
createmode4 mode;
union {
fattr4 createattrs;
verifier4 createverf;
} createhow4_u;
open_claim_type4 claim;
union {
char *cfile;
open_delegation_type4 delegate_type;
copen_claim_delegate_cur4 delegate_cur_info;
char *cfile_delegate_prev;
} open_claim4_u;
};
typedef struct OPEN4cargs OPEN4cargs;
struct open_read_delegation4 {
stateid4 stateid;
bool_t recall;
nfsace4 permissions;
};
typedef struct open_read_delegation4 open_read_delegation4;
struct open_write_delegation4 {
stateid4 stateid;
bool_t recall;
nfs_space_limit4 space_limit;
nfsace4 permissions;
};
typedef struct open_write_delegation4 open_write_delegation4;
/* nfsv4.1 */
enum why_no_delegation4 {
WND4_NOT_WANTED = 0,
WND4_CONTENTION = 1,
WND4_RESOURCE = 2,
WND4_NOT_SUPP_FTYPE = 3,
WND4_WRITE_DELEG_NOT_SUPP_FTYPE = 4,
WND4_NOT_SUPP_UPGRADE = 5,
WND4_NOT_SUPP_DOWNGRADE = 6,
WND4_CANCELLED = 7,
WND4_IS_DIR = 8
};
typedef enum why_no_delegation4 why_no_delegation4;
struct open_none_delegation4 {
why_no_delegation4 ond_why;
union {
bool_t ond_server_will_push_deleg;
bool_t ond_server_will_signal_avail;
} open_none_delegation4_u;
};
typedef struct open_none_delegation4 open_none_delegation4;
/* nfsv4.1 end */
struct open_delegation4 {
open_delegation_type4 delegation_type;
union {
open_read_delegation4 read;
open_write_delegation4 write;
open_none_delegation4 od_whynone; /* nfsv4.1 */
} open_delegation4_u;
};
typedef struct open_delegation4 open_delegation4;
#define OPEN4_RESULT_CONFIRM 0x00000002
#define OPEN4_RESULT_LOCKTYPE_POSIX 0x00000004
#define OPEN4_RESULT_PRESERVE_UNLINKED 0x00000008 /* nfsv4.1 */
#define OPEN4_RESULT_MAY_NOTIFY_LOCK 0x00000020 /* nfsv4.1 */
struct OPEN4res {
nfsstat4 status;
stateid4 stateid;
change_info4 cinfo;
uint32_t rflags;
bitmap4 attrset;
open_delegation4 delegation;
};
typedef struct OPEN4res OPEN4res;
struct OPENATTR4args {
bool_t createdir;
};
typedef struct OPENATTR4args OPENATTR4args;
struct OPENATTR4res {
nfsstat4 status;
};
typedef struct OPENATTR4res OPENATTR4res;
struct OPEN_CONFIRM4args {
stateid4 open_stateid;
seqid4 seqid;
};
typedef struct OPEN_CONFIRM4args OPEN_CONFIRM4args;
struct OPEN_CONFIRM4res {
nfsstat4 status;
stateid4 open_stateid;
};
typedef struct OPEN_CONFIRM4res OPEN_CONFIRM4res;
struct OPEN_DOWNGRADE4args {
stateid4 open_stateid;
seqid4 seqid;
uint32_t share_access;
uint32_t deleg_want; /* nfsv4.1 */
uint32_t share_deny;
};
typedef struct OPEN_DOWNGRADE4args OPEN_DOWNGRADE4args;
struct OPEN_DOWNGRADE4res {
nfsstat4 status;
stateid4 open_stateid;
};
typedef struct OPEN_DOWNGRADE4res OPEN_DOWNGRADE4res;
struct PUTFH4args {
nfs_fh4 object;
};
typedef struct PUTFH4args PUTFH4args;
/*
* Client only side PUTFH arguments
* This is really a nfs4_sharedfh_t * but the forward declaration
* is problematic;
*/
struct PUTFH4cargs {
void *sfh;
};
typedef struct PUTFH4cargs PUTFH4cargs;
struct PUTFH4res {
nfsstat4 status;
};
typedef struct PUTFH4res PUTFH4res;
struct PUTPUBFH4res {
nfsstat4 status;
};
typedef struct PUTPUBFH4res PUTPUBFH4res;
struct PUTROOTFH4res {
nfsstat4 status;
};
typedef struct PUTROOTFH4res PUTROOTFH4res;
struct READ4args {
stateid4 stateid;
offset4 offset;
count4 count;
/* The following are used for the XDR decode path */
char *res_data_val_alt;
mblk_t *res_mblk;
struct uio *res_uiop;
uint_t res_maxsize;
#ifdef _KERNEL
struct clist *wlist;
CONN *conn;
#endif
};
typedef struct READ4args READ4args;
struct READ4res {
nfsstat4 status;
bool_t eof;
uint_t data_len;
char *data_val;
mblk_t *mblk;
#ifdef _KERNEL
struct clist *wlist;
uint_t wlist_len;
#endif
};
typedef struct READ4res READ4res;
struct rddir4_cache;
struct READDIR4args {
nfs_cookie4 cookie;
verifier4 cookieverf;
count4 dircount;
count4 maxcount;
bitmap4 attr_request;
vnode_t *dvp;
struct mntinfo4 *mi;
cred_t *cr;
struct rddir4_cache *rdc;
hrtime_t t;
};
typedef struct READDIR4args READDIR4args;
struct READDIR4res_clnt {
nfsstat4 status;
verifier4 cookieverf;
bool_t eof;
struct dirent64 *dotp, *dotdotp;
struct rddir4_cache *rdc;
};
typedef struct READDIR4res_clnt READDIR4res_clnt;
struct READDIR4res {
nfsstat4 status;
verifier4 cookieverf;
mblk_t *mblk;
uint_t data_len;
};
typedef struct READDIR4res READDIR4res;
struct READLINK4res {
nfsstat4 status;
linktext4 link;
};
typedef struct READLINK4res READLINK4res;
struct REMOVE4args {
component4 target;
};
typedef struct REMOVE4args REMOVE4args;
struct REMOVE4cargs {
char *ctarget;
};
typedef struct REMOVE4cargs REMOVE4cargs;
struct REMOVE4res {
nfsstat4 status;
change_info4 cinfo;
};
typedef struct REMOVE4res REMOVE4res;
struct RENAME4args {
component4 oldname;
component4 newname;
};
typedef struct RENAME4args RENAME4args;
struct RENAME4cargs {
char *coldname;
char *cnewname;
};
typedef struct RENAME4cargs RENAME4cargs;
struct RENAME4res {
nfsstat4 status;
change_info4 source_cinfo;
change_info4 target_cinfo;
};
typedef struct RENAME4res RENAME4res;
struct RENEW4args {
clientid4 clientid;
};
typedef struct RENEW4args RENEW4args;
struct RENEW4res {
nfsstat4 status;
};
typedef struct RENEW4res RENEW4res;
struct RESTOREFH4res {
nfsstat4 status;
};
typedef struct RESTOREFH4res RESTOREFH4res;
struct SAVEFH4res {
nfsstat4 status;
};
typedef struct SAVEFH4res SAVEFH4res;
struct SECINFO4args {
component4 name;
};
typedef struct SECINFO4args SECINFO4args;
struct SECINFO4cargs {
char *cname;
};
typedef struct SECINFO4cargs SECINFO4cargs;
enum rpc_gss_svc_t {
RPC_GSS_SVC_NONE = 1,
RPC_GSS_SVC_INTEGRITY = 2,
RPC_GSS_SVC_PRIVACY = 3
};
typedef enum rpc_gss_svc_t rpc_gss_svc_t;
struct rpcsec_gss_info {
sec_oid4 oid;
qop4 qop;
rpc_gss_svc_t service;
};
typedef struct rpcsec_gss_info rpcsec_gss_info;
struct secinfo4 {
uint32_t flavor;
rpcsec_gss_info flavor_info;
};
typedef struct secinfo4 secinfo4;
struct SECINFO4res {
nfsstat4 status;
uint_t SECINFO4resok_len;
secinfo4 *SECINFO4resok_val;
};
typedef struct SECINFO4res SECINFO4res;
struct SETATTR4args {
stateid4 stateid;
fattr4 obj_attributes;
};
typedef struct SETATTR4args SETATTR4args;
struct SETATTR4res {
nfsstat4 status;
bitmap4 attrsset;
};
typedef struct SETATTR4res SETATTR4res;
struct SETCLIENTID4args {
nfs_client_id4 client;
cb_client4 callback;
uint32_t callback_ident;
};
typedef struct SETCLIENTID4args SETCLIENTID4args;
struct SETCLIENTID4resok {
clientid4 clientid;
verifier4 setclientid_confirm;
};
typedef struct SETCLIENTID4resok SETCLIENTID4resok;
struct SETCLIENTID4res {
nfsstat4 status;
union {
SETCLIENTID4resok resok4;
clientaddr4 client_using;
} SETCLIENTID4res_u;
};
typedef struct SETCLIENTID4res SETCLIENTID4res;
struct SETCLIENTID_CONFIRM4args {
clientid4 clientid;
verifier4 setclientid_confirm;
};
typedef struct SETCLIENTID_CONFIRM4args SETCLIENTID_CONFIRM4args;
struct SETCLIENTID_CONFIRM4res {
nfsstat4 status;
};
typedef struct SETCLIENTID_CONFIRM4res SETCLIENTID_CONFIRM4res;
struct VERIFY4args {
fattr4 obj_attributes;
};
typedef struct VERIFY4args VERIFY4args;
struct VERIFY4res {
nfsstat4 status;
};
typedef struct VERIFY4res VERIFY4res;
/*
* mblk doesn't go over the wire. If non-NULL, it points to an mblk chain
* for the write data.
*/
struct WRITE4args {
stateid4 stateid;
offset4 offset;
stable_how4 stable;
uint_t data_len;
char *data_val;
mblk_t *mblk;
#ifdef _KERNEL
struct clist *rlist;
CONN *conn;
#endif
};
typedef struct WRITE4args WRITE4args;
struct WRITE4res {
nfsstat4 status;
count4 count;
stable_how4 committed;
verifier4 writeverf;
};
typedef struct WRITE4res WRITE4res;
struct RELEASE_LOCKOWNER4args {
lock_owner4 lock_owner;
};
typedef struct RELEASE_LOCKOWNER4args RELEASE_LOCKOWNER4args;
struct RELEASE_LOCKOWNER4res {
nfsstat4 status;
};
typedef struct RELEASE_LOCKOWNER4res RELEASE_LOCKOWNER4res;
struct ILLEGAL4res {
nfsstat4 status;
};
typedef struct ILLEGAL4res ILLEGAL4res;
/*
* New operations for nfsv4.1
*/
typedef struct {
uint_t gsshandle4_t_len;
char *gsshandle4_t_val;
} gsshandle4_t;
struct gss_cb_handles4 {
rpc_gss_svc_t gcbp_service;
gsshandle4_t gcbp_handle_from_server;
gsshandle4_t gcbp_handle_from_client;
};
typedef struct gss_cb_handles4 gss_cb_handles4;
struct callback_sec_parms4 {
uint32_t cb_secflavor;
union {
authsys_parms cbsp_sys_cred;
gss_cb_handles4 cbsp_gss_handles;
} callback_sec_parms4_u;
};
typedef struct callback_sec_parms4 callback_sec_parms4;
struct BACKCHANNEL_CTL4args {
uint32_t bca_cb_program;
struct {
uint_t bca_sec_parms_len;
callback_sec_parms4 *bca_sec_parms_val;
} bca_sec_parms;
};
typedef struct BACKCHANNEL_CTL4args BACKCHANNEL_CTL4args;
struct BACKCHANNEL_CTL4res {
nfsstat4 bcr_status;
};
typedef struct BACKCHANNEL_CTL4res BACKCHANNEL_CTL4res;
enum channel_dir_from_client4 {
CDFC4_FORE = 0x1,
CDFC4_BACK = 0x2,
CDFC4_FORE_OR_BOTH = 0x3,
CDFC4_BACK_OR_BOTH = 0x7
};
typedef enum channel_dir_from_client4 channel_dir_from_client4;
struct BIND_CONN_TO_SESSION4args {
sessionid4 bctsa_sessid;
channel_dir_from_client4 bctsa_dir;
bool_t bctsa_use_conn_in_rdma_mode;
};
typedef struct BIND_CONN_TO_SESSION4args BIND_CONN_TO_SESSION4args;
enum channel_dir_from_server4 {
CDFS4_FORE = 0x1,
CDFS4_BACK = 0x2,
CDFS4_BOTH = 0x3
};
typedef enum channel_dir_from_server4 channel_dir_from_server4;
struct BIND_CONN_TO_SESSION4resok {
sessionid4 bctsr_sessid;
channel_dir_from_server4 bctsr_dir;
bool_t bctsr_use_conn_in_rdma_mode;
};
typedef struct BIND_CONN_TO_SESSION4resok BIND_CONN_TO_SESSION4resok;
struct BIND_CONN_TO_SESSION4res {
nfsstat4 bctsr_status;
union {
BIND_CONN_TO_SESSION4resok bctsr_resok4;
} BIND_CONN_TO_SESSION4res_u;
};
typedef struct BIND_CONN_TO_SESSION4res BIND_CONN_TO_SESSION4res;
#define EXCHGID4_FLAG_SUPP_MOVED_REFER 0x00000001
#define EXCHGID4_FLAG_SUPP_MOVED_MIGR 0x00000002
#define EXCHGID4_FLAG_BIND_PRINC_STATEID 0x00000100
#define EXCHGID4_FLAG_USE_NON_PNFS 0x00010000
#define EXCHGID4_FLAG_USE_PNFS_MDS 0x00020000
#define EXCHGID4_FLAG_USE_PNFS_DS 0x00040000
#define EXCHGID4_FLAG_MASK_PNFS 0x00070000
#define EXCHGID4_FLAG_UPD_CONFIRMED_REC_A 0x40000000
#define EXCHGID4_FLAG_CONFIRMED_R 0x80000000
#define EXID4_FLAG_MASK 0x40070103
struct state_protect_ops4 {
bitmap4 spo_must_enforce;
bitmap4 spo_must_allow;
};
typedef struct state_protect_ops4 state_protect_ops4;
struct ssv_sp_parms4 {
state_protect_ops4 ssp_ops;
struct {
uint_t ssp_hash_algs_len;
sec_oid4 *ssp_hash_algs_val;
} ssp_hash_algs;
struct {
uint_t ssp_encr_algs_len;
sec_oid4 *ssp_encr_algs_val;
} ssp_encr_algs;
uint32_t ssp_window;
uint32_t ssp_num_gss_handles;
};
typedef struct ssv_sp_parms4 ssv_sp_parms4;
enum state_protect_how4 {
SP4_NONE = 0,
SP4_MACH_CRED = 1,
SP4_SSV = 2
};
typedef enum state_protect_how4 state_protect_how4;
struct state_protect4_a {
state_protect_how4 spa_how;
union {
state_protect_ops4 spa_mach_ops;
ssv_sp_parms4 spa_ssv_parms;
} state_protect4_a_u;
};
typedef struct state_protect4_a state_protect4_a;
struct EXCHANGE_ID4args {
client_owner4 eia_clientowner;
uint32_t eia_flags;
state_protect4_a eia_state_protect;
struct {
uint_t eia_client_impl_id_len;
nfs_impl_id4 *eia_client_impl_id_val;
} eia_client_impl_id;
};
typedef struct EXCHANGE_ID4args EXCHANGE_ID4args;
struct ssv_prot_info4 {
state_protect_ops4 spi_ops;
uint32_t spi_hash_alg;
uint32_t spi_encr_alg;
uint32_t spi_ssv_len;
uint32_t spi_window;
struct {
uint_t spi_handles_len;
gsshandle4_t *spi_handles_val;
} spi_handles;
};
typedef struct ssv_prot_info4 ssv_prot_info4;
struct state_protect4_r {
state_protect_how4 spr_how;
union {
state_protect_ops4 spr_mach_ops;
ssv_prot_info4 spr_ssv_info;
} state_protect4_r_u;
};
typedef struct state_protect4_r state_protect4_r;
struct EXCHANGE_ID4resok {
clientid4 eir_clientid;
sequenceid4 eir_sequenceid;
uint32_t eir_flags;
state_protect4_r eir_state_protect;
server_owner4 eir_server_owner;
struct eir_server_scope {
uint_t eir_server_scope_len;
char *eir_server_scope_val;
} eir_server_scope;
struct {
uint_t eir_server_impl_id_len;
nfs_impl_id4 *eir_server_impl_id_val;
} eir_server_impl_id;
};
typedef struct EXCHANGE_ID4resok EXCHANGE_ID4resok;
struct EXCHANGE_ID4res {
nfsstat4 eir_status;
union {
EXCHANGE_ID4resok eir_resok4;
} EXCHANGE_ID4res_u;
};
typedef struct EXCHANGE_ID4res EXCHANGE_ID4res;
struct channel_attrs4 {
count4 ca_headerpadsize;
count4 ca_maxrequestsize;
count4 ca_maxresponsesize;
count4 ca_maxresponsesize_cached;
count4 ca_maxoperations;
count4 ca_maxrequests;
struct {
uint_t ca_rdma_ird_len;
uint32_t *ca_rdma_ird_val;
} ca_rdma_ird;
};
typedef struct channel_attrs4 channel_attrs4;
#define CREATE_SESSION4_FLAG_PERSIST 0x00000001
#define CREATE_SESSION4_FLAG_CONN_BACK_CHAN 0x00000002
#define CREATE_SESSION4_FLAG_CONN_RDMA 0x00000004
#define CREATE_SESSION4_FLAG_MASK 0x07
/* added manually; ie. not part of rpcgened mojo */
typedef struct {
uint_t csa_sec_parms_len;
callback_sec_parms4 *csa_sec_parms_val;
} csa_sec_parms_t;
struct CREATE_SESSION4args {
clientid4 csa_clientid;
sequenceid4 csa_sequence;
uint32_t csa_flags;
channel_attrs4 csa_fore_chan_attrs;
channel_attrs4 csa_back_chan_attrs;
uint32_t csa_cb_program;
struct {
uint_t csa_sec_parms_len;
callback_sec_parms4 *csa_sec_parms_val;
} csa_sec_parms;
};
typedef struct CREATE_SESSION4args CREATE_SESSION4args;
struct CREATE_SESSION4resok {
sessionid4 csr_sessionid;
sequenceid4 csr_sequence;
uint32_t csr_flags;
channel_attrs4 csr_fore_chan_attrs;
channel_attrs4 csr_back_chan_attrs;
};
typedef struct CREATE_SESSION4resok CREATE_SESSION4resok;
struct CREATE_SESSION4res {
nfsstat4 csr_status;
union {
CREATE_SESSION4resok csr_resok4;
} CREATE_SESSION4res_u;
};
typedef struct CREATE_SESSION4res CREATE_SESSION4res;
struct DESTROY_SESSION4args {
sessionid4 dsa_sessionid;
};
typedef struct DESTROY_SESSION4args DESTROY_SESSION4args;
struct DESTROY_SESSION4res {
nfsstat4 dsr_status;
};
typedef struct DESTROY_SESSION4res DESTROY_SESSION4res;
struct FREE_STATEID4args {
stateid4 fsa_stateid;
};
typedef struct FREE_STATEID4args FREE_STATEID4args;
struct FREE_STATEID4res {
nfsstat4 fsr_status;
};
typedef struct FREE_STATEID4res FREE_STATEID4res;
typedef nfstime4 attr_notice4;
struct GET_DIR_DELEGATION4args {
bool_t gdda_signal_deleg_avail;
bitmap4 gdda_notification_types;
attr_notice4 gdda_child_attr_delay;
attr_notice4 gdda_dir_attr_delay;
bitmap4 gdda_child_attributes;
bitmap4 gdda_dir_attributes;
};
typedef struct GET_DIR_DELEGATION4args GET_DIR_DELEGATION4args;
struct GET_DIR_DELEGATION4resok {
verifier4 gddr_cookieverf;
stateid4 gddr_stateid;
bitmap4 gddr_notification;
bitmap4 gddr_child_attributes;
bitmap4 gddr_dir_attributes;
};
typedef struct GET_DIR_DELEGATION4resok GET_DIR_DELEGATION4resok;
enum gddrnf4_status {
GDD4_OK = 0,
GDD4_UNAVAIL = 1
};
typedef enum gddrnf4_status gddrnf4_status;
struct GET_DIR_DELEGATION4res_non_fatal {
gddrnf4_status gddrnf_status;
union {
GET_DIR_DELEGATION4resok gddrnf_resok4;
bool_t gddrnf_will_signal_deleg_avail;
} GET_DIR_DELEGATION4res_non_fatal_u;
};
typedef struct GET_DIR_DELEGATION4res_non_fatal
GET_DIR_DELEGATION4res_non_fatal;
struct GET_DIR_DELEGATION4res {
nfsstat4 gddr_status;
union {
GET_DIR_DELEGATION4res_non_fatal gddr_res_non_fatal4;
} GET_DIR_DELEGATION4res_u;
};
typedef struct GET_DIR_DELEGATION4res GET_DIR_DELEGATION4res;
struct GETDEVICEINFO4args {
deviceid4 gdia_device_id;
layouttype4 gdia_layout_type;
count4 gdia_maxcount;
bitmap4 gdia_notify_types;
};
typedef struct GETDEVICEINFO4args GETDEVICEINFO4args;
struct GETDEVICEINFO4resok {
device_addr4 gdir_device_addr;
bitmap4 gdir_notification;
};
typedef struct GETDEVICEINFO4resok GETDEVICEINFO4resok;
struct GETDEVICEINFO4res {
nfsstat4 gdir_status;
union {
GETDEVICEINFO4resok gdir_resok4;
count4 gdir_mincount;
} GETDEVICEINFO4res_u;
};
typedef struct GETDEVICEINFO4res GETDEVICEINFO4res;
struct GETDEVICELIST4args {
layouttype4 gdla_layout_type;
count4 gdla_maxdevices;
nfs_cookie4 gdla_cookie;
verifier4 gdla_cookieverf;
};
typedef struct GETDEVICELIST4args GETDEVICELIST4args;
struct GETDEVICELIST4resok {
nfs_cookie4 gdlr_cookie;
verifier4 gdlr_cookieverf;
struct {
uint_t gdlr_deviceid_list_len;
deviceid4 *gdlr_deviceid_list_val;
} gdlr_deviceid_list;
bool_t gdlr_eof;
};
typedef struct GETDEVICELIST4resok GETDEVICELIST4resok;
struct GETDEVICELIST4res {
nfsstat4 gdlr_status;
union {
GETDEVICELIST4resok gdlr_resok4;
} GETDEVICELIST4res_u;
};
typedef struct GETDEVICELIST4res GETDEVICELIST4res;
struct newtime4 {
bool_t nt_timechanged;
union {
nfstime4 nt_time;
} newtime4_u;
};
typedef struct newtime4 newtime4;
struct newoffset4 {
bool_t no_newoffset;
union {
offset4 no_offset;
} newoffset4_u;
};
typedef struct newoffset4 newoffset4;
struct LAYOUTCOMMIT4args {
offset4 loca_offset;
length4 loca_length;
bool_t loca_reclaim;
stateid4 loca_stateid;
newoffset4 loca_last_write_offset;
newtime4 loca_time_modify;
layoutupdate4 loca_layoutupdate;
};
typedef struct LAYOUTCOMMIT4args LAYOUTCOMMIT4args;
struct newsize4 {
bool_t ns_sizechanged;
union {
length4 ns_size;
} newsize4_u;
};
typedef struct newsize4 newsize4;
struct LAYOUTCOMMIT4resok {
newsize4 locr_newsize;
};
typedef struct LAYOUTCOMMIT4resok LAYOUTCOMMIT4resok;
struct LAYOUTCOMMIT4res {
nfsstat4 locr_status;
union {
LAYOUTCOMMIT4resok locr_resok4;
} LAYOUTCOMMIT4res_u;
};
typedef struct LAYOUTCOMMIT4res LAYOUTCOMMIT4res;
struct LAYOUTGET4args {
bool_t loga_signal_layout_avail;
layouttype4 loga_layout_type;
layoutiomode4 loga_iomode;
offset4 loga_offset;
length4 loga_length;
length4 loga_minlength;
stateid4 loga_stateid;
count4 loga_maxcount;
};
typedef struct LAYOUTGET4args LAYOUTGET4args;
struct LAYOUTGET4resok {
bool_t logr_return_on_close;
stateid4 logr_stateid;
struct {
uint_t logr_layout_len;
layout4 *logr_layout_val;
} logr_layout;
};
typedef struct LAYOUTGET4resok LAYOUTGET4resok;
struct LAYOUTGET4res {
nfsstat4 logr_status;
union {
LAYOUTGET4resok logr_resok4;
bool_t logr_will_signal_layout_avail;
} LAYOUTGET4res_u;
};
typedef struct LAYOUTGET4res LAYOUTGET4res;
struct LAYOUTRETURN4args {
bool_t lora_reclaim;
layouttype4 lora_layout_type;
layoutiomode4 lora_iomode;
layoutreturn4 lora_layoutreturn;
};
typedef struct LAYOUTRETURN4args LAYOUTRETURN4args;
struct layoutreturn_stateid {
bool_t lrs_present;
union {
stateid4 lrs_stateid;
} layoutreturn_stateid_u;
};
typedef struct layoutreturn_stateid layoutreturn_stateid;
struct LAYOUTRETURN4res {
nfsstat4 lorr_status;
union {
layoutreturn_stateid lorr_stateid;
} LAYOUTRETURN4res_u;
};
typedef struct LAYOUTRETURN4res LAYOUTRETURN4res;
enum secinfo_style4 {
SECINFO_STYLE4_CURRENT_FH = 0,
SECINFO_STYLE4_PARENT = 1
};
typedef enum secinfo_style4 secinfo_style4;
typedef secinfo_style4 SECINFO_NO_NAME4args;
typedef SECINFO4res SECINFO_NO_NAME4res;
struct SEQUENCE4args {
sessionid4 sa_sessionid;
sequenceid4 sa_sequenceid;
slotid4 sa_slotid;
slotid4 sa_highest_slotid;
bool_t sa_cachethis;
};
typedef struct SEQUENCE4args SEQUENCE4args;
#define SEQ4_STATUS_CB_PATH_DOWN 0x00000001
#define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING 0x00000002
#define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED 0x00000004
#define SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED 0x00000008
#define SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED 0x00000010
#define SEQ4_STATUS_ADMIN_STATE_REVOKED 0x00000020
#define SEQ4_STATUS_RECALLABLE_STATE_REVOKED 0x00000040
#define SEQ4_STATUS_LEASE_MOVED 0x00000080
#define SEQ4_STATUS_RESTART_RECLAIM_NEEDED 0x00000100
#define SEQ4_STATUS_CB_PATH_DOWN_SESSION 0x00000200
#define SEQ4_STATUS_BACKCHANNEL_FAULT 0x00000400
#define SEQ4_STATUS_DEVID_CHANGED 0x00000800
#define SEQ4_STATUS_DEVID_DELETED 0x00001000
#define SEQ4_HIGH_BIT SEQ4_STATUS_DEVID_DELETED /* highest defined flag */
struct SEQUENCE4resok {
sessionid4 sr_sessionid;
sequenceid4 sr_sequenceid;
slotid4 sr_slotid;
slotid4 sr_highest_slotid;
slotid4 sr_target_highest_slotid;
uint32_t sr_status_flags;
};
typedef struct SEQUENCE4resok SEQUENCE4resok;
struct SEQUENCE4res {
nfsstat4 sr_status;
union {
SEQUENCE4resok sr_resok4;
} SEQUENCE4res_u;
};
typedef struct SEQUENCE4res SEQUENCE4res;
struct ssa_digest_input4 {
SEQUENCE4args sdi_seqargs;
};
typedef struct ssa_digest_input4 ssa_digest_input4;
struct SET_SSV4args {
struct {
uint_t ssa_ssv_len;
char *ssa_ssv_val;
} ssa_ssv;
struct {
uint_t ssa_digest_len;
char *ssa_digest_val;
} ssa_digest;
};
typedef struct SET_SSV4args SET_SSV4args;
struct ssr_digest_input4 {
SEQUENCE4res sdi_seqres;
};
typedef struct ssr_digest_input4 ssr_digest_input4;
struct SET_SSV4resok {
struct {
uint_t ssr_digest_len;
char *ssr_digest_val;
} ssr_digest;
};
typedef struct SET_SSV4resok SET_SSV4resok;
struct SET_SSV4res {
nfsstat4 ssr_status;
union {
SET_SSV4resok ssr_resok4;
} SET_SSV4res_u;
};
typedef struct SET_SSV4res SET_SSV4res;
struct TEST_STATEID4args {
struct {
uint_t ts_stateids_len;
stateid4 *ts_stateids_val;
} ts_stateids;
};
typedef struct TEST_STATEID4args TEST_STATEID4args;
struct TEST_STATEID4resok {
struct {
uint_t tsr_status_codes_len;
nfsstat4 *tsr_status_codes_val;
} tsr_status_codes;
};
typedef struct TEST_STATEID4resok TEST_STATEID4resok;
struct TEST_STATEID4res {
nfsstat4 tsr_status;
union {
TEST_STATEID4resok tsr_resok4;
} TEST_STATEID4res_u;
};
typedef struct TEST_STATEID4res TEST_STATEID4res;
struct deleg_claim4 {
open_claim_type4 dc_claim;
union {
open_delegation_type4 dc_delegate_type;
} deleg_claim4_u;
};
typedef struct deleg_claim4 deleg_claim4;
struct WANT_DELEGATION4args {
uint32_t wda_want;
deleg_claim4 wda_claim;
};
typedef struct WANT_DELEGATION4args WANT_DELEGATION4args;
struct WANT_DELEGATION4res {
nfsstat4 wdr_status;
union {
open_delegation4 wdr_resok4;
} WANT_DELEGATION4res_u;
};
typedef struct WANT_DELEGATION4res WANT_DELEGATION4res;
struct DESTROY_CLIENTID4args {
clientid4 dca_clientid;
};
typedef struct DESTROY_CLIENTID4args DESTROY_CLIENTID4args;
struct DESTROY_CLIENTID4res {
nfsstat4 dcr_status;
};
typedef struct DESTROY_CLIENTID4res DESTROY_CLIENTID4res;
struct RECLAIM_COMPLETE4args {
bool_t rca_one_fs;
};
typedef struct RECLAIM_COMPLETE4args RECLAIM_COMPLETE4args;
struct RECLAIM_COMPLETE4res {
nfsstat4 rcr_status;
};
typedef struct RECLAIM_COMPLETE4res RECLAIM_COMPLETE4res;
/*
* New operations for nfsv4.2
*/
struct CLONE4args {
stateid4 cl_src_stateid;
stateid4 cl_dst_stateid;
offset4 cl_src_offset;
offset4 cl_dst_offset;
length4 cl_count;
};
typedef struct CLONE4args CLONE4args;
struct CLONE4res {
nfsstat4 cl_status;
};
typedef struct CLONE4res CLONE4res;
struct COPY4args {
stateid4 ca_src_stateid;
stateid4 ca_dst_stateid;
offset4 ca_src_offset;
offset4 ca_dst_offset;
length4 ca_count;
bool_t ca_consecutive;
bool_t ca_synchronous;
struct {
uint_t ca_source_server_len;
netloc4 *ca_source_server_val;
} ca_source_server;
};
typedef struct COPY4args COPY4args;
struct copy_requirements4 {
bool_t cr_consecutive;
bool_t cr_synchronous;
};
typedef struct copy_requirements4 copy_requirements4;
struct COPY4resok {
write_response4 cr_response;
copy_requirements4 cr_requirements;
};
typedef struct COPY4resok COPY4resok;
struct COPY4res {
nfsstat4 cr_status;
union {
COPY4resok cr_resok4;
copy_requirements4 cr_requirements;
} COPY4res_u;
};
typedef struct COPY4res COPY4res;
struct COPY_NOTIFY4args {
stateid4 cna_src_stateid;
netloc4 cna_destination_server;
};
typedef struct COPY_NOTIFY4args COPY_NOTIFY4args;
struct COPY_NOTIFY4resok {
nfstime4 cnr_lease_time;
stateid4 cnr_stateid;
struct {
uint_t cnr_source_server_len;
netloc4 *cnr_source_server_val;
} cnr_source_server;
};
typedef struct COPY_NOTIFY4resok COPY_NOTIFY4resok;
struct COPY_NOTIFY4res {
nfsstat4 cnr_status;
union {
COPY_NOTIFY4resok resok4;
} COPY_NOTIFY4res_u;
};
typedef struct COPY_NOTIFY4res COPY_NOTIFY4res;
struct OFFLOAD_CANCEL4args {
stateid4 oca_stateid;
};
typedef struct OFFLOAD_CANCEL4args OFFLOAD_CANCEL4args;
struct OFFLOAD_CANCEL4res {
nfsstat4 ocr_status;
};
typedef struct OFFLOAD_CANCEL4res OFFLOAD_CANCEL4res;
struct OFFLOAD_STATUS4args {
stateid4 osa_stateid;
};
typedef struct OFFLOAD_STATUS4args OFFLOAD_STATUS4args;
struct OFFLOAD_STATUS4resok {
length4 osr_count;
struct {
uint_t osr_complete_len;
nfsstat4 *osr_complete_val;
} osr_complete;
};
typedef struct OFFLOAD_STATUS4resok OFFLOAD_STATUS4resok;
struct OFFLOAD_STATUS4res {
nfsstat4 osr_status;
union {
OFFLOAD_STATUS4resok osr_resok4;
} OFFLOAD_STATUS4res_u;
};
typedef struct OFFLOAD_STATUS4res OFFLOAD_STATUS4res;
struct ALLOCATE4args {
stateid4 aa_stateid;
offset4 aa_offset;
length4 aa_length;
};
typedef struct ALLOCATE4args ALLOCATE4args;
struct ALLOCATE4res {
nfsstat4 ar_status;
};
typedef struct ALLOCATE4res ALLOCATE4res;
struct DEALLOCATE4args {
stateid4 da_stateid;
offset4 da_offset;
length4 da_length;
};
typedef struct DEALLOCATE4args DEALLOCATE4args;
struct DEALLOCATE4res {
nfsstat4 dr_status;
};
typedef struct DEALLOCATE4res DEALLOCATE4res;
enum IO_ADVISE_type4 {
IO_ADVISE4_NORMAL = 0,
IO_ADVISE4_SEQUENTIAL = 1,
IO_ADVISE4_SEQUENTIAL_BACKWARDS = 2,
IO_ADVISE4_RANDOM = 3,
IO_ADVISE4_WILLNEED = 4,
IO_ADVISE4_WILLNEED_OPPORTUNISTIC = 5,
IO_ADVISE4_DONTNEED = 6,
IO_ADVISE4_NOREUSE = 7,
IO_ADVISE4_READ = 8,
IO_ADVISE4_WRITE = 9,
IO_ADVISE4_INIT_PROXIMITY = 10
};
typedef enum IO_ADVISE_type4 IO_ADVISE_type4;
struct IO_ADVISE4args {
stateid4 iaa_stateid;
offset4 iaa_offset;
length4 iaa_count;
bitmap4 iaa_hints;
};
typedef struct IO_ADVISE4args IO_ADVISE4args;
struct IO_ADVISE4resok {
bitmap4 ior_hints;
};
typedef struct IO_ADVISE4resok IO_ADVISE4resok;
struct IO_ADVISE4res {
nfsstat4 ior_status;
union {
IO_ADVISE4resok resok4;
} IO_ADVISE4res_u;
};
typedef struct IO_ADVISE4res IO_ADVISE4res;
struct device_error4 {
deviceid4 de_deviceid;
nfsstat4 de_status;
nfs_opnum4 de_opnum;
};
typedef struct device_error4 device_error4;
struct LAYOUTERROR4args {
offset4 lea_offset;
length4 lea_length;
stateid4 lea_stateid;
struct {
uint_t lea_errors_len;
device_error4 *lea_errors_val;
} lea_errors;
};
typedef struct LAYOUTERROR4args LAYOUTERROR4args;
struct LAYOUTERROR4res {
nfsstat4 ler_status;
};
typedef struct LAYOUTERROR4res LAYOUTERROR4res;
struct io_info4 {
uint64_t ii_count;
uint64_t ii_bytes;
};
typedef struct io_info4 io_info4;
struct LAYOUTSTATS4args {
offset4 lsa_offset;
length4 lsa_length;
stateid4 lsa_stateid;
io_info4 lsa_read;
io_info4 lsa_write;
deviceid4 lsa_deviceid;
layoutupdate4 lsa_layoutupdate;
};
typedef struct LAYOUTSTATS4args LAYOUTSTATS4args;
struct LAYOUTSTATS4res {
nfsstat4 lsr_status;
};
typedef struct LAYOUTSTATS4res LAYOUTSTATS4res;
struct READ_PLUS4args {
stateid4 rpa_stateid;
offset4 rpa_offset;
count4 rpa_count;
};
typedef struct READ_PLUS4args READ_PLUS4args;
struct read_plus_content {
data_content4 rpc_content;
union {
data4 rpc_data;
data_info4 rpc_hole;
} read_plus_content_u;
};
typedef struct read_plus_content read_plus_content;
struct read_plus_res4 {
bool_t rpr_eof;
struct {
uint_t rpr_contents_len;
read_plus_content *rpr_contents_val;
} rpr_contents;
};
typedef struct read_plus_res4 read_plus_res4;
struct READ_PLUS4res {
nfsstat4 rp_status;
union {
read_plus_res4 rp_resok4;
} READ_PLUS4res_u;
};
typedef struct READ_PLUS4res READ_PLUS4res;
struct SEEK4args {
stateid4 sa_stateid;
offset4 sa_offset;
data_content4 sa_what;
};
typedef struct SEEK4args SEEK4args;
struct seek_res4 {
bool_t sr_eof;
offset4 sr_offset;
};
typedef struct seek_res4 seek_res4;
struct SEEK4res {
nfsstat4 sa_status;
union {
seek_res4 resok4;
} SEEK4res_u;
};
typedef struct SEEK4res SEEK4res;
struct WRITE_SAME4args {
stateid4 wsa_stateid;
stable_how4 wsa_stable;
app_data_block4 wsa_adb;
};
typedef struct WRITE_SAME4args WRITE_SAME4args;
struct WRITE_SAME4res {
nfsstat4 wsr_status;
union {
write_response4 resok4;
} WRITE_SAME4res_u;
};
typedef struct WRITE_SAME4res WRITE_SAME4res;
/* new operations for NFSv4.2 end */
struct nfs_argop4 {
nfs_opnum4 argop;
union {
ACCESS4args opaccess;
CLOSE4args opclose;
COMMIT4args opcommit;
CREATE4args opcreate;
CREATE4cargs opccreate;
DELEGPURGE4args opdelegpurge;
DELEGRETURN4args opdelegreturn;
GETATTR4args opgetattr;
LINK4args oplink;
LINK4cargs opclink;
LOCK4args oplock;
LOCKT4args oplockt;
LOCKU4args oplocku;
LOOKUP4args oplookup;
LOOKUP4cargs opclookup;
NVERIFY4args opnverify;
OPEN4args opopen;
OPEN4cargs opcopen;
OPENATTR4args opopenattr;
OPEN_CONFIRM4args opopen_confirm;
OPEN_DOWNGRADE4args opopen_downgrade;
PUTFH4args opputfh;
PUTFH4cargs opcputfh;
READ4args opread;
READDIR4args opreaddir;
REMOVE4args opremove;
REMOVE4cargs opcremove;
RENAME4args oprename;
RENAME4cargs opcrename;
RENEW4args oprenew;
SECINFO4args opsecinfo;
SECINFO4cargs opcsecinfo;
SETATTR4args opsetattr;
SETCLIENTID4args opsetclientid;
SETCLIENTID_CONFIRM4args opsetclientid_confirm;
VERIFY4args opverify;
WRITE4args opwrite;
RELEASE_LOCKOWNER4args oprelease_lockowner;
BACKCHANNEL_CTL4args opbackchannel_ctl; /* nfsv4.1 */
BIND_CONN_TO_SESSION4args opbind_conn_to_session;
EXCHANGE_ID4args opexchange_id;
CREATE_SESSION4args opcreate_session;
DESTROY_SESSION4args opdestroy_session;
FREE_STATEID4args opfree_stateid;
GET_DIR_DELEGATION4args opget_dir_delegation;
GETDEVICEINFO4args opgetdeviceinfo;
GETDEVICELIST4args opgetdevicelist;
LAYOUTCOMMIT4args oplayoutcommit;
LAYOUTGET4args oplayoutget;
LAYOUTRETURN4args oplayoutreturn;
SECINFO_NO_NAME4args opsecinfo_no_name;
SEQUENCE4args opsequence;
SET_SSV4args opset_ssv;
TEST_STATEID4args optest_stateid;
WANT_DELEGATION4args opwant_delegation;
DESTROY_CLIENTID4args opdestroy_clientid;
RECLAIM_COMPLETE4args opreclaim_complete;
/* nfsv4.2 */
ALLOCATE4args opallocate;
COPY4args opcopy;
COPY_NOTIFY4args opoffload_notify;
DEALLOCATE4args opdeallocate;
IO_ADVISE4args opio_advise;
LAYOUTERROR4args oplayouterror;
LAYOUTSTATS4args oplayoutstats;
OFFLOAD_CANCEL4args opoffload_cancel;
OFFLOAD_STATUS4args opoffload_status;
READ_PLUS4args opread_plus;
SEEK4args opseek;
WRITE_SAME4args opwrite_same;
CLONE4args opclone;
} nfs_argop4_u;
};
typedef struct nfs_argop4 nfs_argop4;
struct nfs_resop4 {
nfs_opnum4 resop;
union {
ACCESS4res opaccess;
CLOSE4res opclose;
COMMIT4res opcommit;
CREATE4res opcreate;
DELEGPURGE4res opdelegpurge;
DELEGRETURN4res opdelegreturn;
GETATTR4res opgetattr;
GETFH4res opgetfh;
LINK4res oplink;
LOCK4res oplock;
LOCKT4res oplockt;
LOCKU4res oplocku;
LOOKUP4res oplookup;
LOOKUPP4res oplookupp;
NVERIFY4res opnverify;
OPEN4res opopen;
OPENATTR4res opopenattr;
OPEN_CONFIRM4res opopen_confirm;
OPEN_DOWNGRADE4res opopen_downgrade;
PUTFH4res opputfh;
PUTPUBFH4res opputpubfh;
PUTROOTFH4res opputrootfh;
READ4res opread;
READDIR4res opreaddir;
READDIR4res_clnt opreaddirclnt;
READLINK4res opreadlink;
REMOVE4res opremove;
RENAME4res oprename;
RENEW4res oprenew;
RESTOREFH4res oprestorefh;
SAVEFH4res opsavefh;
SECINFO4res opsecinfo;
SETATTR4res opsetattr;
SETCLIENTID4res opsetclientid;
SETCLIENTID_CONFIRM4res opsetclientid_confirm;
VERIFY4res opverify;
WRITE4res opwrite;
RELEASE_LOCKOWNER4res oprelease_lockowner;
BACKCHANNEL_CTL4res opbackchannel_ctl; /* nfsv4.1 */
BIND_CONN_TO_SESSION4res opbind_conn_to_session;
EXCHANGE_ID4res opexchange_id;
CREATE_SESSION4res opcreate_session;
DESTROY_SESSION4res opdestroy_session;
FREE_STATEID4res opfree_stateid;
GET_DIR_DELEGATION4res opget_dir_delegation;
GETDEVICEINFO4res opgetdeviceinfo;
GETDEVICELIST4res opgetdevicelist;
LAYOUTCOMMIT4res oplayoutcommit;
LAYOUTGET4res oplayoutget;
LAYOUTRETURN4res oplayoutreturn;
SECINFO_NO_NAME4res opsecinfo_no_name;
SEQUENCE4res opsequence;
SET_SSV4res opset_ssv;
TEST_STATEID4res optest_stateid;
WANT_DELEGATION4res opwant_delegation;
DESTROY_CLIENTID4res opdestroy_clientid;
RECLAIM_COMPLETE4res opreclaim_complete;
/* nfsv4.2 */
ALLOCATE4res opallocate;
COPY4res opcopy;
COPY_NOTIFY4res opcopy_notify;
DEALLOCATE4res opdeallocate;
IO_ADVISE4res opio_advise;
LAYOUTERROR4res oplayouterror;
LAYOUTSTATS4res oplayoutstats;
OFFLOAD_CANCEL4res opoffload_cancel;
OFFLOAD_STATUS4res opoffload_status;
READ_PLUS4res opread_plus;
SEEK4res opseek;
WRITE_SAME4res opwrite_same;
CLONE4res opclone;
ILLEGAL4res opillegal;
} nfs_resop4_u;
};
typedef struct nfs_resop4 nfs_resop4;
/*
* Fixed size tag string for easy client encoding
*/
struct _ctag {
int ct_type;
char *ct_str;
uint32_t ct_tag[3];
};
typedef struct _ctag ctag_t;
/*
* Client-only encode-only version
*/
struct COMPOUND4args_clnt {
int ctag;
uint_t array_len;
nfs_argop4 *array;
};
typedef struct COMPOUND4args_clnt COMPOUND4args_clnt;
struct COMPOUND4args {
utf8string tag;
uint32_t minorversion;
uint_t array_len;
nfs_argop4 *array;
};
typedef struct COMPOUND4args COMPOUND4args;
struct COMPOUND4res_clnt {
nfsstat4 status;
uint_t array_len;
uint_t decode_len;
nfs_resop4 *array;
COMPOUND4args_clnt *argsp;
};
typedef struct COMPOUND4res_clnt COMPOUND4res_clnt;
struct COMPOUND4res {
nfsstat4 status;
utf8string tag;
uint_t array_len;
nfs_resop4 *array;
};
typedef struct COMPOUND4res COMPOUND4res;
struct CB_GETATTR4args {
nfs_fh4 fh;
bitmap4 attr_request;
};
typedef struct CB_GETATTR4args CB_GETATTR4args;
struct CB_GETATTR4res {
nfsstat4 status;
fattr4 obj_attributes;
};
typedef struct CB_GETATTR4res CB_GETATTR4res;
struct CB_RECALL4args {
stateid4 stateid;
bool_t truncate;
nfs_fh4 fh;
};
typedef struct CB_RECALL4args CB_RECALL4args;
struct CB_RECALL4res {
nfsstat4 status;
};
typedef struct CB_RECALL4res CB_RECALL4res;
struct CB_ILLEGAL4res {
nfsstat4 status;
};
typedef struct CB_ILLEGAL4res CB_ILLEGAL4res;
/*
* New to nfsv4.1
*/
enum layoutrecall_type4 {
LAYOUTRECALL4_FILE = LAYOUT4_RET_REC_FILE,
LAYOUTRECALL4_FSID = LAYOUT4_RET_REC_FSID,
LAYOUTRECALL4_ALL = LAYOUT4_RET_REC_ALL
};
typedef enum layoutrecall_type4 layoutrecall_type4;
struct layoutrecall_file4 {
nfs_fh4 lor_fh;
offset4 lor_offset;
length4 lor_length;
stateid4 lor_stateid;
};
typedef struct layoutrecall_file4 layoutrecall_file4;
struct layoutrecall4 {
layoutrecall_type4 lor_recalltype;
union {
layoutrecall_file4 lor_layout;
fsid4 lor_fsid;
} layoutrecall4_u;
};
typedef struct layoutrecall4 layoutrecall4;
struct CB_LAYOUTRECALL4args {
layouttype4 clora_type;
layoutiomode4 clora_iomode;
bool_t clora_changed;
layoutrecall4 clora_recall;
};
typedef struct CB_LAYOUTRECALL4args CB_LAYOUTRECALL4args;
struct CB_LAYOUTRECALL4res {
nfsstat4 clorr_status;
};
typedef struct CB_LAYOUTRECALL4res CB_LAYOUTRECALL4res;
enum notify_type4 {
NOTIFY4_CHANGE_CHILD_ATTRS = 0,
NOTIFY4_CHANGE_DIR_ATTRS = 1,
NOTIFY4_REMOVE_ENTRY = 2,
NOTIFY4_ADD_ENTRY = 3,
NOTIFY4_RENAME_ENTRY = 4,
NOTIFY4_CHANGE_COOKIE_VERIFIER = 5
};
typedef enum notify_type4 notify_type4;
struct notify_entry4 {
component4 ne_file;
fattr4 ne_attrs;
};
typedef struct notify_entry4 notify_entry4;
struct prev_entry4 {
notify_entry4 pe_prev_entry;
nfs_cookie4 pe_prev_entry_cookie;
};
typedef struct prev_entry4 prev_entry4;
struct notify_remove4 {
notify_entry4 nrm_old_entry;
nfs_cookie4 nrm_old_entry_cookie;
};
typedef struct notify_remove4 notify_remove4;
struct notify_add4 {
struct {
uint_t nad_old_entry_len;
notify_remove4 *nad_old_entry_val;
} nad_old_entry;
notify_entry4 nad_new_entry;
struct {
uint_t nad_new_entry_cookie_len;
nfs_cookie4 *nad_new_entry_cookie_val;
} nad_new_entry_cookie;
struct {
uint_t nad_prev_entry_len;
prev_entry4 *nad_prev_entry_val;
} nad_prev_entry;
bool_t nad_last_entry;
};
typedef struct notify_add4 notify_add4;
struct notify_attr4 {
notify_entry4 na_changed_entry;
};
typedef struct notify_attr4 notify_attr4;
struct notify_rename4 {
notify_remove4 nrn_old_entry;
notify_add4 nrn_new_entry;
};
typedef struct notify_rename4 notify_rename4;
struct notify_verifier4 {
verifier4 nv_old_cookieverf;
verifier4 nv_new_cookieverf;
};
typedef struct notify_verifier4 notify_verifier4;
typedef struct {
uint_t notifylist4_len;
char *notifylist4_val;
} notifylist4;
struct notify4 {
bitmap4 notify_mask;
notifylist4 notify_vals;
};
typedef struct notify4 notify4;
struct CB_NOTIFY4args {
stateid4 cna_stateid;
nfs_fh4 cna_fh;
struct {
uint_t cna_changes_len;
notify4 *cna_changes_val;
} cna_changes;
};
typedef struct CB_NOTIFY4args CB_NOTIFY4args;
struct CB_NOTIFY4res {
nfsstat4 cnr_status;
};
typedef struct CB_NOTIFY4res CB_NOTIFY4res;
struct CB_PUSH_DELEG4args {
nfs_fh4 cpda_fh;
open_delegation4 cpda_delegation;
};
typedef struct CB_PUSH_DELEG4args CB_PUSH_DELEG4args;
struct CB_PUSH_DELEG4res {
nfsstat4 cpdr_status;
};
typedef struct CB_PUSH_DELEG4res CB_PUSH_DELEG4res;
#define RCA4_TYPE_MASK_RDATA_DLG 0
#define RCA4_TYPE_MASK_WDATA_DLG 1
#define RCA4_TYPE_MASK_DIR_DLG 2
#define RCA4_TYPE_MASK_FILE_LAYOUT 3
#define RCA4_TYPE_MASK_BLK_LAYOUT 4
#define RCA4_TYPE_MASK_OBJ_LAYOUT_MIN 8
#define RCA4_TYPE_MASK_OBJ_LAYOUT_MAX 9
#define RCA4_TYPE_MASK_OTHER_LAYOUT_MIN 12
#define RCA4_TYPE_MASK_OTHER_LAYOUT_MAX 15
struct CB_RECALL_ANY4args {
uint32_t craa_objects_to_keep;
bitmap4 craa_type_mask;
};
typedef struct CB_RECALL_ANY4args CB_RECALL_ANY4args;
struct CB_RECALL_ANY4res {
nfsstat4 crar_status;
};
typedef struct CB_RECALL_ANY4res CB_RECALL_ANY4res;
typedef CB_RECALL_ANY4args CB_RECALLABLE_OBJ_AVAIL4args;
struct CB_RECALLABLE_OBJ_AVAIL4res {
nfsstat4 croa_status;
};
typedef struct CB_RECALLABLE_OBJ_AVAIL4res CB_RECALLABLE_OBJ_AVAIL4res;
struct CB_RECALL_SLOT4args {
slotid4 rsa_target_highest_slotid;
};
typedef struct CB_RECALL_SLOT4args CB_RECALL_SLOT4args;
struct CB_RECALL_SLOT4res {
nfsstat4 rsr_status;
};
typedef struct CB_RECALL_SLOT4res CB_RECALL_SLOT4res;
struct referring_call4 {
sequenceid4 rc_sequenceid;
slotid4 rc_slotid;
};
typedef struct referring_call4 referring_call4;
struct referring_call_list4 {
sessionid4 rcl_sessionid;
struct {
uint_t rcl_referring_calls_len;
referring_call4 *rcl_referring_calls_val;
} rcl_referring_calls;
};
typedef struct referring_call_list4 referring_call_list4;
struct CB_SEQUENCE4args {
sessionid4 csa_sessionid;
sequenceid4 csa_sequenceid;
slotid4 csa_slotid;
slotid4 csa_highest_slotid;
bool_t csa_cachethis;
struct {
uint_t csa_referring_call_lists_len;
referring_call_list4 *csa_referring_call_lists_val;
} csa_referring_call_lists;
};
typedef struct CB_SEQUENCE4args CB_SEQUENCE4args;
struct CB_SEQUENCE4resok {
sessionid4 csr_sessionid;
sequenceid4 csr_sequenceid;
slotid4 csr_slotid;
slotid4 csr_highest_slotid;
slotid4 csr_target_highest_slotid;
};
typedef struct CB_SEQUENCE4resok CB_SEQUENCE4resok;
struct CB_SEQUENCE4res {
nfsstat4 csr_status;
union {
CB_SEQUENCE4resok csr_resok4;
} CB_SEQUENCE4res_u;
};
typedef struct CB_SEQUENCE4res CB_SEQUENCE4res;
struct CB_WANTS_CANCELLED4args {
bool_t cwca_contended_wants_cancelled;
bool_t cwca_resourced_wants_cancelled;
};
typedef struct CB_WANTS_CANCELLED4args CB_WANTS_CANCELLED4args;
struct CB_WANTS_CANCELLED4res {
nfsstat4 cwcr_status;
};
typedef struct CB_WANTS_CANCELLED4res CB_WANTS_CANCELLED4res;
struct CB_NOTIFY_LOCK4args {
nfs_fh4 cnla_fh;
lock_owner4 cnla_lock_owner;
};
typedef struct CB_NOTIFY_LOCK4args CB_NOTIFY_LOCK4args;
struct CB_NOTIFY_LOCK4res {
nfsstat4 cnlr_status;
};
typedef struct CB_NOTIFY_LOCK4res CB_NOTIFY_LOCK4res;
enum notify_deviceid_type4 {
NOTIFY_DEVICEID4_CHANGE = 1,
NOTIFY_DEVICEID4_DELETE = 2
};
typedef enum notify_deviceid_type4 notify_deviceid_type4;
struct notify_deviceid_delete4 {
layouttype4 ndd_layouttype;
deviceid4 ndd_deviceid;
};
typedef struct notify_deviceid_delete4 notify_deviceid_delete4;
struct notify_deviceid_change4 {
layouttype4 ndc_layouttype;
deviceid4 ndc_deviceid;
bool_t ndc_immediate;
};
typedef struct notify_deviceid_change4 notify_deviceid_change4;
struct CB_NOTIFY_DEVICEID4args {
struct {
uint_t cnda_changes_len;
notify4 *cnda_changes_val;
} cnda_changes;
};
typedef struct CB_NOTIFY_DEVICEID4args CB_NOTIFY_DEVICEID4args;
struct CB_NOTIFY_DEVICEID4res {
nfsstat4 cndr_status;
};
typedef struct CB_NOTIFY_DEVICEID4res CB_NOTIFY_DEVICEID4res;
#define csa_rcall_llen csa_referring_call_lists.csa_referring_call_lists_len
#define csa_rcall_lval csa_referring_call_lists.csa_referring_call_lists_val
#define rcl_len rcl_referring_calls.rcl_referring_calls_len
#define rcl_val rcl_referring_calls.rcl_referring_calls_val
/* Callback operations new to NFSv4.1 */
enum nfs_cb_opnum4 {
OP_CB_GETATTR = 3,
OP_CB_RECALL = 4,
OP_CB_LAYOUTRECALL = 5,
OP_CB_NOTIFY = 6,
OP_CB_PUSH_DELEG = 7,
OP_CB_RECALL_ANY = 8,
OP_CB_RECALLABLE_OBJ_AVAIL = 9,
OP_CB_RECALL_SLOT = 10,
OP_CB_SEQUENCE = 11,
OP_CB_WANTS_CANCELLED = 12,
OP_CB_NOTIFY_LOCK = 13,
OP_CB_NOTIFY_DEVICEID = 14,
OP_CB_OFFLOAD = 15, /* nfsv4.2 */
OP_CB_ILLEGAL = 10044
};
typedef enum nfs_cb_opnum4 nfs_cb_opnum4;
struct nfs_cb_argop4 {
uint_t argop;
union {
CB_GETATTR4args opcbgetattr;
CB_RECALL4args opcbrecall;
CB_LAYOUTRECALL4args opcblayoutrecall;
CB_NOTIFY4args opcbnotify;
CB_PUSH_DELEG4args opcbpush_deleg;
CB_RECALL_ANY4args opcbrecall_any;
CB_RECALLABLE_OBJ_AVAIL4args opcbrecallable_obj_avail;
CB_RECALL_SLOT4args opcbrecall_slot;
CB_SEQUENCE4args opcbsequence;
CB_WANTS_CANCELLED4args opcbwants_cancelled;
CB_NOTIFY_LOCK4args opcbnotify_lock;
CB_NOTIFY_DEVICEID4args opcbnotify_deviceid;
} nfs_cb_argop4_u;
};
typedef struct nfs_cb_argop4 nfs_cb_argop4;
struct nfs_cb_resop4 {
uint_t resop;
union {
CB_GETATTR4res opcbgetattr;
CB_RECALL4res opcbrecall;
CB_LAYOUTRECALL4res opcblayoutrecall;
CB_NOTIFY4res opcbnotify;
CB_PUSH_DELEG4res opcbpush_deleg;
CB_RECALL_ANY4res opcbrecall_any;
CB_RECALLABLE_OBJ_AVAIL4res opcbrecallable_obj_avail;
CB_RECALL_SLOT4res opcbrecall_slot;
CB_SEQUENCE4res opcbsequence;
CB_WANTS_CANCELLED4res opcbwants_cancelled;
CB_NOTIFY_LOCK4res opcbnotify_lock;
CB_NOTIFY_DEVICEID4res opcbnotify_deviceid;
CB_ILLEGAL4res opcbillegal;
} nfs_cb_resop4_u;
};
typedef struct nfs_cb_resop4 nfs_cb_resop4;
struct CB_COMPOUND4args {
utf8string tag;
uint32_t minorversion;
uint32_t callback_ident;
uint_t array_len;
nfs_cb_argop4 *array;
};
typedef struct CB_COMPOUND4args CB_COMPOUND4args;
struct CB_COMPOUND4res {
nfsstat4 status;
utf8string tag;
uint_t array_len;
nfs_cb_resop4 *array;
};
typedef struct CB_COMPOUND4res CB_COMPOUND4res;
#define NFS4_PROGRAM 100003
#define NFS_V4 4
#define NFSPROC4_NULL 0
#define NFSPROC4_COMPOUND 1
#define NFS4_CALLBACK 0x40000000
#define NFS_CB 1
#define CB_NULL 0
#define CB_COMPOUND 1
extern bool_t xdr_bitmap4(XDR *, bitmap4 *);
extern bool_t xdr_utf8string(XDR *, utf8string *);
extern bool_t xdr_nfs_fh4(XDR *, nfs_fh4 *);
extern bool_t xdr_fattr4_fsid(XDR *, fattr4_fsid *);
extern bool_t xdr_fattr4_acl(XDR *, fattr4_acl *);
extern bool_t xdr_fattr4_fs_locations(XDR *, fattr4_fs_locations *);
extern bool_t xdr_fattr4_rawdev(XDR *, fattr4_rawdev *);
extern bool_t xdr_nfstime4(XDR *, nfstime4 *);
extern bool_t xdr_settime4(XDR *, settime4 *);
extern bool_t xdr_COMPOUND4args_clnt(XDR *, COMPOUND4args_clnt *);
extern bool_t xdr_COMPOUND4args_srv(XDR *, COMPOUND4args *);
extern bool_t xdr_COMPOUND4res_clnt(XDR *, COMPOUND4res_clnt *);
extern bool_t xdr_COMPOUND4res_srv(XDR *, COMPOUND4res *);
extern bool_t xdr_CB_COMPOUND4args_clnt(XDR *, CB_COMPOUND4args *);
extern bool_t xdr_CB_COMPOUND4args_srv(XDR *, CB_COMPOUND4args *);
extern bool_t xdr_CB_COMPOUND4res(XDR *, CB_COMPOUND4res *);
/* New XDR to nfsv4.1 */
extern bool_t xdr_nfs_ftype4(XDR *, nfs_ftype4*);
extern bool_t xdr_nfsstat4(XDR *, nfsstat4*);
extern bool_t xdr_attrlist4(XDR *, attrlist4*);
extern bool_t xdr_bitmap4(XDR *, bitmap4*);
extern bool_t xdr_changeid4(XDR *, changeid4*);
extern bool_t xdr_clientid4(XDR *, clientid4*);
extern bool_t xdr_count4(XDR *, count4*);
extern bool_t xdr_length4(XDR *, length4*);
extern bool_t xdr_mode4(XDR *, mode4*);
extern bool_t xdr_nfs_cookie4(XDR *, nfs_cookie4*);
extern bool_t xdr_nfs_fh4(XDR *, nfs_fh4*);
extern bool_t xdr_offset4(XDR *, offset4*);
extern bool_t xdr_qop4(XDR *, qop4*);
extern bool_t xdr_sec_oid4(XDR *, sec_oid4*);
extern bool_t xdr_sequenceid4(XDR *, sequenceid4*);
extern bool_t xdr_seqid4(XDR *, seqid4*);
extern bool_t xdr_sessionid4(XDR *, sessionid4);
extern bool_t xdr_slotid4(XDR *, slotid4*);
extern bool_t xdr_utf8string(XDR *, utf8string*);
extern bool_t xdr_utf8str_cis(XDR *, utf8str_cis*);
extern bool_t xdr_utf8str_cs(XDR *, utf8str_cs*);
extern bool_t xdr_utf8str_mixed(XDR *, utf8str_mixed*);
extern bool_t xdr_component4(XDR *, component4*);
extern bool_t xdr_linktext4(XDR *, linktext4*);
extern bool_t xdr_pathname4(XDR *, pathname4*);
extern bool_t xdr_verifier4(XDR *, verifier4*);
extern bool_t xdr_nfstime4(XDR *, nfstime4*);
extern bool_t xdr_time_how4(XDR *, time_how4*);
extern bool_t xdr_settime4(XDR *, settime4*);
extern bool_t xdr_nfs_lease4(XDR *, nfs_lease4*);
extern bool_t xdr_fsid4(XDR *, fsid4*);
extern bool_t xdr_change_policy4(XDR *, change_policy4*);
extern bool_t xdr_fs_locations4(XDR *, fs_locations4*);
extern bool_t xdr_acetype4(XDR *, acetype4*);
extern bool_t xdr_aceflag4(XDR *, aceflag4*);
extern bool_t xdr_acemask4(XDR *, acemask4*);
extern bool_t xdr_nfsace4(XDR *, nfsace4*);
extern bool_t xdr_aclflag4(XDR *, aclflag4*);
extern bool_t xdr_nfsacl41(XDR *, nfsacl41*);
extern bool_t xdr_mode_masked4(XDR *, mode_masked4*);
extern bool_t xdr_specdata4(XDR *, specdata4*);
extern bool_t xdr_netaddr4(XDR *, netaddr4*);
extern bool_t xdr_nfs_impl_id4(XDR *, nfs_impl_id4*);
extern bool_t xdr_stateid4(XDR *, stateid4*);
extern bool_t xdr_layouttype4(XDR *, layouttype4*);
extern bool_t xdr_layout_content4(XDR *, layout_content4*);
extern bool_t xdr_layouthint4(XDR *, layouthint4*);
extern bool_t xdr_layoutiomode4(XDR *, layoutiomode4*);
extern bool_t xdr_layout4(XDR *, layout4*);
extern bool_t xdr_deviceid4(XDR *, deviceid4);
extern bool_t xdr_device_addr4(XDR *, device_addr4*);
extern bool_t xdr_layoutupdate4(XDR *, layoutupdate4*);
extern bool_t xdr_layoutreturn_type4(XDR *, layoutreturn_type4*);
extern bool_t xdr_layoutreturn_file4(XDR *, layoutreturn_file4*);
extern bool_t xdr_layoutreturn4(XDR *, layoutreturn4*);
extern bool_t xdr_fs4_status_type(XDR *, fs4_status_type*);
extern bool_t xdr_fs4_status(XDR *, fs4_status*);
extern bool_t xdr_threshold4_read_size(XDR *, threshold4_read_size*);
extern bool_t xdr_threshold4_write_size(XDR *, threshold4_write_size*);
extern bool_t xdr_threshold4_read_iosize(XDR *, threshold4_read_iosize*);
extern bool_t xdr_threshold4_write_iosize(XDR *, threshold4_write_iosize*);
extern bool_t xdr_threshold_item4(XDR *, threshold_item4*);
extern bool_t xdr_mdsthreshold4(XDR *, mdsthreshold4*);
extern bool_t xdr_retention_get4(XDR *, retention_get4*);
extern bool_t xdr_retention_set4(XDR *, retention_set4*);
extern bool_t xdr_fs_charset_cap4(XDR *, fs_charset_cap4*);
extern bool_t xdr_netloc_type4(XDR *, netloc_type4*);
extern bool_t xdr_netloc4(XDR *, netloc4*);
extern bool_t xdr_change_attr_type4(XDR *, change_attr_type4*);
/* extern bool_t xdr_labelformat_spec4(XDR *, labelformat_spec4*); */
extern bool_t xdr_sec_label4(XDR *, sec_label4*);
extern bool_t xdr_app_data_block4(XDR *, app_data_block4*);
extern bool_t xdr_data4(XDR *, data4*);
extern bool_t xdr_data_info4(XDR *, data_info4*);
extern bool_t xdr_data_content4(XDR *, data_content4*);
extern bool_t xdr_stable_how4(XDR *, stable_how4*);
extern bool_t xdr_write_response4(XDR *, write_response4*);
extern bool_t xdr_fattr4_supported_attrs(XDR *, fattr4_supported_attrs*);
extern bool_t xdr_fattr4_type(XDR *, fattr4_type*);
extern bool_t xdr_fattr4_fh_expire_type(XDR *, fattr4_fh_expire_type*);
extern bool_t xdr_fattr4_change(XDR *, fattr4_change*);
extern bool_t xdr_fattr4_size(XDR *, fattr4_size*);
extern bool_t xdr_fattr4_link_support(XDR *, fattr4_link_support*);
extern bool_t xdr_fattr4_symlink_support(XDR *, fattr4_symlink_support*);
extern bool_t xdr_fattr4_named_attr(XDR *, fattr4_named_attr*);
extern bool_t xdr_fattr4_fsid(XDR *, fattr4_fsid*);
extern bool_t xdr_fattr4_unique_handles(XDR *, fattr4_unique_handles*);
extern bool_t xdr_fattr4_lease_time(XDR *, fattr4_lease_time*);
extern bool_t xdr_fattr4_rdattr_error(XDR *, fattr4_rdattr_error*);
extern bool_t xdr_fattr4_acl(XDR *, fattr4_acl*);
extern bool_t xdr_fattr4_aclsupport(XDR *, fattr4_aclsupport*);
extern bool_t xdr_fattr4_archive(XDR *, fattr4_archive*);
extern bool_t xdr_fattr4_cansettime(XDR *, fattr4_cansettime*);
extern bool_t xdr_fattr4_case_insensitive(XDR *, fattr4_case_insensitive*);
extern bool_t xdr_fattr4_case_preserving(XDR *, fattr4_case_preserving*);
extern bool_t xdr_fattr4_chown_restricted(XDR *, fattr4_chown_restricted*);
extern bool_t xdr_fattr4_fileid(XDR *, fattr4_fileid*);
extern bool_t xdr_fattr4_files_avail(XDR *, fattr4_files_avail*);
extern bool_t xdr_fattr4_filehandle(XDR *, fattr4_filehandle*);
extern bool_t xdr_fattr4_files_free(XDR *, fattr4_files_free*);
extern bool_t xdr_fattr4_files_total(XDR *, fattr4_files_total*);
extern bool_t xdr_fattr4_fs_locations(XDR *, fattr4_fs_locations*);
extern bool_t xdr_fattr4_hidden(XDR *, fattr4_hidden*);
extern bool_t xdr_fattr4_homogeneous(XDR *, fattr4_homogeneous*);
extern bool_t xdr_fattr4_maxfilesize(XDR *, fattr4_maxfilesize*);
extern bool_t xdr_fattr4_maxlink(XDR *, fattr4_maxlink*);
extern bool_t xdr_fattr4_maxname(XDR *, fattr4_maxname*);
extern bool_t xdr_fattr4_maxread(XDR *, fattr4_maxread*);
extern bool_t xdr_fattr4_maxwrite(XDR *, fattr4_maxwrite*);
extern bool_t xdr_fattr4_mimetype(XDR *, fattr4_mimetype*);
extern bool_t xdr_fattr4_mode(XDR *, fattr4_mode*);
extern bool_t xdr_fattr4_mode_set_masked(XDR *, fattr4_mode_set_masked*);
extern bool_t xdr_fattr4_mounted_on_fileid(XDR *, fattr4_mounted_on_fileid*);
extern bool_t xdr_fattr4_no_trunc(XDR *, fattr4_no_trunc*);
extern bool_t xdr_fattr4_numlinks(XDR *, fattr4_numlinks*);
extern bool_t xdr_fattr4_owner(XDR *, fattr4_owner*);
extern bool_t xdr_fattr4_owner_group(XDR *, fattr4_owner_group*);
extern bool_t xdr_fattr4_quota_avail_hard(XDR *, fattr4_quota_avail_hard*);
extern bool_t xdr_fattr4_quota_avail_soft(XDR *, fattr4_quota_avail_soft*);
extern bool_t xdr_fattr4_quota_used(XDR *, fattr4_quota_used*);
extern bool_t xdr_fattr4_rawdev(XDR *, fattr4_rawdev*);
extern bool_t xdr_fattr4_space_avail(XDR *, fattr4_space_avail*);
extern bool_t xdr_fattr4_space_free(XDR *, fattr4_space_free*);
extern bool_t xdr_fattr4_space_total(XDR *, fattr4_space_total*);
extern bool_t xdr_fattr4_space_used(XDR *, fattr4_space_used*);
extern bool_t xdr_fattr4_system(XDR *, fattr4_system*);
extern bool_t xdr_fattr4_time_access(XDR *, fattr4_time_access*);
extern bool_t xdr_fattr4_time_access_set(XDR *, fattr4_time_access_set*);
extern bool_t xdr_fattr4_time_backup(XDR *, fattr4_time_backup*);
extern bool_t xdr_fattr4_time_create(XDR *, fattr4_time_create*);
extern bool_t xdr_fattr4_time_delta(XDR *, fattr4_time_delta*);
extern bool_t xdr_fattr4_time_metadata(XDR *, fattr4_time_metadata*);
extern bool_t xdr_fattr4_time_modify(XDR *, fattr4_time_modify*);
extern bool_t xdr_fattr4_time_modify_set(XDR *, fattr4_time_modify_set*);
extern bool_t xdr_fattr4_suppattr_exclcreat(XDR *, fattr4_suppattr_exclcreat*);
extern bool_t xdr_fattr4_dir_notif_delay(XDR *, fattr4_dir_notif_delay*);
extern bool_t xdr_fattr4_dirent_notif_delay(XDR *, fattr4_dirent_notif_delay*);
extern bool_t xdr_fattr4_fs_layout_types(XDR *, fattr4_fs_layout_types*);
extern bool_t xdr_fattr4_fs_status(XDR *, fattr4_fs_status*);
extern bool_t xdr_fattr4_fs_charset_cap(XDR *, fattr4_fs_charset_cap*);
extern bool_t xdr_fattr4_layout_alignment(XDR *, fattr4_layout_alignment*);
extern bool_t xdr_fattr4_layout_blksize(XDR *, fattr4_layout_blksize*);
extern bool_t xdr_fattr4_layout_hint(XDR *, fattr4_layout_hint*);
extern bool_t xdr_fattr4_layout_types(XDR *, fattr4_layout_types*);
extern bool_t xdr_fattr4_mdsthreshold(XDR *, fattr4_mdsthreshold*);
extern bool_t xdr_fattr4_retention_get(XDR *, fattr4_retention_get*);
extern bool_t xdr_fattr4_retention_set(XDR *, fattr4_retention_set*);
extern bool_t xdr_fattr4_retentevt_get(XDR *, fattr4_retentevt_get*);
extern bool_t xdr_fattr4_retentevt_set(XDR *, fattr4_retentevt_set*);
extern bool_t xdr_fattr4_retention_hold(XDR *, fattr4_retention_hold*);
extern bool_t xdr_fattr4_dacl(XDR *, fattr4_dacl*);
extern bool_t xdr_fattr4_sacl(XDR *, fattr4_sacl*);
extern bool_t xdr_fattr4_change_policy(XDR *, fattr4_change_policy*);
extern bool_t xdr_fattr4_space_freed(XDR *, fattr4_space_freed*);
extern bool_t xdr_fattr4_change_attr_type(XDR *, fattr4_change_attr_type*);
extern bool_t xdr_fattr4_sec_label(XDR *, fattr4_sec_label*);
extern bool_t xdr_fattr4_clone_blksize(XDR *, fattr4_clone_blksize*);
extern bool_t xdr_fattr4(XDR *, fattr4*);
extern bool_t xdr_change_info4(XDR *, change_info4*);
extern bool_t xdr_clientaddr4(XDR *, clientaddr4*);
extern bool_t xdr_cb_client4(XDR *, cb_client4*);
extern bool_t xdr_nfs_client_id4(XDR *, nfs_client_id4*);
extern bool_t xdr_client_owner4(XDR *, client_owner4*);
extern bool_t xdr_server_owner4(XDR *, server_owner4*);
extern bool_t xdr_state_owner4(XDR *, state_owner4*);
extern bool_t xdr_open_owner4(XDR *, open_owner4*);
extern bool_t xdr_lock_owner4(XDR *, lock_owner4*);
extern bool_t xdr_nfs_lock_type4(XDR *, nfs_lock_type4*);
extern bool_t xdr_ssv_subkey4(XDR *, ssv_subkey4*);
extern bool_t xdr_ssv_mic_plain_tkn4(XDR *, ssv_mic_plain_tkn4*);
extern bool_t xdr_ssv_mic_tkn4(XDR *, ssv_mic_tkn4*);
extern bool_t xdr_ssv_seal_plain_tkn4(XDR *, ssv_seal_plain_tkn4*);
extern bool_t xdr_ssv_seal_cipher_tkn4(XDR *, ssv_seal_cipher_tkn4*);
extern bool_t xdr_fs_locations_server4(XDR *, fs_locations_server4*);
extern bool_t xdr_fs_locations_item4(XDR *, fs_locations_item4*);
extern bool_t xdr_fs_locations_info4(XDR *, fs_locations_info4*);
extern bool_t xdr_fattr4_fs_locations_info(XDR *, fattr4_fs_locations_info*);
extern bool_t xdr_nfl_util4(XDR *, nfl_util4*);
extern bool_t xdr_filelayout_hint_care4(XDR *, filelayout_hint_care4*);
extern bool_t xdr_nfsv4_1_file_layouthint4(XDR *, nfsv4_1_file_layouthint4*);
extern bool_t xdr_multipath_list4(XDR *, multipath_list4*);
extern bool_t xdr_nfsv4_1_file_layout_ds_addr4(XDR *,
nfsv4_1_file_layout_ds_addr4*);
extern bool_t xdr_nfsv4_1_file_layout4(XDR *, nfsv4_1_file_layout4*);
extern bool_t xdr_ACCESS4args(XDR *, ACCESS4args*);
extern bool_t xdr_CLONE4args(XDR *, CLONE4args*);
extern bool_t xdr_CLONE4res(XDR *, CLONE4res*);
extern bool_t xdr_COMMIT4args(XDR *, COMMIT4args*);
extern bool_t xdr_COMMIT4res(XDR *, COMMIT4res*);
extern bool_t xdr_DELEGPURGE4args(XDR *, DELEGPURGE4args*);
extern bool_t xdr_DELEGPURGE4res(XDR *, DELEGPURGE4res*);
extern bool_t xdr_DELEGRETURN4args(XDR *, DELEGRETURN4args*);
extern bool_t xdr_DELEGRETURN4res(XDR *, DELEGRETURN4res*);
extern bool_t xdr_GETATTR4args(XDR *, GETATTR4args*);
extern bool_t xdr_GETATTR4res(XDR *, GETATTR4res*);
extern bool_t xdr_GETFH4res(XDR *, GETFH4res*);
extern bool_t xdr_open_to_lock_owner4(XDR *, open_to_lock_owner4*);
extern bool_t xdr_exist_lock_owner4(XDR *, exist_lock_owner4*);
extern bool_t xdr_locker4(XDR *, locker4*);
extern bool_t xdr_LOCK4denied(XDR *, LOCK4denied*);
extern bool_t xdr_LOOKUP4args(XDR *, LOOKUP4args*);
extern bool_t xdr_LOOKUP4res(XDR *, LOOKUP4res*);
extern bool_t xdr_LOOKUPP4res(XDR *, LOOKUPP4res*);
extern bool_t xdr_NVERIFY4args(XDR *, NVERIFY4args*);
extern bool_t xdr_NVERIFY4res(XDR *, NVERIFY4res*);
extern bool_t xdr_createmode4(XDR *, createmode4*);
extern bool_t xdr_creatverfattr(XDR *, creatverfattr*);
extern bool_t xdr_createhow4(XDR *, createhow4*);
extern bool_t xdr_opentype4(XDR *, opentype4*);
extern bool_t xdr_openflag4(XDR *, openflag4*);
extern bool_t xdr_limit_by4(XDR *, limit_by4*);
extern bool_t xdr_nfs_modified_limit4(XDR *, nfs_modified_limit4*);
extern bool_t xdr_nfs_space_limit4(XDR *, nfs_space_limit4*);
extern bool_t xdr_open_delegation_type4(XDR *, open_delegation_type4*);
extern bool_t xdr_open_claim_type4(XDR *, open_claim_type4*);
extern bool_t xdr_open_claim_delegate_cur4(XDR *, open_claim_delegate_cur4*);
extern bool_t xdr_open_claim4(XDR *, open_claim4*);
extern bool_t xdr_open_read_delegation4(XDR *, open_read_delegation4*);
extern bool_t xdr_open_write_delegation4(XDR *, open_write_delegation4*);
extern bool_t xdr_why_no_delegation4(XDR *, why_no_delegation4*);
extern bool_t xdr_open_none_delegation4(XDR *, open_none_delegation4*);
extern bool_t xdr_open_delegation4(XDR *, open_delegation4*);
extern bool_t xdr_PUTFH4args(XDR *, PUTFH4args*);
extern bool_t xdr_PUTFH4res(XDR *, PUTFH4res*);
extern bool_t xdr_PUTPUBFH4res(XDR *, PUTPUBFH4res*);
extern bool_t xdr_PUTROOTFH4res(XDR *, PUTROOTFH4res*);
extern bool_t xdr_RENEW4args(XDR *, RENEW4args*);
extern bool_t xdr_RENEW4res(XDR *, RENEW4res*);
extern bool_t xdr_RESTOREFH4res(XDR *, RESTOREFH4res*);
extern bool_t xdr_SAVEFH4res(XDR *, SAVEFH4res*);
extern bool_t xdr_SECINFO4args(XDR *, SECINFO4args*);
extern bool_t xdr_rpc_gss_svc_t(XDR *, rpc_gss_svc_t *);
extern bool_t xdr_rpcsec_gss_info(XDR *, rpcsec_gss_info*);
extern bool_t xdr_SECINFO4res(XDR *, SECINFO4res*);
extern bool_t xdr_SETATTR4args(XDR *, SETATTR4args*);
extern bool_t xdr_SETATTR4res(XDR *, SETATTR4res*);
extern bool_t xdr_SETCLIENTID_CONFIRM4args(XDR *, SETCLIENTID_CONFIRM4args*);
extern bool_t xdr_SETCLIENTID_CONFIRM4res(XDR *, SETCLIENTID_CONFIRM4res*);
extern bool_t xdr_VERIFY4args(XDR *, VERIFY4args*);
extern bool_t xdr_VERIFY4res(XDR *, VERIFY4res*);
extern bool_t xdr_RELEASE_LOCKOWNER4args(XDR *, RELEASE_LOCKOWNER4args*);
extern bool_t xdr_RELEASE_LOCKOWNER4res(XDR *, RELEASE_LOCKOWNER4res*);
extern bool_t xdr_ILLEGAL4res(XDR *, ILLEGAL4res*);
extern bool_t xdr_gsshandle4_t(XDR *, gsshandle4_t *);
extern bool_t xdr_gss_cb_handles4(XDR *, gss_cb_handles4*);
extern bool_t xdr_callback_sec_parms4(XDR *, callback_sec_parms4*);
extern bool_t xdr_BACKCHANNEL_CTL4args(XDR *, BACKCHANNEL_CTL4args*);
extern bool_t xdr_BACKCHANNEL_CTL4res(XDR *, BACKCHANNEL_CTL4res*);
extern bool_t xdr_channel_dir_from_client4(XDR *, channel_dir_from_client4*);
extern bool_t xdr_BIND_CONN_TO_SESSION4args(XDR *, BIND_CONN_TO_SESSION4args*);
extern bool_t xdr_channel_dir_from_server4(XDR *, channel_dir_from_server4*);
extern bool_t xdr_BIND_CONN_TO_SESSION4resok(XDR *,
BIND_CONN_TO_SESSION4resok*);
extern bool_t xdr_BIND_CONN_TO_SESSION4res(XDR *, BIND_CONN_TO_SESSION4res*);
extern bool_t xdr_state_protect_ops4(XDR *, state_protect_ops4*);
extern bool_t xdr_ssv_sp_parms4(XDR *, ssv_sp_parms4*);
extern bool_t xdr_state_protect_how4(XDR *, state_protect_how4*);
extern bool_t xdr_state_protect4_a(XDR *, state_protect4_a*);
extern bool_t xdr_EXCHANGE_ID4args(XDR *, EXCHANGE_ID4args*);
extern bool_t xdr_ssv_prot_info4(XDR *, ssv_prot_info4*);
extern bool_t xdr_state_protect4_r(XDR *, state_protect4_r*);
extern bool_t xdr_EXCHANGE_ID4resok(XDR *, EXCHANGE_ID4resok*);
extern bool_t xdr_EXCHANGE_ID4res(XDR *, EXCHANGE_ID4res*);
extern bool_t xdr_channel_attrs4(XDR *, channel_attrs4*);
extern bool_t xdr_CREATE_SESSION4args(XDR *, CREATE_SESSION4args*);
extern bool_t xdr_CREATE_SESSION4resok(XDR *, CREATE_SESSION4resok*);
extern bool_t xdr_CREATE_SESSION4res(XDR *, CREATE_SESSION4res*);
extern bool_t xdr_DESTROY_SESSION4args(XDR *, DESTROY_SESSION4args*);
extern bool_t xdr_DESTROY_SESSION4res(XDR *, DESTROY_SESSION4res*);
extern bool_t xdr_FREE_STATEID4args(XDR *, FREE_STATEID4args*);
extern bool_t xdr_FREE_STATEID4res(XDR *, FREE_STATEID4res*);
extern bool_t xdr_attr_notice4(XDR *, attr_notice4*);
extern bool_t xdr_GET_DIR_DELEGATION4args(XDR *, GET_DIR_DELEGATION4args*);
extern bool_t xdr_GET_DIR_DELEGATION4resok(XDR *, GET_DIR_DELEGATION4resok*);
extern bool_t xdr_gddrnf4_status(XDR *, gddrnf4_status*);
extern bool_t xdr_GET_DIR_DELEGATION4res_non_fatal(XDR *,
GET_DIR_DELEGATION4res_non_fatal*);
extern bool_t xdr_GET_DIR_DELEGATION4res(XDR *, GET_DIR_DELEGATION4res*);
extern bool_t xdr_GETDEVICEINFO4args(XDR *, GETDEVICEINFO4args*);
extern bool_t xdr_GETDEVICEINFO4resok(XDR *, GETDEVICEINFO4resok*);
extern bool_t xdr_GETDEVICEINFO4res(XDR *, GETDEVICEINFO4res*);
extern bool_t xdr_GETDEVICELIST4args(XDR *, GETDEVICELIST4args*);
extern bool_t xdr_GETDEVICELIST4resok(XDR *, GETDEVICELIST4resok*);
extern bool_t xdr_GETDEVICELIST4res(XDR *, GETDEVICELIST4res*);
extern bool_t xdr_newtime4(XDR *, newtime4*);
extern bool_t xdr_newoffset4(XDR *, newoffset4*);
extern bool_t xdr_LAYOUTCOMMIT4args(XDR *, LAYOUTCOMMIT4args*);
extern bool_t xdr_newsize4(XDR *, newsize4*);
extern bool_t xdr_LAYOUTCOMMIT4resok(XDR *, LAYOUTCOMMIT4resok*);
extern bool_t xdr_LAYOUTCOMMIT4res(XDR *, LAYOUTCOMMIT4res*);
extern bool_t xdr_LAYOUTGET4args(XDR *, LAYOUTGET4args*);
extern bool_t xdr_LAYOUTGET4resok(XDR *, LAYOUTGET4resok*);
extern bool_t xdr_LAYOUTGET4res(XDR *, LAYOUTGET4res*);
extern bool_t xdr_LAYOUTRETURN4args(XDR *, LAYOUTRETURN4args*);
extern bool_t xdr_layoutreturn_stateid(XDR *, layoutreturn_stateid*);
extern bool_t xdr_LAYOUTRETURN4res(XDR *, LAYOUTRETURN4res*);
extern bool_t xdr_secinfo_style4(XDR *, secinfo_style4*);
extern bool_t xdr_SECINFO_NO_NAME4args(XDR *, SECINFO_NO_NAME4args*);
extern bool_t xdr_SECINFO_NO_NAME4res(XDR *, SECINFO_NO_NAME4res*);
extern bool_t xdr_SEQUENCE4args(XDR *, SEQUENCE4args*);
extern bool_t xdr_SEQUENCE4resok(XDR *, SEQUENCE4resok*);
extern bool_t xdr_SEQUENCE4res(XDR *, SEQUENCE4res*);
extern bool_t xdr_ssa_digest_input4(XDR *, ssa_digest_input4*);
extern bool_t xdr_SET_SSV4args(XDR *, SET_SSV4args*);
extern bool_t xdr_ssr_digest_input4(XDR *, ssr_digest_input4*);
extern bool_t xdr_SET_SSV4resok(XDR *, SET_SSV4resok*);
extern bool_t xdr_SET_SSV4res(XDR *, SET_SSV4res*);
extern bool_t xdr_TEST_STATEID4args(XDR *, TEST_STATEID4args*);
extern bool_t xdr_TEST_STATEID4resok(XDR *, TEST_STATEID4resok*);
extern bool_t xdr_TEST_STATEID4res(XDR *, TEST_STATEID4res*);
extern bool_t xdr_deleg_claim4(XDR *, deleg_claim4*);
extern bool_t xdr_WANT_DELEGATION4args(XDR *, WANT_DELEGATION4args*);
extern bool_t xdr_WANT_DELEGATION4res(XDR *, WANT_DELEGATION4res*);
extern bool_t xdr_DESTROY_CLIENTID4args(XDR *, DESTROY_CLIENTID4args*);
extern bool_t xdr_DESTROY_CLIENTID4res(XDR *, DESTROY_CLIENTID4res*);
extern bool_t xdr_RECLAIM_COMPLETE4args(XDR *, RECLAIM_COMPLETE4args*);
extern bool_t xdr_RECLAIM_COMPLETE4res(XDR *, RECLAIM_COMPLETE4res*);
extern bool_t xdr_nfs_opnum4(XDR *, nfs_opnum4*);
extern bool_t xdr_COPY4args(XDR *, COPY4args*);
extern bool_t xdr_copy_requirements4(XDR *, copy_requirements4*);
extern bool_t xdr_COPY4resok(XDR *, COPY4resok*);
extern bool_t xdr_COPY4res(XDR *, COPY4res*);
extern bool_t xdr_COPY_NOTIFY4args(XDR *, COPY_NOTIFY4args*);
extern bool_t xdr_COPY_NOTIFY4resok(XDR *, COPY_NOTIFY4resok*);
extern bool_t xdr_COPY_NOTIFY4res(XDR *, COPY_NOTIFY4res*);
extern bool_t xdr_OFFLOAD_CANCEL4args(XDR *, OFFLOAD_CANCEL4args*);
extern bool_t xdr_OFFLOAD_CANCEL4res(XDR *, OFFLOAD_CANCEL4res*);
extern bool_t xdr_OFFLOAD_STATUS4args(XDR *, OFFLOAD_STATUS4args*);
extern bool_t xdr_OFFLOAD_STATUS4resok(XDR *, OFFLOAD_STATUS4resok*);
extern bool_t xdr_OFFLOAD_STATUS4res(XDR *, OFFLOAD_STATUS4res*);
extern bool_t xdr_ALLOCATE4args(XDR *, ALLOCATE4args*);
extern bool_t xdr_ALLOCATE4res(XDR *, ALLOCATE4res*);
extern bool_t xdr_DEALLOCATE4args(XDR *, DEALLOCATE4args*);
extern bool_t xdr_DEALLOCATE4res(XDR *, DEALLOCATE4res*);
extern bool_t xdr_IO_ADVISE_type4(XDR *, IO_ADVISE_type4*);
extern bool_t xdr_IO_ADVISE4args(XDR *, IO_ADVISE4args*);
extern bool_t xdr_IO_ADVISE4resok(XDR *, IO_ADVISE4resok*);
extern bool_t xdr_IO_ADVISE4res(XDR *, IO_ADVISE4res*);
extern bool_t xdr_device_error4(XDR *, device_error4*);
extern bool_t xdr_LAYOUTERROR4args(XDR *, LAYOUTERROR4args*);
extern bool_t xdr_LAYOUTERROR4res(XDR *, LAYOUTERROR4res*);
extern bool_t xdr_io_info4(XDR *, io_info4*);
extern bool_t xdr_LAYOUTSTATS4args(XDR *, LAYOUTSTATS4args*);
extern bool_t xdr_LAYOUTSTATS4res(XDR *, LAYOUTSTATS4res*);
extern bool_t xdr_READ_PLUS4args(XDR *, READ_PLUS4args*);
extern bool_t xdr_read_plus_content(XDR *, read_plus_content*);
extern bool_t xdr_read_plus_res4(XDR *, read_plus_res4*);
extern bool_t xdr_READ_PLUS4res(XDR *, READ_PLUS4res*);
extern bool_t xdr_SEEK4args(XDR *, SEEK4args*);
extern bool_t xdr_seek_res4(XDR *, seek_res4*);
extern bool_t xdr_SEEK4res(XDR *, SEEK4res*);
extern bool_t xdr_WRITE_SAME4args(XDR *, WRITE_SAME4args*);
extern bool_t xdr_WRITE_SAME4res(XDR *, WRITE_SAME4res*);
extern bool_t xdr_COMPOUND4args(XDR *, COMPOUND4args*);
extern bool_t xdr_COMPOUND4res(XDR *, COMPOUND4res*);
extern bool_t xdr_CB_GETATTR4args(XDR *, CB_GETATTR4args*);
extern bool_t xdr_CB_GETATTR4res(XDR *, CB_GETATTR4res*);
extern bool_t xdr_CB_RECALL4args(XDR *, CB_RECALL4args*);
extern bool_t xdr_CB_RECALL4res(XDR *, CB_RECALL4res*);
extern bool_t xdr_CB_ILLEGAL4res(XDR *, CB_ILLEGAL4res*);
extern bool_t xdr_layoutrecall_type4(XDR *, layoutrecall_type4*);
extern bool_t xdr_layoutrecall_file4(XDR *, layoutrecall_file4*);
extern bool_t xdr_layoutrecall4(XDR *, layoutrecall4*);
extern bool_t xdr_CB_LAYOUTRECALL4args(XDR *, CB_LAYOUTRECALL4args*);
extern bool_t xdr_CB_LAYOUTRECALL4res(XDR *, CB_LAYOUTRECALL4res*);
extern bool_t xdr_notify_type4(XDR *, notify_type4*);
extern bool_t xdr_notify_entry4(XDR *, notify_entry4*);
extern bool_t xdr_prev_entry4(XDR *, prev_entry4*);
extern bool_t xdr_notify_remove4(XDR *, notify_remove4*);
extern bool_t xdr_notify_add4(XDR *, notify_add4*);
extern bool_t xdr_notify_attr4(XDR *, notify_attr4*);
extern bool_t xdr_notify_rename4(XDR *, notify_rename4*);
extern bool_t xdr_notify_verifier4(XDR *, notify_verifier4*);
extern bool_t xdr_notifylist4(XDR *, notifylist4*);
extern bool_t xdr_notify4(XDR *, notify4*);
extern bool_t xdr_CB_NOTIFY4args(XDR *, CB_NOTIFY4args*);
extern bool_t xdr_CB_NOTIFY4res(XDR *, CB_NOTIFY4res*);
extern bool_t xdr_CB_PUSH_DELEG4args(XDR *, CB_PUSH_DELEG4args*);
extern bool_t xdr_CB_PUSH_DELEG4res(XDR *, CB_PUSH_DELEG4res*);
extern bool_t xdr_CB_RECALL_ANY4args(XDR *, CB_RECALL_ANY4args*);
extern bool_t xdr_CB_RECALL_ANY4res(XDR *, CB_RECALL_ANY4res*);
extern bool_t xdr_CB_RECALLABLE_OBJ_AVAIL4args(XDR *,
CB_RECALLABLE_OBJ_AVAIL4args*);
extern bool_t xdr_CB_RECALLABLE_OBJ_AVAIL4res(XDR *,
CB_RECALLABLE_OBJ_AVAIL4res*);
extern bool_t xdr_CB_RECALL_SLOT4args(XDR *, CB_RECALL_SLOT4args*);
extern bool_t xdr_CB_RECALL_SLOT4res(XDR *, CB_RECALL_SLOT4res*);
extern bool_t xdr_referring_call4(XDR *, referring_call4*);
extern bool_t xdr_referring_call_list4(XDR *, referring_call_list4*);
extern bool_t xdr_CB_SEQUENCE4args(XDR *, CB_SEQUENCE4args*);
extern bool_t xdr_CB_SEQUENCE4resok(XDR *, CB_SEQUENCE4resok*);
extern bool_t xdr_CB_SEQUENCE4res(XDR *, CB_SEQUENCE4res*);
extern bool_t xdr_CB_WANTS_CANCELLED4args(XDR *, CB_WANTS_CANCELLED4args*);
extern bool_t xdr_CB_WANTS_CANCELLED4res(XDR *, CB_WANTS_CANCELLED4res*);
extern bool_t xdr_CB_NOTIFY_LOCK4args(XDR *, CB_NOTIFY_LOCK4args*);
extern bool_t xdr_CB_NOTIFY_LOCK4res(XDR *, CB_NOTIFY_LOCK4res*);
extern bool_t xdr_notify_deviceid_type4(XDR *, notify_deviceid_type4*);
extern bool_t xdr_notify_deviceid_delete4(XDR *, notify_deviceid_delete4*);
extern bool_t xdr_notify_deviceid_change4(XDR *, notify_deviceid_change4*);
extern bool_t xdr_CB_NOTIFY_DEVICEID4args(XDR *, CB_NOTIFY_DEVICEID4args*);
extern bool_t xdr_CB_NOTIFY_DEVICEID4res(XDR *, CB_NOTIFY_DEVICEID4res*);
extern bool_t xdr_nfs_cb_opnum4(XDR *, nfs_cb_opnum4*);
extern bool_t xdr_nfs_cb_argop4(XDR *, nfs_cb_argop4*);
extern bool_t xdr_nfs_cb_resop4(XDR *, nfs_cb_resop4*);
extern bool_t xdr_CB_COMPOUND4args(XDR *, CB_COMPOUND4args*);
extern bool_t xdr_CB_COMPOUND4res(XDR *, CB_COMPOUND4res*);
/* NFSv4.x xdr */
extern bool_t xdr_nfs4x_argop4(XDR *xdrs, nfs_argop4 *objp);
extern bool_t xdr_nfs4x_resop4(XDR *xdrs, nfs_resop4 *objp);
/*
* xdr for referrrals upcall
*/
extern bool_t xdr_knetconfig(XDR *, struct knetconfig *);
extern bool_t xdr_nfs_fsl_info(XDR *, struct nfs_fsl_info *);
#ifdef __cplusplus
}
#endif
#endif /* _NFS4_KPROT_H */
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
* Copyright 2017 RackTop Systems.
*/
#ifndef _NFS4X_H
#define _NFS4X_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _KERNEL
#include <sys/cred.h>
#include <nfs/nfs4_kprot.h>
/*
* 24 bytes of rpc header
* 12 bytes for compound header
* 44 bytes for SEQUENCE response
*/
#define NFS4_MIN_HDR_SEQSZ (24 + 12 + 44)
/*
* NFSv4.1: slot support (reply cache)
*/
#define RFS4_SLOT_INUSE (1 << 0)
#define RFS4_SLOT_CACHED (1 << 1)
/* Slot entry structure */
typedef struct rfs4_slot {
uint32_t se_flags;
sequenceid4 se_seqid;
COMPOUND4res se_buf; /* Buf for slot and replays */
void *se_p; /* Call-back race detection info buf */
kmutex_t se_lock;
} rfs4_slot_t;
/* se_state values */
#define SLRC_EMPTY_SLOT 0x00000001
#define SLRC_CACHED_OKAY 0x00000002
#define SLRC_CACHED_PURGING 0x00000004
#define SLRC_INPROG_NEWREQ 0x00000008
#define SLRC_INPROG_REPLAY 0x00000010
#define SLOT_FREE 0x00000020
#define SLOT_ERROR 0x00000040
#define SLOT_INUSE 0x00000080
#define SLOT_RECALLED 0x00000100
/* Slot entry structure */
typedef struct slot_ent {
avl_node_t se_node;
slotid4 se_sltno;
uint32_t se_state;
sequenceid4 se_seqid;
COMPOUND4res se_buf; /* Buf for slot and replays */
void *se_p; /* Call-back race detection info buf */
kmutex_t se_lock;
kcondvar_t se_wait;
} slot_ent_t;
/* Slot table token */
typedef struct slot_tab_token {
uint_t st_currw; /* current width of slot table */
uint_t st_fslots; /* current # of available slots */
avl_tree_t *st_sltab; /* tree of 'currw' pointers */
kmutex_t st_lock; /* cache lock; resize or destroy */
kcondvar_t st_wait;
void (*cleanup_entry)(slot_ent_t *);
} stok_t;
typedef enum {
SLT_NOSLEEP = 0,
SLT_SLEEP = 1
} slt_wait_t;
#define SA_SLOT_ANY 0x0001
#define SA_SLOT_SPEC 0x0002
typedef struct {
slotid4 sa_sltno;
uint16_t sa_flags;
} slt_arg_t;
typedef enum {
SLT_MAXSLOT = 1
} slt_query_t;
/*
* NFSv4.x Sessions
*/
/*
* 4.1 only: delegation recallable state info.
* struct contents meaningful iff refcnt > 0
*/
typedef struct {
uint32_t refcnt;
sessionid4 sessid;
sequenceid4 seqid;
slotid4 slotno;
} rfs41_drs_info_t;
typedef struct rfs41_csr { /* contrived create_session result */
sequenceid4 xi_sid; /* seqid response to EXCHG_ID */
nfsstat4 cs_status;
CREATE_SESSION4resok cs_res; /* cached results if NFS4_OK */
} rfs41_csr_t;
/*
* Sessions Callback Infrastructure
*
* Locking:
*
* . cn_lock protects all fields in sess_channel_t, but since
* fore/back and dir don't change often, we serialize only
* the occasional update.
*
* cn_lock: cn_lock
* bsd_rwlock: cn_lock -> bsd_rwlock
*/
#define MAX_CH_CACHE 10
typedef struct { /* Back Chan Specific Data */
stok_t *bsd_stok; /* opaque token for slot tab */
nfsstat4 bsd_stat;
kmutex_t bsd_lock; /* protect slot tab info */
int bsd_ch_free;
CLIENT *bsd_clnt[MAX_CH_CACHE];
} sess_bcsd_t;
typedef struct {
channel_dir_from_server4 cn_dir; /* Chan Direction */
sess_bcsd_t *cn_csd; /* Chan Specific Data */
krwlock_t cn_lock;
} sess_channel_t;
/*
* Maximum number of concurrent COMPOUND requests per session
*/
#define MAXSLOTS 256
#define MAXSLOTS_BACK 16
typedef struct {
state_protect_how4 sp_type;
} rfs41_sprot_t;
/*
* NFSv4.1 Sessions (cont'd)
*
* rfs4_session_t rfs4_client_t
* +-------------+ +--------------------+
* | sn_sessid | | clientid |
* | sn_clnt * -|---------->| : |
* | sn_fore | +--------------------+
* | sn_back |
* | sn_slots * -|---------> +--------------------------------+
* +-------------+ | (slot_ent_t) |
* | +----------------------------+|
* | | status, slot, seqid, resp *||------><Res>
* | +----------------------------+|
* | | status, slot, seqid, resp *||
* | +----------------------------+|
* | | status, slot, seqid, resp *||
* | +----------------------------+|
* | . |
* | : |
* +--------------------------------+
* stok_t
*/
struct rfs4_client;
struct rfs4_dbe;
typedef struct {
nfsstat4 cs_error;
struct rfs4_client *cs_client;
struct svc_req *cs_req;
uint32_t cs_id;
CREATE_SESSION4args cs_aotw;
} session41_create_t;
/*
* sn_seq4 - sequence result bit accounting info (session scope)
* CB_PATH_DOWN_SESSION, CB_GSS_CONTEXT_EXPIRING,
* CB_GSS_CONTEXT_EXPIRED, BACKCHANNEL_FAULT
*/
typedef struct rfs4_session {
struct rfs4_dbe *sn_dbe;
sessionid4 sn_sessid; /* session id */
struct rfs4_client *sn_clnt; /* back ptr to client state */
sess_channel_t *sn_fore; /* fore chan for this session */
sess_channel_t *sn_back; /* back chan for this session */
channel_attrs4 cn_attrs; /* chan Attrs */
channel_attrs4 cn_back_attrs; /* back channel Attrs */
rfs4_slot_t *sn_slots; /* slot replay cache */
time_t sn_laccess; /* struct was last accessed */
int sn_csflags; /* create_session only flags */
bool_t sn_bdrpc;
uint32_t sn_flags; /* SEQ4 status bits */
list_node_t sn_node; /* link node to rfs4_client */
struct {
uint32_t pngcnt; /* conn pings outstanding */
uint32_t paths; /* callback paths verified */
uint32_t progno; /* cb_program number */
csa_sec_parms_t secprms; /* csa_sec_params */
uint32_t failed:1; /* TRUE if no cb path avail */
uint32_t pnginprog:1;
uint32_t _reserved:30;
cred_t *cr;
} sn_bc;
uint32_t sn_rcached; /* cached replies, for stat */
} rfs4_session_t;
#define SN_CB_CHAN_EST(x) ((x)->sn_back != NULL)
#define SN_CB_CHAN_OK(x) ((x)->sn_bc.failed == 0)
/* error code for internal use */
#define nfserr_replay_cache NFS4ERR_REPLAY_CACHE
/* Session end */
/*
* Set of RPC credentials used for a particular operation.
* Used for operations like SETCLIENTID_CONFIRM where the
* credentials needs to match those used at SETCLIENTID.
* For EXCHANGE_ID (NFSv4.1+)
*/
typedef struct {
cred_t *cp_cr;
int cp_aflavor;
int cp_secmod;
caddr_t cp_princ;
} cred_set_t;
/* NFSv4.1 Functions */
extern int rfs4x_dispatch(struct svc_req *, SVCXPRT *, char *);
void rfs4_free_cred_set(cred_set_t *);
void rfs4x_session_rele(rfs4_session_t *);
rfs4_session_t *rfs4x_createsession(session41_create_t *);
nfsstat4 rfs4x_destroysession(rfs4_session_t *, unsigned useref);
void rfs4x_client_session_remove(struct rfs4_client *);
rfs4_session_t *rfs4x_findsession_by_id(sessionid4);
void rfs4x_session_hold(rfs4_session_t *);
void rfs4x_session_rele(rfs4_session_t *);
/* Some init/fini helpers */
struct rfs4_srv;
struct compound_state;
void rfs4x_state_init_locked(struct nfs4_srv *);
void rfs4x_state_fini(struct nfs4_srv *);
int rfs4x_sequence_prep(COMPOUND4args *, COMPOUND4res *,
struct compound_state *, SVCXPRT *);
void rfs4x_sequence_done(COMPOUND4res *, struct compound_state *);
extern void rfs4x_cb_chflush(rfs4_session_t *);
/*
* NFS4.1 backchannel security
*/
struct rfs4_deleg_state;
struct rfs4_client;
extern bool_t rfs4x_cbsec_valid(callback_sec_parms4 *);
extern void rfs4x_cbsec_init(callback_sec_parms4 *, callback_sec_parms4 *);
extern void rfs4x_cbsec_fini(rfs4_session_t *);
extern uid_t rfs4x_cbsec_getuid(callback_sec_parms4 *);
extern gid_t rfs4x_cbsec_getgid(callback_sec_parms4 *);
extern sess_channel_t *rfs41_create_session_channel(channel_dir_from_server4);
extern void rfs41_destroy_back_channel(sess_channel_t *);
extern slotid4 svc_slot_maxslot(rfs4_session_t *);
extern nfsstat4 slot_cb_status(stok_t *);
extern void rfs41_deleg_rs_hold(struct rfs4_deleg_state *);
extern void rfs41_deleg_rs_rele(struct rfs4_deleg_state *);
/*
* NFS4.1 Backchannel slot support.
*/
extern int slot_alloc(stok_t *, slt_wait_t, slot_ent_t **);
extern void slot_free(stok_t *, slot_ent_t *);
extern void slot_table_create(stok_t **, int);
extern void slot_incr_seq(slot_ent_t *);
extern void slot_table_destroy(stok_t *);
extern void slot_table_query(stok_t *, slt_query_t, void *);
extern slot_ent_t *slot_get(stok_t *, slotid4);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _NFS4X_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc.
* All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/
#ifndef _NFS_NFS_ACL_H
#define _NFS_NFS_ACL_H
#ifdef __cplusplus
extern "C" {
#endif
#define NFS_ACL_MAX_ENTRIES 1024
typedef ushort_t o_mode;
struct aclent {
int type;
uid32_t id;
o_mode perm;
};
typedef struct aclent aclent;
#define NA_USER_OBJ 0x1
#define NA_USER 0x2
#define NA_GROUP_OBJ 0x4
#define NA_GROUP 0x8
#define NA_CLASS_OBJ 0x10
#define NA_OTHER_OBJ 0x20
#define NA_ACL_DEFAULT 0x1000
#define NA_READ 0x4
#define NA_WRITE 0x2
#define NA_EXEC 0x1
struct secattr {
uint32 mask;
int aclcnt;
struct {
uint_t aclent_len;
aclent *aclent_val;
} aclent;
int dfaclcnt;
struct {
uint_t dfaclent_len;
aclent *dfaclent_val;
} dfaclent;
};
typedef struct secattr secattr;
#define NA_ACL 0x1
#define NA_ACLCNT 0x2
#define NA_DFACL 0x4
#define NA_DFACLCNT 0x8
struct GETACL2args {
fhandle_t fh;
uint32 mask;
};
typedef struct GETACL2args GETACL2args;
struct GETACL2resok {
struct nfsfattr attr;
vsecattr_t acl;
};
typedef struct GETACL2resok GETACL2resok;
struct GETACL2res {
enum nfsstat status;
union {
GETACL2resok ok;
} res_u;
};
typedef struct GETACL2res GETACL2res;
struct SETACL2args {
fhandle_t fh;
vsecattr_t acl;
};
typedef struct SETACL2args SETACL2args;
struct SETACL2resok {
struct nfsfattr attr;
};
typedef struct SETACL2resok SETACL2resok;
struct SETACL2res {
enum nfsstat status;
union {
SETACL2resok ok;
} res_u;
};
typedef struct SETACL2res SETACL2res;
struct GETATTR2args {
fhandle_t fh;
};
typedef struct GETATTR2args GETATTR2args;
struct GETATTR2resok {
struct nfsfattr attr;
};
typedef struct GETATTR2resok GETATTR2resok;
struct GETATTR2res {
enum nfsstat status;
union {
GETATTR2resok ok;
} res_u;
};
typedef struct GETATTR2res GETATTR2res;
struct ACCESS2args {
fhandle_t fh;
uint32 access;
};
typedef struct ACCESS2args ACCESS2args;
#define ACCESS2_READ 0x1
#define ACCESS2_LOOKUP 0x2
#define ACCESS2_MODIFY 0x4
#define ACCESS2_EXTEND 0x8
#define ACCESS2_DELETE 0x10
#define ACCESS2_EXECUTE 0x20
struct ACCESS2resok {
struct nfsfattr attr;
uint32 access;
};
typedef struct ACCESS2resok ACCESS2resok;
struct ACCESS2res {
enum nfsstat status;
union {
ACCESS2resok ok;
} res_u;
};
typedef struct ACCESS2res ACCESS2res;
struct GETXATTRDIR2args {
fhandle_t fh;
bool_t create;
};
typedef struct GETXATTRDIR2args GETXATTRDIR2args;
struct GETXATTRDIR2resok {
fhandle_t fh;
struct nfsfattr attr;
};
typedef struct GETXATTRDIR2resok GETXATTRDIR2resok;
struct GETXATTRDIR2res {
enum nfsstat status;
union {
GETXATTRDIR2resok ok;
} res_u;
};
typedef struct GETXATTRDIR2res GETXATTRDIR2res;
struct GETACL3args {
nfs_fh3 fh;
uint32 mask;
};
typedef struct GETACL3args GETACL3args;
struct GETACL3resok {
post_op_attr attr;
vsecattr_t acl;
};
typedef struct GETACL3resok GETACL3resok;
struct GETACL3resfail {
post_op_attr attr;
};
typedef struct GETACL3resfail GETACL3resfail;
struct GETACL3res {
nfsstat3 status;
union {
GETACL3resok ok;
GETACL3resfail fail;
} res_u;
};
typedef struct GETACL3res GETACL3res;
struct SETACL3args {
nfs_fh3 fh;
vsecattr_t acl;
};
typedef struct SETACL3args SETACL3args;
struct SETACL3resok {
post_op_attr attr;
};
typedef struct SETACL3resok SETACL3resok;
struct SETACL3resfail {
post_op_attr attr;
};
typedef struct SETACL3resfail SETACL3resfail;
struct SETACL3res {
nfsstat3 status;
union {
SETACL3resok ok;
SETACL3resfail fail;
} res_u;
};
typedef struct SETACL3res SETACL3res;
struct GETXATTRDIR3args {
nfs_fh3 fh;
bool_t create;
};
typedef struct GETXATTRDIR3args GETXATTRDIR3args;
struct GETXATTRDIR3resok {
nfs_fh3 fh;
post_op_attr attr;
};
typedef struct GETXATTRDIR3resok GETXATTRDIR3resok;
struct GETXATTRDIR3res {
nfsstat3 status;
union {
GETXATTRDIR3resok ok;
} res_u;
};
typedef struct GETXATTRDIR3res GETXATTRDIR3res;
#define NFS_ACL_PROGRAM ((rpcprog_t)(100227))
#define NFS_ACL_VERSMIN ((rpcvers_t)(2))
#define NFS_ACL_VERSMAX ((rpcvers_t)(3))
#define NFS_ACL_V2 ((rpcvers_t)(2))
#define ACLPROC2_NULL ((rpcproc_t)(0))
#define ACLPROC2_GETACL ((rpcproc_t)(1))
#define ACLPROC2_SETACL ((rpcproc_t)(2))
#define ACLPROC2_GETATTR ((rpcproc_t)(3))
#define ACLPROC2_ACCESS ((rpcproc_t)(4))
#define ACLPROC2_GETXATTRDIR ((rpcproc_t)(5))
#define NFS_ACL_V3 ((rpcvers_t)(3))
#define ACLPROC3_NULL ((rpcproc_t)(0))
#define ACLPROC3_GETACL ((rpcproc_t)(1))
#define ACLPROC3_SETACL ((rpcproc_t)(2))
#define ACLPROC3_GETXATTRDIR ((rpcproc_t)(3))
#ifdef _KERNEL
/* the xdr functions */
extern bool_t xdr_uid(XDR *, uid32_t *);
extern bool_t xdr_o_mode(XDR *, o_mode *);
extern bool_t xdr_aclent(XDR *, aclent_t *);
extern bool_t xdr_secattr(XDR *, vsecattr_t *);
extern bool_t xdr_GETACL2args(XDR *, GETACL2args *);
extern bool_t xdr_fastGETACL2args(XDR *, GETACL2args **);
extern bool_t xdr_GETACL2resok(XDR *, GETACL2resok *);
extern bool_t xdr_GETACL2res(XDR *, GETACL2res *);
extern bool_t xdr_SETACL2args(XDR *, SETACL2args *);
extern bool_t xdr_SETACL2resok(XDR *, SETACL2resok *);
#ifdef _LITTLE_ENDIAN
extern bool_t xdr_fastSETACL2resok(XDR *, SETACL2resok *);
#endif
extern bool_t xdr_SETACL2res(XDR *, SETACL2res *);
#ifdef _LITTLE_ENDIAN
extern bool_t xdr_fastSETACL2res(XDR *, SETACL2res *);
#endif
extern bool_t xdr_GETATTR2args(XDR *, GETATTR2args *);
extern bool_t xdr_fastGETATTR2args(XDR *, GETATTR2args **);
extern bool_t xdr_GETATTR2resok(XDR *, GETATTR2resok *);
#ifdef _LITTLE_ENDIAN
extern bool_t xdr_fastGETATTR2resok(XDR *, GETATTR2resok *);
#endif
extern bool_t xdr_GETATTR2res(XDR *, GETATTR2res *);
#ifdef _LITTLE_ENDIAN
extern bool_t xdr_fastGETATTR2res(XDR *, GETATTR2res *);
#endif
extern bool_t xdr_ACCESS2args(XDR *, ACCESS2args *);
extern bool_t xdr_fastACCESS2args(XDR *, ACCESS2args **);
extern bool_t xdr_ACCESS2resok(XDR *, ACCESS2resok *);
#ifdef _LITTLE_ENDIAN
extern bool_t xdr_fastACCESS2resok(XDR *, ACCESS2resok *);
#endif
extern bool_t xdr_ACCESS2res(XDR *, ACCESS2res *);
#ifdef _LITTLE_ENDIAN
extern bool_t xdr_fastACCESS2res(XDR *, ACCESS2res *);
#endif
extern bool_t xdr_GETXATTRDIR2args(XDR *, GETXATTRDIR2args *);
extern bool_t xdr_GETXATTRDIR2res(XDR *, GETXATTRDIR2res *);
extern bool_t xdr_GETACL3args(XDR *, GETACL3args *);
extern bool_t xdr_GETACL3resok(XDR *, GETACL3resok *);
extern bool_t xdr_GETACL3resfail(XDR *, GETACL3resfail *);
extern bool_t xdr_GETACL3res(XDR *, GETACL3res *);
extern bool_t xdr_SETACL3args(XDR *, SETACL3args *);
extern bool_t xdr_SETACL3resok(XDR *, SETACL3resok *);
extern bool_t xdr_SETACL3resfail(XDR *, SETACL3resfail *);
extern bool_t xdr_SETACL3res(XDR *, SETACL3res *);
extern bool_t xdr_GETXATTRDIR3args(XDR *, GETXATTRDIR3args *);
extern bool_t xdr_GETXATTRDIR3res(XDR *, GETXATTRDIR3res *);
#endif
#ifdef _KERNEL
/* the service procedures */
extern void acl2_getacl(GETACL2args *, GETACL2res *,
struct exportinfo *, struct svc_req *, cred_t *, bool_t);
extern void *acl2_getacl_getfh(GETACL2args *);
extern void acl2_getacl_free(GETACL2res *);
extern void acl2_setacl(SETACL2args *, SETACL2res *,
struct exportinfo *, struct svc_req *, cred_t *, bool_t);
extern void *acl2_setacl_getfh(SETACL2args *);
extern void acl2_getattr(GETATTR2args *, GETATTR2res *,
struct exportinfo *, struct svc_req *, cred_t *, bool_t);
extern void *acl2_getattr_getfh(GETATTR2args *);
extern void acl2_access(ACCESS2args *, ACCESS2res *,
struct exportinfo *, struct svc_req *, cred_t *, bool_t);
extern void *acl2_access_getfh(ACCESS2args *);
extern void acl2_getxattrdir(GETXATTRDIR2args *, GETXATTRDIR2res *,
struct exportinfo *, struct svc_req *, cred_t *, bool_t);
extern void *acl2_getxattrdir_getfh(GETXATTRDIR2args *);
extern void acl3_getacl(GETACL3args *, GETACL3res *,
struct exportinfo *, struct svc_req *, cred_t *, bool_t);
extern void *acl3_getacl_getfh(GETACL3args *);
extern void acl3_getacl_free(GETACL3res *);
extern void acl3_setacl(SETACL3args *, SETACL3res *,
struct exportinfo *, struct svc_req *, cred_t *, bool_t);
extern void *acl3_setacl_getfh(SETACL3args *);
extern void acl3_getxattrdir(GETXATTRDIR3args *, GETXATTRDIR3res *,
struct exportinfo *, struct svc_req *, cred_t *, bool_t);
extern void *acl3_getxattrdir_getfh(GETXATTRDIR3args *);
#endif
#ifdef _KERNEL
/* the client side procedures */
extern int acl_getacl2(vnode_t *, vsecattr_t *, int, cred_t *);
extern int acl_setacl2(vnode_t *, vsecattr_t *, int, cred_t *);
extern int acl_getattr2_otw(vnode_t *, vattr_t *, cred_t *);
extern int acl_access2(vnode_t *, int, int, cred_t *);
extern int acl_getxattrdir2(vnode_t *, vnode_t **, bool_t, cred_t *, int);
extern int acl_getacl3(vnode_t *, vsecattr_t *, int, cred_t *);
extern int acl_setacl3(vnode_t *, vsecattr_t *, int, cred_t *);
extern int acl_getxattrdir3(vnode_t *, vnode_t **, bool_t, cred_t *, int);
extern int acl2call(mntinfo_t *, rpcproc_t, xdrproc_t, caddr_t, xdrproc_t,
caddr_t, cred_t *, int *, enum nfsstat *, int,
failinfo_t *);
extern int acl3call(mntinfo_t *, rpcproc_t, xdrproc_t, caddr_t, xdrproc_t,
caddr_t, cred_t *, int *, nfsstat3 *, int,
failinfo_t *);
extern void nfs_acl_free(vsecattr_t *);
#endif
#ifdef _KERNEL
/* server and client data structures */
extern char *aclnames_v2[];
extern uchar_t acl_call_type_v2[];
extern uchar_t acl_ss_call_type_v2[];
extern uchar_t acl_timer_type_v2[];
extern char *aclnames_v3[];
extern uchar_t acl_call_type_v3[];
extern uchar_t acl_ss_call_type_v3[];
extern uchar_t acl_timer_type_v3[];
#endif
#ifdef __cplusplus
}
#endif
#endif /* _NFS_NFS_ACL_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1986, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#ifndef _NFS_NFS_CLNT_H
#define _NFS_NFS_CLNT_H
#include <sys/utsname.h>
#include <sys/kstat.h>
#include <sys/time.h>
#include <vm/page.h>
#include <sys/thread.h>
#include <nfs/rnode.h>
#include <sys/list.h>
#include <sys/condvar_impl.h>
#include <sys/zone.h>
#ifdef __cplusplus
extern "C" {
#endif
#define HOSTNAMESZ 32
#define ACREGMIN 3 /* min secs to hold cached file attr */
#define ACREGMAX 60 /* max secs to hold cached file attr */
#define ACDIRMIN 30 /* min secs to hold cached dir attr */
#define ACDIRMAX 60 /* max secs to hold cached dir attr */
#define ACMINMAX 3600 /* 1 hr is longest min timeout */
#define ACMAXMAX 36000 /* 10 hr is longest max timeout */
#define NFS_CALLTYPES 3 /* Lookups, Reads, Writes */
/*
* rfscall() flags
*/
#define RFSCALL_SOFT 0x00000001 /* Do op as if fs was soft-mounted */
/*
* Fake errno passed back from rfscall to indicate transfer size adjustment
*/
#define ENFS_TRYAGAIN 999
/*
* The NFS specific async_reqs structure. iotype is grouped to support two
* types of async thread pools, please read comments section of mntinfo_t
* definition for more information. Care should be taken while adding new
* members to this group.
*/
enum iotype {
NFS_PUTAPAGE,
NFS_PAGEIO,
NFS_COMMIT,
NFS_READ_AHEAD,
NFS_READDIR,
NFS_INACTIVE,
NFS_ASYNC_TYPES
};
#define NFS_ASYNC_PGOPS_TYPES (NFS_COMMIT + 1)
/*
* NFS async requests queue type.
*/
enum ioqtype {
NFS_ASYNC_QUEUE,
NFS_ASYNC_PGOPS_QUEUE,
NFS_MAX_ASYNC_QUEUES
};
/*
* Number of NFS async threads operating exclusively on page op requests.
*/
#define NUM_ASYNC_PGOPS_THREADS 0x2
struct nfs_async_read_req {
void (*readahead)(); /* pointer to readahead function */
u_offset_t blkoff; /* offset in file */
struct seg *seg; /* segment to do i/o to */
caddr_t addr; /* address to do i/o to */
};
struct nfs_pageio_req {
int (*pageio)(); /* pointer to pageio function */
page_t *pp; /* page list */
u_offset_t io_off; /* offset in file */
uint_t io_len; /* size of request */
int flags;
};
struct nfs_readdir_req {
int (*readdir)(); /* pointer to readdir function */
struct rddir_cache *rdc; /* pointer to cache entry to fill */
};
struct nfs_commit_req {
void (*commit)(); /* pointer to commit function */
page_t *plist; /* page list */
offset3 offset; /* starting offset */
count3 count; /* size of range to be commited */
};
struct nfs_inactive_req {
void (*inactive)(); /* pointer to inactive function */
};
struct nfs_async_reqs {
struct nfs_async_reqs *a_next; /* pointer to next arg struct */
#ifdef DEBUG
kthread_t *a_queuer; /* thread id of queueing thread */
#endif
struct vnode *a_vp; /* vnode pointer */
struct cred *a_cred; /* cred pointer */
enum iotype a_io; /* i/o type */
union {
struct nfs_async_read_req a_read_args;
struct nfs_pageio_req a_pageio_args;
struct nfs_readdir_req a_readdir_args;
struct nfs_commit_req a_commit_args;
struct nfs_inactive_req a_inactive_args;
} a_args;
};
#define a_nfs_readahead a_args.a_read_args.readahead
#define a_nfs_blkoff a_args.a_read_args.blkoff
#define a_nfs_seg a_args.a_read_args.seg
#define a_nfs_addr a_args.a_read_args.addr
#define a_nfs_putapage a_args.a_pageio_args.pageio
#define a_nfs_pageio a_args.a_pageio_args.pageio
#define a_nfs_pp a_args.a_pageio_args.pp
#define a_nfs_off a_args.a_pageio_args.io_off
#define a_nfs_len a_args.a_pageio_args.io_len
#define a_nfs_flags a_args.a_pageio_args.flags
#define a_nfs_readdir a_args.a_readdir_args.readdir
#define a_nfs_rdc a_args.a_readdir_args.rdc
#define a_nfs_commit a_args.a_commit_args.commit
#define a_nfs_plist a_args.a_commit_args.plist
#define a_nfs_offset a_args.a_commit_args.offset
#define a_nfs_count a_args.a_commit_args.count
#define a_nfs_inactive a_args.a_inactive_args.inactive
/*
* Due to the way the address space callbacks are used to execute a delmap,
* we must keep track of how many times the same thread has called
* VOP_DELMAP()->nfs_delmap()/nfs3_delmap(). This is done by having a list of
* nfs_delmapcall_t's associated with each rnode_t. This list is protected
* by the rnode_t's r_statelock. The individual elements do not need to be
* protected as they will only ever be created, modified and destroyed by
* one thread (the call_id).
* See nfs_delmap()/nfs3_delmap() for further explanation.
*/
typedef struct nfs_delmapcall {
kthread_t *call_id;
int error; /* error from delmap */
list_node_t call_node;
} nfs_delmapcall_t;
/*
* delmap address space callback args
*/
typedef struct nfs_delmap_args {
vnode_t *vp;
offset_t off;
caddr_t addr;
size_t len;
uint_t prot;
uint_t maxprot;
uint_t flags;
cred_t *cr;
nfs_delmapcall_t *caller; /* to retrieve errors from the cb */
} nfs_delmap_args_t;
#ifdef _KERNEL
extern nfs_delmapcall_t *nfs_init_delmapcall(void);
extern void nfs_free_delmapcall(nfs_delmapcall_t *);
extern int nfs_find_and_delete_delmapcall(rnode_t *, int *errp);
#endif /* _KERNEL */
/*
* The following structures, chhead and chtab, make up the client handle
* cache. chhead represents a quadruple(RPC program, RPC version, Protocol
* Family, and Transport). For example, a chhead entry could represent
* NFS/V3/IPv4/TCP requests. chhead nodes are linked together as a singly
* linked list and is referenced from chtable.
*
* chtab represents an allocated client handle bound to a particular
* quadruple. These nodes chain down from a chhead node. chtab
* entries which are on the chain are considered free, so a thread may simply
* unlink the first node without traversing the chain. When the thread is
* completed with its request, it puts the chtab node back on the chain.
*/
typedef struct chhead {
struct chhead *ch_next; /* next quadruple */
struct chtab *ch_list; /* pointer to free client handle(s) */
uint64_t ch_timesused; /* times this quadruple was requested */
rpcprog_t ch_prog; /* RPC program number */
rpcvers_t ch_vers; /* RPC version number */
dev_t ch_dev; /* pseudo device number (i.e. /dev/udp) */
char *ch_protofmly; /* protocol (i.e. NC_INET, NC_LOOPBACK) */
} chhead_t;
typedef struct chtab {
struct chtab *ch_list; /* next free client handle */
struct chhead *ch_head; /* associated quadruple */
time_t ch_freed; /* timestamp when freed */
CLIENT *ch_client; /* pointer to client handle */
} chtab_t;
/*
* clinfo is a structure which encapsulates data that is needed to
* obtain a client handle from the cache
*/
typedef struct clinfo {
rpcprog_t cl_prog; /* RPC program number */
rpcvers_t cl_vers; /* RPC version number */
uint_t cl_readsize; /* transfer size */
int cl_retrans; /* times to retry request */
uint_t cl_flags; /* info flags */
} clinfo_t;
/*
* Failover information, passed opaquely through rfscall()
*/
typedef struct failinfo {
struct vnode *vp;
caddr_t fhp;
void (*copyproc)(caddr_t, vnode_t *);
int (*lookupproc)(vnode_t *, char *, vnode_t **, struct pathname *,
int, vnode_t *, struct cred *, int);
int (*xattrdirproc)(vnode_t *, vnode_t **, bool_t, cred_t *, int);
} failinfo_t;
/*
* Static server information
*
* These fields are protected by sv_lock:
* sv_flags
*/
typedef struct servinfo {
struct knetconfig *sv_knconf; /* bound TLI fd */
struct knetconfig *sv_origknconf; /* For RDMA save orig knconf */
struct netbuf sv_addr; /* server's address */
nfs_fhandle sv_fhandle; /* this server's filehandle */
struct sec_data *sv_secdata; /* security data for rpcsec module */
char *sv_hostname; /* server's hostname */
int sv_hostnamelen; /* server's hostname length */
uint_t sv_flags; /* see below */
struct servinfo *sv_next; /* next in list */
kmutex_t sv_lock;
} servinfo_t;
/*
* The values for sv_flags.
*/
#define SV_ROOT_STALE 0x1 /* root vnode got ESTALE */
/*
* Switch from RDMA knconf to original mount knconf
*/
#define ORIG_KNCONF(mi) (mi->mi_curr_serv->sv_origknconf ? \
mi->mi_curr_serv->sv_origknconf : mi->mi_curr_serv->sv_knconf)
#if defined(_KERNEL)
/*
* NFS private data per mounted file system
* The mi_lock mutex protects the following fields:
* mi_flags
* mi_printed
* mi_down
* mi_tsize
* mi_stsize
* mi_curread
* mi_curwrite
* mi_timers
* mi_curr_serv
* mi_readers
* mi_klmconfig
*
* The mi_async_lock mutex protects the following fields:
* mi_async_reqs
* mi_async_req_count
* mi_async_tail
* mi_async_curr[NFS_MAX_ASYNC_QUEUES]
* mi_async_clusters
* mi_async_init_clusters
* mi_threads[NFS_MAX_ASYNC_QUEUES]
* mi_manager_thread
*
* Normally the netconfig information for the mount comes from
* mi_curr_serv and mi_klmconfig is NULL. If NLM calls need to use a
* different transport, mi_klmconfig contains the necessary netconfig
* information.
*
* 'mi_zone' is initialized at structure creation time, and never
* changes; it may be read without a lock.
*
* mi_zone_node is linkage into the mi4_globals.mig_list, and is
* protected by mi4_globals.mig_list_lock.
*
* Locking order:
* mi_globals::mig_lock > mi_async_lock > mi_lock
*/
typedef struct mntinfo {
kmutex_t mi_lock; /* protects mntinfo fields */
struct servinfo *mi_servers; /* server list */
struct servinfo *mi_curr_serv; /* current server */
kcondvar_t mi_failover_cv; /* failover synchronization */
int mi_readers; /* failover - users of mi_curr_serv */
struct vfs *mi_vfsp; /* back pointer to vfs */
enum vtype mi_type; /* file type of the root vnode */
uint_t mi_flags; /* see below */
uint_t mi_tsize; /* max read transfer size (bytes) */
uint_t mi_stsize; /* max write transfer size (bytes) */
int mi_timeo; /* inital timeout in 10th sec */
int mi_retrans; /* times to retry request */
hrtime_t mi_acregmin; /* min time to hold cached file attr */
hrtime_t mi_acregmax; /* max time to hold cached file attr */
hrtime_t mi_acdirmin; /* min time to hold cached dir attr */
hrtime_t mi_acdirmax; /* max time to hold cached dir attr */
len_t mi_maxfilesize; /* for pathconf _PC_FILESIZEBITS */
/*
* Extra fields for congestion control, one per NFS call type,
* plus one global one.
*/
struct rpc_timers mi_timers[NFS_CALLTYPES+1];
int mi_curread; /* current read size */
int mi_curwrite; /* current write size */
/*
* Async I/O management
* We have 2 pools of threads working on async I/O:
* (i) Threads which work on all async queues. Default number of
* threads in this queue is 8. Threads in this pool work on async
* queue pointed by mi_async_curr[NFS_ASYNC_QUEUE]. Number of
* active threads in this pool is tracked by
* mi_threads[NFS_ASYNC_QUEUE].
* (ii)Threads which work only on page op async queues.
* Page ops queue comprises of NFS_PUTAPAGE, NFS_PAGEIO &
* NFS_COMMIT. Default number of threads in this queue is 2
* (NUM_ASYNC_PGOPS_THREADS). Threads in this pool work on async
* queue pointed by mi_async_curr[NFS_ASYNC_PGOPS_QUEUE]. Number
* of active threads in this pool is tracked by
* mi_threads[NFS_ASYNC_PGOPS_QUEUE].
*/
struct nfs_async_reqs *mi_async_reqs[NFS_ASYNC_TYPES];
struct nfs_async_reqs *mi_async_tail[NFS_ASYNC_TYPES];
struct nfs_async_reqs **mi_async_curr[NFS_MAX_ASYNC_QUEUES];
/* current async queue */
uint_t mi_async_clusters[NFS_ASYNC_TYPES];
uint_t mi_async_init_clusters;
uint_t mi_async_req_count; /* # outstanding work requests */
kcondvar_t mi_async_reqs_cv; /* signaled when there's work */
ushort_t mi_threads[NFS_MAX_ASYNC_QUEUES];
/* number of active async threads */
ushort_t mi_max_threads; /* max number of async worker threads */
kthread_t *mi_manager_thread; /* async manager thread */
kcondvar_t mi_async_cv; /* signaled when the last worker dies */
kcondvar_t mi_async_work_cv[NFS_MAX_ASYNC_QUEUES];
/* tell workers to work */
kmutex_t mi_async_lock; /* lock to protect async list */
/*
* Other stuff
*/
struct pathcnf *mi_pathconf; /* static pathconf kludge */
rpcprog_t mi_prog; /* RPC program number */
rpcvers_t mi_vers; /* RPC program version number */
char **mi_rfsnames; /* mapping to proc names */
kstat_named_t *mi_reqs; /* count of requests */
uchar_t *mi_call_type; /* dynamic retrans call types */
uchar_t *mi_ss_call_type; /* semisoft call type */
uchar_t *mi_timer_type; /* dynamic retrans timer types */
clock_t mi_printftime; /* last error printf time */
/*
* ACL entries
*/
char **mi_aclnames; /* mapping to proc names */
kstat_named_t *mi_aclreqs; /* count of acl requests */
uchar_t *mi_acl_call_type; /* dynamic retrans call types */
uchar_t *mi_acl_ss_call_type; /* semisoft call types */
uchar_t *mi_acl_timer_type; /* dynamic retrans timer types */
/*
* Client Side Failover stats
*/
uint_t mi_noresponse; /* server not responding count */
uint_t mi_failover; /* failover to new server count */
uint_t mi_remap; /* remap to new server count */
/*
* Kstat statistics
*/
struct kstat *mi_io_kstats;
struct kstat *mi_ro_kstats;
struct knetconfig *mi_klmconfig;
/*
* Zones support.
*/
struct zone *mi_zone; /* Zone in which FS is mounted */
zone_ref_t mi_zone_ref; /* Reference to aforementioned zone */
list_node_t mi_zone_node; /* Linkage into per-zone mi list */
/*
* Serializes threads in failover_remap.
* Need to acquire this lock first in failover_remap() function
* before acquiring any other rnode lock.
*/
kmutex_t mi_remap_lock;
/*
* List of rnode_t structures that belongs to this mntinfo
*/
kmutex_t mi_rnodes_lock; /* protects the mi_rnodes list */
list_t mi_rnodes; /* the list */
} mntinfo_t;
#endif /* _KERNEL */
/*
* vfs pointer to mount info
*/
#define VFTOMI(vfsp) ((mntinfo_t *)((vfsp)->vfs_data))
/*
* vnode pointer to mount info
*/
#define VTOMI(vp) ((mntinfo_t *)(((vp)->v_vfsp)->vfs_data))
/*
* The values for mi_flags.
*/
#define MI_HARD 0x1 /* hard or soft mount */
#define MI_PRINTED 0x2 /* not responding message printed */
#define MI_INT 0x4 /* interrupts allowed on hard mount */
#define MI_DOWN 0x8 /* server is down */
#define MI_NOAC 0x10 /* don't cache attributes */
#define MI_NOCTO 0x20 /* no close-to-open consistency */
#define MI_DYNAMIC 0x40 /* dynamic transfer size adjustment */
#define MI_LLOCK 0x80 /* local locking only (no lockmgr) */
#define MI_GRPID 0x100 /* System V group id inheritance */
#define MI_RPCTIMESYNC 0x200 /* RPC time sync */
#define MI_LINK 0x400 /* server supports link */
#define MI_SYMLINK 0x800 /* server supports symlink */
#define MI_READDIRONLY 0x1000 /* use readdir instead of readdirplus */
#define MI_ACL 0x2000 /* server supports NFS_ACL */
#define MI_BINDINPROG 0x4000 /* binding to server is changing */
#define MI_LOOPBACK 0x8000 /* Set if this is a loopback mount */
#define MI_SEMISOFT 0x10000 /* soft reads, hard modify */
#define MI_NOPRINT 0x20000 /* don't print messages */
#define MI_DIRECTIO 0x40000 /* do direct I/O */
#define MI_EXTATTR 0x80000 /* server supports extended attrs */
#define MI_ASYNC_MGR_STOP 0x100000 /* tell async mgr to die */
#define MI_DEAD 0x200000 /* mount has been terminated */
/*
* Read-only mntinfo statistics
*/
struct mntinfo_kstat {
char mik_proto[KNC_STRSIZE];
uint32_t mik_vers;
uint_t mik_flags;
uint_t mik_secmod;
uint32_t mik_curread;
uint32_t mik_curwrite;
int mik_timeo;
int mik_retrans;
uint_t mik_acregmin;
uint_t mik_acregmax;
uint_t mik_acdirmin;
uint_t mik_acdirmax;
struct {
uint32_t srtt;
uint32_t deviate;
uint32_t rtxcur;
} mik_timers[NFS_CALLTYPES+1];
uint32_t mik_noresponse;
uint32_t mik_failover;
uint32_t mik_remap;
char mik_curserver[SYS_NMLN];
};
/*
* Macro to wakeup sleeping async worker threads.
*/
#define NFS_WAKE_ASYNC_WORKER(work_cv) { \
if (CV_HAS_WAITERS(&work_cv[NFS_ASYNC_QUEUE])) \
cv_signal(&work_cv[NFS_ASYNC_QUEUE]); \
else if (CV_HAS_WAITERS(&work_cv[NFS_ASYNC_PGOPS_QUEUE])) \
cv_signal(&work_cv[NFS_ASYNC_PGOPS_QUEUE]); \
}
#define NFS_WAKEALL_ASYNC_WORKERS(work_cv) { \
cv_broadcast(&work_cv[NFS_ASYNC_QUEUE]); \
cv_broadcast(&work_cv[NFS_ASYNC_PGOPS_QUEUE]); \
}
/*
* Mark cached attributes as timed out
*
* The caller must not be holding the rnode r_statelock mutex.
*/
#define PURGE_ATTRCACHE(vp) { \
rnode_t *rp = VTOR(vp); \
mutex_enter(&rp->r_statelock); \
PURGE_ATTRCACHE_LOCKED(rp); \
mutex_exit(&rp->r_statelock); \
}
#define PURGE_ATTRCACHE_LOCKED(rp) { \
ASSERT(MUTEX_HELD(&rp->r_statelock)); \
rp->r_attrtime = gethrtime(); \
rp->r_mtime = rp->r_attrtime; \
}
/*
* Is the attribute cache valid?
*/
#define ATTRCACHE_VALID(vp) (gethrtime() < VTOR(vp)->r_attrtime)
/*
* Flags to indicate whether to purge the DNLC for non-directory vnodes
* in a call to nfs_purge_caches.
*/
#define NFS_NOPURGE_DNLC 0
#define NFS_PURGE_DNLC 1
/*
* If returned error is ESTALE flush all caches.
*/
#define PURGE_STALE_FH(error, vp, cr) \
if ((error) == ESTALE) { \
struct rnode *rp = VTOR(vp); \
if (vp->v_flag & VROOT) { \
servinfo_t *svp = rp->r_server; \
mutex_enter(&svp->sv_lock); \
svp->sv_flags |= SV_ROOT_STALE; \
mutex_exit(&svp->sv_lock); \
} \
mutex_enter(&rp->r_statelock); \
rp->r_flags |= RSTALE; \
if (!rp->r_error) \
rp->r_error = (error); \
mutex_exit(&rp->r_statelock); \
if (vn_has_cached_data(vp)) \
nfs_invalidate_pages((vp), (u_offset_t)0, (cr)); \
nfs_purge_caches((vp), NFS_PURGE_DNLC, (cr)); \
}
/*
* Is cache valid?
* Swap is always valid, if no attributes (attrtime == 0) or
* if mtime matches cached mtime it is valid
* NOTE: mtime is now a timestruc_t.
* Caller should be holding the rnode r_statelock mutex.
*/
#define CACHE_VALID(rp, mtime, fsize) \
((RTOV(rp)->v_flag & VISSWAP) == VISSWAP || \
(((mtime).tv_sec == (rp)->r_attr.va_mtime.tv_sec && \
(mtime).tv_nsec == (rp)->r_attr.va_mtime.tv_nsec) && \
((fsize) == (rp)->r_attr.va_size)))
/*
* Macro to detect forced unmount or a zone shutdown.
*/
#define FS_OR_ZONE_GONE(vfsp) \
(((vfsp)->vfs_flag & VFS_UNMOUNTED) || \
zone_status_get(curproc->p_zone) >= ZONE_IS_SHUTTING_DOWN)
/*
* Convert NFS tunables to hrtime_t units, seconds to nanoseconds.
*/
#define SEC2HR(sec) ((sec) * (long long)NANOSEC)
#define HR2SEC(hr) ((hr) / (long long)NANOSEC)
/*
* Structure to identify owner of a PC file share reservation.
*/
struct nfs_owner {
int magic; /* magic uniquifying number */
char hname[16]; /* first 16 bytes of hostname */
char lowner[8]; /* local owner from fcntl */
};
/*
* Values for magic.
*/
#define NFS_OWNER_MAGIC 0x1D81E
/*
* Support for extended attributes
*/
#define XATTR_DIR_NAME "/@/" /* used for DNLC entries */
#define XATTR_RPATH "ExTaTtR" /* used for r_path for failover */
/*
* Short hand for checking to see whether the file system was mounted
* interruptible or not.
*/
#define INTR(vp) (VTOMI(vp)->mi_flags & MI_INT)
/*
* Short hand for checking whether failover is enabled or not
*/
#define FAILOVER_MOUNT(mi) (mi->mi_servers->sv_next)
/*
* How long will async threads wait for additional work.
*/
#define NFS_ASYNC_TIMEOUT (60 * 1 * hz) /* 1 minute */
#ifdef _KERNEL
extern int clget(clinfo_t *, servinfo_t *, cred_t *, CLIENT **,
struct chtab **);
extern void clfree(CLIENT *, struct chtab *);
extern void nfs_mi_zonelist_add(mntinfo_t *);
extern void nfs_free_mi(mntinfo_t *);
extern void nfs_mnt_kstat_init(struct vfs *);
#endif
/*
* Per-zone data for managing client handles. Included here solely for the
* benefit of MDB.
*/
/*
* client side statistics
*/
struct clstat {
kstat_named_t calls; /* client requests */
kstat_named_t badcalls; /* rpc failures */
kstat_named_t clgets; /* client handle gets */
kstat_named_t cltoomany; /* client handle cache misses */
#ifdef DEBUG
kstat_named_t clalloc; /* number of client handles */
kstat_named_t noresponse; /* server not responding cnt */
kstat_named_t failover; /* server failover count */
kstat_named_t remap; /* server remap count */
#endif
};
struct nfs_clnt {
struct chhead *nfscl_chtable;
kmutex_t nfscl_chtable_lock;
zoneid_t nfscl_zoneid;
list_node_t nfscl_node;
struct clstat nfscl_stat;
};
#ifdef __cplusplus
}
#endif
#endif /* _NFS_NFS_CLNT_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright 2018 Nexenta Systems, Inc.
*/
#ifndef _NFS_CMD_H
#define _NFS_CMD_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
#include <sys/param.h>
#include <sys/kiconv.h>
#define KICONV_MAX_CODENAME_LEN 63 /* copied from sys/kiconv.h */
#define NFSCMD_VERS_1 1
#define NFSCMD_VERSION NFSCMD_VERS_1
typedef enum { NFSCMD_CHARMAP_LOOKUP, NFSCMD_ERROR } nfscmd_t;
typedef enum { NFSCMD_ERR_SUCCESS, NFSCMD_ERR_BADCMD, NFSCMD_ERR_NOTFOUND,
NFSCMD_ERR_FAIL, NFSCMD_ERR_DROP, NFSCMD_ERR_NOMEM } nfscmd_err_t;
#define NFSCMD_ERR_RET 0x100000
typedef struct nfscmd_arg {
uint32_t version;
nfscmd_t cmd;
union {
struct {
char path[MAXPATHLEN];
struct sockaddr addr;
} charmap;
} arg;
} nfscmd_arg_t;
typedef struct nfscmd_res {
uint32_t version;
uint32_t cmd;
nfscmd_err_t error;
union {
struct {
char codeset[KICONV_MAX_CODENAME_LEN + 1];
uint32_t apply;
} charmap;
} result;
} nfscmd_res_t;
#ifdef _KERNEL
#define NFSCMD_CONV_INBOUND 1
#define NFSCMD_CONV_OUTBOUND 0
extern int nfscmd_send(nfscmd_arg_t *, nfscmd_res_t *);
extern struct charset_cache *nfscmd_findmap(struct exportinfo *,
struct sockaddr *);
extern char *nfscmd_convname(struct sockaddr *, struct exportinfo *,
char *, int, size_t);
extern char *nfscmd_convdirent(struct sockaddr *, struct exportinfo *, char *,
size_t, enum nfsstat3 *);
extern size_t nfscmd_convdirplus(struct sockaddr *, struct exportinfo *, char *,
size_t, size_t, char **);
extern size_t nfscmd_countents(char *, size_t);
extern size_t nfscmd_dropped_entrysize(struct dirent64 *, size_t, size_t);
extern void nfscmd_init(void);
extern void nfscmd_fini(void);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _NFS_CMD_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/
/*
* Copyright (c) 1983,1984,1985,1986,1987,1988,1989 AT&T.
* All rights reserved.
* Use is subject to license terms.
*/
#ifndef _NFS_DISPATCH_H
#define _NFS_DISPATCH_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* RPC dispatch table
* Indexed by version, proc
*/
typedef struct rpcdisp {
void (*dis_proc)(); /* proc to call */
xdrproc_t dis_xdrargs; /* xdr routine to get args */
xdrproc_t dis_fastxdrargs; /* `fast' xdr routine to get args */
int dis_argsz; /* sizeof args */
xdrproc_t dis_xdrres; /* xdr routine to put results */
xdrproc_t dis_fastxdrres; /* `fast' xdr routine to put results */
int dis_ressz; /* size of results */
void (*dis_resfree)(); /* frees space allocated by proc */
int dis_flags; /* flags, see below */
void *(*dis_getfh)(); /* returns the fhandle for the req */
} rpcdisp_t;
#define RPC_IDEMPOTENT 0x1 /* idempotent or not */
/*
* Be very careful about which NFS procedures get the RPC_ALLOWANON bit.
* Right now, if this bit is on, we ignore the results of per NFS request
* access control.
*/
#define RPC_ALLOWANON 0x2 /* allow anonymous access */
#define RPC_MAPRESP 0x4 /* use mapped response buffer */
#define RPC_AVOIDWORK 0x8 /* do work avoidance for dups */
#define RPC_PUBLICFH_OK 0x10 /* allow use of public filehandle */
typedef struct rpc_disptable {
int dis_nprocs;
char **dis_procnames;
struct rpcdisp *dis_table;
} rpc_disptable_t;
void rpc_null(caddr_t *, caddr_t *, struct exportinfo *, struct svc_req *,
cred_t *, bool_t);
#ifdef __cplusplus
}
#endif
#endif /* _NFS_DISPATCH_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright 2018 Nexenta Systems, Inc.
*/
#ifndef _NFS_LOG_H
#define _NFS_LOG_H
#ifdef __cplusplus
extern "C" {
#endif
#include <nfs/nfs.h>
#include <nfs/export.h>
#include <rpc/rpc.h>
#define LOG_MODE 0600 /* open log with these permissions */
#define LOG_INPROG_STRING "_log_in_process"
/*
* Definition of dummy program for logging special non-nfs reqs
*/
#define NFSLOG_PROGRAM ((rpcprog_t)42)
#define NFSLOG_VERSION ((rpcvers_t)1)
#define NFSLOG_VERSMIN ((rpcvers_t)1)
#define NFSLOG_VERSMAX ((rpcvers_t)1)
#define NFSLOG_NULL ((rpcproc_t)0)
#define NFSLOG_SHARE ((rpcproc_t)1)
#define NFSLOG_UNSHARE ((rpcproc_t)2)
#define NFSLOG_LOOKUP ((rpcproc_t)3)
#define NFSLOG_GETFH ((rpcproc_t)4)
/*
* Version of the on disk log file
*/
#define NFSLOG_BUF_VERSION ((rpcvers_t)2)
#define NFSLOG_BUF_VERSMIN ((rpcvers_t)1)
#define NFSLOG_BUF_VERSMAX ((rpcvers_t)2)
/*
* Contents of the on disk log file header
*
* Note: This is the structure for older version 1 buffers, and does not
* adequately support large buffer files, as the offset is 32 bit. Newer
* buffer files are written using version 2 buffer header (below) which
* has a 64 bit offset. However, because existing buffers continue to use
* the old header format, the daemon xdr code can read and write either format.
* This definition below is not explicitely used anywhere in the code,
* but is implicitely used by the daemon xdr code. For that reason, it
* is kept here for information purpose only.
*/
struct nfslog_buffer_header_1 {
uint32_t bh_length; /* Length of this header */
uint32_t bh_version; /* Version of buffer contents */
uint32_t bh_flags; /* Optional flags field */
uint32_t bh_offset; /* offset within file to begin */
timestruc32_t bh_timestamp; /* When the buffer was created */
};
typedef struct nfslog_buffer_header_1 nfslog_buffer_header_1;
/*
* For the current version 2, which supports largefiles
*/
struct nfslog_buffer_header_2 {
uint32_t bh_length; /* Length of this header */
rpcvers_t bh_version; /* Version of buffer contents */
u_offset_t bh_offset; /* offset within file to begin */
uint32_t bh_flags; /* Optional flags field */
timestruc32_t bh_timestamp; /* When the buffer was created */
};
typedef struct nfslog_buffer_header_2 nfslog_buffer_header_2;
typedef struct nfslog_buffer_header_2 nfslog_buffer_header;
/* bh_flags values */
#define NFSLOG_BH_OFFSET_OVERFLOW 1 /* version 1 bh_offset */
/*
* For each record written to the log file, this struct is used
* as the logical header; it will be XDR encoded to be written to the file.
*
* Note: if the buffer file becomes large enough, the rh_rec_id may
* wrap around. This situation is appropriately handled by the daemon however.
*/
struct nfslog_record_header {
uint32_t rh_reclen; /* Length of entire record */
uint32_t rh_rec_id; /* unique id for this log */
rpcprog_t rh_prognum; /* Program number */
rpcproc_t rh_procnum; /* Procedure number */
rpcvers_t rh_version; /* Version number */
uint32_t rh_auth_flavor; /* Auth flavor of RPC request */
timestruc32_t rh_timestamp; /* time stamp of the request */
uid_t rh_uid; /* uid of requestor as per RPC */
gid_t rh_gid; /* gid of requestor as per RPC */
};
typedef struct nfslog_record_header nfslog_record_header;
/*
* For each record written to the log file, this is the logical
* structure of the record; it will be XDR encoded and written to
* the file.
*/
struct nfslog_request_record {
nfslog_record_header re_header; /* Header as defined above */
char *re_principal_name; /* Principal name of caller */
char *re_netid; /* Netid used for request */
char *re_tag; /* Log buffer tag for file system */
struct netbuf re_ipaddr; /* Requestors ip address */
caddr_t re_rpc_arg; /* RPC arguments and response */
caddr_t re_rpc_res;
};
typedef struct nfslog_request_record nfslog_request_record;
/*
* From this point forward, the definitions represent the arguments
* and results of each possible RPC that can be logged. These
* may have been trimmed in content from the real RPC arguments
* and results to save space.
*/
typedef fhandle_t fhandle;
struct nfslog_sharefsargs {
int sh_flags;
uint32_t sh_anon;
char *sh_path;
fhandle sh_fh_buf;
};
typedef struct nfslog_sharefsargs nfslog_sharefsargs;
typedef nfsstat nfslog_sharefsres;
struct nfslog_getfhargs {
fhandle gfh_fh_buf;
char *gfh_path;
};
typedef struct nfslog_getfhargs nfslog_getfhargs;
struct nfslog_diropargs {
fhandle da_fhandle;
char *da_name;
};
typedef struct nfslog_diropargs nfslog_diropargs;
struct nfslog_drok {
fhandle drok_fhandle;
};
typedef struct nfslog_drok nfslog_drok;
struct nfslog_diropres {
nfsstat dr_status;
union {
nfslog_drok dr_ok;
} nfslog_diropres_u;
};
typedef struct nfslog_diropres nfslog_diropres;
typedef struct nfsreadargs nfslog_nfsreadargs;
struct nfslog_rrok {
uint32_t filesize;
uint32_t rrok_count;
};
typedef struct nfslog_rrok nfslog_rrok;
struct nfslog_rdresult {
nfsstat r_status;
union {
nfslog_rrok r_ok;
} nfslog_rdresult_u;
};
typedef struct nfslog_rdresult nfslog_rdresult;
struct nfslog_writeargs {
fhandle waargs_fhandle;
uint32_t waargs_begoff;
uint32_t waargs_offset;
uint32_t waargs_totcount;
uint32_t waargs_count;
};
typedef struct nfslog_writeargs nfslog_writeargs;
struct nfslog_writeresult {
nfsstat wr_status;
union {
uint32_t wr_size;
} nfslog_writeresult_u;
};
typedef struct nfslog_writeresult nfslog_writeresult;
struct nfslog_sattr {
uint32_t sa_mode;
uint32_t sa_uid;
uint32_t sa_gid;
uint32_t sa_size;
nfs2_timeval sa_atime;
nfs2_timeval sa_mtime;
};
typedef struct nfslog_sattr nfslog_sattr;
struct nfslog_createargs {
nfslog_sattr ca_sa;
nfslog_diropargs ca_da;
};
typedef struct nfslog_createargs nfslog_createargs;
struct nfslog_setattrargs {
fhandle saa_fh;
nfslog_sattr saa_sa;
};
typedef struct nfslog_setattrargs nfslog_setattrargs;
struct nfslog_rdlnres {
nfsstat rl_status;
union {
char *rl_ok;
} nfslog_rdlnres_u;
};
typedef struct nfslog_rdlnres nfslog_rdlnres;
struct nfslog_rnmargs {
nfslog_diropargs rna_from;
nfslog_diropargs rna_to;
};
typedef struct nfslog_rnmargs nfslog_rnmargs;
struct nfslog_linkargs {
fhandle la_from;
nfslog_diropargs la_to;
};
typedef struct nfslog_linkargs nfslog_linkargs;
struct nfslog_symlinkargs {
nfslog_diropargs sla_from;
char *sla_tnm;
nfslog_sattr sla_sa;
};
typedef struct nfslog_symlinkargs nfslog_symlinkargs;
struct nfslog_rddirargs {
fhandle rda_fh;
uint32_t rda_offset;
uint32_t rda_count;
};
typedef struct nfslog_rddirargs nfslog_rddirargs;
struct nfslog_rdok {
uint32_t rdok_offset;
uint32_t rdok_size;
bool_t rdok_eof;
};
typedef struct nfslog_rdok nfslog_rdok;
struct nfslog_rddirres {
nfsstat rd_status;
union {
nfslog_rdok rd_ok;
} nfslog_rddirres_u;
};
typedef struct nfslog_rddirres nfslog_rddirres;
struct nfslog_diropargs3 {
nfs_fh3 dir;
char *name;
};
typedef struct nfslog_diropargs3 nfslog_diropargs3;
struct nfslog_LOOKUP3res {
nfsstat3 status;
union {
nfs_fh3 object;
} nfslog_LOOKUP3res_u;
};
typedef struct nfslog_LOOKUP3res nfslog_LOOKUP3res;
struct nfslog_createhow3 {
createmode3 mode;
union {
set_size3 size;
} nfslog_createhow3_u;
};
typedef struct nfslog_createhow3 nfslog_createhow3;
struct nfslog_CREATE3args {
nfslog_diropargs3 where;
nfslog_createhow3 how;
};
typedef struct nfslog_CREATE3args nfslog_CREATE3args;
struct nfslog_CREATE3resok {
post_op_fh3 obj;
};
typedef struct nfslog_CREATE3resok nfslog_CREATE3resok;
struct nfslog_CREATE3res {
nfsstat3 status;
union {
nfslog_CREATE3resok ok;
} nfslog_CREATE3res_u;
};
typedef struct nfslog_CREATE3res nfslog_CREATE3res;
struct nfslog_SETATTR3args {
nfs_fh3 object;
set_size3 size;
};
typedef struct nfslog_SETATTR3args nfslog_SETATTR3args;
struct nfslog_READLINK3res {
nfsstat3 status;
union {
char *data;
} nfslog_READLINK3res_u;
};
typedef struct nfslog_READLINK3res nfslog_READLINK3res;
struct nfslog_READ3args {
nfs_fh3 file;
offset3 offset;
count3 count;
};
typedef struct nfslog_READ3args nfslog_READ3args;
struct nfslog_READ3resok {
size3 filesize;
count3 count;
bool_t eof;
uint32_t size;
};
typedef struct nfslog_READ3resok nfslog_READ3resok;
struct nfslog_READ3res {
nfsstat3 status;
union {
nfslog_READ3resok ok;
} nfslog_READ3res_u;
};
typedef struct nfslog_READ3res nfslog_READ3res;
struct nfslog_WRITE3args {
nfs_fh3 file;
offset3 offset;
count3 count;
stable_how stable;
};
typedef struct nfslog_WRITE3args nfslog_WRITE3args;
struct nfslog_WRITE3resok {
size3 filesize;
count3 count;
stable_how committed;
};
typedef struct nfslog_WRITE3resok nfslog_WRITE3resok;
struct nfslog_WRITE3res {
nfsstat3 status;
union {
nfslog_WRITE3resok ok;
} nfslog_WRITE3res_u;
};
typedef struct nfslog_WRITE3res nfslog_WRITE3res;
struct nfslog_MKDIR3args {
nfslog_diropargs3 where;
};
typedef struct nfslog_MKDIR3args nfslog_MKDIR3args;
struct nfslog_MKDIR3res {
nfsstat3 status;
union {
post_op_fh3 obj;
} nfslog_MKDIR3res_u;
};
typedef struct nfslog_MKDIR3res nfslog_MKDIR3res;
struct nfslog_SYMLINK3args {
nfslog_diropargs3 where;
char *symlink_data;
};
typedef struct nfslog_SYMLINK3args nfslog_SYMLINK3args;
struct nfslog_SYMLINK3res {
nfsstat3 status;
union {
post_op_fh3 obj;
} nfslog_SYMLINK3res_u;
};
typedef struct nfslog_SYMLINK3res nfslog_SYMLINK3res;
struct nfslog_MKNOD3args {
nfslog_diropargs3 where;
ftype3 type;
};
typedef struct nfslog_MKNOD3args nfslog_MKNOD3args;
struct nfslog_MKNOD3res {
nfsstat3 status;
union {
post_op_fh3 obj;
} nfslog_MKNOD3res_u;
};
typedef struct nfslog_MKNOD3res nfslog_MKNOD3res;
struct nfslog_REMOVE3args {
nfslog_diropargs3 object;
};
typedef struct nfslog_REMOVE3args nfslog_REMOVE3args;
struct nfslog_RMDIR3args {
nfslog_diropargs3 object;
};
typedef struct nfslog_RMDIR3args nfslog_RMDIR3args;
struct nfslog_RENAME3args {
nfslog_diropargs3 from;
nfslog_diropargs3 to;
};
typedef struct nfslog_RENAME3args nfslog_RENAME3args;
struct nfslog_LINK3args {
nfs_fh3 file;
nfslog_diropargs3 link;
};
typedef struct nfslog_LINK3args nfslog_LINK3args;
struct nfslog_READDIRPLUS3args {
nfs_fh3 dir;
count3 dircount;
count3 maxcount;
};
typedef struct nfslog_READDIRPLUS3args nfslog_READDIRPLUS3args;
struct nfslog_entryplus3 {
post_op_fh3 name_handle;
char *name;
struct nfslog_entryplus3 *nextentry;
};
typedef struct nfslog_entryplus3 nfslog_entryplus3;
struct nfslog_dirlistplus3 {
nfslog_entryplus3 *entries;
bool_t eof;
};
typedef struct nfslog_dirlistplus3 nfslog_dirlistplus3;
struct nfslog_READDIRPLUS3resok {
nfslog_dirlistplus3 reply;
};
typedef struct nfslog_READDIRPLUS3resok nfslog_READDIRPLUS3resok;
struct nfslog_READDIRPLUS3res {
nfsstat3 status;
union {
nfslog_READDIRPLUS3resok ok;
} nfslog_READDIRPLUS3res_u;
};
typedef struct nfslog_READDIRPLUS3res nfslog_READDIRPLUS3res;
struct nfslog_COMMIT3args {
nfs_fh3 file;
offset3 offset;
count3 count;
};
typedef struct nfslog_COMMIT3args nfslog_COMMIT3args;
/* the xdr functions */
#ifndef _KERNEL
extern bool_t xdr_nfsstat(XDR *, nfsstat *);
extern bool_t xdr_uint64(XDR *, uint64 *);
extern bool_t xdr_uint32(XDR *, uint32 *);
extern bool_t xdr_fhandle(XDR *, fhandle_t *);
extern bool_t xdr_nfs_fh3(XDR *, nfs_fh3 *);
extern bool_t xdr_nfsstat3(XDR *, nfsstat3 *);
extern bool_t xdr_nfslog_buffer_header(XDR *, nfslog_buffer_header *);
extern bool_t xdr_nfslog_request_record(XDR *, nfslog_request_record *);
extern bool_t xdr_nfslog_sharefsargs(XDR *, nfslog_sharefsargs *);
extern bool_t xdr_nfslog_sharefsres(XDR *, nfslog_sharefsres *);
extern bool_t xdr_nfslog_getfhargs(XDR *, nfslog_getfhargs *);
extern bool_t xdr_nfslog_diropargs(XDR *, nfslog_diropargs *);
extern bool_t xdr_nfslog_diropres(XDR *, nfslog_diropres *);
extern bool_t xdr_nfslog_nfsreadargs(XDR *, nfslog_nfsreadargs *);
extern bool_t xdr_nfslog_rdresult(XDR *, nfslog_rdresult *);
extern bool_t xdr_nfslog_writeargs(XDR *, nfslog_writeargs *);
extern bool_t xdr_nfslog_writeresult(XDR *, nfslog_writeresult *);
extern bool_t xdr_nfslog_createargs(XDR *, nfslog_createargs *);
extern bool_t xdr_nfslog_setattrargs(XDR *, nfslog_setattrargs *);
extern bool_t xdr_nfslog_rdlnres(XDR *, nfslog_rdlnres *);
extern bool_t xdr_nfslog_rnmargs(XDR *, nfslog_rnmargs *);
extern bool_t xdr_nfslog_linkargs(XDR *, nfslog_linkargs *);
extern bool_t xdr_nfslog_symlinkargs(XDR *, nfslog_symlinkargs *);
extern bool_t xdr_nfslog_rddirargs(XDR *, nfslog_rddirargs *);
extern bool_t xdr_nfslog_rddirres(XDR *, nfslog_rddirres *);
extern bool_t xdr_nfslog_diropargs3(XDR *, nfslog_diropargs3 *);
extern bool_t xdr_nfslog_LOOKUP3res(XDR *, nfslog_LOOKUP3res *);
extern bool_t xdr_nfslog_CREATE3args(XDR *, nfslog_CREATE3args *);
extern bool_t xdr_nfslog_CREATE3res(XDR *, nfslog_CREATE3res *);
extern bool_t xdr_nfslog_SETATTR3args(XDR *, nfslog_SETATTR3args *);
extern bool_t xdr_nfslog_READLINK3res(XDR *, nfslog_READLINK3res *);
extern bool_t xdr_nfslog_READ3args(XDR *, nfslog_READ3args *);
extern bool_t xdr_nfslog_READ3res(XDR *, nfslog_READ3res *);
extern bool_t xdr_nfslog_WRITE3args(XDR *, nfslog_WRITE3args *);
extern bool_t xdr_nfslog_WRITE3res(XDR *, nfslog_WRITE3res *);
extern bool_t xdr_nfslog_MKDIR3args(XDR *, nfslog_MKDIR3args *);
extern bool_t xdr_nfslog_MKDIR3res(XDR *, nfslog_MKDIR3res *);
extern bool_t xdr_nfslog_SYMLINK3args(XDR *, nfslog_SYMLINK3args *);
extern bool_t xdr_nfslog_SYMLINK3res(XDR *, nfslog_SYMLINK3res *);
extern bool_t xdr_nfslog_MKNOD3args(XDR *, nfslog_MKNOD3args *);
extern bool_t xdr_nfslog_MKNOD3res(XDR *, nfslog_MKNOD3res *);
extern bool_t xdr_nfslog_REMOVE3args(XDR *, nfslog_REMOVE3args *);
extern bool_t xdr_nfslog_RMDIR3args(XDR *, nfslog_RMDIR3args *);
extern bool_t xdr_nfslog_RENAME3args(XDR *, nfslog_RENAME3args *);
extern bool_t xdr_nfslog_LINK3args(XDR *, nfslog_LINK3args *);
extern bool_t xdr_nfslog_READDIRPLUS3args(XDR *, nfslog_READDIRPLUS3args *);
extern bool_t xdr_nfslog_READDIRPLUS3res(XDR *, nfslog_READDIRPLUS3res *);
extern bool_t xdr_nfslog_COMMIT3args(XDR *, nfslog_COMMIT3args *);
#else /* !_KERNEL */
extern bool_t xdr_nfsstat(XDR *, nfsstat *);
extern bool_t xdr_nfslog_nfsreadargs(XDR *, nfslog_nfsreadargs *);
extern bool_t xdr_nfslog_sharefsres(XDR *, nfslog_sharefsres *);
extern bool_t xdr_nfslog_sharefsargs(XDR *, struct exportinfo *);
extern bool_t xdr_nfslog_getfhargs(XDR *, nfslog_getfhargs *);
extern bool_t xdr_nfslog_diropargs(XDR *, struct nfsdiropargs *);
extern bool_t xdr_nfslog_drok(XDR *, struct nfsdrok *);
extern bool_t xdr_nfslog_diropres(XDR *, struct nfsdiropres *);
extern bool_t xdr_nfslog_getattrres(XDR *, struct nfsattrstat *);
extern bool_t xdr_nfslog_rrok(XDR *, struct nfsrrok *);
extern bool_t xdr_nfslog_rdresult(XDR *, struct nfsrdresult *);
extern bool_t xdr_nfslog_writeargs(XDR *, struct nfswriteargs *);
extern bool_t xdr_nfslog_writeresult(XDR *, struct nfsattrstat *);
extern bool_t xdr_nfslog_createargs(XDR *, struct nfscreatargs *);
extern bool_t xdr_nfslog_sattr(XDR *, struct nfssattr *);
extern bool_t xdr_nfslog_setattrargs(XDR *, struct nfssaargs *);
extern bool_t xdr_nfslog_rdlnres(XDR *, struct nfsrdlnres *);
extern bool_t xdr_nfslog_rnmargs(XDR *, struct nfsrnmargs *);
extern bool_t xdr_nfslog_symlinkargs(XDR *, struct nfsslargs *);
extern bool_t xdr_nfslog_statfs(XDR *, struct nfsstatfs *);
extern bool_t xdr_nfslog_linkargs(XDR *, struct nfslinkargs *);
extern bool_t xdr_nfslog_rddirargs(XDR *, struct nfsrddirargs *);
extern bool_t xdr_nfslog_rdok(XDR *, struct nfsrdok *);
extern bool_t xdr_nfslog_rddirres(XDR *, struct nfsrddirres *);
extern bool_t xdr_nfslog_diropargs3(XDR *, diropargs3 *);
extern bool_t xdr_nfslog_LOOKUP3res(XDR *, LOOKUP3res *);
extern bool_t xdr_nfslog_createhow3(XDR *, createhow3 *);
extern bool_t xdr_nfslog_CREATE3args(XDR *, CREATE3args *);
extern bool_t xdr_nfslog_CREATE3resok(XDR *, CREATE3resok *);
extern bool_t xdr_nfslog_CREATE3res(XDR *, CREATE3res *);
extern bool_t xdr_nfslog_GETATTR3res(XDR *, GETATTR3res *);
extern bool_t xdr_nfslog_ACCESS3args(XDR *, ACCESS3args *);
extern bool_t xdr_nfslog_ACCESS3res(XDR *, ACCESS3res *);
extern bool_t xdr_nfslog_SETATTR3args(XDR *, SETATTR3args *);
extern bool_t xdr_nfslog_SETATTR3res(XDR *, SETATTR3res *);
extern bool_t xdr_nfslog_READLINK3res(XDR *, READLINK3res *);
extern bool_t xdr_nfslog_READ3args(XDR *, READ3args *);
extern bool_t xdr_nfslog_READ3resok(XDR *, READ3resok *);
extern bool_t xdr_nfslog_READ3res(XDR *, READ3res *);
extern bool_t xdr_nfslog_READ3resok(XDR *, READ3resok *);
extern bool_t xdr_nfslog_READ3res(XDR *, READ3res *);
extern bool_t xdr_nfslog_WRITE3args(XDR *, WRITE3args *);
extern bool_t xdr_nfslog_WRITE3resok(XDR *, WRITE3resok *);
extern bool_t xdr_nfslog_WRITE3res(XDR *, WRITE3res *);
extern bool_t xdr_nfslog_MKDIR3args(XDR *, MKDIR3args *);
extern bool_t xdr_nfslog_MKDIR3res(XDR *, MKDIR3res *);
extern bool_t xdr_nfslog_SYMLINK3args(XDR *, SYMLINK3args *);
extern bool_t xdr_nfslog_SYMLINK3res(XDR *, SYMLINK3res *);
extern bool_t xdr_nfslog_MKNOD3args(XDR *, MKNOD3args *);
extern bool_t xdr_nfslog_MKNOD3res(XDR *, MKNOD3res *);
extern bool_t xdr_nfslog_REMOVE3args(XDR *, REMOVE3args *);
extern bool_t xdr_nfslog_REMOVE3res(XDR *, REMOVE3res *);
extern bool_t xdr_nfslog_RMDIR3args(XDR *, RMDIR3args *);
extern bool_t xdr_nfslog_RMDIR3res(XDR *, RMDIR3res *);
extern bool_t xdr_nfslog_RENAME3args(XDR *, RENAME3args *);
extern bool_t xdr_nfslog_RENAME3res(XDR *, RENAME3res *);
extern bool_t xdr_nfslog_LINK3args(XDR *, LINK3args *);
extern bool_t xdr_nfslog_LINK3res(XDR *, LINK3res *);
extern bool_t xdr_nfslog_READDIR3args(XDR *, READDIR3args *);
extern bool_t xdr_nfslog_READDIR3res(XDR *, READDIR3res *);
extern bool_t xdr_nfslog_FSSTAT3args(XDR *, FSSTAT3args *);
extern bool_t xdr_nfslog_FSSTAT3res(XDR *, FSSTAT3res *);
extern bool_t xdr_nfslog_FSINFO3args(XDR *, FSINFO3args *);
extern bool_t xdr_nfslog_FSINFO3res(XDR *, FSINFO3res *);
extern bool_t xdr_nfslog_PATHCONF3args(XDR *, PATHCONF3args *);
extern bool_t xdr_nfslog_PATHCONF3res(XDR *, PATHCONF3res *);
extern bool_t xdr_nfslog_COMMIT3args(XDR *, COMMIT3args *);
extern bool_t xdr_nfslog_COMMIT3res(XDR *, COMMIT3res *);
extern bool_t xdr_nfslog_READDIRPLUS3args(XDR *, READDIRPLUS3args *);
extern bool_t xdr_nfslog_READDIRPLUS3res(XDR *, READDIRPLUS3res *);
extern bool_t xdr_nfslog_request_record(XDR *, struct exportinfo *,
struct svc_req *, cred_t *, struct netbuf *,
unsigned int, unsigned int);
#endif /* !_KERNEL */
#ifdef _KERNEL
/*
* Used to direct nfslog_write_record() on its behavior of
* writing log entries
*/
#define NFSLOG_ALL_BUFFERS 1
#define NFSLOG_ONE_BUFFER 2
/* Sizes of the various memory allocations for encoding records */
#define NFSLOG_SMALL_RECORD_SIZE 512
#define NFSLOG_SMALL_REC_NAME "nfslog_small_rec"
#define NFSLOG_MEDIUM_RECORD_SIZE 8192
#define NFSLOG_MEDIUM_REC_NAME "nfslog_medium_rec"
#define NFSLOG_LARGE_RECORD_SIZE 32768
#define NFSLOG_LARGE_REC_NAME "nfslog_large_rec"
/*
* Functions used for interaction with nfs logging
*/
extern bool_t xdr_nfslog_buffer_header(XDR *, nfslog_buffer_header *);
extern void nfslog_share_record(struct exportinfo *exi, cred_t *cr);
extern void nfslog_unshare_record(struct exportinfo *exi, cred_t *cr);
extern void nfslog_getfh(struct exportinfo *, fhandle *, char *,
enum uio_seg, cred_t *);
extern void nfslog_init();
extern int nfslog_setup(struct exportinfo *);
extern void nfslog_disable(struct exportinfo *);
/*PRINTFLIKE2*/
extern void nfslog_dprint(const int, const char *fmt, ...)
__KPRINTFLIKE(2);
extern void *nfslog_record_alloc(struct exportinfo *, int,
void **, int);
extern void nfslog_record_free(void *, void *, size_t);
extern struct exportinfo *nfslog_get_exi(nfs_export_t *, struct exportinfo *,
struct svc_req *, caddr_t, unsigned int *);
extern void nfslog_write_record(struct exportinfo *, struct svc_req *,
caddr_t, caddr_t, cred_t *, struct netbuf *, unsigned int,
unsigned int);
extern struct log_buffer *nfslog_buffer_list;
/*
* Logging debug macro; expands to nothing for non-debug kernels.
*/
#ifndef DEBUG
#define LOGGING_DPRINT(x)
#else
#define LOGGING_DPRINT(x) nfslog_dprint x
#endif
#endif
#ifdef __cplusplus
}
#endif
#endif /* _NFS_LOG_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* nfs_sec.h, NFS specific security service information.
*/
#ifndef _NFS_SEC_H
#define _NFS_SEC_H
#ifdef __cplusplus
extern "C" {
#endif
#include <rpc/rpcsec_gss.h>
#ifndef _KERNEL
#define NFSSEC_CONF "/etc/nfssec.conf"
#define SC_FAILURE -1
/*
* An error string produced by nfs_syslog_scerr can be no longer than
* MAXMSGLEN
*/
#define MAXMSGLEN 80
/*
* Errors for the nfssec_*
*/
#define SC_NOERROR 0
#define SC_NOMEM 1
#define SC_OPENFAIL 2
#define SC_NOTFOUND 3
#define SC_BADENTRIES 4 /* Bad entries in nfssec.conf file */
#endif /* _KERNEL */
typedef struct seconfig {
char sc_name[MAX_NAME_LEN];
int sc_nfsnum;
int sc_rpcnum;
char sc_gss_mech[MAX_NAME_LEN];
struct rpc_gss_OID_s *sc_gss_mech_type;
uint_t sc_qop;
rpc_gss_service_t sc_service;
uid_t sc_uid;
} seconfig_t;
#ifdef _SYSCALL32
typedef struct seconfig32 {
char sc_name[MAX_NAME_LEN];
int32_t sc_nfsnum;
int32_t sc_rpcnum;
char sc_gss_mech[MAX_NAME_LEN];
caddr32_t sc_gss_mech_type;
uint32_t sc_qop;
int32_t sc_service;
uid_t sc_uid;
} seconfig32_t;
#endif /* _SYSCALL32 */
#ifndef _KERNEL
extern int nfs_getseconfig_default(seconfig_t *);
extern int nfs_getseconfig_byname(char *, seconfig_t *);
extern int nfs_getseconfig_bynumber(int, seconfig_t *);
extern int nfs_getseconfig_bydesc(char *, char *, rpc_gss_service_t,
seconfig_t *);
extern sec_data_t *nfs_clnt_secdata(seconfig_t *, char *, struct knetconfig *,
struct netbuf *, int);
extern void nfs_free_secdata(sec_data_t *);
extern int nfs_syslog_scerr(int, char[]);
extern bool_t nfs_get_root_principal(seconfig_t *, char *, caddr_t *);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* !_NFS_SEC_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _NFSID_MAP_H
#define _NFSID_MAP_H
#ifndef _KERNEL
#include <stddef.h>
#endif
#include <sys/sysmacros.h>
#include <sys/types.h>
/*
* NFSv4 id mapping daemon
*
* This daemon is used by the kernel to map strings in the form
* "user@dns_domain" from an integer form or vice-versa. The daemon
* uses the system configured name services for the mapping.
*
* The status results determines if a mapping was successful.
*
* The mapping is cached in the kernel, so that expensive upcalls are
* reduced to a minimum.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* mapid commands
*/
#define NFSMAPID_STR_UID 1
#define NFSMAPID_UID_STR 2
#define NFSMAPID_STR_GID 3
#define NFSMAPID_GID_STR 4
#define NFSMAPID_SRV_NETINFO 5
/*
* We are passing in arguments in a variable length struct
* similar to a dirent_t. We break apart a utf8string into
* its components and allocate a struct long enough to hold
* the string and a NUL terminator. The caller must ensure the
* terminator is set.
*/
struct mapid_arg {
uint_t cmd;
union {
uid_t uid;
gid_t gid;
int len;
} u_arg;
char str[1];
};
typedef struct mapid_arg mapid_arg_t;
/*
* The actual required size of the args, rounded up to a 64 bit boundary
*/
#define MAPID_ARG_LEN(str_length) \
((offsetof(mapid_arg_t, str[0]) + 1 + (str_length) + 7) & ~ 7)
/*
* Return status codes
*/
#define NFSMAPID_OK 0
/*
* numeric string is mapped to its literal number
*/
#define NFSMAPID_NUMSTR 1
/*
* Value cannot be mapped, badly formed string
*/
#define NFSMAPID_UNMAPPABLE 2
/*
* Caller provided invalid arguments
*/
#define NFSMAPID_INVALID 3
/*
* Internal error in daemon e.g. out of memory, can't return result
*/
#define NFSMAPID_INTERNAL 4
/*
* Incorrect domain used
*/
#define NFSMAPID_BADDOMAIN 5
/*
* Out of range uid/gid
*/
#define NFSMAPID_BADID 6
/*
* User or group cannot be found in nameservice
*/
#define NFSMAPID_NOTFOUND 7
/*
* Similar to the arguments, the result is variable length.
* The returner must ensure the string terminator is set.
*/
struct mapid_res {
uint_t status;
union {
uid_t uid;
gid_t gid;
int len;
} u_res;
char str[1];
};
typedef struct mapid_res mapid_res_t;
/*
* The actual required size of the result, rounded up to a 64 bit boundary
*/
#define MAPID_RES_LEN(str_length) \
((offsetof(mapid_res_t, str[0]) + 1 + (str_length) + 7) & ~ 7)
/*
* Support for referral name resolution by the NFS client
*/
typedef struct refd_door_args {
int cmd; /* NFS4_FS_LOCATIONS/NFS4_SRV_NETINFO */
int xdr_len; /* Length of xdr Buffer */
char xdr_arg[1]; /* Buffer holding xdr encoded data */
} refd_door_args_t;
typedef struct refd_door_res {
int res_status;
int xdr_len;
char xdr_res[1];
} refd_door_res_t;
#ifdef _SYSCALL32
typedef struct refd_door_args32 {
int32_t cmd;
int32_t xdr_len;
char xdr_arg[1];
} refd_door_args32_t;
typedef struct refd_door_res32 {
int32_t res_status;
int32_t xdr_len;
char xdr_res[1];
} refd_door_res32_t;
#endif
#ifdef __cplusplus
}
#endif
#endif /* _NFSID_MAP_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright 2023 MNX Cloud, Inc.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#ifndef _NFS_NFSSYS_H
#define _NFS_NFSSYS_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Private definitions for the nfssys system call.
* Note: <nfs/export.h> and <nfs/nfs.h> must be included before
* this file.
*/
/*
* Flavors of nfssys call. Note that OLD_mumble commands are no longer
* implemented, but the entries are kept as placeholders for binary
* compatibility.
*/
enum nfssys_op { OLD_NFS_SVC, OLD_ASYNC_DAEMON, EXPORTFS, OLD_NFS_GETFH,
OLD_NFS_CNVT, NFS_REVAUTH, OLD_NFS_FH_TO_FID, OLD_LM_SVC, KILL_LOCKMGR,
LOG_FLUSH, SVCPOOL_CREATE, NFS_SVC, LM_SVC, SVCPOOL_WAIT, SVCPOOL_RUN,
NFS4_SVC, RDMA_SVC_INIT, NFS4_CLR_STATE, NFS_IDMAP,
NFS4_SVC_REQUEST_QUIESCE, NFS_GETFH, NFS4_DSS_SETPATHS,
NFS4_DSS_SETPATHS_SIZE, NFS4_EPHEMERAL_MOUNT_TO, MOUNTD_ARGS,
NFSCMD_ARGS };
/*
* The protocol version below represents protocol version number and
* for version 4 - minor version number. Use NFS_PROT_VERSION() and
* NFS_PROT_V4_MINORVERSION() to analyse them.
*/
struct nfs_svc_args {
int fd; /* Connection endpoint */
char *netid; /* Identify transport */
struct netbuf addrmask; /* Address mask for host */
uint32_t nfs_versmin; /* Min protocol version. NFS_VERS_ */
uint32_t nfs_versmax; /* Max protocol version. NFS_VERS_ */
int delegation; /* NFSv4 delegation on/off? */
};
#ifdef _SYSCALL32
struct nfs_svc_args32 {
int32_t fd; /* Connection endpoint */
caddr32_t netid; /* Identify transport */
struct netbuf32 addrmask; /* Address mask for host */
uint32_t nfs_versmin; /* Min protocol version. NFS_VERS_ */
uint32_t nfs_versmax; /* Max protocol version. NFS_VERS_ */
int32_t delegation; /* NFSv4 delegation on/off? */
};
#endif
struct exportfs_args {
char *dname;
struct exportdata *uex;
};
#ifdef _SYSCALL32
struct exportfs_args32 {
caddr32_t dname;
caddr32_t uex;
};
#endif
struct nfs_getfh_args {
char *fname;
int vers;
int *lenp;
char *fhp;
};
#ifdef _SYSCALL32
struct nfs_getfh_args32 {
caddr32_t fname;
int32_t vers;
caddr32_t lenp;
caddr32_t fhp;
};
#endif
struct nfs_revauth_args {
int authtype;
uid_t uid;
};
#ifdef _SYSCALL32
struct nfs_revauth_args32 {
int32_t authtype;
uid32_t uid;
};
#endif
/*
* Arguments for establishing lock manager service. If you change
* lm_svc_args, you should increment the version number. Try to keep
* supporting one or more old versions of the args, so that old lockd's
* will work with new kernels.
*/
enum lm_fmly { LM_INET, LM_INET6, LM_LOOPBACK };
enum lm_proto { LM_TCP, LM_UDP };
struct lm_svc_args {
int version; /* keep this first */
int fd;
enum lm_fmly n_fmly; /* protocol family */
enum lm_proto n_proto; /* protocol */
dev_t n_rdev; /* device ID */
int debug; /* debugging level */
time_t timout; /* client handle life (asynch RPCs) */
int grace; /* secs in grace period */
time_t retransmittimeout; /* retransmission interval */
};
#ifdef _SYSCALL32
struct lm_svc_args32 {
int32_t version; /* keep this first */
int32_t fd;
enum lm_fmly n_fmly; /* protocol family */
enum lm_proto n_proto; /* protocol */
dev32_t n_rdev; /* device ID */
int32_t debug; /* debugging level */
time32_t timout; /* client handle life (asynch RPCs) */
int32_t grace; /* secs in grace period */
time32_t retransmittimeout; /* retransmission interval */
};
#endif
#define LM_SVC_CUR_VERS 30 /* current lm_svc_args vers num */
/*
* Arguments for nfslog flush service.
*/
struct nfsl_flush_args {
int version;
int directive;
char *buff; /* buffer to flush/rename */
int buff_len; /* includes terminating '\0' */
};
#define NFSL_FLUSH_ARGS_VERS 1 /* current nfsl_flush_args vers num */
#ifdef _SYSCALL32
struct nfsl_flush_args32 {
int32_t version;
int32_t directive;
caddr32_t buff; /* buffer to flush/rename */
int32_t buff_len; /* includes terminating '\0' */
};
#endif
/*
* Arguments for initialising RDMA service.
*/
struct rdma_svc_args {
uint32_t poolid; /* Thread Pool ID */
char *netid; /* Network Identifier */
uint32_t nfs_versmin; /* Min NFS version. NFS_VERS_... */
uint32_t nfs_versmax; /* Max NFS version. NFS_VERS_... */
int delegation; /* NFSv4 delegation on/off? */
};
#ifdef _SYSCALL32
struct rdma_svc_args32 {
uint32_t poolid; /* Thread Pool ID */
caddr32_t netid; /* Network Identifier */
uint32_t nfs_versmin; /* Min NFS version. NFS_VERS_... */
uint32_t nfs_versmax; /* Max NFS version. NFS_VERS_... */
int32_t delegation; /* NFSv4 delegation on/off? */
};
#endif
#define NFS4_CLRST_VERSION 1
struct nfs4clrst_args {
int vers;
int addr_type;
void *ap;
};
#ifdef _SYSCALL32
struct nfs4clrst_args32 {
int32_t vers;
int32_t addr_type;
caddr32_t ap;
};
#endif
struct nfsidmap_args {
uint_t state; /* Flushes caches, set state up 1 or down 0 */
uint_t did; /* Door id to upcall */
};
#define NFSL_ALL 0x01 /* Flush all buffers */
#define NFSL_RENAME 0x02 /* Rename buffer(s) */
#define NFSL_SYNC 0x04 /* Perform operation synchronously? */
#ifdef _KERNEL
union nfssysargs {
struct exportfs_args *exportfs_args_u; /* exportfs args */
struct nfs_getfh_args *nfs_getfh_args_u; /* nfs_getfh args */
struct nfs_svc_args *nfs_svc_args_u; /* nfs_svc args */
struct rdma_svc_args *rdma_svc_args_u; /* rdma_svc args */
struct nfs_revauth_args *nfs_revauth_args_u; /* nfs_revauth args */
struct lm_svc_args *lm_svc_args_u; /* lm_svc args */
/* kill_lockmgr args: none */
struct nfsl_flush_args *nfsl_flush_args_u; /* nfsl_flush args */
struct svcpool_args *svcpool_args_u; /* svcpool args */
struct nfs4clrst_args *nfs4clrst_u; /* nfs4 clear state */
struct nfsidmap_args *nfsidmap_u; /* nfsidmap */
};
struct nfssysa {
enum nfssys_op opcode; /* operation discriminator */
union nfssysargs arg; /* syscall-specific arg pointer */
};
#define nfssysarg_exportfs arg.exportfs_args_u
#define nfssysarg_getfh arg.nfs_getfh_args_u
#define nfssysarg_svc arg.nfs_svc_args_u
#define nfssysarg_rdmastart arg.rdma_svc_args_u
#define nfssysarg_revauth arg.nfs_revauth_args_u
#define nfssysarg_lmsvc arg.lm_svc_args_u
#define nfssysarg_nfslflush arg.nfsl_flush_args_u
#define nfssysarg_svcpool arg.svcpool_args_u
#define nfssysarg_nfs4clrst arg.nfs4clrst_u
#define nfssysarg_nfsidmap arg.nfsidmap_u
#ifdef _SYSCALL32
union nfssysargs32 {
caddr32_t exportfs_args_u; /* exportfs args */
caddr32_t nfs_getfh_args_u; /* nfs_getfh args */
caddr32_t nfs_svc_args_u; /* nfs_svc args */
caddr32_t rdma_svc_args_u; /* rdma_start args */
caddr32_t nfs_revauth_args_u; /* nfs_revauth args */
caddr32_t lm_svc_args_u; /* lm_svc args */
/* kill_lockmgr args: none */
caddr32_t nfsl_flush_args_u; /* nfsl_flush args */
caddr32_t svcpool_args_u;
caddr32_t nfs4clrst_u;
};
struct nfssysa32 {
enum nfssys_op opcode; /* operation discriminator */
union nfssysargs32 arg; /* syscall-specific arg pointer */
};
#endif /* _SYSCALL32 */
#endif /* _KERNEL */
struct nfs4_svc_args {
int fd; /* Connection endpoint */
int cmd;
char *netid; /* Transport Identifier */
char *addr; /* Universal Address */
char *protofmly; /* Protocol Family */
char *proto; /* Protocol, eg. "tcp" */
struct netbuf addrmask; /* Address mask for host */
};
#ifdef _SYSCALL32
struct nfs4_svc_args32 {
int32_t fd;
int32_t cmd;
caddr32_t netid;
caddr32_t addr;
caddr32_t protofmly;
caddr32_t proto;
struct netbuf32 addrmask;
};
#endif
#define NFS4_KRPC_START 1
#define NFS4_SETPORT 2
#define NFS4_DQUERY 4
/* DSS: distributed stable storage */
#define NFS4_DSS_STATE_LEAF "v4_state"
#define NFS4_DSS_OLDSTATE_LEAF "v4_oldstate"
#define NFS4_DSS_DIR_MODE 0755
#define NFS4_DSS_NVPAIR_NAME "dss_pathname_array"
/* default storage dir */
#define NFS4_DSS_VAR_DIR "/var/nfs"
#ifdef _KERNEL
#include <sys/systm.h> /* for rval_t typedef */
extern int nfssys(enum nfssys_op opcode, void *arg);
extern int exportfs(struct exportfs_args *, model_t, cred_t *);
extern int nfs_getfh(struct nfs_getfh_args *, model_t, cred_t *);
extern int nfs_svc(struct nfs_svc_args *, model_t);
extern int lm_svc(struct lm_svc_args *uap);
extern int lm_shutdown(void);
extern int nfsl_flush(struct nfsl_flush_args *, model_t);
extern int nfs4_svc(struct nfs4_svc_args *, model_t);
extern int rdma_start(struct rdma_svc_args *);
extern int rfs4_clear_client_state(struct nfs4clrst_args *);
extern void nfs_idmap_args(struct nfsidmap_args *);
extern void nfs4_ephemeral_set_mount_to(uint_t);
extern void mountd_args(uint_t);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _NFS_NFSSYS_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#ifndef _NFS_RNODE_H
#define _NFS_RNODE_H
#include <sys/avl.h>
#include <sys/list.h>
#include <nfs/nfs.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum nfs_access_type {
NFS_ACCESS_UNKNOWN,
NFS_ACCESS_ALLOWED,
NFS_ACCESS_DENIED
} nfs_access_type_t;
typedef struct acache_hash {
struct acache *next; /* next and prev must be first */
struct acache *prev;
krwlock_t lock;
} acache_hash_t;
typedef struct acache {
struct acache *next; /* next and prev must be first */
struct acache *prev;
uint32_t known;
uint32_t allowed;
struct rnode *rnode;
cred_t *cred;
struct acache *list;
struct acache_hash *hashq;
} acache_t;
#define NFS_FHANDLE_LEN 72
typedef struct nfs_fhandle {
int fh_len;
char fh_buf[NFS_FHANDLE_LEN];
} nfs_fhandle;
typedef struct rddir_cache {
lloff_t _cookie; /* cookie used to find this cache entry */
lloff_t _ncookie; /* cookie used to find the next cache entry */
char *entries; /* buffer containing dirent entries */
int eof; /* EOF reached after this request */
int entlen; /* size of dirent entries in buf */
int buflen; /* size of the buffer used to store entries */
int flags; /* control flags, see below */
kcondvar_t cv; /* cv for blocking */
int error; /* error from RPC operation */
kmutex_t lock;
uint_t count; /* reference count */
avl_node_t tree; /* AVL tree links */
} rddir_cache;
#define nfs_cookie _cookie._p._l
#define nfs_ncookie _ncookie._p._l
#define nfs3_cookie _cookie._f
#define nfs3_ncookie _ncookie._f
#define RDDIR 0x1 /* readdir operation in progress */
#define RDDIRWAIT 0x2 /* waiting on readdir in progress */
#define RDDIRREQ 0x4 /* a new readdir is required */
#define RDDIRCACHED 0x8 /* entry is in the cache */
#define HAVE_RDDIR_CACHE(rp) (avl_numnodes(&(rp)->r_dir) > 0)
typedef struct symlink_cache {
char *contents; /* contents of the symbolic link */
int len; /* length of the contents */
int size; /* size of the allocated buffer */
} symlink_cache;
typedef struct commit {
page_t *c_pages; /* list of pages to commit */
offset3 c_commbase; /* base offset to do commit from */
count3 c_commlen; /* len to commit */
kcondvar_t c_cv; /* condvar for waiting for commit */
} commit_t;
/*
* The various values for the commit states. These are stored in
* the p_fsdata byte in the page struct.
* NFSv3,4 can use asynchronous writes - the NFS server can send a response
* before storing the data to the stable store (disk). The response contains
* information if the data are on a disk or not. NFS client marks pages
* which are already on the stable store as C_NOCOMMIT. The pages which were
* sent but are not yet on the stable store are only partially 'safe' and are
* marked as C_DELAYCOMMIT, which can be later changed to C_COMMIT if the
* commit operation is in progress. If the NFS server is e.g. rebooted, the
* client needs to resend all the uncommitted data. The client walks all the
* vp->v_pages and if C_DELAYCOMMIT or C_COMMIT is set, the page is marked as
* dirty and thus will be written to the server again.
*/
#define C_NOCOMMIT 0 /* no commit is required */
#define C_COMMIT 1 /* a commit is required so do it now */
#define C_DELAYCOMMIT 2 /* a commit is required, but can be delayed */
/*
* The lock manager holds state making it possible for the client
* and server to be out of sync. For example, if the response from
* the server granting a lock request is lost, the server will think
* the lock is granted and the client will think the lock is lost.
* To deal with this, a list of processes for which the client is
* not sure if the server holds a lock is attached to the rnode.
* When such a process closes the rnode, an unlock request is sent
* to the server to unlock the entire file.
*
* The list is kept as a singularly linked NULL terminated list.
* Because it is only added to under extreme error conditions, the
* list shouldn't get very big. DEBUG kernels print a console warning
* when the number of entries on a list go beyond nfs_lmpl_high_water
* an arbitrary number defined in nfs_add_locking_id()
*/
#define RLMPL_PID 1
#define RLMPL_OWNER 2
typedef struct lock_manager_pid_list {
int lmpl_type;
pid_t lmpl_pid;
union {
pid_t _pid;
struct {
int len;
char *owner;
} _own;
} un;
struct lock_manager_pid_list *lmpl_next;
} lmpl_t;
#define lmpl_opid un._pid
#define lmpl_own_len un._own.len
#define lmpl_owner un._own.owner
/*
* A homegrown reader/writer lock implementation. It addresses
* two requirements not addressed by the system primitives. They
* are that the `enter" operation is optionally interruptible and
* that they can be re`enter'ed by writers without deadlock.
*/
typedef struct nfs_rwlock {
int count;
int waiters;
kthread_t *owner;
kmutex_t lock;
kcondvar_t cv;
kcondvar_t cv_rd;
} nfs_rwlock_t;
/*
* The format of the hash bucket used to lookup rnodes from a file handle.
*/
typedef struct rhashq {
struct rnode *r_hashf;
struct rnode *r_hashb;
krwlock_t r_lock;
} rhashq_t;
/*
* Remote file information structure.
*
* The rnode is the "inode" for remote files. It contains all the
* information necessary to handle remote file on the client side.
*
* Note on file sizes: we keep two file sizes in the rnode: the size
* according to the client (r_size) and the size according to the server
* (r_attr.va_size). They can differ because we modify r_size during a
* write system call (nfs_rdwr), before the write request goes over the
* wire (before the file is actually modified on the server). If an OTW
* request occurs before the cached data is written to the server the file
* size returned from the server (r_attr.va_size) may not match r_size.
* r_size is the one we use, in general. r_attr.va_size is only used to
* determine whether or not our cached data is valid.
*
* Each rnode has 3 locks associated with it (not including the rnode
* hash table and free list locks):
*
* r_rwlock: Serializes nfs_write and nfs_setattr requests
* and allows nfs_read requests to proceed in parallel.
* Serializes reads/updates to directories.
*
* r_lkserlock: Serializes lock requests with map, write, and
* readahead operations.
*
* r_statelock: Protects all fields in the rnode except for
* those listed below. This lock is intented
* to be held for relatively short periods of
* time (not accross entire putpage operations,
* for example).
*
* The following members are protected by the mutex rpfreelist_lock:
* r_freef
* r_freeb
*
* The following members are protected by the hash bucket rwlock:
* r_hashf
* r_hashb
*
* Note: r_modaddr is only accessed when the r_statelock mutex is held.
* Its value is also controlled via r_rwlock. It is assumed that
* there will be only 1 writer active at a time, so it safe to
* set r_modaddr and release r_statelock as long as the r_rwlock
* writer lock is held.
*
* r_inmap informs nfsX_read()/write() that there is a call to nfsX_map()
* in progress. nfsX_read()/write() check r_inmap to decide whether
* to perform directio on the file or not. r_inmap is atomically
* incremented in nfsX_map() before the address space routines are
* called and atomically decremented just before nfsX_map() exits.
* r_inmap is not protected by any lock.
*
* r_mapcnt tells that the rnode has mapped pages. r_inmap can be 0
* while the rnode has mapped pages.
*
* 64-bit offsets: the code formerly assumed that atomic reads of
* r_size were safe and reliable; on 32-bit architectures, this is
* not true since an intervening bus cycle from another processor
* could update half of the size field. The r_statelock must now
* be held whenever any kind of access of r_size is made.
*
* Lock ordering:
* r_rwlock > r_lkserlock > r_statelock
*/
struct exportinfo; /* defined in nfs/export.h */
struct servinfo; /* defined in nfs/nfs_clnt.h */
struct failinfo; /* defined in nfs/nfs_clnt.h */
struct mntinfo; /* defined in nfs/nfs_clnt.h */
#ifdef _KERNEL
typedef struct rnode {
/* the hash fields must be first to match the rhashq_t */
struct rnode *r_hashf; /* hash queue forward pointer */
struct rnode *r_hashb; /* hash queue back pointer */
struct rnode *r_freef; /* free list forward pointer */
struct rnode *r_freeb; /* free list back pointer */
rhashq_t *r_hashq; /* pointer to the hash bucket */
vnode_t *r_vnode; /* vnode for remote file */
nfs_rwlock_t r_rwlock; /* serializes write/setattr requests */
nfs_rwlock_t r_lkserlock; /* serialize lock with other ops */
kmutex_t r_statelock; /* protects (most of) rnode contents */
nfs_fhandle r_fh; /* file handle */
struct servinfo *r_server; /* current server */
char *r_path; /* path to this rnode */
u_offset_t r_nextr; /* next byte read offset (read-ahead) */
cred_t *r_cred; /* current credentials */
cred_t *r_unlcred; /* unlinked credentials */
char *r_unlname; /* unlinked file name */
vnode_t *r_unldvp; /* parent dir of unlinked file */
len_t r_size; /* client's view of file size */
struct vattr r_attr; /* cached vnode attributes */
hrtime_t r_attrtime; /* time attributes become invalid */
hrtime_t r_mtime; /* client time file last modified */
long r_mapcnt; /* count of mmapped pages */
uint_t r_count; /* # of refs not reflect in v_count */
uint_t r_awcount; /* # of outstanding async write */
uint_t r_gcount; /* getattrs waiting to flush pages */
ushort_t r_flags; /* flags, see below */
short r_error; /* async write error */
kcondvar_t r_cv; /* condvar for blocked threads */
int (*r_putapage) /* address of putapage routine */
(vnode_t *, page_t *, u_offset_t *, size_t *, int, cred_t *);
avl_tree_t r_dir; /* cache of readdir responses */
rddir_cache *r_direof; /* pointer to the EOF entry */
symlink_cache r_symlink; /* cached readlink response */
writeverf3 r_verf; /* version 3 write verifier */
u_offset_t r_modaddr; /* address for page in writerp */
commit_t r_commit; /* commit information */
u_offset_t r_truncaddr; /* base for truncate operation */
vsecattr_t *r_secattr; /* cached security attributes (acls) */
cookieverf3 r_cookieverf; /* version 3 readdir cookie verifier */
lmpl_t *r_lmpl; /* pids that may be holding locks */
nfs3_pathconf_info *r_pathconf; /* cached pathconf information */
acache_t *r_acache; /* list of access cache entries */
kthread_t *r_serial; /* id of purging thread */
list_t r_indelmap; /* list of delmap callers */
uint_t r_inmap; /* to serialize read/write and mmap */
list_node_t r_mi_link; /* linkage into list of rnodes for */
/* this mntinfo */
} rnode_t;
#endif /* _KERNEL */
/*
* Flags
*/
#define RREADDIRPLUS 0x1 /* issue a READDIRPLUS instead of READDIR */
#define RDIRTY 0x2 /* dirty pages from write operation */
#define RSTALE 0x4 /* file handle is stale */
#define RMODINPROGRESS 0x8 /* page modification happening */
#define RTRUNCATE 0x10 /* truncating, don't commit */
#define RHAVEVERF 0x20 /* have a write verifier to compare against */
#define RCOMMIT 0x40 /* commit in progress */
#define RCOMMITWAIT 0x80 /* someone is waiting to do a commit */
#define RHASHED 0x100 /* rnode is in hash queues */
#define ROUTOFSPACE 0x200 /* an out of space error has happened */
#define RDIRECTIO 0x400 /* bypass the buffer cache */
#define RLOOKUP 0x800 /* a lookup has been performed */
#define RWRITEATTR 0x1000 /* attributes came from WRITE */
#define RINDNLCPURGE 0x2000 /* in the process of purging DNLC references */
#define RDELMAPLIST 0x4000 /* delmap callers tracking for as callback */
#define RINCACHEPURGE 0x8000 /* purging caches due to file size change */
/*
* Convert between vnode and rnode
*/
#define RTOV(rp) ((rp)->r_vnode)
#define VTOR(vp) ((rnode_t *)((vp)->v_data))
#define VTOFH(vp) (RTOFH(VTOR(vp)))
#define RTOFH(rp) ((fhandle_t *)(&(rp)->r_fh.fh_buf))
#define VTOFH3(vp) (RTOFH3(VTOR(vp)))
#define RTOFH3(rp) ((nfs_fh3 *)(&(rp)->r_fh))
#ifdef _KERNEL
extern int nfs_async_readahead(vnode_t *, u_offset_t, caddr_t,
struct seg *, cred_t *,
void (*)(vnode_t *, u_offset_t,
caddr_t, struct seg *, cred_t *));
extern int nfs_async_putapage(vnode_t *, page_t *, u_offset_t, size_t,
int, cred_t *, int (*)(vnode_t *, page_t *,
u_offset_t, size_t, int, cred_t *));
extern int nfs_async_pageio(vnode_t *, page_t *, u_offset_t, size_t,
int, cred_t *, int (*)(vnode_t *, page_t *,
u_offset_t, size_t, int, cred_t *));
extern void nfs_async_readdir(vnode_t *, rddir_cache *,
cred_t *, int (*)(vnode_t *,
rddir_cache *, cred_t *));
extern void nfs_async_commit(vnode_t *, page_t *, offset3, count3,
cred_t *, void (*)(vnode_t *, page_t *,
offset3, count3, cred_t *));
extern void nfs_async_inactive(vnode_t *, cred_t *, void (*)(vnode_t *,
cred_t *, caller_context_t *));
extern int writerp(rnode_t *, caddr_t, int, struct uio *, int);
extern int nfs_putpages(vnode_t *, u_offset_t, size_t, int, cred_t *);
extern void nfs_invalidate_pages(vnode_t *, u_offset_t, cred_t *);
extern int rfs2call(struct mntinfo *, rpcproc_t, xdrproc_t, caddr_t,
xdrproc_t, caddr_t, cred_t *, int *, enum nfsstat *,
int, struct failinfo *);
extern int rfs3call(struct mntinfo *, rpcproc_t, xdrproc_t, caddr_t,
xdrproc_t, caddr_t, cred_t *, int *, nfsstat3 *,
int, struct failinfo *);
extern void nfs_setswaplike(vnode_t *, vattr_t *);
extern vnode_t *makenfsnode(fhandle_t *, struct nfsfattr *, struct vfs *,
hrtime_t, cred_t *, char *, char *);
extern vnode_t *makenfs3node_va(nfs_fh3 *, vattr_t *, struct vfs *, hrtime_t,
cred_t *, char *, char *);
extern vnode_t *makenfs3node(nfs_fh3 *, fattr3 *, struct vfs *, hrtime_t,
cred_t *, char *, char *);
extern void rp_addfree(rnode_t *, cred_t *);
extern void rp_rmhash(rnode_t *);
extern int check_rtable(struct vfs *);
extern void destroy_rtable(struct vfs *, cred_t *);
extern void rflush(struct vfs *, cred_t *);
extern nfs_access_type_t nfs_access_check(rnode_t *, uint32_t, cred_t *);
extern void nfs_access_cache(rnode_t *rp, uint32_t, uint32_t, cred_t *);
extern int nfs_access_purge_rp(rnode_t *);
extern int nfs_putapage(vnode_t *, page_t *, u_offset_t *, size_t *,
int, cred_t *);
extern int nfs3_putapage(vnode_t *, page_t *, u_offset_t *, size_t *,
int, cred_t *);
extern void nfs_printfhandle(nfs_fhandle *);
extern void nfs_write_error(vnode_t *, int, cred_t *);
extern rddir_cache *rddir_cache_alloc(int);
extern void rddir_cache_hold(rddir_cache *);
extern void rddir_cache_rele(rddir_cache *);
#ifdef DEBUG
extern char *rddir_cache_buf_alloc(size_t, int);
extern void rddir_cache_buf_free(void *, size_t);
#endif
extern int nfs_rw_enter_sig(nfs_rwlock_t *, krw_t, int);
extern int nfs_rw_tryenter(nfs_rwlock_t *, krw_t);
extern void nfs_rw_exit(nfs_rwlock_t *);
extern int nfs_rw_lock_held(nfs_rwlock_t *, krw_t);
extern void nfs_rw_init(nfs_rwlock_t *, char *, krw_type_t, void *);
extern void nfs_rw_destroy(nfs_rwlock_t *);
extern int nfs_directio(vnode_t *, int, cred_t *);
extern int nfs3_rddir_compar(const void *, const void *);
extern int nfs_rddir_compar(const void *, const void *);
extern struct zone *nfs_zone(void);
extern zoneid_t nfs_zoneid(void);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _NFS_RNODE_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#ifndef _NFS_RNODE4_H
#define _NFS_RNODE4_H
#ifdef __cplusplus
extern "C" {
#endif
#include <nfs/rnode.h> /* for symlink_cache, nfs_rwlock_t, etc. */
#include <nfs/nfs4.h>
#include <nfs/nfs4_clnt.h>
#include <sys/thread.h>
#include <sys/sysmacros.h> /* for offsetof */
typedef enum nfs4_stub_type {
NFS4_STUB_NONE,
NFS4_STUB_MIRRORMOUNT,
NFS4_STUB_REFERRAL
} nfs4_stub_type_t;
typedef enum nfs4_access_type {
NFS4_ACCESS_UNKNOWN,
NFS4_ACCESS_ALLOWED,
NFS4_ACCESS_DENIED
} nfs4_access_type_t;
/*
* Access cache
*/
typedef struct acache4_hash {
struct acache4 *next;
struct acache4 *prev;
krwlock_t lock;
} acache4_hash_t;
typedef struct acache4 {
struct acache4 *next; /* next and prev must be first */
struct acache4 *prev;
uint32_t known;
uint32_t allowed;
struct rnode4 *rnode;
cred_t *cred;
struct acache4 *list;
struct acache4_hash *hashq;
} acache4_t;
/*
* Note on the different buffer sizes in rddir4_cache:
* There seems to be some discrepancy between the intended and actual
* use of entlen and buflen, which does not correspond to the comment below.
* entlen - nfsv2/3 used as both alloc'd size of entries buffer and
* as the actual size of the entries (XXX is this correct?).
* nfsv4 will use it only as the alloc'd size.
* buflen - used for calculations of readahead.
* actlen - added for nfsv4 to serve as the size of the useful
* portion of the entries buffer. That is because in
* nfsv4, the otw entries are converted to system entries,
* and may not be the same size - thus buffer may not be full.
*/
typedef struct rddir4_cache {
lloff_t _cookie; /* cookie used to find this cache entry */
lloff_t _ncookie; /* cookie used to find the next cache entry */
char *entries; /* buffer containing dirent entries */
int eof; /* EOF reached after this request */
int entlen; /* size of dirent entries in buf */
int buflen; /* size of the buffer used to store entries */
int actlen; /* size of the actual entries (nfsv4 only) */
int flags; /* control flags, see below */
kcondvar_t cv; /* cv for blocking */
int error; /* error from RPC operation */
void *data; /* private data */
} rddir4_cache;
#define nfs4_cookie _cookie._f
#define nfs4_ncookie _ncookie._f
/*
* Shadow vnode, v4 only.
*
* A file's shadow vnode list is protected by its hash bucket lock,
* r_hashq->r_lock.
*
* sv_r_vnode is protected by the appropriate vnode locks.
*
* sv_dfh, sv_name, sv_dfileid, and sv_dfileid_valid are protected
* by rp->r_svlock.
*/
typedef struct insq_link {
void *forw;
void *back;
} insq_link_t;
typedef struct svnode {
insq_link_t sv_link; /* must be first for insque */
vnode_t *sv_r_vnode; /* vnode for this shadow */
nfs4_fname_t *sv_name; /* component name */
nfs4_sharedfh_t *sv_dfh; /* directory file handle */
} svnode_t;
#define sv_forw sv_link.forw
#define sv_back sv_link.back
extern svnode_t *vtosv(vnode_t *);
#define VTOSV(vp) vtosv(vp)
#define SVTOV(svp) (((svp)->sv_r_vnode))
#define IS_SHADOW(vp, rp) ((vp) != (rp)->r_vnode)
/*
* The format of the hash bucket used to lookup rnodes from a file handle.
*/
typedef struct r4hashq {
struct rnode4 *r_hashf;
struct rnode4 *r_hashb;
krwlock_t r_lock;
} r4hashq_t;
/*
* Remote file information structure.
*
* The rnode is the "inode" for remote files. It contains all the
* information necessary to handle remote file on the client side.
*
* Note on file sizes: we keep two file sizes in the rnode: the size
* according to the client (r_size) and the size according to the server
* (r_attr.va_size). They can differ because we modify r_size during a
* write system call (nfs_rdwr), before the write request goes over the
* wire (before the file is actually modified on the server). If an OTW
* request occurs before the cached data is written to the server the file
* size returned from the server (r_attr.va_size) may not match r_size.
* r_size is the one we use, in general. r_attr.va_size is only used to
* determine whether or not our cached data is valid.
*
* Each rnode has 5 locks associated with it (not including the rnode
* hash table and free list locks):
*
* r_rwlock: Serializes nfs_write and nfs_setattr requests
* and allows nfs_read requests to proceed in parallel.
* Serializes reads/updates to directories.
*
* r_lkserlock: Serializes lock requests with map, write, and
* readahead operations.
*
* r_statelock: Protects all fields in the rnode except for
* those listed below. This lock is intented
* to be held for relatively short periods of
* time (not accross entire putpage operations,
* for example).
*
* r_statev4_lock: Protects the created_v4 flag, the lock_owners list,
* and all the delegation fields except r_deleg_list.
*
* r_os_lock: Protects r_open_streams.
*
*
* The following members are protected by the mutex rp4freelist_lock:
* r_freef
* r_freeb
*
* The following members are protected by the hash bucket rwlock:
* r_hashf
* r_hashb
*
* r_fh is read-only except when an rnode is created (or recycled from the
* free list).
*
* The following members are protected by nfs4_server_t::s_lock:
* r_deleg_list
*
* Note: r_modaddr is only accessed when the r_statelock mutex is held.
* Its value is also controlled via r_rwlock. It is assumed that
* there will be only 1 writer active at a time, so it safe to
* set r_modaddr and release r_statelock as long as the r_rwlock
* writer lock is held.
*
* r_inmap informs nfs4_read()/write() that there is a call to nfs4_map()
* in progress. nfs4_read()/write() check r_inmap to decide whether
* to perform directio on the file or not. r_inmap is atomically
* incremented in nfs4_map() before the address space routines are
* called and atomically decremented just before nfs4_map() exits.
* r_inmap is not protected by any lock.
*
* r_mapcnt tells that the rnode has mapped pages. r_inmap can be 0
* while the rnode has mapped pages.
*
* 64-bit offsets: the code formerly assumed that atomic reads of
* r_size were safe and reliable; on 32-bit architectures, this is
* not true since an intervening bus cycle from another processor
* could update half of the size field. The r_statelock must now
* be held whenever any kind of access of r_size is made.
*
* Lock ordering:
* r_rwlock > r_lkserlock > r_os_lock > r_statelock > r_statev4_lock
* vnode_t::v_lock > r_os_lock
*/
struct exportinfo; /* defined in nfs/export.h */
struct servinfo4; /* defined in nfs/nfs4_clnt.h */
struct failinfo; /* defined in nfs/nfs_clnt.h */
struct mntinfo4; /* defined in nfs/nfs4_clnt.h */
typedef struct rnode4 {
/* the hash fields must be first to match the rhashq_t */
struct rnode4 *r_hashf; /* hash queue forward pointer */
struct rnode4 *r_hashb; /* hash queue back pointer */
struct rnode4 *r_freef; /* free list forward pointer */
struct rnode4 *r_freeb; /* free list back pointer */
r4hashq_t *r_hashq; /* pointer to the hash bucket */
svnode_t r_svnode; /* "master" shadow vnode for file */
kmutex_t r_svlock; /* serializes access to svnode list */
nfs_rwlock_t r_rwlock; /* serializes write/setattr requests */
nfs_rwlock_t r_lkserlock; /* serialize lock with other ops */
kmutex_t r_statelock; /* protects (most of) rnode contents */
nfs4_sharedfh_t *r_fh; /* file handle */
struct servinfo4
*r_server; /* current server */
u_offset_t r_nextr; /* next byte read offset (read-ahead) */
uint_t r_flags; /* flags, see below */
short r_error; /* async write error */
cred_t *r_unlcred; /* unlinked credentials */
char *r_unlname; /* unlinked file name */
vnode_t *r_unldvp; /* parent dir of unlinked file */
vnode_t *r_xattr_dir; /* cached xattr dir vnode */
len_t r_size; /* client's view of file size */
vattr_t r_attr; /* cached vnode attributes */
hrtime_t r_time_attr_saved; /* time attributes were cached */
hrtime_t r_time_attr_inval; /* time attributes become invalid */
hrtime_t r_time_cache_inval; /* time caches become invalid */
time_t r_delay_wait; /* future time for DELAY handling */
int r_delay_interval; /* Number of Secs of last DELAY */
time_t r_last_recov; /* time of last recovery operation */
nfs4_recov_t r_recov_act; /* action from last recovery op */
long r_mapcnt; /* count of mmapped pages */
uint_t r_count; /* # of refs not reflect in v_count */
uint_t r_awcount; /* # of outstanding async write */
uint_t r_gcount; /* getattrs waiting to flush pages */
kcondvar_t r_cv; /* condvar for blocked threads */
int (*r_putapage) /* address of putapage routine */
(vnode_t *, page_t *, u_offset_t *, size_t *, int, cred_t *);
void *r_dir; /* cache of readdir responses */
rddir4_cache *r_direof; /* pointer to the EOF entry */
symlink_cache r_symlink; /* cached readlink response */
verifier4 r_writeverf; /* file data write verifier */
u_offset_t r_modaddr; /* address for page in writerp */
commit_t r_commit; /* commit information */
u_offset_t r_truncaddr; /* base for truncate operation */
vsecattr_t *r_secattr; /* cached security attributes (acls) */
verifier4 r_cookieverf4; /* version 4 readdir cookie verifier */
nfs4_pathconf_info_t r_pathconf; /* cached pathconf info */
acache4_t *r_acache; /* list of access cache entries */
list_t r_open_streams; /* open streams list */
kmutex_t r_os_lock; /* protects r_open_streams */
nfs4_lock_owner_t
r_lo_head; /* lock owners list head */
int created_v4; /* 1 if file has been created in v4 */
kmutex_t r_statev4_lock; /* protects created_v4, state4ptr */
list_node_t r_deleg_link; /* linkage into list of */
/* delegated rnodes for this server */
open_delegation_type4
r_deleg_type; /* type of delegation granted */
stateid4 r_deleg_stateid;
/* delegation state id */
nfs_space_limit4
r_deleg_limit; /* file limits returned from */
/* server on delegated open */
nfsace4 r_deleg_perms; /* file permissions returned from */
/* server on delegated open */
fattr4_change r_deleg_change; /* current deleg change attr */
fattr4_change r_deleg_change_grant;
/* change @ write deleg grant */
cred_t *r_deleg_cred; /* credential in force when the */
/* delegation was granted */
open_delegation_type4
r_deleg_needs_recovery;
/* delegation needs recovery */
/* This contains the delegation type */
/* for use with CLAIM_PREVIOUS. */
/* OPEN_DELEGATE_NONE means recovery */
/* is not needed. */
unsigned r_deleg_needs_recall:1;
/* delegation has been recalled by */
/* the server during open with */
/* CLAIM_PREVIOUS */
unsigned r_deleg_return_pending:1;
/* delegreturn is pending, don't use */
/* the delegation stateid, set in */
/* nfs4_dlistadd */
unsigned r_deleg_return_inprog:1;
/* delegreturn is in progress, may */
/* only be set by nfs4delegreturn. */
nfs_rwlock_t r_deleg_recall_lock;
/* lock for synchronizing delegreturn */
/* with in other operations, acquired */
/* in read mode by nfs4_start_fop, */
/* acquired in write mode in */
/* nfs4delegreturn */
fattr4_change r_change; /* GETATTR4 change attr; client */
/* should always request change */
/* when c/mtime requested to keep */
/* change and c/mtime in sync */
fattr4_fileid r_mntd_fid; /* mounted on fileid attr */
kthread_t *r_serial; /* attrcache validation thread */
kthread_t *r_pgflush; /* thread flushing page cache */
list_t r_indelmap; /* list of delmap callers */
fattr4_fsid r_srv_fsid; /* fsid of srv fs containing object */
/* when rnode created; compare with */
/* sv_fsid (servinfo4_t) to see why */
/* stub type was set */
nfs4_stub_type_t r_stub_type;
/* e.g. mirror-mount or referral */
uint_t r_inmap; /* to serialize read/write and mmap */
list_node_t r_mi_link; /* linkage into list of rnodes for */
/* this mntinfo */
} rnode4_t;
#define r_vnode r_svnode.sv_r_vnode
/*
* Flags
*/
#define R4READDIRWATTR 0x1 /* Use READDIR with attributes */
#define R4DIRTY 0x2 /* dirty pages from write operation */
#define R4STALE 0x4 /* stale, don't even attempt to write */
#define R4MODINPROGRESS 0x8 /* page modification happening */
#define R4TRUNCATE 0x10 /* truncating, don't commit */
#define R4HAVEVERF 0x20 /* have a write verifier to compare against */
#define R4COMMIT 0x40 /* commit in progress */
#define R4COMMITWAIT 0x80 /* someone is waiting to do a commit */
#define R4HASHED 0x100 /* rnode is in hash queues */
#define R4OUTOFSPACE 0x200 /* an out of space error has happened */
#define R4LODANGLERS 0x400 /* rnode has dangling lock_owners to cleanup */
#define R4WRITEMODIFIED 0x800 /* file data has been modified by write */
#define R4DIRECTIO 0x1000 /* bypass the buffer cache */
#define R4RECOVERR 0x2000 /* couldn't recover */
#define R4RECEXPFH 0x4000 /* recovering expired filehandle */
#define R4RECOVERRP 0x8000 /* R4RECOVERR pending, but not set (yet) */
#define R4ISXATTR 0x20000 /* rnode is a named attribute */
#define R4DELMAPLIST 0x40000 /* delmap callers tracked for as callback */
#define R4PGFLUSH 0x80000 /* page flush thread active */
#define R4INCACHEPURGE 0x100000 /* purging caches due to file size change */
#define R4LOOKUP 0x200000 /* a lookup has been done in the directory */
/*
* Convert between vnode and rnode
*/
#define RTOV4(rp) ((rp)->r_vnode)
#define VTOR4(vp) ((rnode4_t *)((vp)->v_data))
#define RP_ISSTUB(rp) (((rp)->r_stub_type != NFS4_STUB_NONE))
#define RP_ISSTUB_MIRRORMOUNT(rp) ((rp)->r_stub_type == NFS4_STUB_MIRRORMOUNT)
#define RP_ISSTUB_REFERRAL(rp) ((rp)->r_stub_type == NFS4_STUB_REFERRAL)
/*
* Open file instances.
*/
typedef struct nfs4_opinst {
struct nfs4_opinst *re_next; /* next in list */
vnode_t *re_vp; /* held reference */
uint32_t re_numosp; /* number of valid open streams */
nfs4_open_stream_t **re_osp; /* held reference */
} nfs4_opinst_t;
#ifdef _KERNEL
extern long nrnode;
/* Used for r_delay_interval */
#define NFS4_INITIAL_DELAY_INTERVAL 1
#define NFS4_MAX_DELAY_INTERVAL 20
extern rnode4_t *r4find(r4hashq_t *, nfs4_sharedfh_t *, struct vfs *);
extern rnode4_t *r4find_unlocked(nfs4_sharedfh_t *, struct vfs *);
extern void r4flush(struct vfs *, cred_t *);
extern void destroy_rtable4(struct vfs *, cred_t *);
extern int check_rtable4(struct vfs *);
extern void rp4_addfree(rnode4_t *, cred_t *);
extern void rp4_addhash(rnode4_t *);
extern void rp4_rmhash(rnode4_t *);
extern void rp4_rmhash_locked(rnode4_t *);
extern int rtable4hash(nfs4_sharedfh_t *);
extern vnode_t *makenfs4node(nfs4_sharedfh_t *, nfs4_ga_res_t *, struct vfs *,
hrtime_t, cred_t *, vnode_t *, nfs4_fname_t *);
extern vnode_t *makenfs4node_by_fh(nfs4_sharedfh_t *, nfs4_sharedfh_t *,
nfs4_fname_t **, nfs4_ga_res_t *, mntinfo4_t *, cred_t *, hrtime_t);
extern nfs4_opinst_t *r4mkopenlist(struct mntinfo4 *);
extern void r4releopenlist(nfs4_opinst_t *);
extern int r4find_by_fsid(mntinfo4_t *, fattr4_fsid *);
/* Access cache calls */
extern nfs4_access_type_t nfs4_access_check(rnode4_t *, uint32_t, cred_t *);
extern void nfs4_access_cache(rnode4_t *rp, uint32_t, uint32_t, cred_t *);
extern int nfs4_access_purge_rp(rnode4_t *);
extern int nfs4_free_data_reclaim(rnode4_t *);
extern void nfs4_rnode_invalidate(struct vfs *);
extern time_t r2lease_time(rnode4_t *);
extern int nfs4_directio(vnode_t *, int, cred_t *);
/* shadow vnode functions */
extern void sv_activate(vnode_t **, vnode_t *, nfs4_fname_t **, int);
extern vnode_t *sv_find(vnode_t *, vnode_t *, nfs4_fname_t **);
extern void sv_update_path(vnode_t *, char *, char *);
extern void sv_inactive(vnode_t *);
extern void sv_exchange(vnode_t **);
extern void sv_uninit(svnode_t *);
extern void nfs4_clear_open_streams(rnode4_t *);
/*
* Mark cached attributes as timed out
*
* The caller must not be holding the rnode r_statelock mutex.
*/
#define PURGE_ATTRCACHE4_LOCKED(rp) { \
rp->r_time_attr_inval = gethrtime(); \
rp->r_time_attr_saved = rp->r_time_attr_inval; \
rp->r_pathconf.pc4_xattr_valid = 0; \
rp->r_pathconf.pc4_cache_valid = 0; \
}
#define PURGE_ATTRCACHE4(vp) { \
rnode4_t *rp = VTOR4(vp); \
mutex_enter(&rp->r_statelock); \
PURGE_ATTRCACHE4_LOCKED(rp); \
mutex_exit(&rp->r_statelock); \
}
extern void nfs4_async_readdir(vnode_t *, rddir4_cache *,
cred_t *, int (*)(vnode_t *, rddir4_cache *, cred_t *));
extern char *rnode4info(rnode4_t *rp);
extern int writerp4(rnode4_t *, caddr_t, int, struct uio *, int);
extern void nfs4_set_nonvattrs(rnode4_t *, struct nfs4attr_to_vattr *);
extern void nfs4delegabandon(rnode4_t *);
extern stateid4 nfs4_get_w_stateid(cred_t *, rnode4_t *, pid_t, mntinfo4_t *,
nfs_opnum4, nfs4_stateid_types_t *);
extern stateid4 nfs4_get_stateid(cred_t *, rnode4_t *, pid_t, mntinfo4_t *,
nfs_opnum4, nfs4_stateid_types_t *, bool_t);
extern nfsstat4 nfs4_find_or_create_lock_owner(pid_t, rnode4_t *, cred_t *,
nfs4_open_owner_t **, nfs4_open_stream_t **,
nfs4_lock_owner_t **);
extern cred_t *nfs4_get_otw_cred_by_osp(rnode4_t *, cred_t *,
nfs4_open_stream_t **, bool_t *, bool_t *);
/*
* Defines for the flag argument of nfs4delegreturn
*/
#define NFS4_DR_FORCE 0x1 /* discard even if start_op fails */
#define NFS4_DR_PUSH 0x2 /* push modified data back to the server */
#define NFS4_DR_DISCARD 0x4 /* discard the delegation w/o delegreturn */
#define NFS4_DR_DID_OP 0x8 /* calling function did nfs4_start_op */
#define NFS4_DR_RECALL 0x10 /* delegreturn done in response to CB_RECALL */
#define NFS4_DR_REOPEN 0x20 /* perform file reopens, if applicable */
extern int nfs4delegreturn(rnode4_t *, int);
extern void nfs4_delegreturn_all(nfs4_server_t *);
extern void nfs4delegreturn_cleanup(rnode4_t *, nfs4_server_t *);
extern void nfs4_delegation_accept(rnode4_t *, open_claim_type4, OPEN4res *,
nfs4_ga_res_t *, cred_t *);
extern void nfs4_dlistclean(void);
extern void nfs4_deleg_discard(mntinfo4_t *, nfs4_server_t *);
extern void rddir4_cache_create(rnode4_t *);
extern void rddir4_cache_purge(rnode4_t *);
extern void rddir4_cache_destroy(rnode4_t *);
extern rddir4_cache *rddir4_cache_lookup(rnode4_t *, offset_t, int);
extern void rddir4_cache_rele(rnode4_t *, rddir4_cache *);
extern void r4_stub_mirrormount(rnode4_t *);
extern void r4_stub_referral(rnode4_t *);
extern void r4_stub_none(rnode4_t *);
#ifdef DEBUG
extern char *rddir4_cache_buf_alloc(size_t, int);
extern void rddir4_cache_buf_free(void *, size_t);
#endif
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _NFS_RNODE4_H */
|