|
root / base / usr / src / uts / common / nfs / nfs4_kprot.h
nfs4_kprot.h C 4201 lines 106.6 KB
   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
/*
 * 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 */