Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
\input texinfo          @c -*-texinfo-*-
@c $NetBSD: am-utils.texi,v 1.4 2015/01/17 17:46:31 christos Exp $
@c
@c Copyright (c) 1997-2014 Erez Zadok
@c Copyright (c) 1989 Jan-Simon Pendry
@c Copyright (c) 1989 Imperial College of Science, Technology & Medicine
@c Copyright (c) 1989 The Regents of the University of California.
@c All rights reserved.
@c
@c This code is derived from software contributed to Berkeley by
@c Jan-Simon Pendry at Imperial College, London.
@c
@c Redistribution and use in source and binary forms, with or without
@c modification, are permitted provided that the following conditions
@c are met:
@c 1. Redistributions of source code must retain the above copyright
@c    notice, this list of conditions and the following disclaimer.
@c 2. Redistributions in binary form must reproduce the above copyright
@c    notice, this list of conditions and the following disclaimer in the
@c    documentation and/or other materials provided with the distribution.
@c 3. Neither the name of the University nor the names of its contributors
@c    may be used to endorse or promote products derived from this software
@c    without specific prior written permission.
@c
@c THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
@c ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@c IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@c ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
@c FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
@c DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
@c OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@c HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
@c LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
@c OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
@c
@c
@c File: am-utils/doc/am-utils.texi
@c
@setfilename am-utils.info

@include version.texi

@c info directory entry
@dircategory Administration
@direntry
* Am-utils: (am-utils).          The Amd automounter suite of utilities
@end direntry

@settitle Am-utils (4.4BSD Automounter Utilities)
@setchapternewpage odd

@titlepage
@title Am-utils (4.4BSD Automounter Utilities)
@subtitle For version @value{VERSION}, @value{UPDATED}

@author Erez Zadok
(Originally by Jan-Simon Pendry and Nick Williams)

@page
Copyright @copyright{} 1997-2014 Erez Zadok
@*
Copyright @copyright{} 1989 Jan-Simon Pendry
@*
Copyright @copyright{} 1989 Imperial College of Science, Technology & Medicine
@*
Copyright @copyright{} 1989 The Regents of the University of California.
@sp 1
All Rights Reserved.
@vskip 1ex
Permission to copy this document, or any portion of it, as
necessary for use of this software is granted provided this
copyright notice and statement of permission are included.
@end titlepage
@page

@c Define a new index for options.
@syncodeindex pg cp
@syncodeindex vr cp

@ifinfo

@c ################################################################
@node Top, License, , (DIR)

@b{Am-utils (4.4BSD Automounter Utilities) User Manual}
@*
For version @value{VERSION}, @value{UPDATED}

@b{Erez Zadok}
@*
(Originally by Jan-Simon Pendry and Nick Williams)

Copyright @copyright{} 1997-2014 Erez Zadok
@*
Copyright @copyright{} 1989 Jan-Simon Pendry
@*
Copyright @copyright{} 1989 Imperial College of Science, Technology & Medicine
@*
Copyright @copyright{} 1989 The Regents of the University of California.
@*
All Rights Reserved.

Permission to copy this document, or any portion of it, as
necessary for use of this software is granted provided this
copyright notice and statement of permission are included.

Am-utils is the 4.4BSD Automounter Tool Suite, which includes the Amd
automounter, the Amq query and control program, the Hlfsd daemon, and
other tools.  This Info file describes how to use and understand the
tools within Am-utils.
@end ifinfo

@menu
* License::                  Explains the terms and conditions for using
                             and distributing Am-utils.
* Distrib::                  How to get the latest Am-utils distribution.
* AddInfo::                  How to get additional information.
* Intro::                    An introduction to Automounting concepts.
* History::                  History of am-utils' development.
* Overview::                 An overview of Amd.
* Supported Platforms::      Machines and Systems supported by Amd.
* Mount Maps::               Details of mount maps.
* Amd Command Line Options:: All the Amd command line options explained.
* Filesystem Types::         The different mount types supported by Amd.
* Amd Configuration File::   The amd.conf file syntax and meaning.
* Run-time Administration::  How to start, stop and control Amd.
* FSinfo::                   The FSinfo filesystem management tool.
* Hlfsd::                    The Home-Link Filesystem server.
* Assorted Tools::           Other tools which come with am-utils.
* Examples::                 Some examples showing how Amd might be used.
* Internals::                Implementation details.
* Acknowledgments & Trademarks:: Legal Notes.

Indexes
* Index::                    An item for each concept.
@end menu

@iftex
@unnumbered Preface

This manual documents the use of the 4.4BSD automounter tool suite,
which includes @i{Amd}, @i{Amq}, @i{Hlfsd}, and other programs.  This is
primarily a reference manual.  While no tutorial exists, there are
examples available.  @xref{Examples}.

This manual comes in two forms: the published form and the Info form.
The Info form is for on-line perusal with the INFO program which is
distributed along with GNU texinfo package (a version of which is
available for GNU Emacs).@footnote{GNU packages can be found in
@url{ftp://ftp.gnu.org/pub/gnu/}.}  Both forms contain substantially
the same text and are generated from a common source file, which is
distributed with the @i{Am-utils} source.
@end iftex

@c ################################################################
@node License, Distrib, Top, Top
@unnumbered License
@cindex License Information

@i{Am-utils} is not in the public domain; it is copyrighted and there are
restrictions on its distribution.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

@enumerate

@item
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

@item
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

@item
Neither the name of the University nor the names of its contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.

@end enumerate

THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.

@c ################################################################
@node Distrib, AddInfo, License, Top
@unnumbered Source Distribution
@cindex Source code distribution
@cindex Obtaining the source code

The @i{Am-utils} home page is located in
@example
@url{http://www.am-utils.org/}
@end example

You can get the latest distribution version of @i{Am-utils} from
@example
@url{ftp://ftp.am-utils.org/pub/am-utils/am-utils.tar.gz}
@end example

Additional alpha, beta, and release distributions are available in
@example
@url{ftp://ftp.am-utils.org/pub/am-utils/}.
@end example

Revision 5.2 was part of the 4.3BSD Reno distribution.

Revision 5.3bsdnet, a late alpha version of 5.3, was part
of the BSD network version 2 distribution

Revision 6.0 was made independently by
Erez Zadok at the Computer Science
Department of @uref{http://www.cs.columbia.edu/,Columbia University},
as part of his
@uref{http://www.fsl.cs.sunysb.edu/docs/zadok-thesis-proposal/,PhD
thesis work}.  Am-utils (especially version 6.1) continues to be
developed and maintained at the
@uref{http://www.cs.sunysb.edu/,Computer Science Department} of
@uref{http://www.stonybrook.edu/,Stony Brook University}, as a service
to the user community.


@xref{History}, for more details.

@c ################################################################
@node AddInfo, Intro, Distrib, Top
@unnumbered Getting Additional Information
@cindex Getting Additional Information

@unnumberedsec Bug Reports
@cindex Bug reports

Before reporting a bug, see if it is a known one in the
@uref{http://www.am-utils.org/docs/am-utils/BUGS.txt,bugs} file.

If you find a problem and hopefully you can reproduce it, please
describe it in detail and
@uref{https://bugzilla.filesystems.org/,submit a bug report} via
@uref{http://www.bugzilla.org/,Bugzilla}.  Alternatively, you can send
your bug report to the ``am-utils'' list (see
@url{http://www.am-utils.org/} under ``Mailing Lists'') quoting the details
of the release and your configuration.  These details can be obtained
by running the command @samp{amd -v}.  It would greatly help if you
could provide a reproducible procedure for detecting the bug you are
reporting.

Providing working patches is highly encouraged.  Every patch
incorporated, however small, will get its author an honorable mention in
the @uref{http://www.am-utils.org/docs/am-utils/AUTHORS.txt,authors
file}.

@unnumberedsec Mailing Lists
@cindex Mailing lists

There are several mailing lists for people interested in keeping up-to-date
with developments.

@c ###############

@enumerate

@item
The users mailing list, @samp{am-utils} is for

@itemize @minus
@item
announcements of alpha and beta releases of am-utils
@item
reporting of bugs and patches
@item
discussions of new features for am-utils
@item
implementation and porting issues
@end itemize

To subscribe, visit @url{http://www.am-utils.org/} under ``Mailing
Lists.''  After subscribing, you can post a message to this list.  To
avoid as much spam as possible, only subscribers to this list may post
to it.

Subscribers of @samp{am-utils} are most helpful if they have the time
and resources to test new and development versions of amd, on as many
different platforms as possible.  They should also be prepared to
learn and use the GNU Autoconf, Automake, and Libtool packages, as
needed; and of course, become familiar with the complex code in the
am-utils package.  In other words, subscribers on this list should
hopefully be able to contribute meaningfully to the development of
amd.

Note that this @samp{am-utils} list used to be called @samp{amd-dev}
before January 1st, 2004.  Please use the new name, @samp{am-utils}.

@item
The announcements mailing list, @samp{am-utils-announce} is for
announcements only (mostly new releases).  To subscribe, visit
@url{http://www.am-utils.org/} under ``Mailing Lists.''
This list is read-only: only am-utils developers may post to it.

@item
We distribute nightly CVS snapshots in
@url{ftp://ftp.am-utils.org/pub/am-utils/snapshots/daily/}.  If you
like to get email notices of commits to the am-utils CVS repository,
subscribe to the CVS logs mailing list, @samp{am-utils-cvs} at
@url{http://www.am-utils.org/} under ``Mailing Lists.''

@item
The older list which was used to user discussions, @samp{amd-workers},
is defunct as of January 2004.  (Its last address was
@email{amd-workers AT majordomo.glue.umd.edu}.)  Don't use
@samp{amd-workers}: use the newer, more active @samp{am-utils} list.

@item
For completeness, there's a developers-only closed list called
@samp{am-utils-developers} (see @url{http://www.am-utils.org/} under
``Mailing Lists'').

@end enumerate

@unnumberedsec Am-utils Book
@cindex Am-utils book
@cindex Amd book
@cindex Automounter book
@cindex book

@uref{http://www.cs.sunysb.edu/~ezk,Erez Zadok} wrote a
@uref{http://www.fsl.cs.sunysb.edu/docs/amd-book/,book}, titled @i{Linux NFS and
Automounter Administration}, ISBN 0-7821-2739-8, (Sybex, 2001).  The
book is full of details and examples that go beyond what this manual
has.  The book also covers NFS in great detail.  Although the book is
geared toward Linux users, it is general enough for any Unix
administrator and contains specific sections for non-Linux systems.

@c ################################################################
@node Intro, History, AddInfo, Top
@unnumbered Introduction
@cindex Introduction

An @dfn{automounter} maintains a cache of mounted filesystems.
Filesystems are mounted on demand when they are first referenced,
and unmounted after a period of inactivity.

@i{Amd} may be used as a replacement for Sun's automounter.  The choice
of which filesystem to mount can be controlled dynamically with
@dfn{selectors}.  Selectors allow decisions of the form ``hostname is
@var{this},'' or ``architecture is not @var{that}.''  Selectors may be
combined arbitrarily.  @i{Amd} also supports a variety of filesystem
types, including NFS, UFS and the novel @dfn{program} filesystem.  The
combination of selectors and multiple filesystem types allows identical
configuration files to be used on all machines thus reducing the
administrative overhead.

@i{Amd} ensures that it will not hang if a remote server goes down.
Moreover, @i{Amd} can determine when a remote server has become
inaccessible and then mount replacement filesystems as and when they
become available.

@i{Amd} contains no proprietary source code and has been ported to
numerous flavors of Unix.

@c ################################################################
@node History, Overview, Intro, Top
@unnumbered History
@cindex History

The @i{Amd} package has been without an official maintainer since 1992.
Several people have stepped in to maintain it unofficially.  Most
notable were the `upl' (Unofficial Patch Level) releases of @i{Amd},
created by me (@uref{http://www.cs.sunysb.edu/~ezk,Erez Zadok}), and available from
@url{ftp://ftp.am-utils.org/pub/amd/}.  The last such unofficial
release was `upl102'.

Through the process of patching and aging, it was becoming more and more
apparent that @i{Amd} was in much need of revitalizing.  Maintaining
@i{Amd} had become a difficult task.  I took it upon myself to cleanup
the code, so that it would be easier to port to new platforms, add new
features, keep up with the many new feature requests, and deal with the
never ending stream of bug reports.

I have been working on such a release of @i{Amd} on and off since
January of 1996.  The new suite of tools is currently named "am-utils"
(AutoMounter Utilities), in line with GNU naming conventions, befitting
the contents of the package.  In October of 1996 I had received enough
offers to help me with this task that I decided to make a mailing list
for this group of people.  Around the same time, @i{Amd} had become a
necessary part of my PhD thesis work, resulting in more work performed
on am-utils.

Am-utils version 6.0 was numbered with a major new release number to
distinguish it from the last official release of @i{Amd} (5.x).  Many
new features have been added such as a GNU @code{configure} system, NFS
Version 3, a run-time configuration file (`amd.conf'), many new ports,
more scripts and programs, as well as numerous bug fixes.  Another
reason for the new major release number was to alert users of am-utils
that user-visible interfaces may have changed.  In order to make @i{Amd}
work well for the next 10 years, and be easier to maintain, it was
necessary to remove old or unused features, change various syntax files,
etc.  However, great care was taken to ensure the maximum possible
backwards compatibility.

Am-utils version 6.1 has autofs support for Linux and Solaris 2.5+ as
@i{the} major new feature, in addition to several other minor new
features.  The autofs support is completely transparent to the
end-user, aside from the fact that @code{/bin/pwd} now always returns
the correct amd-ified path.  The administrator can easily switch
between NFS and autofs mounts by changing one parameter in
@code{amd.conf}.  Autofs support and maintenance was developed in
conjunction with @email{ionut AT badula.org,Ion Badulescu}.

@c ################################################################
@node Overview, Supported Platforms, History, Top
@chapter Overview

@i{Amd} maintains a cache of mounted filesystems.  Filesystems are
@dfn{demand-mounted} when they are first referenced, and unmounted after
a period of inactivity.  @i{Amd} may be used as a replacement for Sun's
@b{automount}(8) program.  It contains no proprietary source code and
has been ported to numerous flavors of Unix.  @xref{Supported
Platforms}.@refill

@i{Amd} was designed as the basis for experimenting with filesystem
layout and management.  Although @i{Amd} has many direct applications it
is loaded with additional features which have little practical use.  At
some point the infrequently used components may be removed to streamline
the production system.

@i{Amd} supports the notion of @dfn{replicated} filesystems by evaluating
each member of a list of possible filesystem locations one by one.
@i{Amd} checks that each cached mapping remains valid.  Should a mapping be
lost -- such as happens when a fileserver goes down -- @i{Amd} automatically
selects a replacement should one be available.

@menu
* Fundamentals::
* Filesystems and Volumes::
* Volume Naming::
* Volume Binding::
* Operational Principles::
* Mounting a Volume::
* Automatic Unmounting::
* Keep-alives::
* Non-blocking Operation::
@end menu

@node Fundamentals, Filesystems and Volumes, Overview, Overview
@comment  node-name,  next,  previous,  up
@section Fundamentals
@cindex Automounter fundamentals

The fundamental concept behind @i{Amd} is the ability to separate the
name used to refer to a file from the name used to refer to its physical
storage location.  This allows the same files to be accessed with the
same name regardless of where in the network the name is used.  This is
very different from placing @file{/n/hostname} in front of the pathname
since that includes location dependent information which may change if
files are moved to another machine.

By placing the required mappings in a centrally administered database,
filesystems can be re-organized without requiring changes to
configuration files, shell scripts and so on.

@node Filesystems and Volumes, Volume Naming, Fundamentals, Overview
@comment  node-name,  next,  previous,  up
@section Filesystems and Volumes
@cindex Filesystem
@cindex Volume
@cindex Fileserver
@cindex sublink

@i{Amd} views the world as a set of fileservers, each containing one or
more filesystems where each filesystem contains one or more
@dfn{volumes}.  Here the term @dfn{volume} is used to refer to a
coherent set of files such as a user's home directory or a @TeX{}
distribution.@refill

In order to access the contents of a volume, @i{Amd} must be told in
which filesystem the volume resides and which host owns the filesystem.
By default the host is assumed to be local and the volume is assumed to
be the entire filesystem.  If a filesystem contains more than one
volume, then a @dfn{sublink} is used to refer to the sub-directory
within the filesystem where the volume can be found.

@node Volume Naming, Volume Binding, Filesystems and Volumes, Overview
@comment  node-name,  next,  previous,  up
@section Volume Naming
@cindex Volume names
@cindex Network-wide naming
@cindex Replicated volumes
@cindex Duplicated volumes
@cindex Replacement volumes

Volume names are defined to be unique across the entire network.  A
volume name is the pathname to the volume's root as known by the users
of that volume.  Since this name uniquely identifies the volume
contents, all volumes can be named and accessed from each host, subject
to administrative controls.

Volumes may be replicated or duplicated.  Replicated volumes contain
identical copies of the same data and reside at two or more locations in
the network.  Each of the replicated volumes can be used
interchangeably.  Duplicated volumes each have the same name but contain
different, though functionally identical, data.  For example,
@samp{/vol/tex} might be the name of a @TeX{} distribution which varied
for each machine architecture.@refill

@i{Amd} provides facilities to take advantage of both replicated and
duplicated volumes.  Configuration options allow a single set of
configuration data to be shared across an entire network by taking
advantage of replicated and duplicated volumes.

@i{Amd} can take advantage of replacement volumes by mounting them as
required should an active fileserver become unavailable.

@node Volume Binding, Operational Principles, Volume Naming, Overview
@comment  node-name,  next,  previous,  up
@section Volume Binding
@cindex Volume binding
@cindex Unix namespace
@cindex Namespace
@cindex Binding names to filesystems

Unix implements a namespace of hierarchically mounted filesystems.  Two
forms of binding between names and files are provided.  A @dfn{hard
link} completes the binding when the name is added to the filesystem.  A
@dfn{soft link} delays the binding until the name is accessed.  An
@dfn{automounter} adds a further form in which the binding of name to
filesystem is delayed until the name is accessed.@refill

The target volume, in its general form, is a tuple (host, filesystem,
sublink) which can be used to name the physical location of any volume
in the network.

When a target is referenced, @i{Amd} ignores the sublink element and
determines whether the required filesystem is already mounted.  This is
done by computing the local mount point for the filesystem and checking
for an existing filesystem mounted at the same place.  If such a
filesystem already exists then it is assumed to be functionally
identical to the target filesystem.  By default there is a one-to-one
mapping between the pair (host, filesystem) and the local mount point so
this assumption is valid.

@node Operational Principles, Mounting a Volume, Volume Binding, Overview
@comment  node-name,  next,  previous,  up
@section Operational Principles
@cindex Operational principles

@i{Amd} operates by introducing new mount points into the namespace.
These are called @dfn{automount} points.  The kernel sees these
automount points as NFS filesystems being served by @i{Amd}.  Having
attached itself to the namespace, @i{Amd} is now able to control the
view the rest of the system has of those mount points.  RPC calls are
received from the kernel one at a time.

When a @dfn{lookup} call is received @i{Amd} checks whether the name is
already known.  If it is not, the required volume is mounted.  A
symbolic link pointing to the volume root is then returned.  Once the
symbolic link is returned, the kernel will send all other requests
direct to the mounted filesystem.

If a volume is not yet mounted, @i{Amd} consults a configuration
@dfn{mount-map} corresponding to the automount point.  @i{Amd} then
makes a runtime decision on what and where to mount a filesystem based
on the information obtained from the map.

@i{Amd} does not implement all the NFS requests; only those relevant
to name binding such as @dfn{lookup}, @dfn{readlink} and @dfn{readdir}.
Some other calls are also implemented but most simply return an error
code; for example @dfn{mkdir} always returns ``read-only filesystem''.

@node Mounting a Volume, Automatic Unmounting, Operational Principles, Overview
@comment  node-name,  next,  previous,  up
@section Mounting a Volume
@cindex Mounting a volume
@cindex Location lists
@cindex Alternate locations
@cindex Mount retries
@cindex Background mounts

Each automount point has a corresponding mount map.  The mount map
contains a list of key--value pairs.  The key is the name of the volume
to be mounted.  The value is a list of locations describing where the
filesystem is stored in the network.  In the source for the map the
value would look like

@display
location1  location2  @dots{}  locationN
@end display

@i{Amd} examines each location in turn.  Each location may contain
@dfn{selectors} which control whether @i{Amd} can use that location.
For example, the location may be restricted to use by certain hosts.
Those locations which cannot be used are ignored.

@i{Amd} attempts to mount the filesystem described by each remaining
location until a mount succeeds or @i{Amd} can no longer proceed.  The
latter can occur in three ways:

@itemize @bullet
@item
If none of the locations could be used, or if all of the locations
caused an error, then the last error is returned.

@item
If a location could be used but was being mounted in the background then
@i{Amd} marks that mount as being ``in progress'' and continues with
the next request; no reply is sent to the kernel.

@item
Lastly, one or more of the mounts may have been @dfn{deferred}.  A mount
is deferred if extra information is required before the mount can
proceed.  When the information becomes available the mount will take
place, but in the mean time no reply is sent to the kernel.  If the
mount is deferred, @i{Amd} continues to try any remaining locations.
@end itemize

Once a volume has been mounted, @i{Amd} establishes a @dfn{volume
mapping} which is used to satisfy subsequent requests.@refill

@node Automatic Unmounting, Keep-alives, Mounting a Volume, Overview
@comment  node-name,  next,  previous,  up
@section Automatic Unmounting

To avoid an ever increasing number of filesystem mounts, @i{Amd} removes
volume mappings which have not been used recently.  A time-to-live
interval is associated with each mapping and when that expires the
mapping is removed.  When the last reference to a filesystem is removed,
that filesystem is unmounted.  If the unmount fails, for example the
filesystem is still busy, the mapping is re-instated and its
time-to-live interval is extended.  The global default for this grace
period is controlled by the @code{-w} command-line option (@pxref{-w
Option, -w}) or the @i{amd.conf} parameter @samp{dismount_interval}
(@pxref{dismount_interval Parameter}).  It is also possible to set this
value on a per-mount basis (@pxref{opts Option, opts, opts}).

Filesystems can be forcefully timed out using the @i{Amq} command.
@xref{Run-time Administration}.  Note that on new enough systems that
support forced unmounts, such as Linux, @i{Amd} can try to use the
@b{umount2}(2) system call to force the unmount, if the regular
@b{umount}(2) system call failed in a way that indicates that the
mount point is hung or stale.  @xref{forced_unmounts Parameter}.

@node Keep-alives, Non-blocking Operation, Automatic Unmounting, Overview
@comment  node-name,  next,  previous,  up
@section Keep-alives
@cindex Keep-alives
@cindex Server crashes
@cindex NFS ping

Use of some filesystem types requires the presence of a server on
another machine.  If a machine crashes then it is of no concern to
processes on that machine that the filesystem is unavailable.  However,
to processes on a remote host using that machine as a fileserver this
event is important.  This situation is most widely recognized when an
NFS server crashes and the behavior observed on client machines is that
more and more processes hang.  In order to provide the possibility of
recovery, @i{Amd} implements a @dfn{keep-alive} interval timer for some
filesystem types.  Currently only NFS makes use of this service.

The basis of the NFS keep-alive implementation is the observation that
most sites maintain replicated copies of common system data such as
manual pages, most or all programs, system source code and so on.  If
one of those servers goes down it would be reasonable to mount one of
the others as a replacement.

The first part of the process is to keep track of which fileservers are
up and which are down.  @i{Amd} does this by sending RPC requests to the
servers' NFS @code{NullProc} and checking whether a reply is returned.
While the server state is uncertain the requests are re-transmitted at
three second intervals and if no reply is received after four attempts
the server is marked down.  If a reply is received the fileserver is
marked up and stays in that state for 30 seconds at which time another
NFS ping is sent.  This interval is configurable and can even be
turned off using the @i{ping} option.  @xref{opts Option}.

Once a fileserver is marked down, requests continue to be sent every 30
seconds in order to determine when the fileserver comes back up.  During
this time any reference through @i{Amd} to the filesystems on that
server fail with the error ``Operation would block''.  If a replacement
volume is available then it will be mounted, otherwise the error is
returned to the user.

@c @i{Amd} keeps track of which servers are up and which are down.
@c It does this by sending RPC requests to the servers' NFS {\sc NullProc} and
@c checking whether a reply is returned.  If no replies are received after a
@c short period, @i{Amd} marks the fileserver @dfn{down}.
@c RPC requests continue to be sent so that it will notice when a fileserver
@c comes back up.
@c ICMP echo packets \cite{rfc:icmp} are not used because it is the availability
@c of the NFS service that is important, not the existence of a base kernel.
@c Whenever a reference to a fileserver which is down is made via @i{Amd}, an alternate
@c filesystem is mounted if one is available.
@c
Although this action does not protect user files, which are unique on
the network, or processes which do not access files via @i{Amd} or
already have open files on the hung filesystem, it can prevent most new
processes from hanging.
@c
@c With a suitable combination of filesystem management and mount-maps,
@c machines can be protected against most server downtime.  This can be
@c enhanced by allocating boot-servers dynamically which allows a diskless
@c workstation to be quickly restarted if necessary.  Once the root filesystem
@c is mounted, @i{Amd} can be started and allowed to mount the remainder of
@c the filesystem from whichever fileservers are available.

@node Non-blocking Operation, , Keep-alives, Overview
@comment  node-name,  next,  previous,  up
@section Non-blocking Operation
@cindex Non-blocking operation
@cindex Multiple-threaded server
@cindex RPC retries

Since there is only one instance of @i{Amd} for each automount point,
and usually only one instance on each machine, it is important that it
is always available to service kernel calls.  @i{Amd} goes to great
lengths to ensure that it does not block in a system call.  As a last
resort @i{Amd} will fork before it attempts a system call that may block
indefinitely, such as mounting an NFS filesystem.  Other tasks such as
obtaining filehandle information for an NFS filesystem, are done using a
purpose built non-blocking RPC library which is integrated with
@i{Amd}'s task scheduler.  This library is also used to implement NFS
keep-alives (@pxref{Keep-alives}).

Whenever a mount is deferred or backgrounded, @i{Amd} must wait for it
to complete before replying to the kernel.  However, this would cause
@i{Amd} to block waiting for a reply to be constructed.  Rather than do
this, @i{Amd} simply @dfn{drops} the call under the assumption that the
kernel RPC mechanism will automatically retry the request.

@c ################################################################
@node Supported Platforms, Mount Maps, Overview, Top
@comment  node-name,  next,  previous,  up
@chapter Supported Platforms
@cindex Supported Platforms
@cindex shared libraries
@cindex NFS V.3 support

@i{Am-utils} has been ported to a wide variety of machines and operating
systems.  @i{Am-utils}'s code works for little-endian and big-endian
machines, as well as 32 bit and 64 bit architectures.  Furthermore, when
@i{Am-utils} ports to an Operating System on one architecture, it is generally
readily portable to the same Operating System on all platforms on which
it is available.

See the @file{INSTALL} in the distribution for more specific details on
building and/or configuring for some systems.

@c ################################################################
@node Mount Maps, Amd Command Line Options, Supported Platforms, Top
@comment  node-name,  next,  previous,  up
@chapter Mount Maps
@cindex Mount maps
@cindex Automounter configuration maps
@cindex Mount information

@i{Amd} has no built-in knowledge of machines or filesystems.
External @dfn{mount-maps} are used to provide the required information.
Specifically, @i{Amd} needs to know when and under what conditions it
should mount filesystems.

The map entry corresponding to the requested name contains a list of
possible locations from which to resolve the request.  Each location
specifies filesystem type, information required by that filesystem (for
example the block special device in the case of UFS), and some
information describing where to mount the filesystem (@pxref{fs Option}).  A
location may also contain @dfn{selectors} (@pxref{Selectors}).@refill

@menu
* Map Types::
* Key Lookup::
* Location Format::
@end menu

@node Map Types, Key Lookup, Mount Maps, Mount Maps
@comment  node-name,  next,  previous,  up
@section Map Types
@cindex Mount map types
@cindex Map types
@cindex Configuration map types
@cindex Types of mount map
@cindex Types of configuration map
@cindex Determining the map type

A mount-map provides the run-time configuration information to @i{Amd}.
Maps can be implemented in many ways.  Some of the forms supported by
@i{Amd} are regular files, ndbm databases, NIS maps, the @dfn{Hesiod}
name server, and even the password file.

A mount-map @dfn{name} is a sequence of characters.  When an automount
point is created a handle on the mount-map is obtained.  For each map
type configured, @i{Amd} attempts to reference the map of the
appropriate type.  If a map is found, @i{Amd} notes the type for future
use and deletes the reference, for example closing any open file
descriptors.  The available maps are configured when @i{Amd} is built
and can be displayed by running the command @samp{amd -v}.

When using an @i{Amd} configuration file (@pxref{Amd Configuration File})
and the keyword @samp{map_type} (@pxref{map_type Parameter}), you may
force the map used to any type.

By default, @i{Amd} caches data in a mode dependent on the type of map.
This is the same as specifying @samp{cache:=mapdefault} and selects a
suitable default cache mode depending on the map type.  The individual
defaults are described below.  The @var{cache} option can be specified
on automount points to alter the caching behavior (@pxref{Automount
Filesystem}).@refill

The following map types have been implemented, though some are not
available on all machines.  Run the command @samp{amd -v} to obtain a
list of map types configured on your machine.

@menu
* File maps::
* ndbm maps::
* NIS maps::
* NIS+ maps::
* Hesiod maps::
* Password maps::
* Union maps::
* LDAP maps::
* Executable maps::
@end menu

@c ----------------------------------------------------------------
@node File maps, ndbm maps, Map Types, Map Types
@comment  node-name,  next,  previous,  up
@subsection File maps
@cindex File maps
@cindex Flat file maps
@cindex File map syntactic conventions

When @i{Amd} searches a file for a map entry it does a simple scan of
the file and supports both comments and continuation lines.

Continuation lines are indicated by a backslash character (@samp{\}) as
the last character of a line in the file.  The backslash, newline character
@emph{and any leading white space on the following line} are discarded.  A maximum
line length of 2047 characters is enforced after continuation lines are read
but before comments are stripped.  Each line must end with
a newline character; that is newlines are terminators, not separators.
The following examples illustrate this:

@example
key     valA   valB;   \
          valC
@end example

specifies @emph{three} locations, and is identical to

@example
key     valA   valB;   valC
@end example

However,

@example
key     valA   valB;\
          valC
@end example

specifies only @emph{two} locations, and is identical to

@example
key     valA   valB;valC
@end example

After a complete line has been read from the file, including
continuations, @i{Amd} determines whether there is a comment on the
line.  A comment begins with a hash (``@samp{#}'') character and
continues to the end of the line.  There is no way to escape or change
the comment lead-in character.

Note that continuation lines and comment support @dfn{only} apply to
file maps, or ndbm maps built with the @code{mk-amd-map} program.

When caching is enabled, file maps have a default cache mode of
@code{all} (@pxref{Automount Filesystem}).

@c ----------------------------------------------------------------
@node ndbm maps, NIS maps, File maps, Map Types
@comment  node-name,  next,  previous,  up
@subsection ndbm maps
@cindex ndbm maps

An ndbm map may be used as a fast access form of a file map.  The program,
@code{mk-amd-map}, converts a normal map file into an ndbm database.
This program supports the same continuation and comment conventions that
are provided for file maps.  Note that ndbm format files may @emph{not}
be sharable across machine architectures.  The notion of speed generally
only applies to large maps; a small map, less than a single disk block,
is almost certainly better implemented as a file map.

ndbm maps have a default cache mode of @samp{all}
(@pxref{Automount Filesystem}).

@c ----------------------------------------------------------------
@node NIS maps, NIS+ maps, ndbm maps, Map Types
@comment  node-name,  next,  previous,  up
@subsection NIS maps
@cindex NIS (YP) maps

When using NIS (formerly YP), an @i{Amd} map is implemented directly
by the underlying NIS map.  Comments and continuation lines are
@emph{not} supported in the automounter and must be stripped when
constructing the NIS server's database.

NIS maps have a default cache mode of @code{all} (@pxref{Automount
Filesystem}).

The following rule illustrates what could be added to your NIS @file{Makefile},
in this case causing the @file{amd.home} map to be rebuilt:
@example
$(YPTSDIR)/amd.home.time: $(ETCDIR)/amd.home
    -@@sed -e "s/#.*$$//" -e "/^$$/d" $(ETCDIR)/amd.home | \
      awk '@{  \
         for (i = 1; i <= NF; i++) \
             if (i == NF) @{ \
             if (substr($$i, length($$i), 1) == "\\") \
                 printf("%s", substr($$i, 1, length($$i) - 1)); \
             else \
                 printf("%s\n", $$i); \
             @} \
             else \
             printf("%s ", $$i); \
         @}' | \
    $(MAKEDBM) - $(YPDBDIR)/amd.home; \
    touch $(YPTSDIR)/amd.home.time; \
    echo "updated amd.home"; \
    if [ ! $(NOPUSH) ]; then \
        $(YPPUSH) amd.home; \
        echo "pushed amd.home"; \
    else \
        : ; \
    fi
@end example

Here @code{$(YPTSDIR)} contains the time stamp files, and
@code{$(YPDBDIR)} contains the dbm format NIS files.

@c ----------------------------------------------------------------
@node NIS+ maps, Hesiod maps, NIS maps, Map Types
@comment  node-name,  next,  previous,  up
@subsection NIS+ maps
@cindex NIS+ maps

NIS+ maps do not support cache mode @samp{all} and, when caching is
enabled, have a default cache mode of @samp{inc}.

XXX: FILL IN WITH AN EXAMPLE.

@c ----------------------------------------------------------------
@node Hesiod maps, Password maps, NIS+ maps, Map Types
@comment  node-name,  next,  previous,  up
@subsection Hesiod maps
@cindex Hesiod maps

When the map name begins with the string @samp{hesiod.} lookups are made
using the @dfn{Hesiod} name server.  The string following the dot is
used as a name qualifier and is prepended with the key being located.
The entire string is then resolved in the @code{automount} context, or
the @i{amd.conf} parameter @samp{hesiod_base} (@pxref{hesiod_base
Parameter}).  For example, if the key is @samp{jsp} and map name is
@samp{hesiod.homes} then @dfn{Hesiod} is asked to resolve
@samp{jsp.homes.automount}.

Hesiod maps do not support cache mode @samp{all} and, when caching is
enabled, have a default cache mode of @samp{inc} (@pxref{Automount
Filesystem}).

The following is an example of a @dfn{Hesiod} map entry:

@example
jsp.homes.automount HS TXT "rfs:=/home/charm;rhost:=charm;sublink:=jsp"
njw.homes.automount HS TXT "rfs:=/home/dylan/dk2;rhost:=dylan;sublink:=njw"
@end example

@c ----------------------------------------------------------------
@node Password maps, Union maps, Hesiod maps, Map Types
@comment  node-name,  next,  previous,  up
@subsection Password maps
@cindex Password file maps
@cindex /etc/passwd maps
@cindex User maps, automatic generation
@cindex Automatic generation of user maps
@cindex Using the password file as a map

The password map support is unlike the four previous map types.  When
the map name is the string @file{/etc/passwd} @i{Amd} can lookup a user
name in the password file and re-arrange the home directory field to
produce a usable map entry.

@i{Amd} assumes the home directory has the format
`@t{/}@i{anydir}@t{/}@i{dom1}@t{/../}@i{domN}@t{/}@i{login}'.
@c @footnote{This interpretation is not necessarily exactly what you want.}
It breaks this string into a map entry where @code{$@{rfs@}} has the
value `@t{/}@i{anydir}@t{/}@i{domN}', @code{$@{rhost@}} has the value
`@i{domN}@t{.}@i{...}@t{.}@i{dom1}', and @code{$@{sublink@}} has the
value @i{login}.@refill

Thus if the password file entry was

@example
/home/achilles/jsp
@end example

the map entry used by @i{Amd} would be

@example
rfs:=/home/achilles;rhost:=achilles;sublink:=jsp
@end example

Similarly, if the password file entry was

@example
/home/cc/sugar/mjh
@end example

the map entry used by @i{Amd} would be

@example
rfs:=/home/sugar;rhost:=sugar.cc;sublink:=mhj
@end example

@c ----------------------------------------------------------------
@node Union maps, LDAP maps, Password maps, Map Types
@comment  node-name,  next,  previous,  up
@subsection Union maps
@cindex Union file maps

The union map support is provided specifically for use with the union
filesystem, @pxref{Union Filesystem}.

It is identified by the string @samp{union:} which is followed by a
colon separated list of directories.  The directories are read in order,
and the names of all entries are recorded in the map cache.  Later
directories take precedence over earlier ones.  The union filesystem
type then uses the map cache to determine the union of the names in all
the directories.

@c ----------------------------------------------------------------
@node LDAP maps, Executable maps, Union maps, Map Types
@comment  node-name,  next,  previous,  up
@subsection LDAP maps
@cindex LDAP maps
@cindex Lightweight Directory Access Protocol

LDAP (Lightweight Directory Access Protocol) maps do not support cache
mode @samp{all} and, when caching is enabled, have a default cache mode
of @samp{inc}.

For example, an @i{Amd} map @samp{amd.home} that looks as follows:

@example
/defaults    opts:=rw,intr;type:=link

zing         -rhost:=shekel \
             host==shekel \
             host!=shekel;type:=nfs
@end example
@noindent
when converted to LDAP (@pxref{amd2ldif}), will result in the following
LDAP database:
@example
$ amd2ldif amd.home CUCS < amd.home
dn: cn=amdmap timestamp, CUCS
cn             : amdmap timestamp
objectClass    : amdmapTimestamp
amdmapTimestamp: 873071363

dn: cn=amdmap amd.home[/defaults], CUCS
cn          : amdmap amd.home[/defaults]
objectClass : amdmap
amdmapName  : amd.home
amdmapKey   : /defaults
amdmapValue : opts:=rw,intr;type:=link

dn: cn=amdmap amd.home[], CUCS
cn          : amdmap amd.home[]
objectClass : amdmap
amdmapName  : amd.home
amdmapKey   :
amdmapValue :

dn: cn=amdmap amd.home[zing], CUCS
cn          : amdmap amd.home[zing]
objectClass : amdmap
amdmapName  : amd.home
amdmapKey   : zing
amdmapValue : -rhost:=shekel host==shekel host!=shekel;type:=nfs
@end example

@c ----------------------------------------------------------------
@node Executable maps, , LDAP maps, Map Types
@comment  node-name,  next,  previous,  up
@subsection Executable maps
@cindex Executable maps

An executable map is a dynamic map in which the keys and values for
the maps are generated on the fly by a program or script.  The program
is expected to take a single parameter argument which is the key to
lookup.  If the key is found, the program should print on stdout the
key-value pair that were found; if the key was not found, nothing
should be printed out.  Below is an sample of such a map script:

@example
#!/bin/sh
# executable map example
case "$1" in
    "/defaults" )
	echo "/defaults   type:=nfs;rfs:=filer"
	;;
    "a" )
	echo "a   type:=nfs;fs:=/tmp"
	;;
    "b" )
	echo "b   type:=link;fs:=/usr/local"
	;;
    * )  # no match, echo nothing
	;;
esac
@end example

@xref{exec_map_timeout Parameter}.

@c ----------------------------------------------------------------
@c subsection Gdbm
@c ----------------------------------------------------------------
@node Key Lookup, Location Format, Map Types, Mount Maps
@comment  node-name,  next,  previous,  up
@section How keys are looked up
@cindex Key lookup
@cindex Map lookup
@cindex Looking up keys
@cindex How keys are looked up
@cindex Wildcards in maps

The key is located in the map whose type was determined when the
automount point was first created.  In general the key is a pathname
component.  In some circumstances this may be modified by variable
expansion (@pxref{Variable Expansion}) and prefixing.  If the automount
point has a prefix, specified by the @var{pref} option, then that is
prepended to the search key before the map is searched.

If the map cache is a @samp{regexp} cache then the key is treated as an
egrep-style regular expression, otherwise a normal string comparison is
made.

If the key cannot be found then a @dfn{wildcard} match is attempted.
@i{Amd} repeatedly strips the basename from the key, appends @samp{/*} and
attempts a lookup.  Finally, @i{Amd} attempts to locate the special key @samp{*}.

For example, the following sequence would be checked if @file{home/dylan/dk2} was
being located:

@example
   home/dylan/dk2
   home/dylan/*
   home/*
   *
@end example

At any point when a wildcard is found, @i{Amd} proceeds as if an exact
match had been found and the value field is then used to resolve the
mount request, otherwise an error code is propagated back to the kernel.
(@pxref{Filesystem Types}).@refill

@node Location Format, , Key Lookup, Mount Maps
@comment  node-name,  next,  previous,  up
@section Location Format
@cindex Location format
@cindex Map entry format
@cindex How locations are parsed

The value field from the lookup provides the information required to
mount a filesystem.  The information is parsed according to the syntax
shown below.

@display
@i{location-list}:
                  @i{location-selection}
                  @i{location-list} @i{white-space} @t{||} @i{white-space} @i{location-selection}
@i{location-selection}:
                  @i{location}
                  @i{location-selection} @i{white-space} @i{location}
@i{location}:
                  @i{location-info}
                  @t{-}@i{location-info}
                  @t{-}
@i{location-info}:
                  @i{sel-or-opt}
                  @i{location-info}@t{;}@i{sel-or-opt}
                  @t{;}
@i{sel-or-opt}:
                  @i{selection}
                  @i{opt-ass}
@i{selection}:
                  selector@t{==}@i{value}
                  selector@t{!=}@i{value}
@i{opt-ass}:
                  option@t{:=}@i{value}
@i{white-space}:
                  space
                  tab
@end display

Note that unquoted whitespace is not allowed in a location description.
White space is only allowed, and is mandatory, where shown with non-terminal
@i{white-space}.

A @dfn{location-selection} is a list of possible volumes with which to
satisfy the request.  Each @dfn{location-selection} is tried
sequentially, until either one succeeds or all fail.  This, by the
way, is different from the historically documented behavior, which
claimed (falsely, at least for last 3 years) that @i{Amd} would
attempt to mount all @dfn{location-selection}s in parallel and the
first one to succeed would be used.

@dfn{location-selection}s are optionally separated by the @samp{||}
operator.  The effect of this operator is to prevent use of
location-selections to its right if any of the location-selections on
its left were selected, whether or not any of them were successfully
mounted (@pxref{Selectors}).@refill

The location-selection, and singleton @dfn{location-list},
@samp{type:=ufs;dev:=/dev/xd1g} would inform @i{Amd} to mount a UFS
filesystem from the block special device @file{/dev/xd1g}.

The @dfn{sel-or-opt} component is either the name of an option required
by a specific filesystem, or it is the name of a built-in, predefined
selector such as the architecture type.  The value may be quoted with
double quotes @samp{"}, for example
@samp{type:="ufs";dev:="/dev/xd1g"}.  These quotes are stripped when the
value is parsed and there is no way to get a double quote into a value
field.  Double quotes are used to get white space into a value field,
which is needed for the program filesystem (@pxref{Program Filesystem}).@refill

@menu
* Map Defaults::
* Variable Expansion::
* Selectors::
* Map Options::
@end menu

@node Map Defaults, Variable Expansion, Location Format, Location Format
@comment  node-name,  next,  previous,  up
@subsection Map Defaults
@cindex Map defaults
@cindex How to set default map parameters
@cindex Setting default map parameters

A location beginning with a dash @samp{-} is used to specify default
values for subsequent locations.  Any previously specified defaults in
the location-list are discarded.  The default string can be empty in
which case no defaults apply.

The location @samp{-fs:=/mnt;opts:=ro} would set the local mount point
to @file{/mnt} and cause mounts to be read-only by default.  Defaults
specified this way are appended to, and so override, any global map
defaults given with @samp{/defaults}).

@c
@c A @samp{/defaults} value @dfn{gdef} and a location list
@c \begin{quote}
@c $@samp{-}@dfn{def}_a $\verb*+ +$ @dfn{loc}_{a_1} $\verb*+ +$ @dfn{loc}_{a_2} $\verb*+ +$ @samp{-}@dfn{def}_b $\verb*+ +$ @dfn{loc}_{b_1} \ldots$
@c \end{quote}
@c is equivalent to
@c \begin{quote}
@c $@samp{-}@dfn{gdef}@samp{;}@dfn{def}_a $\verb*+ +$ @dfn{loc}_{a_1} $\verb*+ +$ @dfn{loc}_{a_2} $\verb*+ +$ @samp{-}@dfn{gdef}@samp{;}@dfn{def}_b $\verb*+ +$ @dfn{loc}_{b_1} \ldots$
@c \end{quote}
@c which is equivalent to
@c \begin{quote}
@c $@dfn{gdef}@samp{;}@dfn{def}_a@samp{;}@dfn{loc}_{a_1} $\verb*+ +$@dfn{gdef}@samp{;}@dfn{def}_a@samp{;}@dfn{loc}_{a_2} $\verb*+ +$@dfn{gdef}@samp{;}@dfn{def}_b@samp{;}@dfn{loc}_{b_1} \ldots$
@c \end{quote}

@node Variable Expansion, Selectors, Map Defaults, Location Format
@comment  node-name,  next,  previous,  up
@subsection Variable Expansion
@cindex Variable expansion
@cindex How variables are expanded
@cindex Pathname operators
@cindex Domain stripping
@cindex Domainname operators
@cindex Stripping the local domain name
@cindex Environment variables
@cindex How to access environment variables in maps

To allow generic location specifications @i{Amd} does variable expansion
on each location and also on some of the option strings.  Any option or
selector appearing in the form @code{$@dfn{var}} is replaced by the
current value of that option or selector.  For example, if the value of
@code{$@{key@}} was @samp{bin}, @code{$@{autodir@}} was @samp{/a} and
@code{$@{fs@}} was `@t{$@{autodir@}}@t{/local/}@t{$@{key@}}' then
after expansion @code{$@{fs@}} would have the value @samp{/a/local/bin}.
Any environment variable can be accessed in a similar way.@refill

Two pathname operators are available when expanding a variable.  If the
variable name begins with @samp{/} then only the last component of the
pathname is substituted.  For example, if @code{$@{path@}} was
@samp{/foo/bar} then @code{$@{/path@}} would be expanded to @samp{bar}.
Similarly, if the variable name ends with @samp{/} then all but the last
component of the pathname is substituted.  In the previous example,
@code{$@{path/@}} would be expanded to @samp{/foo}.@refill

Two domain name operators are also provided.  If the variable name
begins with @samp{.} then only the domain part of the name is
substituted.  For example, if @code{$@{rhost@}} was
@samp{swan.doc.ic.ac.uk} then @code{$@{.rhost@}} would be expanded to
@samp{doc.ic.ac.uk}.  Similarly, if the variable name ends with @samp{.}
then only the host component is substituted.  In the previous example,
@code{$@{rhost.@}} would be expanded to @samp{swan}.@refill

Variable expansion is a two phase process.  Before a location is parsed,
all references to selectors, @i{eg} @code{$@{path@}}, are expanded.  The
location is then parsed, selections are evaluated and option assignments
recorded.  If there were no selections or they all succeeded the
location is used and the values of the following options are expanded in
the order given: @var{sublink}, @var{rfs}, @var{fs}, @var{opts},
@var{remopts}, @var{mount} and @var{unmount}.

Note that expansion of option values is done after @dfn{all} assignments
have been completed and not in a purely left to right order as is done
by the shell.  This generally has the desired effect but care must be
taken if one of the options references another, in which case the
ordering can become significant.

There are two special cases concerning variable expansion:

@enumerate
@item
before a map is consulted, any selectors in the name received
from the kernel are expanded.  For example, if the request from the
kernel was for `@t{$@{arch@}}@t{.bin}' and the machine architecture
was @samp{vax}, the value given to @code{$@{key@}} would be
@samp{vax.bin}.@refill

@item
the value of @code{$@{rhost@}} is expanded and normalized before the
other options are expanded.  The normalization process strips any local
sub-domain components.  For example, if @code{$@{domain@}} was
@samp{Berkeley.EDU} and @code{$@{rhost@}} was initially
@samp{snow.Berkeley.EDU}, after the normalization it would simply be
@samp{snow}.  Hostname normalization is currently done in a
@emph{case-dependent} manner.@refill
@end enumerate

@c======================================================================
@node Selectors, Map Options, Variable Expansion, Location Format
@comment  node-name,  next,  previous,  up
@subsection Selectors
@cindex Selectors

Selectors are used to control the use of a location.  It is possible to
share a mount map between many machines in such a way that filesystem
location, architecture and operating system differences are hidden from
the users.  A selector of the form @samp{arch==sun3;os==sunos4} would only
apply on Sun-3s running SunOS 4.x.

Selectors can be negated by using @samp{!=} instead of @samp{==}.  For
example to select a location on all non-Vax machines the selector
@samp{arch!=vax} would be used.

Selectors are evaluated left to right.  If a selector fails then that
location is ignored.  Thus the selectors form a conjunction and the
locations form a disjunction.  If all the locations are ignored or
otherwise fail then @i{Amd} uses the @dfn{error} filesystem
(@pxref{Error Filesystem}).  This is equivalent to having a location
@samp{type:=error} at the end of each mount-map entry.@refill

The default value of many of the selectors listed here can be overridden
by an @i{Amd} command line switch or in an @i{Amd} configuration file.
@xref{Amd Configuration File}.

The following selectors are currently implemented.

@menu
* arch Selector Variable::
* autodir Selector Variable::
* byte Selector Variable::
* cluster Selector Variable::
* domain Selector Variable::
* dollar Selector Variable::
* host Selector Variable::
* hostd Selector Variable::
* karch Selector Variable::
* os Selector Variable::
* osver Selector Variable::
* full_os Selector Variable::
* vendor Selector Variable::

* key Selector Variable::
* map Selector Variable::
* netnumber Selector Variable::
* network Selector Variable::
* path Selector Variable::
* wire Selector Variable::
* uid Selector Variable::
* gid Selector Variable::

* exists Selector Function::
* false Selector Function::
* netgrp Selector Function::
* netgrpd Selector Function::
* in_network Selector Function::
* true Selector Function::
* xhost Selector Function::
@end menu

@c ----------------------------------------------------------------
@node arch Selector Variable, autodir Selector Variable, Selectors, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection arch Selector Variable
@cindex arch Selector Variable
@cindex arch, mount selector
@cindex Mount selector; arch
@cindex Selector; arch

The machine architecture which was automatically determined at compile
time.  The architecture type can be displayed by running the command
@samp{amd -v}.  You can override this value also using the @code{-A}
command line option.  @xref{Supported Platforms}.@refill

@c ----------------------------------------------------------------
@node autodir Selector Variable, byte Selector Variable, arch Selector Variable, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection autodir Selector Variable
@cindex autodir Selector Variable
@cindex autodir, mount selector
@cindex Mount selector; autodir
@cindex Selector; autodir

The default directory under which to mount filesystems.  This may be
changed by the @code{-a} command line option.  @xref{fs Option}.

@c ----------------------------------------------------------------
@node byte Selector Variable, cluster Selector Variable, autodir Selector Variable, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection byte Selector Variable
@cindex byte Selector Variable
@cindex byte, mount selector
@cindex Mount selector; byte
@cindex Selector; byte

The machine's byte ordering.  This is either @samp{little}, indicating
little-endian, or @samp{big}, indicating big-endian.  One possible use
is to share @samp{rwho} databases (@pxref{rwho servers}).  Another is to
share ndbm databases, however this use can be considered a courageous
juggling act.

@c ----------------------------------------------------------------
@node cluster Selector Variable, domain Selector Variable, byte Selector Variable, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection cluster Selector Variable
@cindex cluster Selector Variable
@cindex cluster, mount selector
@cindex Mount selector; cluster
@cindex Selector; cluster

This is provided as a hook for the name of the local cluster.  This can
be used to decide which servers to use for copies of replicated
filesystems.  @code{$@{cluster@}} defaults to the value of
@code{$@{domain@}} unless a different value is set with the @code{-C}
command line option.

@c ----------------------------------------------------------------
@node domain Selector Variable, dollar Selector Variable, cluster Selector Variable, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection domain Selector Variable
@cindex domain Selector Variable
@cindex domain, mount selector
@cindex Mount selector; domain
@cindex Selector; domain

The local domain name as specified by the @code{-d} command line option.
@xref{host Selector Variable}.

@c ----------------------------------------------------------------
@node dollar Selector Variable, host Selector Variable, domain Selector Variable, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection dollar Selector Variable
@cindex dollar Selector Variable

This is a special variable, whose sole purpose is to produce a literal
dollar sign in the value of another variable.  For example, if you have
a remote file system whose name is @samp{/disk$s}, you can mount it by
setting the remote file system variable as follows:

@example
rfs:=/disk$@{dollar@}s
@end example

@c ----------------------------------------------------------------
@node host Selector Variable, hostd Selector Variable, dollar Selector Variable, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection host Selector Variable
@cindex host Selector Variable
@cindex host, mount selector
@cindex Mount selector; host
@cindex Selector; host

The local hostname as determined by @b{gethostname}(2).  If no domain
name was specified on the command line and the hostname contains a
period @samp{.} then the string before the period is used as the host
name, and the string after the period is assigned to @code{$@{domain@}}.
For example, if the hostname is @samp{styx.doc.ic.ac.uk} then
@code{host} would be @samp{styx} and @code{domain} would be
@samp{doc.ic.ac.uk}.  @code{hostd} would be
@samp{styx.doc.ic.ac.uk}.@refill

@c ----------------------------------------------------------------
@node hostd Selector Variable, karch Selector Variable, host Selector Variable, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection hostd Selector Variable
@cindex hostd Selector Variable
@cindex hostd, mount selector
@cindex Mount selector; hostd
@cindex Selector; hostd

This resolves to the @code{$@{host@}} and @code{$@{domain@}}
concatenated with a @samp{.} inserted between them if required.  If
@code{$@{domain@}} is an empty string then @code{$@{host@}} and
@code{$@{hostd@}} will be identical.

@c ----------------------------------------------------------------
@node karch Selector Variable, os Selector Variable, hostd Selector Variable, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection karch Selector Variable
@cindex karch Selector Variable
@cindex karch, mount selector
@cindex Mount selector; karch
@cindex Selector; karch

This is provided as a hook for the kernel architecture.  This is used on
SunOS 4 and SunOS 5, for example, to distinguish between different
@samp{/usr/kvm} volumes.  @code{$@{karch@}} defaults to the ``machine''
value gotten from @b{uname}(2).  If the @b{uname}(2) system call is not
available, the value of @code{$@{karch@}} defaults to that of
@code{$@{arch@}}.  Finally, a different value can be set with the @code{-k}
command line option.

@c ----------------------------------------------------------------
@node os Selector Variable, osver Selector Variable, karch Selector Variable, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection os Selector Variable
@cindex os Selector Variable
@cindex os, mount selector
@cindex Mount selector; os
@cindex Selector; os

The operating system.  Like the machine architecture, this is
automatically determined at compile time.  The operating system name can
be displayed by running the command @samp{amd -v}.  @xref{Supported
Platforms}.@refill

@c ----------------------------------------------------------------
@node osver Selector Variable, full_os Selector Variable, os Selector Variable, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection osver Selector Variable
@cindex osver Selector Variable
@cindex osver, mount selector
@cindex Mount selector; osver
@cindex Selector; osver

The operating system version.  Like the machine architecture, this is
automatically determined at compile time.  The operating system name can
be displayed by running the command @samp{amd -v}.  @xref{Supported
Platforms}.@refill

@c ----------------------------------------------------------------
@node full_os Selector Variable, vendor Selector Variable, osver Selector Variable, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection full_os Selector Variable
@cindex full_os Selector Variable
@cindex full_os, mount selector
@cindex Mount selector; full_os
@cindex Selector; full_os

The full name of the operating system, including its version.  This
value is automatically determined at compile time.  The full operating
system name and version can be displayed by running the command
@samp{amd -v}.  @xref{Supported Platforms}.@refill

@c ----------------------------------------------------------------
@node vendor Selector Variable, key Selector Variable, full_os Selector Variable, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection vendor Selector Variable
@cindex vendor Selector Variable
@cindex vendor, mount selector
@cindex Mount selector; vendor
@cindex Selector; vendor

The name of the vendor of the operating system.  This value is
automatically determined at compile time.  The name of the vendor can be
displayed by running the command @samp{amd -v}.  @xref{Supported
Platforms}.@refill


@c ----------------------------------------------------------------
@ifhtml
<HR>
@end ifhtml
@sp 3
The following selectors are also provided.  Unlike the other selectors,
they vary for each lookup.  Note that when the name from the kernel is
expanded prior to a map lookup, these selectors are all defined as empty
strings.

@c ----------------------------------------------------------------
@node key Selector Variable, map Selector Variable, vendor Selector Variable, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection key Selector Variable
@cindex key Selector Variable
@cindex key, mount selector
@cindex Mount selector; key
@cindex Selector; key

The name being resolved.  For example, if @file{/home} is an automount
point, then accessing @file{/home/foo} would set @code{$@{key@}} to the
string @samp{foo}.  The key is prefixed by the @var{pref} option set in
the parent mount point.  The default prefix is an empty string.  If the
prefix was @file{blah/} then @code{$@{key@}} would be set to
@file{blah/foo}.@refill

@c ----------------------------------------------------------------
@node map Selector Variable, netnumber Selector Variable, key Selector Variable, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection map Selector Variable
@cindex map Selector Variable
@cindex map, mount selector
@cindex Mount selector; map
@cindex Selector; map

The name of the mount map being used.

@c ----------------------------------------------------------------
@node netnumber Selector Variable, network Selector Variable, map Selector Variable, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection netnumber Selector Variable
@cindex netnumber Selector Variable
@cindex netnumber, mount selector
@cindex Mount selector; netnumber
@cindex Selector; netnumber

This selector is identical to the @samp{in_network} selector function,
see @ref{in_network Selector Function}.  It will match either the name
or number of @i{any} network interface on which this host is connected
to.  The names and numbers of all attached interfaces are available from
the output of @samp{amd -v}.

@c ----------------------------------------------------------------
@node network Selector Variable, path Selector Variable, netnumber Selector Variable, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection network Selector Variable
@cindex network Selector Variable
@cindex network, mount selector
@cindex Mount selector; network
@cindex Selector; network

This selector is identical to the @samp{in_network} selector function,
see @ref{in_network Selector Function}.  It will match either the name
or number of @i{any} network interface on which this host is connected
to.  The names and numbers of all attached interfaces are available from
the output of @samp{amd -v}.

@c ----------------------------------------------------------------
@node path Selector Variable, wire Selector Variable, network Selector Variable, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection path Selector Variable
@cindex path Selector Variable
@cindex path, mount selector
@cindex Mount selector; path
@cindex Selector; path

The full pathname of the name being resolved.  For example
@file{/home/foo} in the example above.

@c ----------------------------------------------------------------
@node wire Selector Variable, uid Selector Variable, path Selector Variable, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection wire Selector Variable
@cindex wire Selector Variable
@cindex wire, mount selector
@cindex Mount selector; wire
@cindex Selector; wire

This selector is identical to the @samp{in_network} selector function,
see @ref{in_network Selector Function}.  It will match either the name
or number of @i{any} network interface on which this host is connected
to.  The names and numbers of all attached interfaces are available from
the output of @samp{amd -v}.

@c ----------------------------------------------------------------
@node uid Selector Variable, gid Selector Variable, wire Selector Variable, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection uid Selector Variable
@cindex uid Selector Variable
@cindex uid, mount selector
@cindex Mount selector; uid
@cindex Selector; uid

This selector provides the numeric effective user ID (UID) of the user
which last accessed an automounted path name.  This simple example shows
how floppy mounting can be assigned only to machine owners:

@example
floppy  -type:=pcfs \
        uid==2301;host==shekel;dev:=/dev/floppy \
        uid==6712;host==titan;dev=/dev/fd0 \
        uid==0;dev:=/dev/fd0c \
        type:=error
@end example

The example allows two machine owners to mount floppies on their
designated workstations, allows the root user to mount on any host, and
otherwise forces an error.

@c ----------------------------------------------------------------
@node gid Selector Variable, exists Selector Function, uid Selector Variable, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection gid Selector Variable
@cindex gid Selector Variable
@cindex gid, mount selector
@cindex Mount selector; gid
@cindex Selector; gid

This selector provides the numeric effective group ID (GID) of the user
which last accessed an automounted path name.

@c ----------------------------------------------------------------
@ifhtml
<HR>
@end ifhtml
@sp 2
The following boolean functions are selectors which take an argument
@i{ARG}.  They return a value of true or false, and thus do not need to
be compared with a value.  Each of these may be negated by prepending
@samp{!} to their name.

@c ----------------------------------------------------------------
@node exists Selector Function, false Selector Function, gid Selector Variable, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection exists Selector Function
@cindex exists Selector Function
@cindex exists, boolean mount selector
@cindex !exists, boolean mount selector
@cindex Mount selector; exists
@cindex Selector; exists

If the file listed by @i{ARG} exists (via @b{lstat}(2)), this function
evaluates to true.  Otherwise it evaluates to false.

@c ----------------------------------------------------------------
@node false Selector Function, netgrp Selector Function, exists Selector Function, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection false Selector Function
@cindex false Selector Function
@cindex false, boolean mount selector
@cindex !false, boolean mount selector
@cindex Mount selector; false
@cindex Selector; false

Always evaluates to false.  @i{ARG} is ignored.

@c ----------------------------------------------------------------
@node netgrp Selector Function, netgrpd Selector Function, false Selector Function, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection netgrp Selector Function
@cindex netgrp Selector Function
@cindex netgrp, boolean mount selector
@cindex !netgrp, boolean mount selector
@cindex Mount selector; netgrp
@cindex Selector; netgrp

The argument @i{ARG} of this selector is a netgroup name followed
optionally by a comma and a host name.  If the host name is not
specified, it defaults to @code{$@{host@}}.  If the host name (short
name) is a member of the netgroup, this selector evaluates to true.
Otherwise it evaluates to false.

For example, suppose you have a netgroup @samp{ppp-hosts}, and for
reasons of performance, these have a local @file{/home} partition,
while all other clients on the faster network can access a shared home
directory.  A common map to use for both might look like the
following:

@example
home/*  netgrp(ppp-hosts);type:=link;fs:=/local/$@{key@} \
        !netgrp(ppp-hosts);type:=nfs;rhost:=serv1;rfs:=/remote/$@{key@}
@end example

A more complex example that takes advantage of the two argument netgrp
mount selector is given in the following scenario.  Suppose one wants
to mount the local scratch space from a each host under
@file{scratch/<hostname>} and some hosts have their scratch space in a
different path than others.  Hosts in the netgroup @samp{apple-hosts}
have their scratch space in the @file{/apple} path, where hosts in the
netgroup @samp{cherry-hosts} have their scratch space in the
@file{/cherry} path.  For hosts that are neither in the
@samp{apple-hosts} or @samp{cherry-hosts} netgroups we want to make a
symlink pointing to nowhere but provide a descriptive error message in
the link destination:

@example
scratch/*	netgrp(apple-hosts,$@{/key@});type:=nfs;rhost:=$@{/key@};\
		    rfs:="/apple" \
		netgrp(cherry-hosts,$@{/key@});type:=nfs;rhost:=$@{/key@};\
		    rfs:="/cherry" \
		type:=link;rfs:="no local partition for $@{/key@}"
@end example

@c ----------------------------------------------------------------
@node netgrpd Selector Function, in_network Selector Function, netgrp Selector Function, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection netgrpd Selector Function
@cindex netgrpd Selector Function
@cindex netgrpd, boolean mount selector
@cindex !netgrpd, boolean mount selector
@cindex Mount selector; netgrpd
@cindex Selector; netgrpd

The argument @i{ARG} of this selector is a netgroup name followed
optionally by a comma and a host name.  If the host name is not
specified, it defaults to @code{$@{hostd@}}.  If the host name
(fully-qualified name) is a member of the netgroup, this selector
evaluates to true.  Otherwise it evaluates to false.

The @samp{netgrpd} function uses fully-qualified host names to match
netgroup names, while the @samp{netgrp} function (@pxref{netgrp
Selector Function}) uses short host names.

@c ----------------------------------------------------------------
@node in_network Selector Function, true Selector Function, netgrpd Selector Function, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection in_network Selector Function
@cindex in_network Selector Function
@cindex in_network, boolean mount selector
@cindex !in_network, boolean mount selector
@cindex Mount selector; in_network
@cindex Selector; in_network

This selector matches against any network name or number with an
optional netmask.  First, if the current host has any network interface that is
locally attached to the network specified in @i{ARG} (either via name or
number), this selector evaluates to true.

Second, @samp{in_network} supports a network/netmask syntax such as
@samp{128.59.16.0/255.255.255.0}, @samp{128.59.16.0/24},
@samp{128.59.16.0/0xffffff00}, or @samp{128.59.16.0/}.  Using the last
form, @i{Amd} will match the specified network number against the
default netmasks of each of the locally attached interfaces.

If the selector does not match, it evaluates to false.

For example, suppose you have two servers that have an exportable
@file{/opt} that smaller clients can NFS mount.  The two servers are
say, @samp{serv1} on network @samp{foo-net.site.com} and @samp{serv2} on
network @samp{123.4.5.0}.  You can write a map to be used by all clients
that will attempt to mount the closest one as follows:

@example
opt in_network(foo-net.site.com);rhost:=serv1;rfs:=/opt \
    in_network(123.4.5.0);rhost:=serv2;rfs:=/opt \
    rhost:=fallback-server
@end example

@c ----------------------------------------------------------------
@node true Selector Function, xhost Selector Function, in_network Selector Function, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection true Selector Function
@cindex true Selector Function
@cindex true, boolean mount selector
@cindex !true, boolean mount selector
@cindex Mount selector; true
@cindex Selector; true

Always evaluates to true.  @i{ARG} is ignored.

@c ----------------------------------------------------------------
@node xhost Selector Function, , true Selector Function, Selectors
@comment  node-name,  next,  previous,  up
@subsubsection xhost Selector Function
@cindex xhost Selector Function
@cindex xhost, boolean mount selector
@cindex !xhost, boolean mount selector
@cindex Mount selector; xhost
@cindex Selector; xhost
@cindex CNAMEs

This function compares @i{ARG} against the current hostname, similarly
to the @ref{host Selector Variable}.  However, this function will
also match if @i{ARG} is a CNAME (DNS Canonical Name, or alias) for
the current host's name.

@c ================================================================
@node Map Options,  , Selectors, Location Format
@comment  node-name,  next,  previous,  up
@subsection Map Options
@cindex Map options
@cindex Setting map options

Options are parsed concurrently with selectors.  The difference is that
when an option is seen the string following the @samp{:=} is
recorded for later use.  As a minimum the @var{type} option must be
specified.  Each filesystem type has other options which must also be
specified.  @xref{Filesystem Types}, for details on the filesystem
specific options.@refill

Superfluous option specifications are ignored and are not reported
as errors.

The following options apply to more than one filesystem type.

@menu
* addopts Option::
* delay Option::
* fs Option::
* opts Option::
* remopts Option::
* sublink Option::
* type Option::
@end menu

@node addopts Option, delay Option, Map Options, Map Options
@comment  node-name,  next,  previous,  up
@subsubsection addopts Option
@cindex Setting additional options on a mount location
@cindex Overriding or adding options to a mount
@cindex addopts, mount option
@cindex Mount option; addopts

This option adds additional options to default options normally
specified in the @samp{/defaults} entry or the defaults of the key entry
being processed (@pxref{opts Option}).  Normally when you specify
@samp{opts} in both the @samp{/defaults} and the map entry, the latter
overrides the former completely.  But with @samp{addopts} it will append
the options and override any conflicting ones.

@samp{addopts} also overrides the value of the @samp{remopts} option
(@pxref{remopts Option}), which unless specified defaults to the value
of @samp{opts}.

Options which start with @samp{no} will override those with the same
name that do not start with @samp{no} and vice verse.  Special handling
is given to inverted options such as @samp{soft} and @samp{hard},
@samp{bg} and @samp{fg}, @samp{ro} and @samp{rw}, etc.

For example, if the default options specified were
@example
opts:=rw,nosuid,intr,rsize=1024,wsize=1024,quota,posix
@end example

and the ones specified in a map entry were

@example
addopts:=grpid,suid,ro,rsize=2048,quota,nointr
@end example

then the actual options used would be

@example
wsize=1024,posix,grpid,suid,ro,rsize=2048,quota,nointr
@end example

@node delay Option, fs Option, addopts Option, Map Options
@comment  node-name,  next,  previous,  up
@subsubsection delay Option
@cindex Setting a delay on a mount location
@cindex Delaying mounts from specific locations
@cindex Primary server
@cindex Secondary server
@cindex delay, mount option
@cindex Mount option; delay

The delay, in seconds, before an attempt will be made to mount from the
current location.  Auxiliary data, such as network address, file handles
and so on are computed regardless of this value.

A delay can be used to implement the notion of primary and secondary
file servers.  The secondary servers would have a delay of a few
seconds, thus giving the primary servers a chance to respond first.

@node fs Option, opts Option, delay Option, Map Options
@comment  node-name,  next,  previous,  up
@subsubsection fs Option
@cindex Setting the local mount point
@cindex Overriding the default mount point
@cindex fs, mount option
@cindex Mount option; fs

The local mount point.  The semantics of this option vary between
filesystems.

For NFS and UFS filesystems the value of @code{$@{fs@}} is used as the
local mount point.  For other filesystem types it has other meanings
which are described in the section describing the respective filesystem
type.  It is important that this string uniquely identifies the
filesystem being mounted.  To satisfy this requirement, it should
contain the name of the host on which the filesystem is resident and the
pathname of the filesystem on the local or remote host.

The reason for requiring the hostname is clear if replicated filesystems
are considered.  If a fileserver goes down and a replacement filesystem
is mounted then the @dfn{local} mount point @dfn{must} be different from
that of the filesystem which is hung.  Some encoding of the filesystem
name is required if more than one filesystem is to be mounted from any
given host.

If the hostname is first in the path then all mounts from a particular
host will be gathered below a single directory.  If that server goes
down then the hung mount points are less likely to be accidentally
referenced, for example when @b{getcwd}(3) traverses the namespace to
find the pathname of the current directory.

The @samp{fs} option defaults to
@code{$@{autodir@}/$@{rhost@}$@{rfs@}}.  In addition,
@samp{rhost} defaults to the local host name (@code{$@{host@}}) and
@samp{rfs} defaults to the value of @code{$@{path@}}, which is the full
path of the requested file; @samp{/home/foo} in the example above
(@pxref{Selectors}).  @code{$@{autodir@}} defaults to @samp{/a} but may
be changed with the @code{-a} command line option.  Sun's automounter
defaults to @samp{/tmp_mnt}.  Note that there is no @samp{/} between
the @code{$@{rhost@}} and @code{$@{rfs@}} since @code{$@{rfs@}} begins
with a @samp{/}.@refill

@node opts Option, remopts Option, fs Option, Map Options
@comment  node-name,  next,  previous,  up
@subsubsection opts Option
@cindex Setting system mount options
@cindex Passing parameters to the mount system call
@cindex mount system call
@cindex mount system call flags
@cindex The mount system call
@cindex opts, mount option
@cindex Mount option; opts

The options to pass to the mount system call.  A leading @samp{-} is
silently ignored.  The mount options supported generally correspond to
those used by @b{mount}(8) and are listed below.  Some additional
pseudo-options are interpreted by @i{Amd} and are also listed.

Unless specifically overridden, each of the system default mount options
applies.  Any options not recognized are ignored.  If no options list is
supplied the string @samp{rw,defaults} is used and all the system
default mount options apply.  Options which are not applicable for a
particular operating system are silently ignored.  For example, only 4.4BSD
is known to implement the @code{compress} and @code{spongy} options.

@table @code

@item acdirmax=@var{n}
@cindex Mount flags; acdirmax
Set the maximum directory attribute cache timeout to @var{n}.

@item acdirmin=@var{n}
@cindex Mount flags; acdirmin
Set the minimum directory attribute cache timeout to @var{n}.

@item acregmax=@var{n}
@cindex Mount flags; acregmax
Set the maximum file attribute cache timeout to @var{n}.

@item acregmin=@var{n}
@cindex Mount flags; acregmin
Set the minimum file attribute cache timeout to @var{n}.

@item actimeo=@var{n}
@cindex Mount flags; actimeo
Set the overall attribute cache timeout to @var{n}.

@item auto
@cindex Mount flags; auto
@itemx ignore
@cindex Mount flags; ignore
Ignore this mount by @b{df}(1).

@item cache
@cindex Mount flags; cache
Allow data to be cached from a remote server for this mount.

@item closesession
@cindex Mount flags; closesession
For UDF mounts, close the session when unmounting.

@item compress
@cindex Mount flags; compress
Use NFS compression protocol.

@item defperm
@cindex Mount flags; defperm
Ignore the permission mode bits, and default file permissions to 0555,
UID 0, and GID 0.  Useful for CD-ROMs formatted as ISO-9660.

@item dev
@cindex Mount flags; dev
Allow local special devices on this filesystem.

@item dirmask=@var{n}
@cindex Mount flags; dirmask
For PCFS mounts, specify the maximum file permissions for directories
in the file system.  See the @samp{mask} option's description for more
details.  The mask value of @var{n} can be specified in decimal,
octal, or hexadecimal.

@item dumbtimr
@cindex Mount flags; dumbtimr
Turn off the dynamic retransmit timeout estimator.  This may be useful
for UDP mounts that exhibit high retry rates, since it is possible that
the dynamically estimated timeout interval is too short.

@item extatt
@cindex Mount flags; extatt
Enable extended attributes in ISO-9660 file systems.

@item fsid
@cindex Mount flags; fsid
Set ID of filesystem.

@item gens
@cindex Mount flags; gens
Enable generations in ISO-9660 file systems.  Generations allow you to
see all versions of a given file.

@item gmtoff=@var{n}
@cindex Mount flags; gmtoff
For UDF mounts, set the time zone offset from UTC to @var{n} seconds,
with positive values indicating east of the Prime Meridian.  If not
set, the user's current time zone will be used.

@item group=@var{n}
@cindex Mount flags; group
For PCFS and UDF mounts, set the group of the files in the file system
to @var{n} (which can either be a group name or a GID number).  The
default group is the group of the directory on which the file system
is being mounted.

@item grpid
@cindex Mount flags; grpid
Use BSD directory group-id semantics.

@item int
@cindex Mount flags; int
@itemx intr
@cindex Mount flags; intr
Allow keyboard interrupts on hard mounts.

@item lock
@cindex Mount flags; lock
Use the NFS locking protocol (default)

@item longname
@cindex Mount Flags; longname
For PCFS mounts, force Win95 long names.

@item mask=@var{n}
@cindex Mount flags; mask
For PCFS mounts, specify the maximum file permissions for files in the
file system.  For example, a mask of 755 specifies that, by default,
the owner should have read, write, and execute permissions for files,
but others should only have read and execute permissions.  Only the
nine low-order bits of mask are used.  The default mask is taken from
the directory on which the file system is being mounted.  The mask
value of @var{n} can be specified in decimal, octal, or hexadecimal.

@item multi
@cindex Mount flags; multi
Perform multi-component lookup on files.

@item maxgroups
@cindex Mount flags; maxgroups
Set the maximum number of groups to allow for this mount.

@item nfsv3
@cindex Mount flags; nfsv3
Use NFS Version 3 for this mount.

@item noac
@cindex Mount flags; noac
Turn off the attribute cache.

@item noauto
@cindex Mount flags; noauto
This option is used by the mount command in @samp{/etc/fstab} or
@samp{/etc/vfstab} and means not to mount this file system when mount -a
is used.

@item nocache
@cindex Mount flags; nocache
Do not allow data to be cached from a remote server for this
mount.

@item nocasetrans
@cindex Mount flags; nocasetrans
Don't do case translation. Useful for CD-ROMS formatted as
ISO-9660.

@item noconn
@cindex Mount flags; noconn
Don't make a connection on datagram transports.

@item nocto
@cindex Mount flags; nocto
No close-to-open consistency.

@item nodefperm
@cindex Mount flags; nodefperm
Do not ignore the permission mode bits.  Useful for CD-ROMS formatted as
ISO-9660.

@item nodev
@cindex Mount flags; nodev
@itemx nodevs
@cindex Mount flags; nodevs
Don't allow local special devices on this filesystem.

@item noexec
@cindex Mount flags; noexec
Don't allow program execution.

@item noint
@cindex Mount flags; noint
Do not allow keyboard interrupts for this mount

@item nojoliet
@cindex Mount flags; nojoliet
Turn off the Joliet extensions.  Useful for CD-ROMS formatted as ISO-9660.

@item nolock
@cindex Mount flags; nolock
Do not use the NFS locking protocol

@item nomnttab
@cindex Mount flags; nomnttab
This option is used internally to tell Amd that a Solaris 8 system using
mntfs is in use.

@item norrip
@cindex Mount flags; norrip
Turn off using of the Rock Ridge Interchange Protocol (RRIP) extensions
to ISO-9660.

@item nosub
@cindex Mount flags; nosub
Disallow mounts beneath this mount.

@item nosuid
@cindex Mount flags; nosuid
Don't allow set-uid or set-gid executables on this filesystem.

@item noversion
@cindex Mount flags; noversion
Strip the extension @samp{;#} from the version string of files recorded
on an ISO-9660 CD-ROM.

@item nowin95
@cindex Mount Flags; nowin95
For PCFS mounts, completely ignore Win95 entries.

@item optionstr
@cindex Mount flags; optionstr
Under Solaris 8, provide the kernel a string of options to parse and
show as part of the special in-kernel mount file system.

@item overlay
@cindex Mount flags; overlay
Overlay this mount on top of an existing mount, if any.

@item pgthresh=@var{n}
@cindex Mount flags; pgthresh
Set the paging threshold to @var{n} kilobytes.

@item port=@var{n}
@cindex Mount flags; port
Set the NFS port to @var{n}.

@item posix
@cindex Mount flags; posix
Turn on POSIX static pathconf for mounts.

@item private
@cindex Mount flags; private
Use local locking instead of the NLM protocol, useful for IRIX 6 only.

@item proplist
@cindex Mount flags; proplist
Support property lists (ACLs) for this mount, useful primarily for Tru64
UNIX.

@item proto=@var{s}
@cindex Mount flags; proto
Use transport protocol @var{s} for NFS (can be @code{"tcp"} or @code{"udp"}).

@item quota
@cindex Mount flags; quota
Enable quota checking on this mount.

@item rdonly
@cindex Mount flags; rdonly
@itemx ro
@cindex Mount flags; ro
Mount this filesystem readonly.

@item resvport
@cindex Mount flags; resvport
Use a reserved port (smaller than 1024) for remote NFS mounts.  Most
systems assume that, but some allow for mounts to occur on non-reserved
ports.   This causes problems when such a system tries to NFS mount one
that requires reserved ports.  It is recommended that this option always
be on.

@item retrans=@i{n}
@cindex Mount flags; retrans
The number of NFS retransmits made before a user error is generated by a
@samp{soft} mounted filesystem, and before a @samp{hard} mounted
filesystem reports @samp{NFS server @dfn{yoyo} not responding still
trying}.

@item retry
@cindex Mount flags; retry
Set the NFS retry counter.

@item rrcaseins
@cindex Mount flags; rrcaseins
Enable the Rock Ridge Interchange Protocol (RRIP) case insensitive extensions.
Useful for CD-ROMS formatted as ISO-9660.

@item rrip
@cindex Mount flags; rrip
Uses the Rock Ridge Interchange Protocol (RRIP) extensions to ISO-9660.

@item rsize=@var{n}
@cindex Mount flags; rsize
The NFS read packet size.  You may need to set this if you are using
NFS/UDP through a gateway or a slow link.

@item rw
@cindex Mount flags; rw
Allow reads and writes on this filesystem.

@item sessionnr=@var{n}
@cindex Mount Flags; sessionnr
For multisession UDF mounts, use session number @var{n} when mounting.

@item shortname
@cindex Mount Flags; longname
For PCFS mounts, force old DOS short names only.

@item soft
@cindex Mount flags; soft
Give up after @dfn{retrans} retransmissions.

@item spongy
@cindex Mount flags; spongy
Like @samp{soft} for status requests, and @samp{hard} for data transfers.

@item suid
@cindex Mount flags; suid
Allow set-uid programs on this mount.

@item symttl
@cindex Mount flags; symttl
Turn off the symbolic link cache time-to-live.

@item sync
@cindex Mount flags; sync
Perform synchronous filesystem operations on this mount.

@item tcp
@cindex Mount flags; tcp
Use TCP/IP instead of UDP/IP, ignored if the NFS implementation does not
support TCP/IP mounts.

@item timeo=@var{n}
@cindex Mount flags; timeo
The NFS timeout, in tenth-seconds, before a request is retransmitted.

@item user=@var{n}
@cindex Mount flags; user
For PCFS and UDF mounts, set the owner of the files in the file system
to @var{n} (which can either be a user name or a UID number).  The
default owner is the owner of the directory on which the file system
is being mounted.

@item vers=@var{n}
@cindex Mount flags; vers
Use NFS protocol version number @var{n} (can be 2 or 3).

@item wsize=@var{n}
@cindex Mount flags; wsize
The NFS write packet size.  You may need to set this if you are using
NFS/UDP through a gateway or a slow link.

@end table

The following options are implemented by @i{Amd}, rather than being
passed to the kernel.

@table @code

@item nounmount
@cindex Mount flags; nounmount
Configures the mount so that its time-to-live will never expire.  This
is the default for non-network based filesystem types (such as
mounting local disks, floppies, and CD-ROMs).  See also the related
@i{unmount} option.
@c
@c Implementation broken:

@item ping=@var{n}
@cindex Mount flags; ping
The interval, in seconds, between keep-alive pings.  When four
consecutive pings have failed the mount point is marked as hung.  This
interval defaults to 30 seconds; if the ping interval is set to zero,
@i{Amd} will use the default 30-second interval.  If the interval is
set to -1 (or any other negative value), no pings are sent and the
host is assumed to be always up, which can cause unmounts to hang See
the @i{softlookup} option for a better alternative.  Turning pings off
can be useful in NFS-HA (High-Availability) sites where the NFS
service rarely goes down.  Setting the ping value to a large value can
reduce the amount of NFS_NULL chatter on your network considerably,
especially in large sites.

Note that if you have multiple @i{Amd} entries using the same file
server, and each entry sets a different value of N, then each time Amd
mounts a new entry, the ping value will be re-evaluated (and updated,
turned off, or turned back on as needed).  Finally, note that NFS_NULL
pings are sent for both UDP and TCP mounts, because even a hung TCP
mount can cause user processes to hang.

@item public
@cindex Mount flags; public
Use WebNFS multi-component lookup on the public file handle instead of
the mount protocol to obtain NFS file handles, as documented in the
WebNFS Client Specification, RFC 2054.  This means that @i{Amd} will not
attempt to contact the remote portmapper or remote mountd daemon, and
will only connect to the well-known NFS port 2049 or the port specified
with the @i{port} mount option, thus making it easier to use NFS through
a firewall.

@item retry=@var{n}
@cindex Mount flags; retry=@var{n}
The number of times to retry the mount system call.

@item softlookup
@cindex Mount flags; softlookup
Configures @i{Amd}'s behavior with respect to already-mounted shares from
NFS fileservers that are unreachable.  If softlookup is specified,
trying to access such a share will result in an error (EIO, which is
changed from the ENOENT 6.0 used to return).  If it is not specified, a
regular symlink is provided and the access will probably hang
in the NFS filesystem.

The default behavior depends on whether the mount is 'soft' or 'hard';
softlookup can be used to change this default. This is changed from 6.0
which always behaved as if softlookup was specified.

@item unmount
@cindex Mount flags; unmount
Configures the mount so that its time-to-live will indeed expire (and
thus may be automatically unmounted).  This is also the default for
network-based filesystem types (e.g., NFS).  This option is useful for
removable local media such as CD-ROMs, USB drives, etc. so they can
expire when not in use, and get unmounted (such drives can get work
out when they keep spinning).  See also the related @i{nounmount}
option.

@item utimeout=@var{n}
@cindex Mount flags; utimeout=@var{n}
The interval, in seconds, that looked up and mounted map entries are
cached.  After that period of time, @i{Amd} will attempt to unmount
the entries.  If, however, the unmount fails (with EBUSY), then
@i{Amd} will extend the mount's time-to-live by the @i{utimeout} value
before the next unmount attempt is made.  In fact the interval is
extended before the unmount is attempted, to avoid thrashing.  The
default value is 120 seconds (two minutes) or as set by the @code{-w}
command line option.

@item xlatecookie
@cindex Mount flags; xlatecookie
Translate directory cookies between 32-long and 64-long lengths.

@end table

@node remopts Option, sublink Option, opts Option, Map Options
@comment  node-name,  next,  previous,  up
@subsubsection remopts Option
@cindex Setting system mount options for non-local networks
@cindex remopts, mount option
@cindex Mount option; remopts

This option has the same use as @code{$@{opts@}} but applies only when
the remote host is on a non-local network.  For example, when using NFS
across a gateway it is often necessary to use smaller values for the
data read and write sizes.  This can simply be done by specifying the
small values in @var{remopts}.  When a non-local host is accessed, the
smaller sizes will automatically be used.

@i{Amd} determines whether a host is local by examining the network
interface configuration at startup.  Any interface changes made after
@i{Amd} has been started will not be noticed.  The likely effect will
be that a host may incorrectly be declared non-local.

Unless otherwise set, the value of @code{$@{remopts@}} is the same as
the value of @code{$@{opts@}}.

@node sublink Option, type Option, remopts Option, Map Options
@comment  node-name,  next,  previous,  up
@subsubsection sublink Option
@cindex Setting the sublink option
@cindex sublink, mount option
@cindex Mount option; sublink

The subdirectory within the mounted filesystem to which the reference
should point.  This can be used to prevent duplicate mounts in cases
where multiple directories in the same mounted filesystem are used.

@node type Option, , sublink Option, Map Options
@comment  node-name,  next,  previous,  up
@subsubsection type Option
@cindex Setting the filesystem type option
@cindex type, mount option
@cindex Mount option; type

The filesystem type to be used.  @xref{Filesystem Types}, for a full
description of each type.@refill

@c ################################################################
@node Amd Command Line Options, Filesystem Types, Mount Maps, Top
@comment  node-name,  next,  previous,  up
@chapter @i{Amd} Command Line Options
@cindex Command line options, Amd
@cindex Amd command line options
@cindex Overriding defaults on the command line

Many of @i{Amd}'s parameters can be set from the command line.  The
command line is also used to specify automount points and maps.

The general format of a command line is

@example
amd [@i{options}] [@{ @i{directory} @i{map-name} [-@i{map-options}] @} ...]
@end example

For each directory and map-name given or specified in the
@file{amd.conf} file, @i{Amd} establishes an automount point.  The
@dfn{map-options} may be any sequence of options or
selectors---@pxref{Location Format}.  The @dfn{map-options} apply only
to @i{Amd}'s mount point.

@samp{type:=toplvl;cache:=mapdefault;fs:=$@{map@}} is the default value for the
map options.  Default options for a map are read from a special entry in
the map whose key is the string @samp{/defaults}.  When default options
are given they are prepended to any options specified in the mount-map
locations as explained in @ref{Map Defaults}.

The @dfn{options} are any combination of those listed below.

Once the command line has been parsed, the automount points are mounted.
The mount points are created if they do not already exist, in which case they
will be removed when @i{Amd} exits.
Finally, @i{Amd} disassociates itself from its controlling terminal and
forks into the background.

Note: Even if @i{Amd} has been built with @samp{-DDEBUG} (via
@code{configure --enable-debug}), it will still background itself and
disassociate itself from the controlling terminal.  To use a debugger it
is necessary to specify @samp{-D daemon} on the command line.
However, even with all of this, mounts and unmounts are performed in the
background, and @i{Amd} will always fork before doing them.  Therefore,
debugging what happens closely during un/mounts is more challenging.

@emph{All} of @i{Amd}'s command options (save @code{-F} and @code{-T})
can be specified in the @file{amd.conf} file. @xref{Amd Configuration
File}.  If @i{Amd} is invoked without any command line options, it will
default to using the configuration file @file{/etc/amd.conf}, if one
exists.

@menu
* -a Option::   Automount directory.
* -c Option::   Cache timeout interval.
* -d Option::   Domain name.
* -k Option::   Kernel architecture.
* -l Option::   Log file.
* -n Option::   Hostname normalization.
* -o Option::   Operating system version.
* -p Option::   Output process id.
* -r Option::   Restart existing mounts.
* -t Option::   Kernel RPC timeout.
* -v Option::   Version information.
* -w Option::   Wait interval after failed unmount.
* -x Option::   Log options.
* -y Option::   NIS domain.
* -A Option::   Operating system Architecture.
* -C Option::   Cluster name.
* -D Option::   Debug flags.
* -F Option::   Amd configuration file.
* -H Option::   Show brief help.
* -O Option::   Operating system name.
* -S Option::   Lock executable pages in memory.
* -T Option::   Set tag for configuration file.
@end menu

@c ----------------------------------------------------------------
@node -a Option, -c Option, Amd Command Line Options, Amd Command Line Options
@comment  node-name,  next,  previous,  up
@section @code{-a} @var{directory}
@cindex Automount directory
@cindex Setting the default mount directory

Specifies the default mount directory.  This option changes the variable
@code{$@{autodir@}} which otherwise defaults to @file{/a}.  For example,
some sites prefer @file{/amd} or @file{/n}.

@example
amd -a /amd ...
@end example

@c ----------------------------------------------------------------
@node -c Option, -d Option, -a Option, Amd Command Line Options
@comment  node-name,  next,  previous,  up
@section @code{-c} @var{cache-interval}
@cindex Cache interval
@cindex Interval before a filesystem times out
@cindex Setting the interval before a filesystem times out
@cindex Changing the interval before a filesystem times out

Selects the period, in seconds, for which a name is cached by @i{Amd}.
If no reference is made to the volume in this period, @i{Amd} discards
the volume name to filesystem mapping.

Once the last reference to a filesystem has been removed, @i{Amd}
attempts to unmount the filesystem.  If the unmount fails the interval
is extended by a further period as specified by the @samp{-w} command
line option or by the @samp{utimeout} mount option.

The default @dfn{cache-interval} is 300 seconds (five minutes).

@c ----------------------------------------------------------------
@node -d Option, -k Option, -c Option, Amd Command Line Options
@comment  node-name,  next,  previous,  up
@section @code{-d} @var{domain}
@cindex Domain name
@cindex Setting the local domain name
@cindex Overriding the local domain name

Specifies the host's domain.  This sets the internal variable
@code{$@{domain@}} and affects the @code{$@{hostd@}} variable.

If this option is not specified and the hostname already contains the
local domain then that is used, otherwise the default value of
@code{$@{domain@}} is @samp{unknown.domain}.

For example, if the local domain was @samp{doc.ic.ac.uk}, @i{Amd} could
be started as follows:

@example
amd -d doc.ic.ac.uk ...
@end example

@c ----------------------------------------------------------------
@node -k Option, -l Option, -d Option, Amd Command Line Options
@comment  node-name,  next,  previous,  up
@section @code{-k} @var{kernel-architecture}
@cindex Setting the Kernel architecture

Specifies the kernel architecture of the system.  This is usually the
output of @samp{uname -m} (the ``machine'' value gotten from
@b{uname}(2)).  If the @b{uname}(2) system call is not available, the
value of @code{$@{karch@}} defaults to that of @code{$@{arch@}}.

The only effect of this option is to set the variable @code{$@{karch@}}.

This option would be used as follows:

@example
amd -k `arch -k` ...
@end example

@c ----------------------------------------------------------------
@node -l Option, -n Option, -k Option, Amd Command Line Options
@comment  node-name,  next,  previous,  up
@section @code{-l} @var{log-option}
@cindex Log filename
@cindex Setting the log file
@cindex Using syslog to log errors
@cindex syslog

Selects the form of logging to be made.  Several special @dfn{log-options}
are recognized.

@enumerate
@item
If @dfn{log-option} is the string @samp{syslog}, @i{Amd} will use the
@b{syslog}(3) mechanism.  If your system supports syslog facilities, then
the default facility used is @samp{LOG_DAEMON}.

@item
@cindex syslog facility; specifying an alternate
When using syslog, if you wish to change the facility, append its name
to the log option name, delimited by a single colon.  For example, if
@dfn{log-options} is the string @samp{syslog:local7} then @b{Amd} will
log messages via @b{syslog}(3) using the @samp{LOG_LOCAL7} facility.  If
the facility name specified is not recognized, @i{Amd} will default to
@samp{LOG_DAEMON}.  Note: while you can use any syslog facility
available on your system, it is generally a bad idea to use those
reserved for other services such as @samp{kern}, @samp{lpr},
@samp{cron}, etc.

@item
If @dfn{log-option} is the string @samp{/dev/stderr}, @i{Amd} will use
standard error, which is also the default target for log messages.  To
implement this, @i{Amd} simulates the effect of the @samp{/dev/fd}
driver.
@end enumerate

Any other string is taken as a filename to use for logging.  Log
messages are appended to the file if it already exists, otherwise a new
file is created.  The file is opened once and then held open, rather
than being re-opened for each message.

Normally, when long-running daemons hold an open file descriptor on a
log file, it is impossible to ``rotate'' the log file and compress older
logs on a daily basis.  The daemon needs to be told to discard (via
@b{close}(2)) its file handle, and re-open the log file.  This is done
using @code{amq -l} @i{log-option}. @xref{Amq -l option}.

If the @samp{syslog} option is specified but the system does not support
syslog or if the named file cannot be opened or created, @i{Amd} will
use standard error.  Error messages generated before @i{Amd} has
finished parsing the command line are printed on standard error.

Since @i{Amd} tends to generate a lot of logging information (especially
if debugging was turned on), and due to it being an important program
running on the system, it is usually best to log to a separate disk
file.  In that case @i{Amd} would be started as follows:

@example
amd -l /var/log/amd ...
@end example

@c ----------------------------------------------------------------
@node -n Option, -o Option, -l Option, Amd Command Line Options
@comment  node-name,  next,  previous,  up
@section @code{-n}
@cindex Hostname normalization
@cindex Aliased hostnames
@cindex Resolving aliased hostnames
@cindex Normalizing hostnames

Normalizes the remote hostname before using it.  Normalization is done
by replacing the value of @code{$@{rhost@}} with the (generally fully
qualified) primary name returned by a hostname lookup.

This option should be used if several names are used to refer to a
single host in a mount map.

@c ----------------------------------------------------------------
@node -o Option, -p Option, -n Option, Amd Command Line Options
@comment  node-name,  next,  previous,  up
@section @code{-o} @var{op-sys-ver}
@cindex Operating System version
@cindex Setting the Operating System version

Overrides the compiled-in version number of the operating system, with
@var{op-sys-ver}.  Useful when the built-in version is not desired for
backward compatibility reasons.  For example, if the built-in version is
@samp{2.5.1}, you can override it to @samp{5.5.1}, and use older maps
that were written with the latter in mind.

@c ----------------------------------------------------------------
@node -p Option, -r Option, -o Option, Amd Command Line Options
@comment  node-name,  next,  previous,  up
@section @code{-p}
@cindex Process id
@cindex Displaying the process id
@cindex process id of Amd daemon
@cindex pid file, creating with -p option
@cindex Creating a pid file

Causes @i{Amd}'s process id to be printed on standard output.
This can be redirected to a suitable file for use with kill:

@example
amd -p > /var/run/amd.pid ...
@end example

This option only has an affect if @i{Amd} is running in daemon mode.
If @i{Amd} is started with the @code{-D daemon} debug flag, this
option is ignored.

@c ----------------------------------------------------------------
@node -r Option, -t Option, -p Option, Amd Command Line Options
@comment  node-name,  next,  previous,  up
@section @code{-r}
@cindex Restarting existing mounts
@cindex Picking up existing mounts

Tells @i{Amd} to restart existing mounts (@pxref{Inheritance Filesystem}).
@c @dfn{This option will be made the default in the next release.}

@c ----------------------------------------------------------------
@node -t Option, -v Option, -r Option, Amd Command Line Options
@comment  node-name,  next,  previous,  up
@section @code{-t} @var{timeout.retransmit}
@cindex Setting Amd's RPC parameters

Specifies the RPC @dfn{timeout} interval and the @dfn{retransmit}
counter used by the kernel to communicate to @i{Amd}.  These are used to
set the @samp{timeo} and @samp{retrans} mount options, respectively.
The default timeout is 0.8 seconds, and the default number of
retransmissions is 11.

@i{Amd} relies on the kernel RPC retransmit mechanism to trigger mount
retries.  The values of these parameters change the overall retry
interval.  Too long an interval gives poor interactive response; too
short an interval causes excessive retries.

@c ----------------------------------------------------------------
@node -v Option, -w Option, -t Option, Amd Command Line Options
@comment  node-name,  next,  previous,  up
@section @code{-v}
@cindex Version information
@cindex Discovering version information
@cindex How to discover your version of Amd

Print version information on standard error and then exit.  The output
is of the form:

@example
Copyright (c) 1997-1999 Erez Zadok
Copyright (c) 1990 Jan-Simon Pendry
Copyright (c) 1990 Imperial College of Science, Technology & Medicine
Copyright (c) 1990 The Regents of the University of California.
am-utils version 6.0a15 (build 61).
Built by ezk@@example.com on date Wed Oct 22 15:21:03 EDT 1997.
cpu=sparc (big-endian), arch=sun4, karch=sun4u.
full_os=solaris2.5.1, os=sos5, osver=5.5.1, vendor=sun.
Map support for: root, passwd, union, nisplus, nis, ndbm, file, error.
AMFS: nfs, link, nfsx, nfsl, host, linkx, program, union, inherit,
      ufs, lofs, hsfs, pcfs, auto, direct, toplvl, error.
FS: autofs, cachefs, cdfs, lofs, nfs, nfs3, pcfs, tfs, tmpfs, udf, ufs.
Network 1: wire="mcl-lab-net.cs.columbia.edu" (netnumber=128.59.13).
Network 2: wire="14-net.cs.columbia.edu" (netnumber=128.59.14).
Network 3: wire="old-net.cs.columbia.edu" (netnumber=128.59.16).
@end example

The information includes the version number, number of times @i{Amd} was
compiled on the local system, release date and name of the release.
Following come the cpu type, byte ordering, and the architecture and
kernel architecture as @code{$@{arch@}} and @code{$@{karch@}},
respectively.  The next line lists the operating system full name, short
name, version, and vendor.  These four values correspond to the
variables @code{$@{full_os@}}, @code{$@{os@}}, @code{$@{osver@}}, and
@code{$@{vendor@}}, respectively.  @xref{Supported Platforms}.

Then come a list of map types supported, filesystems internally
supported by @i{Amd} (AMFS), and generic filesystems available (FS).
Finally all known networks (if any) of this host are listed by name
and number.  They are available via the variables
@code{$@{wire@}} or @code{$@{network@}}, and
@code{$@{netnumber@}} (@pxref{Selectors}) or the @samp{in_network}
selector function (@pxref{in_network Selector Function}).

@c ----------------------------------------------------------------
@node -w Option, -x Option, -v Option, Amd Command Line Options
@comment  node-name,  next,  previous,  up
@section @code{-w} @var{wait-timeout}
@cindex Setting the interval between unmount attempts
@cindex unmount attempt backoff interval

Selects the interval in seconds between unmount attempts after the
initial time-to-live has expired.

This defaults to 120 seconds (two minutes).

@c ----------------------------------------------------------------
@node -x Option, -y Option, -w Option, Amd Command Line Options
@comment  node-name,  next,  previous,  up
@section @code{-x} @var{opts}
@cindex Log message selection
@cindex Selecting specific log messages
@cindex How to select log messages
@cindex syslog priorities

Specifies the type and verbosity of log messages.  @dfn{opts} is
a comma separated list selected from the following options:

@table @code
@item fatal
Fatal errors (cannot be turned off)
@item error
Non-fatal errors (cannot be turned off)
@item user
Non-fatal user errors
@item warn
Recoverable errors
@item warning
Alias for @code{warn}
@item info
Information messages
@item map
Mount map usage
@item stats
Additional statistics
@item all
All of the above
@item defaults
An alias for "fatal,error,user,warning,info".
@end table

Initially a set of default logging flags is enabled.  This is as if
@samp{-x defaults}
or
@samp{-x fatal,error,user,warning,info}
had been selected.  The command line is
parsed and logging is controlled by the @code{-x} option.  The very first
set of logging flags is saved and can not be subsequently disabled using
@i{Amq}.  This default set of options is useful for general production
use.@refill

The @samp{info} messages include details of what is mounted and
unmounted and when filesystems have timed out.  If you want to have the
default set of messages without the @samp{info} messages then you simply
need @samp{-x noinfo}.  The messages given by @samp{user} relate to
errors in the mount maps, so these are useful when new maps are
installed.  The following table lists the syslog priorities used for each
of the message types.@refill

@table @code
@item fatal
@samp{LOG_CRIT}
@item error
@samp{LOG_ERR}
@item user
@samp{LOG_WARNING}
@item warning
@samp{LOG_WARNING}
@item info
@samp{LOG_INFO}
@item debug
@samp{LOG_DEBUG}
@item map
@samp{LOG_DEBUG}
@item stats
@samp{LOG_INFO}
@end table

The options can be prefixed by the string @samp{no} to indicate
that this option should be turned off.  For example, to obtain all
but @samp{info} messages the option @samp{-x all,noinfo} would be used.

If @i{Amd} was built with debugging enabled the @code{debug} option is
automatically enabled regardless of the command line options.

@c ----------------------------------------------------------------
@node -y Option, -A Option, -x Option, Amd Command Line Options
@comment  node-name,  next,  previous,  up
@section @code{-y} @var{NIS-domain}
@cindex NIS (YP) domain name
@cindex Overriding the NIS (YP) domain name
@cindex Setting the NIS (YP) domain name
@cindex YP domain name

Selects an alternate NIS domain.  This is useful for debugging and
cross-domain shared mounting.  If this flag is specified, @i{Amd}
immediately attempts to bind to a server for this domain.
@c @i{Amd} refers to NIS maps when it starts, unless the @code{-m} option
@c is specified, and whenever required in a mount map.

@c ----------------------------------------------------------------
@node -A Option, -C Option, -y Option, Amd Command Line Options
@comment  node-name,  next,  previous,  up
@section @code{-A} @var{architecture}
@cindex Setting the operating system architecture

Specifies the OS architecture of the system.
The only effect of this option is to set the variable @code{$@{arch@}}.

This option would be used as follows:

@example
amd -A i386 ...
@end example

@c ----------------------------------------------------------------
@node -C Option, -D Option, -A Option, Amd Command Line Options
@comment  node-name,  next,  previous,  up
@section @code{-C} @var{cluster-name}
@cindex Cluster names
@cindex Setting the cluster name

Specifies the name of the cluster of which the local machine is a member.
The only effect is to set the variable @code{$@{cluster@}}.
The @dfn{cluster-name} is will usually obtained by running another command which uses
a database to map the local hostname into a cluster name.
@code{$@{cluster@}} can then be used as a selector to restrict mounting of
replicated data.
If this option is not given, @code{$@{cluster@}} has the same value as @code{$@{domain@}}.
This would be used as follows:

@example
amd -C `clustername` ...
@end example

@c ----------------------------------------------------------------
@node -D Option, -F Option, -C Option, Amd Command Line Options
@comment  node-name,  next,  previous,  up
@section @code{-D} @var{opts}
@cindex Debug options
@cindex Setting debug flags

Controls the verbosity and coverage of the debugging trace; @dfn{opts}
is a comma separated list of debugging options.  The @code{-D} option is
only available if @i{Amd} was compiled with @samp{-DDEBUG}, or
configured with @code{configure --enable-debug}.  The memory debugging
facilities (@samp{mem}) are only available if @i{Amd} was compiled with
@samp{-DDEBUG_MEM} (in addition to @samp{-DDEBUG}), or configured with
@code{configure --enable-debug=mem}.

The most common options to use are @samp{-D trace} and @samp{-D test}
(which turns on all the useful debug options).  As usual, every option
can be prefixed with @samp{no} to turn it off.

@table @code
@item all
all options (excluding hrtime and mtab)
@item defaults
``sensible'' default options (all--excluding hrtime, mtab, and xdrtrace)
@item test
full debug options plus mtab,nodaemon,nofork,noamq
@item amq
register @i{Amd} with the RPC portmapper, for @i{Amq}
@item daemon
enter daemon mode
@item fork
fork child worker (hlfsd only)
@item full
program trace
@item hrtime
print high resolution time stamps (only if @b{syslog}(3) is not used)
@item info
@cindex debugging hesiod resolver service
@cindex Hesiod; turning on RES_DEBUG
info service specific debugging (hesiod, nis, etc.)  In the case of
hesiod maps, turns on the hesiod RES_DEBUG internal debugging option.
@item mem
trace memory allocations.  Needs to be explicitly enabled at compile
time with --enable-debug=mem.
@item mtab
use local mount-table file (defaults to @file{/tmp/mtab}, @pxref{debug_mtab_file Parameter})
@item readdir
show readdir progress
@item str
debug string munging
@item trace
trace RPC protocol and NFS mount arguments
@item xdrtrace
trace XDR routines
@end table

You may also refer to the program source for a more detailed explanation
of the available options.

@c ----------------------------------------------------------------
@node -F Option, -H Option, -D Option, Amd Command Line Options
@comment  node-name,  next,  previous,  up
@section @code{-F} @var{conf-file}
@cindex Amd configuration file; specifying name
@cindex Amd configuration file
@cindex amd.conf file

Specify an @i{Amd} configuration file @var{conf-file} to use.  For a
description of the format and syntax, @pxref{Amd Configuration File}.
This configuration file is used to specify any options in lieu of typing
many of them on the command line.  The @file{amd.conf} file includes
directives for every command line option @i{Amd} has, and many more that
are only available via the configuration file facility.  The
configuration file specified by this option is processed after all other
options had been processed, regardless of the actual location of this
option on the command line.

@c ----------------------------------------------------------------
@node -H Option, -O Option, -F Option, Amd Command Line Options
@comment  node-name,  next,  previous,  up
@section @code{-H}
@cindex Displaying brief help
@cindex Help; showing from Amd

Print a brief help and usage string.

@c ----------------------------------------------------------------
@node -O Option, -S Option, -H Option, Amd Command Line Options
@comment  node-name,  next,  previous,  up
@section @code{-O} @var{op-sys-name}
@cindex Operating System name
@cindex Setting the Operating System name

Overrides the compiled-in name of the operating system, with
@var{op-sys-name}.  Useful when the built-in name is not desired for
backward compatibility reasons.  For example, if the build in name is
@samp{sunos5}, you can override it to the old name @samp{sos5}, and use
older maps which were written with the latter in mind.

@c ----------------------------------------------------------------
@node -S Option, -T Option, -O Option, Amd Command Line Options
@comment  node-name,  next,  previous,  up
@section @code{-S}
@cindex plock; using
@cindex mlockall; using
@cindex locking executable pages in memory

Do @emph{not} lock the running executable pages of @i{Amd} into memory.
To improve @i{Amd}'s performance, systems that support the @b{plock}(3)
or @b{mlockall}(2)
call lock the @i{Amd} process into memory.  This way there is less
chance the operating system will schedule, page out, and swap the
@i{Amd} process as needed.  This tends to improve @i{Amd}'s performance,
at the cost of reserving the memory used by the @i{Amd} process (making
it unavailable for other processes).  If this behavior is not desired,
use the @code{-S} option.

@c ----------------------------------------------------------------
@node -T Option, , -S Option, Amd Command Line Options
@comment  node-name,  next,  previous,  up
@section @code{-T} @var{tag}
@cindex Tags for Amd configuration file
@cindex Configuration file; tags

Specify a tag to use with @file{amd.conf}.  All map entries tagged with
@var{tag} will be processed.  Map entries that are not tagged are always
processed.  Map entries that are tagged with a tag other than @var{tag}
will not be processed.

@c ################################################################
@node Filesystem Types, Amd Configuration File, Amd Command Line Options, Top
@comment  node-name,  next,  previous,  up
@chapter Filesystem Types
@cindex Filesystem types
@cindex Mount types
@cindex Types of filesystem

To mount a volume, @i{Amd} must be told the type of filesystem to be
used.  Each filesystem type typically requires additional information
such as the fileserver name for NFS.

From the point of view of @i{Amd}, a @dfn{filesystem} is anything that
can resolve an incoming name lookup.  An important feature is support
for multiple filesystem types.  Some of these filesystems are
implemented in the local kernel and some on remote fileservers, whilst
the others are implemented internally by @i{Amd}.@refill

The two common filesystem types are UFS and NFS.  Four other user
accessible filesystems (@samp{link}, @samp{program}, @samp{auto} and
@samp{direct}) are also implemented internally by @i{Amd} and these are
described below.  There are two additional filesystem types internal to
@i{Amd} which are not directly accessible to the user (@samp{inherit}
and @samp{error}).  Their use is described since they may still have an
effect visible to the user.@refill

@menu
* Network Filesystem::          A single NFS filesystem.
* Network Host Filesystem::     NFS mount a host's entire export tree.
* Network Filesystem Group::    An atomic group of NFS filesystems.
* Unix Filesystem::             Native disk filesystem.
* Caching Filesystem::          Caching from remote server filesystem.
* CD-ROM Filesystem::           ISO9660 CD ROM.
* UDF Filesystem::              Universal Disk Format filesystem.
* Loopback Filesystem::         Local loopback-mount filesystem.
* Memory/RAM Filesystem::       A memory or RAM-based filesystem.
* Null Filesystem::             4.4BSD's loopback-mount filesystem.
* Floppy Filesystem::           MS-DOS Floppy filesystem.
* Translucent Filesystem::      The directory merging filesystem.
* Shared Memory+Swap Filesystem:: Sun's tmpfs filesystem.
* User ID Mapping Filesystem::  4.4BSD's umapfs filesystem.
* Program Filesystem::          Generic Program mounts.
* Symbolic Link Filesystem::    Local link.
* Symbolic Link Filesystem II:: Local link referencing existing filesystem.
* NFS-Link Filesystem::         Link if path exists, NFS otherwise.
* Automount Filesystem::
* Direct Automount Filesystem::
* Union Filesystem::
* Error Filesystem::
* Top-level Filesystem::
* Root Filesystem::
* Inheritance Filesystem::
@end menu

@c ----------------------------------------------------------------
@node Network Filesystem, Network Host Filesystem, Filesystem Types, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Network Filesystem (@samp{nfs})
@cindex NFS
@cindex Mounting an NFS filesystem
@cindex How to mount and NFS filesystem
@cindex nfs, filesystem type
@cindex Filesystem type; nfs

The @dfn{nfs} (@samp{type:=nfs}) filesystem type provides access to Sun's NFS.

@noindent
The following options must be specified:

@table @code
@cindex rhost, mount option
@cindex Mount option; rhost
@item rhost
the remote fileserver.  This must be an entry in the hosts database.  IP
addresses are not accepted.  The default value is taken
from the local host name (@code{$@{host@}}) if no other value is
specified.

@cindex rfs, mount option
@cindex Mount option; rfs
@item rfs
the remote filesystem.
If no value is specified for this option, an internal default of
@code{$@{path@}} is used.
@end table

NFS mounts require a two stage process.  First, the @dfn{file handle} of
the remote file system must be obtained from the server.  Then a mount
system call must be done on the local system.  @i{Amd} keeps a cache
of file handles for remote file systems.  The cache entries have a
lifetime of a few minutes.

If a required file handle is not in the cache, @i{Amd} sends a request
to the remote server to obtain it.
@c  @i{Amd} @dfn{does not} wait for
@c a response; it notes that one of the locations needs retrying, but
@c continues with any remaining locations.  When the file handle becomes
@c available, and assuming none of the other locations was successfully
@c mounted, @i{Amd} will retry the mount.  This mechanism allows several
@c NFS filesystems to be mounted in parallel.
@c @footnote{The mechanism
@c is general, however NFS is the only filesystem
@c for which the required hooks have been written.}
@c The first one which responds with a valid file handle will be used.

Historically, this documentation has maintained that @i{Amd} will try
all the locations in parallel and use the first one which responds
with a valid file handle. This has not been the case for quite some
time, however. Instead, @i{Amd} will go through each location, one by
one, and will only skip to the next one if the previous one either
fails or times out.

@noindent
An NFS entry might be:

@example
jsp  host!=charm;type:=nfs;rhost:=charm;rfs:=/home/charm;sublink:=jsp
@end example

The mount system call and any unmount attempts are always done
in a new task to avoid the possibility of blocking @i{Amd}.

@c ----------------------------------------------------------------
@node Network Host Filesystem, Network Filesystem Group, Network Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Network Host Filesystem (@samp{host})
@cindex Network host filesystem
@cindex Mounting entire export trees
@cindex How to mount all NFS exported filesystems
@cindex host, filesystem type
@cindex Filesystem type; host

@c NOTE: the current implementation of the @dfn{host} filesystem type
@c sometimes fails to maintain a consistent view of the remote mount tree.
@c This happens when the mount times out and only some of the remote mounts
@c are successfully unmounted.  To prevent this from occurring, use the
@c @samp{nounmount} mount option.

The @dfn{host} (@samp{type:=host}) filesystem allows access to the entire export tree of an
NFS server.  The implementation is layered above the @samp{nfs}
implementation so keep-alives work in the same way.  The only option
which needs to be specified is @samp{rhost} which is the name of the
fileserver to mount.

The @samp{host} filesystem type works by querying the mount daemon on
the given fileserver to obtain its export list.  @i{Amd} then obtains
filehandles for each of the exported filesystems.  Any errors at this
stage cause that particular filesystem to be ignored.  Finally each
filesystem is mounted.  Again, errors are logged but ignored.  One
common reason for mounts to fail is that the mount point does not exist.
Although @i{Amd} attempts to automatically create the mount point, it
may be on a remote filesystem to which @i{Amd} does not have write
permission.

When an attempt to unmount a @samp{host} filesystem mount fails, @i{Amd}
remounts any filesystems which had successfully been unmounted.  To do
this @i{Amd} queries the mount daemon again and obtains a fresh copy of
the export list.  @i{Amd} then tries to mount any exported filesystems
which are not currently mounted.

Sun's automounter provides a special @samp{-hosts} map.  To achieve the
same effect with @i{Amd} requires two steps.  First a mount map must
be created as follows:

@example
*       type:=host;rhost:=$@{key@};fs:=$@{autodir@}/$@{rhost@}/root
@end example

@noindent
and then start @i{Amd} with the following command

@example
amd /net net.map
@end example

@noindent
where @samp{net.map} is the name of map described above.  Note that the
value of @code{$@{fs@}} is overridden in the map.  This is done to avoid
a clash between the mount tree and any other filesystem already mounted
from the same fileserver.

If different mount options are needed for different hosts then
additional entries can be added to the map, for example

@example
host2       opts:=ro,nosuid,soft
@end example

@noindent
would soft mount @samp{host2} read-only.

@c ----------------------------------------------------------------
@node Network Filesystem Group, Unix Filesystem, Network Host Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Network Filesystem Group (@samp{nfsx})
@cindex Network filesystem group
@cindex Atomic NFS mounts
@cindex Mounting an atomic group of NFS filesystems
@cindex How to mount an atomic group of NFS filesystems
@cindex nfsx, filesystem type
@cindex Filesystem type; nfsx

The @dfn{nfsx} (@samp{type:=nfsx}) filesystem allows a group of filesystems to be mounted
from a single NFS server.  The implementation is layered above the
@samp{nfs} implementation so keep-alives work in the same way.

@emph{WARNING}: @samp{nfsx} is meant to be a ``last resort'' kind of
solution. It is racy and poorly supported. The authors @emph{highly}
recommend that other solutions be considered before relying on it.

The options are the same as for the @samp{nfs} filesystem with one
difference for @samp{rfs}, as explained below.

@noindent
The following options should be specified:

@table @code
@item rhost
the remote fileserver.  The default value is taken from the local
host name (@code{$@{host@}}) if no other value is specified.

@item rfs
is a list of filesystems to mount, and must be specified.
The list is in the form of a comma separated strings.
@end table

@noindent
For example:

@example
pub  type:=nfsx;rhost:=gould;\
     rfs:=/public,/,graphics,usenet;fs:=$@{autodir@}/$@{rhost@}/root
@end example

The first string defines the root of the tree, and is applied as a
prefix to the remaining members of the list which define the individual
filesystems.  The first string is @emph{not} used as a filesystem name.
A serial operation is used to determine the local mount points to
ensure a consistent layout of a tree of mounts.

Here, the @emph{three} filesystems, @samp{/public},
@samp{/public/graphics} and @samp{/public/usenet}, would be mounted.@refill

A local mount point, @code{$@{fs@}}, @emph{must} be specified.  The
default local mount point will not work correctly in the general case.
A suggestion is to use @samp{fs:=$@{autodir@}/$@{rhost@}/root}.@refill

@c ----------------------------------------------------------------
@node Unix Filesystem, Caching Filesystem, Network Filesystem Group, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Unix Filesystem (@samp{ufs}, @samp{xfs}, or @samp{efs})
@cindex Unix filesystem
@cindex UFS
@cindex XFS
@cindex EFS
@cindex Mounting a UFS filesystem
@cindex Mounting a local disk
@cindex How to mount a UFS filesystems
@cindex How to mount a local disk
@cindex Disk filesystems
@cindex ufs, filesystem type
@cindex Filesystem type; ufs
@cindex xfs, filesystem type
@cindex Filesystem type; xfs
@cindex efs, filesystem type
@cindex Filesystem type; efs

The @dfn{ufs} (@samp{type:=ufs}) filesystem type provides access to the system's standard
disk filesystem---usually a derivative of the Berkeley Fast Filesystem.

@noindent
The following option must be specified:

@table @code
@cindex dev, mount option
@cindex Mount option; dev
@item dev
the block special device to be mounted.
@end table

A UFS entry might be:

@example
jsp   host==charm;type:=ufs;dev:=/dev/sd0d;sublink:=jsp
@end example

UFS is the default Unix disk-based file system, which Am-utils picks up
during the autoconfiguration phase.  Some systems have more than one
type, such as IRIX, that comes with EFS (Extent File System) and XFS
(Extended File System).  In those cases, you may explicitly set the file
system type, by using entries such:

@example
ez1   type:=efs;dev:=/dev/xd0a
ez2   type:=xfs;dev:=/dev/sd3c
@end example

The UFS/XFS/EFS filesystems are never timed out by default, i.e. they
will never be unmounted by @i{Amd}. If automatic unmounting is
desired, the ``unmount'' option should be added to the mount options
for the entry.

@c ----------------------------------------------------------------
@node Caching Filesystem, CD-ROM Filesystem, Unix Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Caching Filesystem (@samp{cachefs})
@cindex Caching Filesystem
@cindex cachefs, filesystem type
@cindex Filesystem type; cachefs

The @dfn{cachefs} (@samp{type:=cachefs}) filesystem caches files from
one location onto another, presumably providing faster access.  It is
particularly useful to cache from a larger and remote (slower) NFS
partition to a smaller and local (faster) UFS directory.

@noindent
The following options must be specified:

@table @code
@cindex cachedir, mount option
@cindex Mount option; cachedir
@item cachedir
the directory where the cache is stored.
@item rfs
the path name to the ``back file system'' to be cached from.
@item fs
the ``front file system'' mount point to the cached files, where @i{Amd}
will set a symbolic link pointing to.
@end table

A CacheFS entry for, say, the @file{/import} @i{Amd} mount point, might
be:

@example
copt  type:=cachefs;cachedir:=/cache;rfs:=/import/opt;fs:=/n/import/copt
@end example

Access to the pathname @file{/import/copt} will follow a symbolic link
to @file{/n/import/copt}.  The latter is the mount point for a caching
file system, that caches from @file{/import/opt} to @file{/cache}.

The cachefs filesystem is never timed out by default, i.e. it will
never be unmounted by @i{Amd}. If automatic unmounting is desired, the
``unmount'' option should be added to the mount options for the entry.

@b{Caveats}:
@enumerate
@item This file system is currently only implemented for Solaris 2.x!
@item Before being used for the first time, the cache directory @i{must} be
initialized with @samp{cfsadmin -c @var{cachedir}}.  See the manual page for
@b{cfsadmin}(1M) for more information.
@item The ``back file system'' mounted must be a complete file system, not
a subdirectory thereof; otherwise you will get an error ``Invalid Argument''.
@item If @i{Amd} aborts abnormally, the state of the cache may be
inconsistent, requiring running the command @file{fsck -F cachefs
@var{cachedir}}.  Otherwise you will get the error ``No Space Left on Device''.
@end enumerate

@c ----------------------------------------------------------------
@node CD-ROM Filesystem, UDF Filesystem, Caching Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section CD-ROM Filesystem (@samp{cdfs})
@cindex CD-ROM Filesystem
@cindex cdfs, filesystem type
@cindex Filesystem type; cdfs

The @dfn{cdfs} (@samp{type:=cdfs}) filesystem mounts a CD-ROM with an
ISO9660 format filesystem on it.

@noindent
The following option must be specified:

@table @code
@cindex dev, mount option
@cindex Mount option; dev
@item dev
the block special device to be mounted.
@end table

Some operating systems will fail to mount read-only CDs unless the
@samp{ro} option is specified.  A cdfs entry might be:

@example
cdfs      os==sunos4;type:=cdfs;dev:=/dev/sr0 \
          os==sunos5;addopts:=ro;type:=cdfs;dev:=/dev/dsk/c0t6d0s2
@end example

@c ----------------------------------------------------------------
@node UDF Filesystem, Loopback Filesystem, CD-ROM Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section CD-ROM Filesystem (@samp{udf})
@cindex CD-ROM Filesystem
@cindex udf, filesystem type
@cindex Filesystem type; udf

The @dfn{udf} (@samp{type:=udf}) filesystem mounts media with a
Universal Disk Format (UDF) filesystem on it, e.g., a video DVD.

@noindent
The following option must be specified:

@table @code
@cindex dev, mount option
@cindex Mount option; dev
@item dev
the block special device to be mounted.
@end table

Some operating systems will fail to mount read-only media unless the
@samp{ro} option is specified.  A udf entry might be:

@example
udf      os==sunos4;type:=udf;dev:=/dev/sr0 \
         os==sunos5;addopts:=ro;type:=udf;dev:=/dev/dsk/c0t6d0s2
@end example

@c ----------------------------------------------------------------
@node Loopback Filesystem, Memory/RAM Filesystem, UDF Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Loopback Filesystem (@samp{lofs})
@cindex Loopback Filesystem
@cindex lofs, filesystem type
@cindex Filesystem type; lofs

The @dfn{lofs} (@samp{type:=lofs}) filesystem is also called the
loopback filesystem.  It mounts a local directory on another, thus
providing mount-time binding to another location (unlike symbolic
links).

The loopback filesystem is particularly useful within the context of a
chroot-ed directory (via @b{chroot}(2)), to provide access to
directories otherwise inaccessible.

@noindent
The following option must be specified:

@table @code
@cindex rfs, mount option
@cindex Mount option; rfs
@item rfs
the pathname to be mounted on top of @code{$@{fs@}}.
@end table

Usually, the FTP server runs in a chroot-ed environment, for security
reasons.  In this example, lofs is used to provide a subdirectory within
a user's home directory, also available for public ftp.

@example
lofs      type:=lofs;rfs:=/home/ezk/myftpdir;fs:=/usr/ftp/pub/ezk
@end example

@c ----------------------------------------------------------------
@node Memory/RAM Filesystem, Null Filesystem, Loopback Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Memory/RAM Filesystem (@samp{mfs})
@cindex Memory/RAM Filesystem
@cindex mfs, filesystem type
@cindex Filesystem type; mfs

The @dfn{mfs} (@samp{type:=mfs}) filesystem is available in 4.4BSD,
Linux, and other systems.  It creates a filesystem in a portion of the
system's memory, thus providing very fast file (volatile) access.

XXX: THIS FILESYSTEM IS NOT IMPLEMENTED YET!

@c ----------------------------------------------------------------
@node Null Filesystem, Floppy Filesystem, Memory/RAM Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Null Filesystem (@samp{nullfs})
@cindex Null Filesystem
@cindex nullfs, filesystem type
@cindex Filesystem type; nullfs

The @dfn{nullfs} (@samp{type:=nullfs}) filesystem is available from 4.4BSD,
and is very similar to the loopback filesystem, @dfn{lofs}.

XXX: THIS FILESYSTEM IS NOT IMPLEMENTED YET!

@c ----------------------------------------------------------------
@node Floppy Filesystem, Translucent Filesystem, Null Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Floppy Filesystem (@samp{pcfs})
@cindex Floppy Filesystem
@cindex pcfs, filesystem type
@cindex Filesystem type; pcfs

The @dfn{pcfs} (@samp{type:=pcfs}) filesystem mounts a floppy previously
formatted for the MS-DOS format.

@noindent
The following option must be specified:

@table @code
@cindex dev, mount option
@cindex Mount option; dev
@item dev
the block special device to be mounted.
@end table

A pcfs entry might be:

@example
pcfs      os==sunos4;type:=pcfs;dev:=/dev/fd0 \
          os==sunos5;type:=pcfs;dev:=/dev/diskette
@end example

@c ----------------------------------------------------------------
@node Translucent Filesystem, Shared Memory+Swap Filesystem, Floppy Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Translucent Filesystem (@samp{tfs})
@cindex Translucent Filesystem
@cindex tfs, filesystem type
@cindex Filesystem type; tfs

The @dfn{tfs} (@samp{type:=tfs}) filesystem is an older version of the
4.4BSD @dfn{unionfs}.

XXX: THIS FILESYSTEM IS NOT IMPLEMENTED YET!

@c ----------------------------------------------------------------
@node Shared Memory+Swap Filesystem, User ID Mapping Filesystem, Translucent Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Shared Memory+Swap Filesystem (@samp{tmpfs})
@cindex Shared Memory and Swap Filesystem
@cindex tmpfs, filesystem type
@cindex Filesystem type; tmpfs

The @dfn{tmpfs} (@samp{type:=tmpfs}) filesystem shares memory between a
the swap device and the rest of the system.  It is generally used to
provide a fast access @file{/tmp} directory, one that uses memory that
is otherwise unused.  This filesystem is available in SunOS 4.x and 5.x.

XXX: THIS FILESYSTEM IS NOT IMPLEMENTED YET!

@c ----------------------------------------------------------------
@node User ID Mapping Filesystem, Program Filesystem, Shared Memory+Swap Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section User ID Mapping Filesystem (@samp{umapfs})
@cindex User ID Mapping Filesystem
@cindex umapfs, filesystem type
@cindex Filesystem type; umapfs

The @dfn{umapfs} (@samp{type:=umapfs}) filesystem maps User IDs of file
ownership, and is available from 4.4BSD.

XXX: THIS FILESYSTEM IS NOT IMPLEMENTED YET!

@c ----------------------------------------------------------------
@node Program Filesystem, Symbolic Link Filesystem, User ID Mapping Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Program Filesystem (@samp{program})
@cindex Program filesystem
@cindex Mount a filesystem under program control
@cindex program, filesystem type
@cindex Filesystem type; program

The @dfn{program} (@samp{type:=program}) filesystem type allows a
program to be run whenever a mount or unmount is required.  This allows
easy addition of support for other filesystem types, such as MIT's
Remote Virtual Disk (RVD) which has a programmatic interface via the
commands @samp{rvdmount} and @samp{rvdunmount}.

@noindent
Both of the following options must be specified:

@table @code
@cindex mount, mount option
@cindex Mount option; mount
@item mount
the program which will perform the mount.

@cindex unmount, mount option
@cindex umount, mount option
@cindex Mount option; unmount
@cindex Mount option; umount
@item unmount
@item umount
the program which will perform the unmount.  For convenience, you may
use either @samp{unmount} or @samp{umount} but not both.  If neither
is defined, @i{Amd} will default to @samp{umount $@{fs@}} (the actual
unmount program pathname will be automatically determined at the time
GNU @code{configure} runs.)
@end table

The exit code from these two programs is interpreted as a Unix error
code.  As usual, exit code zero indicates success.  To execute the
program, @i{Amd} splits the string on whitespace to create an array of
substrings.  Single quotes @samp{'} can be used to quote whitespace
if that is required in an argument.  There is no way to escape or change
the single quote character.

To run e.g. the program @samp{rvdmount} with a host name and filesystem as
arguments, it would be specified by
@samp{fs:=$@{autodir@}$@{path@};type:=program;mount:="/etc/rvdmount
rvdmount fserver $@{fs@}";unmount:="/etc/rdvumount rvdumount $@{fs@}"}.

The first element in the array is taken as the pathname of the program
to execute.  The other members of the array form the argument vector
to be passed to the program, @dfn{including argument zero}.  The array
is exactly the same as the array passed to the execv() system call
(man execv for details).  The split string must have at least two
elements.  The programs are directly executed by @i{Amd}, not via a
shell.  Therefore, if a script is to be used as a mount/umount
program, it @dfn{must} begin with a @code{#!} interpreter specification.

Often, this program mount type is used for Samba mounts, where you
need a double slash in pathnames.  However, @i{Amd} normalizes
sequences of slashes into one slash.  Therefore, you must use an
escaped slash, preceded by an escaped backslash.  So to get a double
slash in the mount command, you need the eight character sequence
@samp{\\\/\\\/} in your map.  For example:

@samp{mount="/sbin/mount mount -r -t smbfs -o-N,-Ihostname \\\/\\\/guest@@venus/mp3"}

If a filesystem type is to be heavily used, it may be worthwhile adding
a new filesystem type into @i{Amd}, but for most uses the program
filesystem should suffice.

When the program is run, standard input and standard error are inherited
from the current values used by @i{Amd}.  Standard output is a
duplicate of standard error.  The value specified with the @code{-l}
command line option has no effect on standard error.

@i{Amd} guarantees that the mountpoint will be created before calling
the mount program, and that it will be removed after the umount
program returns success.

@c ----------------------------------------------------------------
@node Symbolic Link Filesystem, Symbolic Link Filesystem II, Program Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Symbolic Link Filesystem (@samp{link})
@cindex Symbolic link filesystem
@cindex Referencing part of the local name space
@cindex Mounting part of the local name space
@cindex How to reference part of the local name space
@cindex link, filesystem type
@cindex symlink, link filesystem type
@cindex Filesystem type; link

Each filesystem type creates a symbolic link to point from the volume
name to the physical mount point.  The @samp{link} filesystem does the
same without any other side effects.  This allows any part of the
machines name space to be accessed via @i{Amd}.

One common use for the symlink filesystem is @file{/homes} which can be
made to contain an entry for each user which points to their
(auto-mounted) home directory.  Although this may seem rather expensive,
it provides a great deal of administrative flexibility.

@noindent
The following option must be defined:

@table @code
@item fs
The value of @var{fs} option specifies the destination of the link, as
modified by the @var{sublink} option.  If @var{sublink} is non-null, it
is appended to @code{$@{fs@}}@code{/} and the resulting string is used
as the target.
@end table

The @samp{link} filesystem can be thought of as identical to the
@samp{ufs} filesystem but without actually mounting anything.

An example entry might be:

@example
jsp   host==charm;type:=link;fs:=/home/charm;sublink:=jsp
@end example
which would return a symbolic link pointing to @file{/home/charm/jsp}.

@c ----------------------------------------------------------------
@node Symbolic Link Filesystem II, NFS-Link Filesystem, Symbolic Link Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Symbolic Link Filesystem II (@samp{linkx})
@cindex Symbolic link filesystem II
@cindex Referencing an existing part of the local name space
@cindex Mounting an existing part of the local name space
@cindex How to reference an existing part of the local name space
@cindex linkx, filesystem type
@cindex symlink, linkx filesystem type
@cindex Filesystem type; linkx

The @dfn{linkx} (@samp{type:=linkx}) filesystem type is identical to @samp{link} with the
exception that the target of the link must exist.  Existence is checked
with the @b{lstat}(2) system call.

The @samp{linkx} filesystem type is particularly useful for wildcard map
entries.  In this case, a list of possible targets can be given and
@i{Amd} will choose the first one which exists on the local machine.

@c ----------------------------------------------------------------
@node NFS-Link Filesystem, Automount Filesystem, Symbolic Link Filesystem II, Filesystem Types
@comment  node-name,  next,  previous,  up
@section NFS-Link Filesystem (@samp{nfsl})
@cindex NFS-Link filesystem II
@cindex Referencing an existing part of the name space if target exists
@cindex Mounting a remote part of the name space if target is missing
@cindex Symlink if target exists, NFS otherwise
@cindex nfsl, filesystem type
@cindex symlink, nfsl filesystem type
@cindex Filesystem type; nfsl

The @dfn{nfsl} (@samp{type:=nfsl}) filesystem type is a combination of two others:
@samp{link} and @samp{nfs}.  If the local host name is equal to the
value of @code{$@{rhost@}} @emph{and} the target pathname listed in
@code{$@{fs@}} exists, @samp{nfsl} will behave exactly as
@samp{type:=link}, and refer to the target as a symbolic link.  If the
local host name is not equal to the value of @code{$@{rhost@}}, or if
the target of the link does not exist, @i{Amd} will treat it as
@samp{type:=nfs}, and will mount a remote pathname for it.

The @samp{nfsl} filesystem type is particularly useful as a shorthand
for the more cumbersome and yet one of the most popular @i{Amd}
entries.  For example, you can simplify all map entries that look like:

@example
zing    -fs:=/n/shekel/u/zing \
        host!=shekel;type:=nfs;rhost:=shekel;rfs:=$@{fs@} \
        host==shekel;type:=link
@end example

or

@example
zing    -fs:=/n/shekel/u/zing \
        exists($@{fs@});type:=link \
        !exists($@{fs@});type:=nfs;rhost:=shekel;rfs:=$@{fs@}
@end example

into a shorter form

@example
zing    type:=nfsl;fs:=/n/shekel/u/zing;rhost:=shekel;rfs:=$@{fs@}
@end example

Not just does it make the maps smaller and simpler, but it avoids
possible mistakes that often happen when forgetting to set up the two
entries (one for @samp{type:=nfs} and the other for @samp{type:=link})
necessary to perform transparent mounts of existing or remote mounts.

@c ----------------------------------------------------------------
@node Automount Filesystem, Direct Automount Filesystem, NFS-Link Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Automount Filesystem (@samp{auto})
@cindex Automount filesystem
@cindex Map cache types
@cindex Setting map cache parameters
@cindex How to set map cache parameters
@cindex How to start an indirect automount point
@cindex auto, filesystem type
@cindex Filesystem type; auto
@cindex SIGHUP signal
@cindex Map cache synchronizing
@cindex Synchronizing the map cache
@cindex Map cache options
@cindex Regular expressions in maps

The @dfn{auto} (@samp{type:=auto}) filesystem type creates a new automount point below an
existing automount point.  Top-level automount points appear as system
mount points.  An automount mount point can also appear as a
sub-directory of an existing automount point.  This allows some
additional structure to be added, for example to mimic the mount tree of
another machine.

The following options may be specified:

@table @code
@cindex cache, mount map option
@cindex Mount map option; cache
@item cache
specifies whether the data in this mount-map should be
cached.  The default value is @samp{none}, in which case
no caching is done in order to conserve memory.

However, better performance and reliability can be obtained by caching
some or all of a mount-map.

If the cache option specifies @samp{all},
the entire map is enumerated when the mount point is created.

If the cache option specifies @samp{inc}, caching is done incrementally
as and when data is required.
Some map types do not support cache mode @samp{all}, in which case @samp{inc}
is used whenever @samp{all} is requested.

Caching can be entirely disabled by using cache mode @samp{none}.

If the cache option specifies @samp{regexp} then the entire map will be
enumerated and each key will be treated as an egrep-style regular
expression.  The order in which a cached map is searched does not
correspond to the ordering in the source map so the regular expressions
should be mutually exclusive to avoid confusion.

Each mount map type has a default cache type, usually @samp{inc}, which
can be selected by specifying @samp{mapdefault}.

The cache mode for a mount map can only be selected on the command line.
Starting @i{Amd} with the command:

@example
amd /homes hesiod.homes -cache:=inc
@end example

will cause @samp{/homes} to be automounted using the @dfn{Hesiod} name
server with local incremental caching of all successfully resolved names.

All cached data is forgotten whenever @i{Amd} receives a @samp{SIGHUP}
signal and, if cache @samp{all} mode was selected, the cache will be
reloaded.  This can be used to inform @i{Amd} that a map has been
updated.  In addition, whenever a cache lookup fails and @i{Amd} needs
to examine a map, the map's modify time is examined.  If the cache is
out of date with respect to the map then it is flushed as if a
@samp{SIGHUP} had been received.

An additional option (@samp{sync}) may be specified to force @i{Amd} to
check the map's modify time whenever a cached entry is being used.  For
example, an incremental, synchronized cache would be created by the
following command:

@example
amd /homes hesiod.homes -cache:=inc,sync
@end example

@item fs
specifies the name of the mount map to use for the new mount point.

Arguably this should have been specified with the @code{$@{rfs@}} option but
we are now stuck with it due to historical accident.

@c %If the string @samp{.} is used then the same map is used;
@c %in addition the lookup prefix is set to the name of the mount point followed
@c %by a slash @samp{/}.
@c %This is the same as specifying @samp{fs:=\$@{map@};pref:=\$@{key@}/}.
@c

@item pref
alters the name that is looked up in the mount map.  If
@code{$@{pref@}}, the @dfn{prefix}, is non-null then it is prepended
to the name requested by the kernel @dfn{before} the map is
searched. The default prefix is the prefix of the parent map (if any)
with name of the auto node appended to it. That means if you want no
prefix you must say so in the map: @samp{pref:=null}.

@item opts
Normally, @samp{auto} style maps are not browsable even if you turn on
directory browsability (@pxref{browsable_dirs Parameter}).  To enable
browsing entries in @samp{auto} maps, specify @samp{opts:=browsable}
or @samp{opts:=fullybrowsable} in
the description of this map.

@end table

The server @samp{dylan.doc.ic.ac.uk} has two user disks:
@samp{/dev/dsk/2s0} and @samp{/dev/dsk/5s0}.  These are accessed as
@samp{/home/dylan/dk2} and @samp{/home/dylan/dk5} respectively.  Since
@samp{/home} is already an automount point, this naming is achieved with
the following map entries:@refill

@example
dylan        type:=auto;fs:=$@{map@};pref:=$@{key@}/
dylan/dk2    type:=ufs;dev:=/dev/dsk/2s0
dylan/dk5    type:=ufs;dev:=/dev/dsk/5s0
@end example

@c ----------------------------------------------------------------
@node Direct Automount Filesystem, Union Filesystem, Automount Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Direct Automount Filesystem (@samp{direct})
@cindex Direct automount filesystem
@cindex How to start a direct automount point
@cindex direct, filesystem type
@cindex Filesystem type; direct

The @dfn{direct} (@samp{type:=direct}) filesystem is almost identical to
the automount filesystem.  Instead of appearing to be a directory of
mount points, it appears as a symbolic link to a mounted filesystem.
The mount is done at the time the link is accessed.  @xref{Automount
Filesystem}, for a list of required options.

Direct automount points are created by specifying the @samp{direct}
filesystem type on the command line:

@example
amd ... /usr/man auto.direct -type:=direct
@end example

where @samp{auto.direct} would contain an entry such as:

@example
usr/man    -type:=nfs;rfs:=/usr/man \
           rhost:=man-server1  rhost:=man-server2
@end example

In this example, @samp{man-server1} and @samp{man-server2} are file
servers which export copies of the manual pages.  Note that the key
which is looked up is the name of the automount point without the
leading @samp{/}.

Note that the implementation of the traditional @dfn{direct} filesystem is
essentially a hack (pretending that the root of an NFS filesystem is a
symlink) and many modern operating systems get very unhappy about
it. For example, Linux kernel 2.4+ completely disallows it, and Solaris
2.8 fails to unmount it when @i{Amd} shuts down. Therefore, the use of
the traditional @dfn{direct} filesystem is strongly discouraged; it is
only semi-supported, at best.

The autofs implementations that permit direct mounts are fully
supported, however. That currently includes all versions of
Solaris. Linux autofs does NOT support direct mounts at all.

@c ----------------------------------------------------------------
@node Union Filesystem, Error Filesystem, Direct Automount Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Union Filesystem (@samp{union})
@cindex Union filesystem
@cindex union, filesystem type
@cindex Filesystem type; union

The @dfn{union} (@samp{type:=union}) filesystem type allows the contents of several
directories to be merged and made visible in a single directory.  This
can be used to overcome one of the major limitations of the Unix mount
mechanism which only allows complete directories to be mounted.

For example, supposing @file{/tmp} and @file{/var/tmp} were to be merged
into a new directory called @file{/mtmp}, with files in @file{/var/tmp}
taking precedence.  The following command could be used to achieve this
effect:

@example
amd ... /mtmp union:/tmp:/var/tmp -type:=union
@end example

Currently, the unioned directories must @emph{not} be automounted.  That
would cause a deadlock.  This seriously limits the current usefulness of
this filesystem type and the problem will be addressed in a future
release of @i{Amd}.

Files created in the union directory are actually created in the last
named directory.  This is done by creating a wildcard entry which points
to the correct directory.  The wildcard entry is visible if the union
directory is listed, so allowing you to see which directory has
priority.

The files visible in the union directory are computed at the time
@i{Amd} is started, and are not kept up-to-date with respect to the
underlying directories.  Similarly, if a link is removed, for example
with the @samp{rm} command, it will be lost forever.

@c ----------------------------------------------------------------
@node Error Filesystem, Top-level Filesystem, Union Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Error Filesystem (@samp{error})
@cindex Error filesystem
@cindex error, filesystem type
@cindex Filesystem type; error

The @dfn{error} (@samp{type:=error}) filesystem type is used internally as a catch-all in the
case where none of the other filesystems was selected, or some other
error occurred.  Lookups and mounts always fail with ``No such file or
directory''.  All other operations trivially succeed.

The error filesystem is not directly accessible.

@c ----------------------------------------------------------------
@node Top-level Filesystem, Root Filesystem, Error Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Top-level Filesystem (@samp{toplvl})
@cindex Top level filesystem
@cindex toplvl, filesystem type
@cindex Filesystem type; toplvl

The @dfn{toplvl} (@samp{type:=toplvl}) filesystems is derived from the @samp{auto} filesystem
and is used to mount the top-level automount nodes.  Requests of this
type are automatically generated from the command line arguments.

@c ----------------------------------------------------------------
@node Root Filesystem, Inheritance Filesystem, Top-level Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Root Filesystem (@samp{root})
@cindex Root filesystem
@cindex root, filesystem type
@cindex Filesystem type; root

The @dfn{root} (@samp{type:=root}) filesystem type acts as an internal
placeholder onto which @i{Amd} can pin @samp{toplvl} mounts.  Only one
node of this type need ever exist and one is created automatically
during startup.  The effect of having more than one root node is
undefined.

The root filesystem is not directly accessible.

@c ----------------------------------------------------------------
@node Inheritance Filesystem, , Root Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Inheritance Filesystem (@samp{inherit})
@cindex Inheritance filesystem
@cindex Nodes generated on a restart
@cindex inherit, filesystem type
@cindex Filesystem type; inherit

The @dfn{inheritance} (@samp{type:=inherit}) filesystem is not directly
accessible.  Instead, internal mount nodes of this type are
automatically generated when @i{Amd} is started with the @code{-r} option.
At this time the system mount table is scanned to locate any filesystems
which are already mounted.  If any reference to these filesystems is
made through @i{Amd} then instead of attempting to mount it, @i{Amd}
simulates the mount and @dfn{inherits} the filesystem.  This allows a
new version of @i{Amd} to be installed on a live system simply by
killing the old daemon with @samp{SIGTERM} and starting the new one.@refill

This filesystem type is not generally visible externally, but it is
possible that the output from @samp{amq -m} may list @samp{inherit} as
the filesystem type.  This happens when an inherit operation cannot
be completed for some reason, usually because a fileserver is down.

@c ################################################################
@node Amd Configuration File, Run-time Administration, Filesystem Types, Top
@comment  node-name,  next,  previous,  up
@chapter Amd Configuration File
@cindex  Amd Configuration File
@cindex amd.conf

The @samp{amd.conf} file is the configuration file for @i{Amd}, as part
of the am-utils suite.  This file contains runtime configuration
information for the @i{Amd} automounter program.

@menu
* File Format::
* The Global Section::
* Regular Map Sections::
* Common Parameters::
* Global Parameters::
* Regular Map Parameters::
* amd.conf Examples::
@end menu

@c ================================================================
@node File Format, The Global Section, Amd Configuration File, Amd Configuration File
@comment  node-name,  next,  previous,  up
@section File Format
@cindex amd.conf file format

The @samp{amd.conf} file consists of sections and parameters.  A section
begins with the name of the section in square brackets @samp{[]} and
continues until the next section begins or the end of the file is reached.
Sections contain parameters of the form @samp{name = value}.

The file is line-based --- that is, each newline-terminated line
represents either a comment, a section name or a parameter.  No
line-continuation syntax is available.

Section names, parameter names and their values are case sensitive.

Only the first equals sign in a parameter is significant.  Whitespace
before or after the first equals sign is discarded.  Leading, trailing
and internal whitespace in section and parameter names is irrelevant.
Leading and trailing whitespace in a parameter value is discarded.
Internal whitespace within a parameter value is not allowed, unless the
whole parameter value is quoted with double quotes as in @samp{name =
"some value"}.

Any line beginning with a pound sign @samp{#} is ignored, as are lines
containing only whitespace.

The values following the equals sign in parameters are all either a
string (no quotes needed if string does not include spaces) or a
boolean, which may be given as @samp{yes}/@samp{no}.  Case is significant in all
values.  Some items such as cache timeouts are numeric.

@c ================================================================
@node The Global Section, Regular Map Sections, File Format, Amd Configuration File
@comment  node-name,  next,  previous,  up
@section The Global Section
@cindex amd.conf global section

The global section must be specified as @samp{[global]}.  Parameters in
this section either apply to @i{Amd} as a whole, or to all other regular map
sections which follow.  There should be only one global section defined
in one configuration file.

It is highly recommended that this section be specified first in the
configuration file.  If it is not, then regular map sections which
precede it will not use global values defined later.

@c ================================================================
@node Regular Map Sections, Common Parameters, The Global Section, Amd Configuration File
@comment  node-name,  next,  previous,  up
@section Regular Map Sections
@cindex amd.conf regular map sections

Parameters in regular (non-global) sections apply to a single map entry.
For example, if the map section @samp{[/homes]} is defined, then all
parameters following it will be applied to the @file{/homes}
@i{Amd}-managed mount point.

@c ================================================================
@node Common Parameters, Global Parameters, Regular Map Sections, Amd Configuration File
@comment  node-name,  next,  previous,  up
@section Common Parameters
@cindex amd.conf common parameters

These parameters can be specified either in the global or a map-specific
section.  Entries specified in a map-specific section override the default
value or one defined in the global section.   If such a common parameter is
specified only in the global section, it is applicable to all regular map
sections that follow.

@menu
* autofs_use_lofs Parameter::
* browsable_dirs Parameter::
* map_defaults Parameter::
* map_options Parameter::
* map_type Parameter::
* mount_type Parameter::
* search_path Parameter::
* selectors_in_defaults Parameter::
* sun_map_syntax Parameter::
@end menu

@c ----------------------------------------------------------------
@node autofs_use_lofs Parameter, browsable_dirs Parameter, Common Parameters, Common Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{autofs_use_lofs} Parameter
@cindex autofs_use_lofs Parameter

(type=string, default=@samp{yes}).
When set to @samp{yes}, @i{Amd}'s autofs code will use lofs-type
(loopback) mounts for @code{type:=link} mounts, as well as several
other cases that require local references.  This has the advantage
that @i{Amd} does not use a secondary mount point and users do not see
external pathnames (the infamous @code{/bin/pwd} problem, where it
reports a different path than the user chdir'ed into).  One of the
disadvantages of using this option is that the autofs code is
relatively new and the in-place mounts have not been throughly tested.

If this option is set to @samp{no}, then @i{Amd}'s autofs code will
use symlinks instead of lofs-type mounts for local references.  This
has the advantage of using simpler (more stable) code, but at the
expense of negating one of autofs's big advantages: the hiding of
@i{Amd}'s internal paths.  Note that symlinks are not supported in all
autofs implementations, especially those derived from Solaris Autofs
v1.  Also, on Solaris 2.6 and newer, autofs symlinks are not cached,
resulting in repeated up-call requests to @i{Amd}.

@c ----------------------------------------------------------------
@node browsable_dirs Parameter, map_defaults Parameter, autofs_use_lofs Parameter, Common Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{browsable_dirs} Parameter
@cindex browsable_dirs Parameter

(type=string, default=@samp{no}).  If @samp{yes}, then @i{Amd}'s top-level
mount points will be browsable to @b{readdir}(3) calls.  This means you
could run for example @b{ls}(1) and see what keys are available to mount
in that directory.  Not all entries are made visible to @b{readdir}(3):
the @samp{/defaults} entry, wildcard entries, and those with a @file{/}
in them are not included.  If you specify @samp{full} to this option,
all but the @samp{/defaults} entry will be visible.  Note that if you run
a command which will attempt to @b{stat}(2) the entries, such as often
done by @samp{ls -l} or @samp{ls -F}, @i{Amd} will attempt to mount
@i{every} entry in that map.  This is often called a ``mount storm''.

Note that mount storms are mostly avoided by using autofs mounts
(@samp{mount_type = autofs}).

@c ----------------------------------------------------------------
@node map_defaults Parameter, map_options Parameter, browsable_dirs Parameter, Common Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{map_defaults} Parameter
@cindex map_defaults Parameter

(type=string, default to empty).  This option sets a string to be used
as the map's @code{/defaults} entry, overriding any @code{/defaults}
specified in the map.  This allows local users to override a given
map's defaults without modifying maps globally (which is impossible in
sites where the maps are managed by a different administrative group).

@c ----------------------------------------------------------------
@node map_options Parameter, map_type Parameter, map_defaults Parameter, Common Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{map_options} Parameter
@cindex map_options Parameter

(type=string, default no options).  This option is the same as
specifying map options on the command line to @i{Amd}, such as
@samp{cache:=all}.

@c ----------------------------------------------------------------
@node map_type Parameter, mount_type Parameter, map_options Parameter, Common Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{map_type} Parameter
@cindex map_type Parameter

(type=string, default search all map types).  If specified, @i{Amd} will
initialize the map only for the type given.  This is useful to avoid the
default map search type used by @i{Amd} which takes longer and can have
undesired side-effects such as initializing NIS even if not used.
Possible values are

@table @samp
@item file
plain files
@item hesiod
Hesiod name service from MIT
@item ldap
Lightweight Directory Access Protocol
@item ndbm
(New) dbm style hash files
@item nis
Network Information Services (version 2)
@item nisplus
Network Information Services Plus (version 3)
@item passwd
local password files
@item union
union maps
@end table

@c ----------------------------------------------------------------
@node mount_type Parameter, search_path Parameter, map_type Parameter, Common Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{mount_type} Parameter
@cindex mount_type Parameter

(type=string, default=@samp{nfs}).  All @i{Amd} mount types default to NFS.
That is, @i{Amd} is an NFS server on the map mount points, for the local
host it is running on.  If @samp{autofs} is specified, @i{Amd} will be
an autofs server for those mount points.

@c ----------------------------------------------------------------
@node search_path Parameter, selectors_in_defaults Parameter, mount_type Parameter, Common Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{search_path} Parameter
@cindex search_path Parameter

(type=string, default no search path).  This provides a
(colon-delimited) search path for file maps.  Using a search path,
sites can allow for local map customizations and overrides, and can
distributed maps in several locations as needed.

@c ----------------------------------------------------------------
@node selectors_in_defaults Parameter, sun_map_syntax Parameter, search_path Parameter, Common Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{selectors_in_defaults} Parameter
@cindex selectors_in_defaults Parameter

(type=boolean, default=@samp{no}).  If @samp{yes}, then the
@samp{/defaults} entry of maps will search for and process any
selectors before setting defaults for all other keys in that map.
Useful when you want to set different options for a complete map based
on some parameters.  For example, you may want to better the NFS
performance over slow slip-based networks as follows:

@example
/defaults \
    wire==slip-net;opts:=intr,rsize=1024,wsize=1024 \
    wire!=slip-net;opts:=intr,rsize=8192,wsize=8192
@end example

Deprecated form: selectors_on_default.

@c ----------------------------------------------------------------
@node sun_map_syntax Parameter, , selectors_in_defaults Parameter, Common Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{sun_map_syntax} Parameter
@cindex sun_map_syntax Parameter

(type=boolean, default=@samp{no}).  If @samp{yes}, then @i{Amd} will
parse the map according to the Sun Automount syntax.


@c ================================================================
@node Global Parameters, Regular Map Parameters, Common Parameters, Amd Configuration File
@comment  node-name,  next,  previous,  up
@section Global Parameters
@cindex amd.conf global parameters

The following parameters are applicable to the @samp{[global]} section only.

@menu
* arch Parameter::
* auto_attrcache Parameter::
* auto_dir Parameter::
* cache_duration Parameter::
* cluster Parameter::
* debug_mtab_file Parameter::
* debug_options Parameter::
* dismount_interval Parameter::
* domain_strip Parameter::
* exec_map_timeout Parameter::
* forced_unmounts Parameter::
* full_os Parameter::
* fully_qualified_hosts Parameter::
* hesiod_base Parameter::
* karch Parameter::
* ldap_base Parameter::
* ldap_cache_maxmem Parameter::
* ldap_cache_seconds Parameter::
* ldap_hostports Parameter::
* ldap_proto_version Parameter::
* local_domain Parameter::
* localhost_address Parameter::
* log_file Parameter::
* log_options Parameter::
* map_reload_interval Parameter::
* nfs_allow_any_interface Parameter::
* nfs_allow_insecure_port Parameter::
* nfs_proto Parameter::
* nfs_retransmit_counter Parameter::
* nfs_retransmit_counter_udp Parameter::
* nfs_retransmit_counter_tcp Parameter::
* nfs_retransmit_counter_toplvl Parameter::
* nfs_retry_interval Parameter::
* nfs_retry_interval_udp Parameter::
* nfs_retry_interval_tcp Parameter::
* nfs_retry_interval_toplvl Parameter::
* nfs_vers Parameter::
* nis_domain Parameter::
* normalize_hostnames Parameter::
* normalize_slashes Parameter::
* os Parameter::
* osver Parameter::
* pid_file Parameter::
* plock Parameter::
* portmap_program Parameter::
* preferred_amq_port Parameter::
* print_pid Parameter::
* print_version Parameter::
* restart_mounts Parameter::
* show_statfs_entries Parameter::
* truncate_log Parameter::
* unmount_on_exit Parameter::
* use_tcpwrappers Parameter::
* vendor Parameter::
@end menu

@c ----------------------------------------------------------------
@node arch Parameter, auto_attrcache Parameter, Global Parameters, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{arch} Parameter
@cindex arch Parameter

(type=string, default to compiled in value).  Same as the @code{-A}
option to @i{Amd}.  Allows you to override the value of the @i{arch}
@i{Amd} variable.

@c ----------------------------------------------------------------
@node auto_attrcache Parameter, auto_dir Parameter, arch Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{auto_attrcache} Parameter
@cindex auto_attrcache Parameter

(type=numeric, default=0).  Specify in seconds (or units of 0.1
seconds, depending on the OS), what is the (kernel-side) NFS attribute
cache timeout for @i{Amd}'s own automount points.  A value of 0 is
supposed to turn off attribute caching, meaning that @i{Amd} will be
consulted via a kernel-RPC each time someone stat()'s the mount point
(which could be abused as a denial-of-service attack).

@emph{WARNING}: @i{Amd} depends on being able to turn off the NFS
attribute cache of the client OS.  If it cannot be turned off, then
users may get ESTALE errors or symlinks that point to the wrong
places.  This is more likely under heavy use of @i{Amd}, for example
if your system is experiencing frequent map changes or frequent
mounts/unmounts.  Therefore, under normal circumstances, this
parameter should remain set to 0, to ensure that the attribute cache
is indeed off.

Unfortunately, some kernels (e.g., certain BSDs) don't have a way to
turn off the NFS attribute cache.  Setting this parameter to 0 is
supposed to turn off attribute caching entirely, but unfortunately it
does not; instead, the attribute cache is set to some internal
hard-coded default (usually anywhere from 5-30 seconds).  If you
suspect that your OS doesn't have a reliable way of turning off the
attribute cache, then it is better to set this parameter to the
smallest possible non-zero value (set @samp{auto_attrcache=1} in your
@code{amd.conf}).  This will not eliminate the problem, but reduce the
risk window somewhat.  The best solutions are (1) to use @i{Amd} in
Autofs mode, if it's supported in your OS, and (2) talk to your OS
vendor to support a true @samp{noac} flag.  See the
@uref{http://www.am-utils.org/docs/am-utils/attrcache.txt,README.attrcache}
document for more details.

If you are able to turn off the attribute cache on your OS, alas,
@i{Amd}'s performance may degrade (when not using Autofs) because
every traversal of an automounter-controlled pathname will result in a
lookup request from the kernel to @i{Amd}.  Under heavy loads, for
example when using recursive tools like @samp{find}, @samp{rdist}, or
@samp{rsync}, this performance degradation can be noticeable.  There
are two possible solutions that some administrators have chosen to
improve performance:

@enumerate

@item
First, you can turn off unmounting using the @samp{nounmount} mount
option.  This will ensure that no @i{Amd} symlink could ever change,
thereby the kernel's attribute cache and @i{Amd} will always be in
sync.  However, this method will cause the number of mounts to keep
growing, even if some are no longer in use; this has the disadvantage
that your system could be more susceptible to hangs if even one of
those accumulating mounts hangs due to a downed server.

@item
Second, you can turn on attribute caching carefully by setting a small
automounter attribute cache value (say, one second), and a relatively
large dismount interval (say, one hour).  (@xref{dismount_interval
Parameter}.)  For example, you can set this in your @code{amd.conf}:

@example
[global]
auto_attrcache = 1
dismount_interval = 3600
@end example

This has the benefit of using the kernel's attribute cache and thus
improving performance.  The disadvantage with this option is that the
window of vulnerability is not eliminated entirely: it is only made
smaller.

@end enumerate

@c ----------------------------------------------------------------
@node auto_dir Parameter, cache_duration Parameter, auto_attrcache Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{auto_dir} Parameter
@cindex auto_dir Parameter

(type=string, default=@samp{/a}).  Same as the @code{-a} option to @i{Amd}.
This sets the private directory where @i{Amd} will create
sub-directories for its real mount points.

@c ----------------------------------------------------------------
@node cache_duration Parameter, cluster Parameter, auto_dir Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{cache_duration} Parameter
@cindex cache_duration Parameter

(type=numeric, default=300).  Same as the @code{-c} option to @i{Amd}.
Sets the duration in seconds that looked-up or mounted map entries
remain in the cache.

@c ----------------------------------------------------------------
@node cluster Parameter, debug_mtab_file Parameter, cache_duration Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{cluster} Parameter
@cindex cluster Parameter

(type=string, default no cluster).  Same as the @code{-C} option to
@i{Amd}.  Specifies the alternate HP-UX cluster to use.

@c ----------------------------------------------------------------
@node debug_mtab_file Parameter, debug_options Parameter, cluster Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{debug_mtab_file} Parameter
@cindex debug_mtab_file Parameter

(type=string, default="/tmp/mtab").  Path to mtab file that is used
by @i{Amd} to store a list of mounted file systems during debug-mtab mode.
This option only applies to systems that store mtab information on disk.

@c ----------------------------------------------------------------
@node debug_options Parameter, dismount_interval Parameter, debug_mtab_file Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{debug_options} Parameter
@cindex debug_options Parameter

(type=string, default no debug options).  Same as the @code{-D} option
to @i{Amd}.  Specify any debugging options for @i{Amd}.  Works only if
am-utils was configured for debugging using the @code{--enable-debug}
option.  The additional @samp{mem} option can be turned on via
@code{--enable-debug=mem}.  Otherwise debugging options are ignored.
Options are comma delimited, and can be preceded by the string
@samp{no} to negate their meaning.  You can get the list of supported
debugging and logging options by running @code{amd -H}.  Possible
values those listed for the -D option.  @xref{-D Option}.

@c ----------------------------------------------------------------
@node dismount_interval Parameter, domain_strip Parameter, debug_options Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{dismount_interval} Parameter
@cindex dismount_interval Parameter

(type=numeric, default=120).  Same as the @code{-w} option to
@i{Amd}.  Specify in seconds, the time between attempts to dismount file
systems that have exceeded their cached times.

@c ----------------------------------------------------------------
@node domain_strip Parameter, exec_map_timeout Parameter, dismount_interval Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{domain_strip} Parameter
@cindex domain_strip Parameter

(type=boolean, default=@samp{yes}).  If @samp{yes}, then the domain
name part referred to by @code{$@{rhost@}} is stripped off.  This is
useful to keep logs and smaller.  If @samp{no}, then the domain name
part is left changed.  This is useful when using multiple domains with
the same maps (as you may have hosts whose domain-stripped name is
identical).

@c ----------------------------------------------------------------
@node exec_map_timeout Parameter, forced_unmounts Parameter, domain_strip Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{exec_map_timeout} Parameter
@cindex exec_map_timeout Parameter

(type=numeric, default=10).  The timeout in seconds that @i{Amd} will
wait for an executable map program before an answer is returned from
that program (or script).  This value should be set to as small as
possible while still allowing normal replies to be returned before the
timer expires, because during the time that the executable map program
is queried, @i{Amd} is essentially waiting and is thus not responding
to any other queries.  @xref{Executable maps}.

@c ----------------------------------------------------------------
@node forced_unmounts Parameter, full_os Parameter, exec_map_timeout Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{forced_unmounts} Parameter
@cindex forced_unmounts Parameter

(type=boolean, default=@samp{no}).
Sometimes, mount points are hung due to unrecoverable conditions, such
as when NFS servers migrate, change their IP address, are down
permanently, or due to hardware failures, and more.  In this case,
attempting to unmount an existing mount point, or even just to
@b{stat}(2) it, results in one of three fatal errors: EIO, ESTALE, or
EBUSY.  At that point, @i{Amd} can do little to recover that hung
point (in fact, the OS cannot automatically recover either).  For that
reason, some OSs support special kinds of forced unmounts, which must
be used very carefully: they will force an unmount immediately (or
lazily on Linux), which could result in application data loss.
However, that may be the only way to recover the entire host (without
rebooting).  Once a hung mount point is forced out, @i{Amd} can then
re-mount a replacement one (if available), bringing a mostly-hung
system back to operation and avoiding a potentially costly reboot.

If the @samp{forced_unmounts} option is set to @samp{yes}, and the
client OS supports forced or lazy unmounts, then @i{Amd} will attempt
to use them if it gets any of the three serious error conditions
listed above.  Note that @i{Amd} will force the unmount of mount
points that returned EBUSY only for @samp{type:=toplvl} mounts
(@pxref{Top-level Filesystem}): that is, @i{Amd}'s own mount points.
This is useful to recover from a previously hung @i{Amd}, and to
ensure that an existing @i{Amd} can shutdown cleanly even if some
processes are keeping its mount points busy (i.e., when a user's shell
process uses @code{cd} to set its CWD to @i{Amd}'s own mount point).

If this option is set to @samp{no} (the default), then @i{Amd} will
not attempt this special recovery procedure.

@c ----------------------------------------------------------------
@node full_os Parameter, fully_qualified_hosts Parameter, forced_unmounts Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{full_os} Parameter
@cindex full_os Parameter

(type=string, default to compiled in value).  The full name of the
operating system, along with its version.  Allows you to override the
compiled-in full name and version of the operating system.  Useful when
the compiled-in name is not desired.  For example, the full operating
system name on linux comes up as @samp{linux}, but you can override it
to @samp{linux-2.2.5}.

@c ----------------------------------------------------------------
@node fully_qualified_hosts Parameter, hesiod_base Parameter, full_os Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{fully_qualified_hosts} Parameter
@cindex fully_qualified_hosts Parameter

(type=string, default=@samp{no}).  If @samp{yes}, @i{Amd} will perform RPC
authentication using fully-qualified host names.  This is necessary for
some systems, and especially when performing cross-domain mounting.  For
this function to work, the @i{Amd} variable @samp{$@{hostd@}} is used,
requiring that @samp{$@{domain@}} not be null.

@c ----------------------------------------------------------------
@node hesiod_base Parameter, karch Parameter, fully_qualified_hosts Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{hesiod_base} Parameter
@cindex hesiod_base Parameter

(type=string, default=@samp{automount}).  Specify the base name for
hesiod maps.

@c ----------------------------------------------------------------
@node karch Parameter, ldap_base Parameter, hesiod_base Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{karch} Parameter
@cindex karch Parameter

(type=string, default to karch of the system).  Same as the @code{-k}
option to @i{Amd}.  Allows you to override the kernel-architecture of
your system.  Useful for example on Sun (Sparc) machines, where you can
build one @i{Amd} binary, and run it on multiple machines, yet you want
each one to get the correct @i{karch} variable set (for example, sun4c,
sun4m, sun4u, etc.)  Note that if not specified, @i{Amd} will use
@b{uname}(2) to figure out the kernel architecture of the machine.

@c ----------------------------------------------------------------
@node ldap_base Parameter, ldap_cache_maxmem Parameter, karch Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{ldap_base} Parameter
@cindex ldap_base Parameter

(type=string, default not set).
Specify the base name for LDAP.  This often includes LDAP-specific
values such as country and organization.

@c ----------------------------------------------------------------
@node ldap_cache_maxmem Parameter, ldap_cache_seconds Parameter, ldap_base Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{ldap_cache_maxmem} Parameter
@cindex ldap_cache_maxmem Parameter

(type=numeric, default=131072).  Specify the maximum memory @i{Amd}
should use to cache LDAP entries.

@c ----------------------------------------------------------------
@node ldap_cache_seconds Parameter, ldap_hostports Parameter, ldap_cache_maxmem Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{ldap_cache_seconds} Parameter
@cindex ldap_cache_seconds Parameter

(type=numeric, default=0).  Specify the number of seconds to keep
entries in the cache.

@c ----------------------------------------------------------------
@node ldap_hostports Parameter, ldap_proto_version Parameter, ldap_cache_seconds Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{ldap_hostports} Parameter
@cindex ldap_hostports Parameter

(type=string, default not set).
Specify the LDAP host and port values.

@c ----------------------------------------------------------------
@node ldap_proto_version Parameter, local_domain Parameter, ldap_hostports Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{ldap_proto_version} Parameter
@cindex ldap_proto_version Parameter

(type=numeric, default=2).  Specify the LDAP protocol version to use.
With a value of 3 will use LDAPv3 protocol.

@c ----------------------------------------------------------------
@node local_domain Parameter, localhost_address Parameter, ldap_proto_version Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{local_domain} Parameter
@cindex local_domain Parameter

(type=string, default no sub-domain).  Same as the @code{-d} option
to @i{Amd}.  Specify the local domain name.  If this option is not given
the domain name is determined from the hostname, by removing the first
component of the fully-qualified host name.

@c ----------------------------------------------------------------
@node localhost_address Parameter, log_file Parameter, local_domain Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{localhost_address} Parameter
@cindex localhost_address Parameter

(type=string, default to localhost or 127.0.0.1).  Specify the name or
IP address for @i{Amd} to use when connecting the sockets for the
local NFS server and the RPC server.  This defaults to 127.0.0.1 or
whatever the host reports as its local address.  This parameter is
useful on hosts with multiple addresses where you want to force
@i{Amd} to connect to a specific address.

@c ----------------------------------------------------------------
@node log_file Parameter, log_options Parameter, localhost_address Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{log_file} Parameter
@cindex log_file Parameter

(type=string, default=@samp{stderr}).  Same as the @code{-l} option to
@i{Amd}.  Specify a file name to log @i{Amd} events to.
If the string @samp{/dev/stderr} is specified,
@i{Amd} will send its events to the standard error file descriptor.

If the string @samp{syslog} is given, @i{Amd} will record its events
with the system logger @b{syslogd}(8).  If your system supports syslog
facilities, then the default facility used is @samp{LOG_DAEMON}.

When using syslog, if you wish to change the facility, append its name
to the option name, delimited by a single colon.  For example, if it is
the string @samp{syslog:local7} then @i{Amd} will log messages via
@b{syslog}(3) using the @samp{LOG_LOCAL7} facility.  If the facility
name specified is not recognized, @i{Amd} will default to @samp{LOG_DAEMON}.
Note: while you can use any syslog facility available on your system, it
is generally a bad idea to use those reserved for other services such as
@samp{kern}, @samp{lpr}, @samp{cron}, etc.

@c ----------------------------------------------------------------
@node log_options Parameter, map_reload_interval Parameter, log_file Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{log_options} Parameter
@cindex log_options Parameter

(type=string, default=``defaults'').  Same as the @code{-x}
option to @i{Amd}.  Specify any logging options for @i{Amd}.  Options
are comma delimited, and can be preceded by the string @samp{no} to
negate their meaning.  The @samp{debug} logging option is only available
if am-utils was configured with @code{--enable-debug}.  You can get the
list of supported debugging options by running @code{amd -H}.  Possible
values are:

@table @samp
@item all
all messages
@item defaults
an alias for "fatal,error,user,warning,info"
@item debug
debug messages
@item error
non-fatal system errors (cannot be turned off)
@item fatal
fatal errors (cannot be turned off)
@item info
information
@item map
map errors
@item stats
additional statistical information
@item user
non-fatal user errors
@item warn
warnings
@item warning
warnings
@end table

@c ----------------------------------------------------------------
@node map_reload_interval Parameter, nfs_allow_any_interface Parameter, log_options Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{map_reload_interval} Parameter
@cindex map_reload_interval Parameter

(type=numeric, default=3600).  The number of seconds that @i{Amd} will
wait before it checks to see if any maps have changed at their source
(NIS servers, LDAP servers, files, etc.).  @i{Amd} will reload only
those maps that have changed.

@c ----------------------------------------------------------------
@node nfs_allow_any_interface Parameter, nfs_allow_insecure_port Parameter, map_reload_interval Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{nfs_allow_any_interface} Parameter
@cindex nfs_allow_any_interface Parameter

(type=string, default=@samp{no}).  Normally @i{Amd} accepts local NFS
packets only from 127.0.0.1.  If this parameter is set to @samp{yes},
then @i{amd} will accept local NFS packets from any local interface;
this is useful on hosts that may have multiple interfaces where the
system is forced to send all outgoing packets (even those bound to the
same host) via an address other than 127.0.0.1.

@c ----------------------------------------------------------------
@node nfs_allow_insecure_port Parameter, nfs_proto Parameter, nfs_allow_any_interface Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{nfs_allow_insecure_port} Parameter
@cindex nfs_allow_insecure_port Parameter

(type=string, default=@samp{no}).  Normally @i{Amd} will refuse requests
coming from unprivileged ports (i.e., ports >= 1024 on Unix systems),
so that only privileged users and the kernel can send NFS requests to
it.  However, some kernels (certain versions of Darwin, MacOS X, and
Linux) have bugs that cause them to use unprivileged ports in certain
situations, which causes @i{Amd} to stop dead in its tracks.  This
parameter allows @i{Amd} to operate normally even on such systems, at the
expense of a slight decrease in the security of its operations.  If
you see messages like ``ignoring request from foo:1234, port not
reserved'' in your @i{Amd} log, try enabling this parameter and give it
another go.

@c ----------------------------------------------------------------
@node nfs_proto Parameter, nfs_retransmit_counter Parameter, nfs_allow_insecure_port Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{nfs_proto} Parameter
@cindex nfs_proto Parameter

(type=string, default to trying version tcp then udp).  By default,
@i{Amd} tries @code{tcp} and then @code{udp}.  This option forces the
overall NFS protocol used to TCP or UDP.  It overrides what is in the
@i{Amd} maps, and is useful when @i{Amd} is compiled with TCP support
in NFSv2/NFSv3 that may not be stable.  With this option you can turn
off the complete usage of TCP for NFS dynamically (without having to
recompile @i{Amd}), and use UDP only, until such time as TCP support
is desired again.

@c ----------------------------------------------------------------
@node nfs_retransmit_counter Parameter, nfs_retransmit_counter_udp Parameter, nfs_proto Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{nfs_retransmit_counter} Parameter
@cindex nfs_retransmit_counter Parameter

(type=numeric, default=11).  Same as the @i{retransmit} part of the
@code{-t} @i{timeout.retransmit} option to @i{Amd}.  Specifies the
number of NFS retransmissions that the kernel will use to communicate
with @i{Amd} using either UDP or TCP mounts.  @xref{-t Option}.

@c ----------------------------------------------------------------
@node nfs_retransmit_counter_udp Parameter, nfs_retransmit_counter_tcp Parameter, nfs_retransmit_counter Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{nfs_retransmit_counter_udp} Parameter
@cindex nfs_retransmit_counter_udp Parameter
@cindex nfs_retransmit_counter Parameter
@cindex UDP

(type=numeric, default=11).  Same as the @i{nfs_retransmit_counter}
parameter, but applied globally only to UDP mounts.
@xref{nfs_retransmit_counter Parameter}.

@c ----------------------------------------------------------------
@node nfs_retransmit_counter_tcp Parameter, nfs_retransmit_counter_toplvl Parameter, nfs_retransmit_counter_udp Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{nfs_retransmit_counter_tcp} Parameter
@cindex nfs_retransmit_counter_tcp Parameter
@cindex nfs_retransmit_counter Parameter
@cindex TCP

(type=numeric, default=11).  Same as the @i{nfs_retransmit_counter}
parameter, but applied globally only to TCP mounts.
@xref{nfs_retransmit_counter Parameter}.

@c ----------------------------------------------------------------
@node nfs_retransmit_counter_toplvl Parameter, nfs_retry_interval Parameter, nfs_retransmit_counter_tcp Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{nfs_retransmit_counter_toplvl} Parameter
@cindex nfs_retransmit_counter_toplvl Parameter
@cindex nfs_retransmit_counter Parameter
@cindex UDP

(type=numeric, default=11).  Same as the @i{nfs_retransmit_counter}
parameter, applied only for @i{Amd}'s top-level UDP mounts.  On some
systems it is useful to set this differently than the OS default, so
as to better tune @i{Amd}'s responsiveness under heavy scheduler
loads.  @xref{nfs_retransmit_counter Parameter}.

@c ----------------------------------------------------------------
@node nfs_retry_interval Parameter, nfs_retry_interval_udp Parameter, nfs_retransmit_counter_toplvl Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{nfs_retry_interval} Parameter
@cindex nfs_retry_interval Parameter

(type=numeric, default=8).  Same as the @i{timeout} part of the
@code{-t} @i{timeout.retransmit} option to @i{Amd}.  Specifies the NFS
timeout interval, in @emph{tenths} of seconds, between NFS/RPC retries
(for UDP or TCP).  This is the value that the kernel will use to
communicate with @i{Amd}.  @xref{-t Option}.

@i{Amd} relies on the kernel RPC retransmit mechanism to trigger mount
retries.  The values of the @i{nfs_retransmit_counter} and the
@i{nfs_retry_interval} parameters change the overall retry interval.
Too long an interval gives poor interactive response; too short an
interval causes excessive retries.

@c ----------------------------------------------------------------
@node nfs_retry_interval_udp Parameter, nfs_retry_interval_tcp Parameter, nfs_retry_interval Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{nfs_retry_interval_udp} Parameter
@cindex nfs_retry_interval_udp Parameter
@cindex nfs_retry_interval Parameter
@cindex UDP

(type=numeric, default=8).  Same as the @i{nfs_retry_interval}
parameter, but applied globally only to UDP mounts.
@xref{nfs_retry_interval Parameter}.

@c ----------------------------------------------------------------
@node nfs_retry_interval_tcp Parameter, nfs_retry_interval_toplvl Parameter, nfs_retry_interval_udp Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{nfs_retry_interval_tcp} Parameter
@cindex nfs_retry_interval_tcp Parameter
@cindex nfs_retry_interval Parameter
@cindex TCP

(type=numeric, default=8).  Same as the @i{nfs_retry_interval}
parameter, but applied globally only to TCP mounts.
@xref{nfs_retry_interval Parameter}.

@c ----------------------------------------------------------------
@node nfs_retry_interval_toplvl Parameter, nfs_vers Parameter, nfs_retry_interval_tcp Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{nfs_retry_interval_toplvl} Parameter
@cindex nfs_retry_interval_toplvl Parameter
@cindex nfs_retry_interval Parameter
@cindex UDP

(type=numeric, default=8).  Same as the @i{nfs_retry_interval}
parameter, applied only for @i{Amd}'s top-level UDP mounts.  On some
systems it is useful to set this differently than the OS default, so
as to better tune @i{Amd}'s responsiveness under heavy scheduler
loads.  @xref{nfs_retry_interval Parameter}.

@c ----------------------------------------------------------------
@node nfs_vers Parameter, nis_domain Parameter, nfs_retry_interval_toplvl Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{nfs_vers} Parameter
@cindex nfs_vers Parameter

(type=numeric, default to trying version 3 then 2).  By default,
@i{Amd} tries version 3 and then version 2.  This option forces the
overall NFS protocol used to version 3 or 2.  It overrides what is in
the @i{Amd} maps, and is useful when @i{Amd} is compiled with NFSv3
support that may not be stable.  With this option you can turn off the
complete usage of NFSv3 dynamically (without having to recompile
@i{Amd}), and use NFSv2 only, until such time as NFSv3 support is
desired again.

@c ----------------------------------------------------------------
@node nis_domain Parameter, normalize_hostnames Parameter, nfs_vers Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{nis_domain} Parameter
@cindex nis_domain Parameter

(type=string, default to local NIS domain name).  Same as the
@code{-y} option to @i{Amd}.  Specify an alternative NIS domain from
which to fetch the NIS maps.  The default is the system domain name.
This option is ignored if NIS support is not available.

@c ----------------------------------------------------------------
@node normalize_hostnames Parameter, normalize_slashes Parameter, nis_domain Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{normalize_hostnames} Parameter
@cindex normalize_hostnames Parameter

(type=boolean, default=@samp{no}).  Same as the @code{-n} option to @i{Amd}.
If @samp{yes}, then the name referred to by @code{$@{rhost@}} is normalized
relative to the host database before being used.  The effect is to
translate aliases into ``official'' names.

@c ----------------------------------------------------------------
@node normalize_slashes Parameter, os Parameter, normalize_hostnames Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{normalize_slashes} Parameter
@cindex normalize_slashes Parameter

(type=boolean, default=@samp{yes}).  If @samp{yes} then amd will
condense all multiple @code{/} (slash) characters into one and remove
all trailing slashes.  If @samp{no}, then amd will not touch strings
that may contain repeated or trailing slashes.  The latter is
sometimes useful with SMB mounts, which often require multiple slash
characters in pathnames.

@c ----------------------------------------------------------------
@node os Parameter, osver Parameter, normalize_slashes Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{os} Parameter
@cindex os Parameter

(type=string, default to compiled in value).  Same as the @code{-O}
option to @i{Amd}.  Allows you to override the compiled-in name of the
operating system.  Useful when the built-in name is not desired for
backward compatibility reasons.  For example, if the built-in name is
@samp{sunos5}, you can override it to @samp{sos5}, and use older maps
which were written with the latter in mind.


@c ----------------------------------------------------------------
@node osver Parameter, pid_file Parameter, os Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{osver} Parameter
@cindex osver Parameter

(type=string, default to compiled in value).  Same as the @code{-o}
option to @i{Amd}.  Allows you to override the compiled-in version
number of the operating system.  Useful when the built-in version is not
desired for backward compatibility reasons.  For example, if the build
in version is @samp{2.5.1}, you can override it to @samp{5.5.1}, and use
older maps that were written with the latter in mind.

@c ----------------------------------------------------------------
@node pid_file Parameter, plock Parameter, osver Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{pid_file} Parameter
@cindex pid_file Parameter

(type=string, default=@samp{/dev/stdout}).  Specify a file to store the process
ID of the running daemon into.  If not specified, @i{Amd} will print its
process id onto the standard output.  Useful for killing @i{Amd} after
it had run.  Note that the PID of a running @i{Amd} can also be
retrieved via @i{Amq} (@pxref{Amq -p option}).

This file is used only if the @samp{print_pid} option is on
(@pxref{print_pid Parameter}).

@c ----------------------------------------------------------------
@node plock Parameter, portmap_program Parameter, pid_file Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{plock} Parameter
@cindex plock Parameter

(type=boolean, default=@samp{yes}).  Same as the @code{-S} option to @i{Amd}.
If @samp{yes}, lock the running executable pages of @i{Amd} into memory.
To improve @i{Amd}'s performance, systems that support the @b{plock}(3)
or @b{mlockall}(2)
call can lock the @i{Amd} process into memory.  This way there is less
chance the operating system will schedule, page out, and swap the
@i{Amd} process as needed.  This improves @i{Amd}'s performance, at the
cost of reserving the memory used by the @i{Amd} process (making it
unavailable for other processes).

@c ----------------------------------------------------------------
@node portmap_program Parameter, preferred_amq_port Parameter, plock Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{portmap_program} Parameter
@cindex portmap_program Parameter

(type=numeric, default=300019).  Specify an alternate Port-mapper RPC
program number, other than the official number.  This is useful when
running multiple @i{Amd} processes.  For example, you can run another
@i{Amd} in ``test'' mode, without affecting the primary @i{Amd} process
in any way.  For safety reasons, the alternate program numbers that can
be specified must be in the range 300019-300029, inclusive.  @i{Amq} has
an option @code{-P} which can be used to specify an alternate program
number of an @i{Amd} to contact.  In this way, amq can fully control any
number of @i{Amd} processes running on the same host.

@c ----------------------------------------------------------------
@node preferred_amq_port Parameter, print_pid Parameter, portmap_program Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{preferred_amq_port} Parameter
@cindex preferred_amq_port Parameter

(type=numeric, default=0).  Specify an alternate Port-mapper RPC port
number for @i{Amd}'s @i{Amq} service.  This is used for both UDP and
TCP.  Setting this value to 0 (or not defining it) will cause @i{Amd}
to select an arbitrary port number.  Setting the @i{Amq} RPC service
port to a specific number is useful in firewalled or NAT'ed
environments, where you need to know which port @i{Amd} will listen
on.

@c ----------------------------------------------------------------
@node print_pid Parameter, print_version Parameter, preferred_amq_port Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{print_pid} Parameter
@cindex print_pid Parameter

(type=boolean, default=@samp{no}).  Same as the @code{-p} option to @i{Amd}.
If @samp{yes}, @i{Amd} will print its process ID upon starting.

@c ----------------------------------------------------------------
@node print_version Parameter, restart_mounts Parameter, print_pid Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{print_version} Parameter
@cindex print_version Parameter

(type=boolean, default=@samp{no}).  Same as the @code{-v} option to @i{Amd},
but the version prints and @i{Amd} continues to run.  If @samp{yes}, @i{Amd}
will print its version information string, which includes some
configuration and compilation values.

@c ----------------------------------------------------------------
@node restart_mounts Parameter, show_statfs_entries Parameter, print_version Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{restart_mounts} Parameter
@cindex restart_mounts Parameter

(type=boolean, default=@samp{no}).  Same as the @code{-r} option to @i{Amd}.
If @samp{yes} @i{Amd} will scan the mount table to determine which file
systems are currently mounted.  Whenever one of these would have been
auto-mounted, @i{Amd} inherits it.

@c ----------------------------------------------------------------
@node show_statfs_entries Parameter, truncate_log Parameter, restart_mounts Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{show_statfs_entries} Parameter
@cindex show_statfs_entries Parameter

(type=boolean), default=@samp{no}).  If @samp{yes}, then all maps which are
browsable will also show the number of entries (keys) they have when
@b{df}(1) runs. (This is accomplished by returning non-zero values to
the @b{statfs}(2) system call).

@c ----------------------------------------------------------------
@node truncate_log Parameter, unmount_on_exit Parameter, show_statfs_entries Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{truncate_log} Parameter
@cindex truncate_log Parameter

(type=boolean), default=@samp{no}).  If @samp{yes}, then @i{Amd} will
truncate the log file (if it's a regular file) on startup.  This could
be useful when conducting extensive testing on @i{Amd} maps (or
@i{Amd} itself) and you don't want to see log data from a previous run
in the same file.

@c ----------------------------------------------------------------
@node unmount_on_exit Parameter, use_tcpwrappers Parameter, truncate_log Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{unmount_on_exit} Parameter
@cindex unmount_on_exit Parameter

(type=boolean, default=@samp{no}).  If @samp{yes}, then @i{Amd} will attempt
to unmount all file systems which it knows about.  Normally it leaves
all (esp. NFS) mounted file systems intact.  Note that @i{Amd} does not
know about file systems mounted before it starts up, unless the
@samp{restart_mounts} option is used (@pxref{restart_mounts Parameter}).

@c ----------------------------------------------------------------
@node use_tcpwrappers Parameter, vendor Parameter, unmount_on_exit Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{use_tcpwrappers} Parameter
@cindex use_tcpwrappers Parameter

(type=boolean), default=@samp{yes}).  If @samp{yes}, then amd will use
the tcpwrappers (tcpd/librwap) library (if available) to control
access to @i{Amd} via the @code{/etc/hosts.allow} and
@code{/etc/hosts.deny} files.  @i{Amd} will verify that the host
running @i{Amq} is authorized to connect.  The @code{amd} service name
must used in the @code{/etc/hosts.allow} and @code{/etc/hosts.deny}
files.  For example, to allow only localhost to connect to @i{Amd},
add this line to @code{/etc/hosts.allow}:

@example
amd: localhost
@end example

and this line to @code{/etc/hosts.deny}:

@example
amd: ALL
@end example

Consult the man pages for @b{hosts_access}(5) for more information on using
the tcpwrappers access-control library.

Note that in particular, you should not configure your @code{hosts.allow}
file to spawn a command for @i{Amd}: that will cause @i{Amd} to not be able
to @code{waitpid} on the child process ID of any background un/mount that
@i{Amd} issued, resulting in a confused @i{Amd} that does not know what
happened to those background un/mount requests.

@c ----------------------------------------------------------------
@node vendor Parameter, , use_tcpwrappers Parameter, Global Parameters
@comment  node-name,  next,  previous,  up
@subsection @t{vendor} Parameter
@cindex vendor Parameter

(type=string, default to compiled in value).  The name of the vendor of
the operating system.  Overrides the compiled-in vendor name.  Useful
when the compiled-in name is not desired.  For example, most Intel based
systems set the vendor name to @samp{unknown}, but you can set it to
@samp{redhat}.

@c ================================================================
@node Regular Map Parameters, amd.conf Examples, Global Parameters, Amd Configuration File
@comment  node-name,  next,  previous,  up
@section Regular Map Parameters
@cindex amd.conf regular map parameters

The following parameters are applicable only to regular map sections.

@menu
* map_name Parameter::
* tag Parameter::
@end menu

@c ----------------------------------------------------------------
@node map_name Parameter, tag Parameter, Regular Map Parameters, Regular Map Parameters
@comment  node-name,  next,  previous,  up
@subsection map_name Parameter
@cindex map_name Parameter

(type=string, must be specified).  Name of the map where the keys are
located.

@c ----------------------------------------------------------------
@node tag Parameter, , map_name Parameter, Regular Map Parameters
@comment  node-name,  next,  previous,  up
@subsection tag Parameter
@cindex tag Parameter

(type=string, default no tag).  Each map entry in the configuration file
can be tagged.  If no tag is specified, that map section will always be
processed by @i{Amd}.  If it is specified, then @i{Amd} will process the map
if the @code{-T} option was given to @i{Amd}, and the value given to that
command-line option matches that in the map section.

@c ================================================================
@node amd.conf Examples, , Regular Map Parameters, Amd Configuration File
@comment  node-name,  next,  previous,  up
@section amd.conf Examples
@cindex amd.conf examples

The following is the actual @code{amd.conf} file I used at the
Computer Science Department of Columbia University.

@example
# GLOBAL OPTIONS SECTION
[ global ]
normalize_hostnames =    no
print_pid =              no
#pid_file =              /var/run/amd.pid
restart_mounts =         yes
#unmount_on_exit =       yes
auto_dir =               /n
log_file =               /var/log/amd
log_options =            all
#debug_options =         defaults
plock =                  no
selectors_in_defaults =  yes
# config.guess picks up "sunos5" and I don't want to edit my maps yet
os =                     sos5
# if you print_version after setting up "os", it will show it.
print_version =          no
map_type =               file
search_path =            /etc/amdmaps:/usr/lib/amd:/usr/local/AMD/lib
browsable_dirs =         yes
fully_qualified_hosts =  no

# DEFINE AN AMD MOUNT POINT
[ /u ]
map_name =               amd.u

[ /proj ]
map_name =               amd.proj

[ /src ]
map_name =               amd.src

[ /misc ]
map_name =               amd.misc

[ /import ]
map_name =               amd.import

[ /tftpboot/.amd ]
tag =                    tftpboot
map_name =               amd.tftpboot
@end example

@c ################################################################
@node Run-time Administration, FSinfo, Amd Configuration File, Top
@comment  node-name,  next,  previous,  up
@chapter Run-time Administration
@cindex Run-time administration
@cindex Amq command

@menu
* Starting Amd::
* Stopping Amd::
* Restarting Amd::
* Controlling Amd::
@end menu

@node Starting Amd, Stopping Amd, Run-time Administration, Run-time Administration
@comment  node-name,  next,  previous,  up
@section Starting @i{Amd}
@cindex Starting Amd
@cindex Additions to /etc/rc.local
@cindex /etc/rc.local additions
@cindex ctl-amd

@i{Amd} is best started from @samp{/etc/rc.local} on BSD systems, or
from the appropriate start-level script in @samp{/etc/init.d} on System V
systems.

@example
if [ -f /usr/local/sbin/ctl-amd ]; then
    /usr/local/sbin/ctl-amd start; (echo -n ' amd') > /dev/console
fi
@end example

@noindent
The shell script, @samp{ctl-amd} is used to start, stop, or restart
@i{Amd}.  It is a relatively generic script.  All options you want to
set should not be made in this script, but rather updated in the
@file{amd.conf} file. @xref{Amd Configuration File}.

If you do not wish to use an @i{Amd} configuration file, you may start
@i{Amd} manually.  For example, getting the map entries via NIS:

@example
amd -r -l /var/log/amd `ypcat -k auto.master`
@end example

@node Stopping Amd, Restarting Amd, Starting Amd, Run-time Administration
@comment  node-name,  next,  previous,  up
@section Stopping @i{Amd}
@cindex Stopping Amd
@cindex SIGTERM signal
@cindex SIGINT signal

@i{Amd} stops in response to two signals.

@table @samp
@item SIGTERM
causes the top-level automount points to be unmounted and then @i{Amd}
to exit.  Any automounted filesystems are left mounted.  They can be
recovered by restarting @i{Amd} with the @code{-r} command line option.@refill

@item SIGINT
causes @i{Amd} to attempt to unmount any filesystems which it has
automounted, in addition to the actions of @samp{SIGTERM}.  This signal
is primarily used for debugging.@refill
@end table

Actions taken for other signals are undefined.

The easiest and safest way to stop @i{Amd}, without having to find its
process ID by hand, is to use the @file{ctl-amd} script, as with:

@example
ctl-amd stop
@end example

@node Restarting Amd, Controlling Amd, Stopping Amd, Run-time Administration
@comment  node-name,  next,  previous,  up
@section Restarting @i{Amd}
@cindex Restarting Amd
@cindex Killing and starting Amd

Before @i{Amd} can be started, it is vital to ensure that no other
@i{Amd} processes are managing any of the mount points, and that the
previous process(es) have terminated cleanly.  When a terminating signal
is set to @i{Amd}, the automounter does @emph{not} terminate right then.
Rather, it starts by unmounting all of its managed mount mounts in the
background, and then terminates.  It usually takes a few seconds for
this process to happen, but it can take an arbitrarily longer time.  If
two or more @i{Amd} processes attempt to manage the same mount point, it
usually will result in a system lockup.

The easiest and safest way to restart @i{Amd}, without having to find
its process ID by hand, sending it the @samp{SIGTERM} signal, waiting for @i{Amd}
to die cleanly, and verifying so, is to use the @file{ctl-amd} script,
as with:

@example
ctl-amd restart
@end example

The script will locate the process ID of @i{Amd}, kill it, and wait for
it to die cleanly before starting a new instance of the automounter.
@file{ctl-amd} will wait for a total of 30 seconds for @i{Amd} to die,
and will check once every 5 seconds if it had.

@node Controlling Amd, , Restarting Amd, Run-time Administration
@comment  node-name,  next,  previous,  up
@section Controlling @i{Amd}
@cindex Controlling Amd
@cindex Discovering what is going on at run-time
@cindex Listing currently mounted filesystems

It is sometimes desirable or necessary to exercise external control
over some of @i{Amd}'s internal state.  To support this requirement,
@i{Amd} implements an RPC interface which is used by the @dfn{Amq} program.
A variety of information is available.

@i{Amq} generally applies an operation, specified by a single letter option,
to a list of mount points.  The default operation is to obtain statistics
about each mount point.  This is similar to the output shown above
but includes information about the number and type of accesses to each
mount point.

@menu
* Amq default::       Default command behavior.
* Amq -f option::     Flushing the map cache.
* Amq -h option::     Controlling a non-local host.
* Amq -H option::     Print help message.
* Amq -l option::     Controlling the log file.
* Amq -m option::     Obtaining mount statistics.
* Amq -p option::     Getting Amd's process ID.
* Amq -P option::     Contacting alternate Amd processes.
* Amq -q option::     Suppress synchronous unmounting errors.
* Amq -s option::     Obtaining global statistics.
* Amq -T option::     Use TCP transport.
* Amq -U option::     Use UDP transport.
* Amq -u option::     Forcing volumes to time out.
* Amq -v option::     Version information.
* Amq -w option::     Print Amd current working directory.
* Other Amq options:: Three other special options.
@end menu

@c ----------------------------------------------------------------
@node Amq default, Amq -f option, Controlling Amd, Controlling Amd
@comment  node-name,  next,  previous,  up
@subsection @i{Amq} default information

With no arguments, @dfn{Amq} obtains a brief list of all existing
mounts created by @i{Amd}.  This is different from the list displayed by
@b{df}(1) since the latter only includes system mount points.

@noindent
The output from this option includes the following information:

@itemize @bullet
@item
the automount point,
@item
the filesystem type,
@item
the mount map or mount information,
@item
the internal, or system mount point.
@end itemize

@noindent
For example:

@example
/            root   "root"                    sky:(pid75)
/homes       toplvl /usr/local/etc/amd.homes  /homes
/home        toplvl /usr/local/etc/amd.home   /home
/homes/jsp   nfs    charm:/home/charm         /a/charm/home/charm/jsp
/homes/phjk  nfs    toytown:/home/toytown     /a/toytown/home/toytown/ai/phjk
@end example

@noindent
If an argument is given then statistics for that volume name will
be output.  For example:

@example
What         Uid   Getattr Lookup RdDir   RdLnk   Statfs Mounted@@
/homes       0     1196    512    22      0       30     90/09/14 12:32:55
/homes/jsp   0     0       0      0       1180    0      90/10/13 12:56:58
@end example

@table @code
@item What
the volume name.

@item Uid
ignored.

@item Getattr
the count of NFS @dfn{getattr} requests on this node.  This should only be
non-zero for directory nodes.

@item Lookup
the count of NFS @dfn{lookup} requests on this node.  This should only be
non-zero for directory nodes.

@item RdDir
the count of NFS @dfn{readdir} requests on this node.  This should only
be non-zero for directory nodes.

@item RdLnk
the count of NFS @dfn{readlink} requests on this node.  This should be
zero for directory nodes.

@item Statfs
the count of NFS @dfn{statfs} requests on this node.  This should only
be non-zero for top-level automount points.

@item Mounted@@
the date and time the volume name was first referenced.
@end table

@c ----------------------------------------------------------------
@node Amq -f option, Amq -h option, Amq default, Controlling Amd
@comment  node-name,  next,  previous,  up
@subsection @i{Amq} @code{-f} option
@cindex Flushing the map cache
@cindex Map cache, flushing

The @code{-f} option causes @i{Amd} to flush the internal mount map cache.
This is useful for example in Hesiod maps since @i{Amd} will not
automatically notice when they have been updated.  The map cache can
also be synchronized with the map source by using the @samp{sync} option
(@pxref{Automount Filesystem}).@refill

@c ----------------------------------------------------------------
@node Amq -h option, Amq -H option, Amq -f option, Controlling Amd
@comment  node-name,  next,  previous,  up
@subsection @i{Amq} @code{-h} option
@cindex Querying an alternate host

By default the local host is used.  In an HP-UX cluster the root server
is used since that is the only place in the cluster where @i{Amd} will
be running.  To query @i{Amd} on another host the @code{-h} option should
be used.

@c ----------------------------------------------------------------
@node Amq -H option, Amq -l option, Amq -h option, Controlling Amd
@comment  node-name,  next,  previous,  up
@subsection @i{Amq} @code{-H} option
@cindex Displaying brief help
@cindex Help; showing from Amq

Print a brief help and usage string.

@c ----------------------------------------------------------------
@node Amq -l option, Amq -m option, Amq -H option, Controlling Amd
@comment  node-name,  next,  previous,  up
@subsection @i{Amq} @code{-l} option
@cindex Resetting the Amd log file
@cindex Setting the Amd log file via Amq
@cindex Log file, resetting

Tell @i{Amd} to use @i{log_file} as the log file name.  For security
reasons, this @emph{must} be the same log file which @i{Amd} used when
started.  This option is therefore only useful to refresh @i{Amd}'s open
file handle on the log file, so that it can be rotated and compressed
via daily cron jobs.

@c ----------------------------------------------------------------
@node Amq -m option, Amq -p option, Amq -l option, Controlling Amd
@comment  node-name,  next,  previous,  up
@subsection @i{Amq} @code{-m} option

The @code{-m} option displays similar information about mounted
filesystems, rather than automount points.  The output includes the
following information:

@itemize @bullet
@item
the mount information,
@item
the mount point,
@item
the filesystem type,
@item
the number of references to this filesystem,
@item
the server hostname,
@item
the state of the file server,
@item
any error which has occurred.
@end itemize

For example:

@example
"root"           truth:(pid602)     root   1 localhost is up
hesiod.home      /home              toplvl 1 localhost is up
hesiod.vol       /vol               toplvl 1 localhost is up
hesiod.homes     /homes             toplvl 1 localhost is up
amy:/home/amy    /a/amy/home/amy    nfs    5 amy is up
swan:/home/swan  /a/swan/home/swan  nfs    0 swan is up (Permission denied)
ex:/home/ex      /a/ex/home/ex      nfs    0 ex is down
@end example

When the reference count is zero the filesystem is not mounted but
the mount point and server information is still being maintained
by @i{Amd}.

@c ----------------------------------------------------------------
@ignore
@comment Retained for future consideration: from the description of the
@comment amq -M option removed in amd 6.0.5.

A future release of @i{Amd} will include code to allow the @b{mount}(8)
command to mount automount points:

@example
mount -t amd /vol hesiod.vol
@end example

This will then allow @i{Amd} to be controlled from the standard system
filesystem mount list.

@end ignore

@c ----------------------------------------------------------------
@node Amq -p option, Amq -P option, Amq -m option, Controlling Amd
@comment  node-name,  next,  previous,  up
@subsection @i{Amq} @code{-p} option
@cindex Process ID; Amd
@cindex Amd's process ID
@cindex Amd's PID
@cindex PID; Amd

Return the process ID of the remote or locally running @i{Amd}.  Useful
when you need to send a signal to the local @i{Amd} process, and would
rather not have to search through the process table.  This option is
used in the @file{ctl-amd} script.

@c ----------------------------------------------------------------
@node Amq -P option, Amq -q option, Amq -p option, Controlling Amd
@comment  node-name,  next,  previous,  up
@subsection @i{Amq} @code{-P} option
@cindex Multiple Amd processes
@cindex Running multiple Amd
@cindex Debugging a new Amd configuration
@cindex RPC Program numbers; Amd

Contact an alternate running @i{Amd} that had registered itself on a
different RPC @var{program_number} and apply all other operations to
that instance of the automounter.  This is useful when you run multiple
copies of @i{Amd}, and need to manage each one separately.  If not
specified, @i{Amq} will use the default program number for @i{Amd}, 300019.
For security reasons, the only alternate program numbers @i{Amd} can use
range from 300019 to 300029, inclusive.

For example, to kill an alternate running @i{Amd}:

@example
kill `amq -p -P 300020`
@end example

@c ----------------------------------------------------------------
@node Amq -q option, Amq -s option, Amq -P option, Controlling Amd
@comment  node-name,  next,  previous,  up
@subsection @i{Amq} @code{-q} option
@cindex Unmounting a filesystem

Suppress any error messages produced when a synchronous unmount fails.
See @ref{Amq -u option}.

@c ----------------------------------------------------------------
@node Amq -s option, Amq -T option, Amq -q option, Controlling Amd
@comment  node-name,  next,  previous,  up
@subsection @i{Amq} @code{-s} option
@cindex Global statistics
@cindex Statistics

The @code{-s} option displays global statistics.  If any other options are specified
or any filesystems named then this option is ignored.  For example:

@example
requests  stale     mount     mount     unmount
deferred  fhandles  ok        failed    failed
1054      1         487       290       7017
@end example

@table @samp
@item Deferred requests
are those for which an immediate reply could not be constructed.  For
example, this would happen if a background mount was required.

@item Stale filehandles
counts the number of times the kernel passes a stale filehandle to @i{Amd}.
Large numbers indicate problems.

@item Mount ok
counts the number of automounts which were successful.

@item Mount failed
counts the number of automounts which failed.

@item Unmount failed
counts the number of times a filesystem could not be unmounted.  Very
large numbers here indicate that the time between unmount attempts
should be increased.
@end table

@c ----------------------------------------------------------------
@node Amq -T option, Amq -U option, Amq -s option, Controlling Amd
@comment  node-name,  next,  previous,  up
@subsection @i{Amq} @code{-T} option
@cindex Forcing Amq to use a TCP transport
@cindex TCP; using with Amq

The @code{-T} option causes the @i{Amq} to contact @i{Amd} using the TCP
transport only (connection oriented).  Normally, @i{Amq} will use TCP
first, and if that failed, will try UDP.

@c ----------------------------------------------------------------
@node Amq -U option, Amq -u option, Amq -T option, Controlling Amd
@comment  node-name,  next,  previous,  up
@subsection @i{Amq} @code{-U} option
@cindex Forcing Amq to use a UDP transport
@cindex UDP; using with Amq

The @code{-U} option causes the @i{Amq} to contact @i{Amd} using the UDP
transport only (connectionless).  Normally, @i{Amq} will use TCP first,
and if that failed, will try UDP.

@c ----------------------------------------------------------------
@node Amq -u option, Amq -v option, Amq -U option, Controlling Amd
@comment  node-name,  next,  previous,  up
@subsection @i{Amq} @code{-u} option
@cindex Forcing filesystem to time out
@cindex Unmounting a filesystem

The @code{-u} option causes the time-to-live interval of the named
mount points to be expired, thus causing an unmount attempt.  This is
the only safe way to unmount an automounted filesystem.  If @code{-u}
is repeated, then @i{Amd} will attempt to unmount the filesystem
synchronously.  This makes things like

@example
amq -uu /t/cd0d && eject cd0
@end example

@noindent
work as expected.  Any error messages this might produce can be
suppressed with the @code{-q} option.  See @ref{Amq -q option}.

@c The @code{-H} option informs @i{Amd} that the specified mount point
@c has hung - as if its keepalive timer had expired.

@c ----------------------------------------------------------------
@node Amq -v option, Amq -w option, Amq -u option, Controlling Amd
@comment  node-name,  next,  previous,  up
@subsection @i{Amq} @code{-v} option
@cindex Version information at run-time

The @code{-v} option displays the version of @i{Amd} in a similar way to
@i{Amd}'s @code{-v} option.

@c ----------------------------------------------------------------
@node Amq -w option, Other Amq options, Amq -v option, Controlling Amd
@comment  node-name,  next,  previous,  up
@subsection @i{Amq} @code{-w} option
@cindex Getting real working directory

The @code{-w} option translates a full pathname as returned by
@b{getpwd}(3) into a short @i{Amd} pathname that goes through its mount
points.  This option requires that @i{Amd} is running.

@c ----------------------------------------------------------------
@node Other Amq options, , Amq -w option, Controlling Amd
@comment  node-name,  next,  previous,  up
@subsection Other @i{Amq} options
@cindex Logging options via Amq
@cindex Debugging options via Amq

Two other operations are implemented.  These modify the state of @i{Amd}
as a whole, rather than any particular filesystem.  The @code{-x} and
@code{-D} options have exactly the same effect as @i{Amd}'s corresponding
command line options.

When @i{Amd} receives the @code{-x} flag, it disallows turning off the
@samp{fatal} or @samp{error} flags.  Both are on by default.  They are
mandatory so that @i{Amd} could report important errors, including
errors relating to turning flags on/off.

@c ################################################################
@node FSinfo, Hlfsd, Run-time Administration, Top
@comment  node-name,  next,  previous,  up
@chapter FSinfo
@cindex FSinfo
@cindex Filesystem info package

XXX: this chapter should be reviewed by someone knowledgeable with
fsinfo.

@menu
* FSinfo Overview::                 Introduction to FSinfo.
* Using FSinfo::                    Basic concepts.
* FSinfo Grammar::                  Language syntax, semantics and examples.
* FSinfo host definitions::         Defining a new host.
* FSinfo host attributes::          Definable host attributes.
* FSinfo filesystems::              Defining locally attached filesystems.
* FSinfo static mounts::            Defining additional static mounts.
* FSinfo automount definitions::
* FSinfo Command Line Options::
* FSinfo errors::
@end menu

@node FSinfo Overview, Using FSinfo, FSinfo, FSinfo
@comment  node-name,  next,  previous,  up
@section @i{FSinfo} overview
@cindex FSinfo overview

@i{FSinfo} is a filesystem management tool.  It has been designed to
work with @i{Amd} to help system administrators keep track of the ever
increasing filesystem namespace under their control.

The purpose of @i{FSinfo} is to generate all the important standard
filesystem data files from a single set of input data.  Starting with a
single data source guarantees that all the generated files are
self-consistent.  One of the possible output data formats is a set of
@i{Amd} maps which can be used among the set of hosts described in the
input data.

@i{FSinfo} implements a declarative language.  This language is
specifically designed for describing filesystem namespace and physical
layouts.  The basic declaration defines a mounted filesystem including
its device name, mount point, and all the volumes and access
permissions.  @i{FSinfo} reads this information and builds an internal
map of the entire network of hosts.  Using this map, many different data
formats can be produced including @file{/etc/fstab},
@file{/etc/exports}, @i{Amd} mount maps and
@file{/etc/bootparams}.@refill

@node Using FSinfo, FSinfo Grammar, FSinfo Overview, FSinfo
@comment  node-name,  next,  previous,  up
@section Using @i{FSinfo}
@cindex Using FSinfo

The basic strategy when using @i{FSinfo} is to gather all the
information about all disks on all machines into one set of
declarations.  For each machine being managed, the following data is
required:

@itemize @bullet
@item
Hostname
@item
List of all filesystems and, optionally, their mount points.
@item
Names of volumes stored on each filesystem.
@item
NFS export information for each volume.
@item
The list of static filesystem mounts.
@end itemize

The following information can also be entered into the same
configuration files so that all data can be kept in one place.

@itemize @bullet
@item
List of network interfaces
@item
IP address of each interface
@item
Hardware address of each interface
@item
Dumpset to which each filesystem belongs
@item
and more @dots{}
@end itemize

To generate @i{Amd} mount maps, the automount tree must also be defined
(@pxref{FSinfo automount definitions}).  This will have been designed at
the time the volume names were allocated.  Some volume names will not be
automounted, so @i{FSinfo} needs an explicit list of which volumes
should be automounted.@refill

Hostnames are required at several places in the @i{FSinfo} language.  It
is important to stick to either fully qualified names or unqualified
names.  Using a mixture of the two will inevitably result in confusion.

Sometimes volumes need to be referenced which are not defined in the set
of hosts being managed with @i{FSinfo}.  The required action is to add a
dummy set of definitions for the host and volume names required.  Since
the files generated for those particular hosts will not be used on them,
the exact values used is not critical.

@node FSinfo Grammar, FSinfo host definitions, Using FSinfo, FSinfo
@comment  node-name,  next,  previous,  up
@section @i{FSinfo} grammar
@cindex FSinfo grammar
@cindex Grammar, FSinfo

@i{FSinfo} has a relatively simple grammar.  Distinct syntactic
constructs exist for each of the different types of data, though they
share a common flavor.  Several conventions are used in the grammar
fragments below.

The notation, @i{list(}@t{xxx}@i{)}, indicates a list of zero or more
@t{xxx}'s.  The notation, @i{opt(}@t{xxx}@i{)}, indicates zero or one
@t{xxx}.  Items in double quotes, @i{eg} @t{"host"}, represent input
tokens.  Items in angle brackets, @i{eg} @var{<hostname>}, represent
strings in the input.  Strings need not be in double quotes, except to
differentiate them from reserved words.  Quoted strings may include the
usual set of C ``@t{\}'' escape sequences with one exception: a
backslash-newline-whitespace sequence is squashed into a single space
character.  To defeat this feature, put a further backslash at the start
of the second line.

At the outermost level of the grammar, the input consists of a
sequence of host and automount declarations.  These declarations are
all parsed before they are analyzed.  This means they can appear in
any order and cyclic host references are possible.

@example
fsinfo      : @i{list(}fsinfo_attr@i{)} ;

fsinfo_attr : host | automount ;
@end example

@menu
* FSinfo host definitions::
* FSinfo automount definitions::
@end menu

@node FSinfo host definitions, FSinfo host attributes, FSinfo Grammar, FSinfo
@comment  node-name,  next,  previous,  up
@section @i{FSinfo} host definitions
@cindex FSinfo host definitions
@cindex Defining a host, FSinfo

A host declaration consists of three parts: a set of machine attribute
data, a list of filesystems physically attached to the machine, and a
list of additional statically mounted filesystems.

@example
host        : "host" host_data @i{list(}filesystem@i{@i{)}} @i{list(}mount@i{@i{)}} ;
@end example

Each host must be declared in this way exactly once.  Such things as the
hardware address, the architecture and operating system types and the
cluster name are all specified within the @dfn{host data}.

All the disks the machine has should then be described in the @dfn{list
of filesystems}.  When describing disks, you can specify what
@dfn{volname} the disk/partition should have and all such entries are
built up into a dictionary which can then be used for building the
automounter maps.

The @dfn{list of mounts} specifies all the filesystems that should be
statically mounted on the machine.

@menu
* FSinfo host attributes::
* FSinfo filesystems::
* FSinfo static mounts::
@end menu

@node FSinfo host attributes, FSinfo filesystems, FSinfo host definitions , FSinfo host definitions
@comment  node-name,  next,  previous,  up
@section @i{FSinfo} host attributes
@cindex FSinfo host attributes
@cindex Defining host attributes, FSinfo

The host data, @dfn{host_data}, always includes the @dfn{hostname}.  In
addition, several other host attributes can be given.

@example
host_data   : @var{<hostname>}
            | "@{" @i{list(}host_attrs@i{)} "@}" @var{<hostname>}
            ;

host_attrs  : host_attr "=" @var{<string>}
            | netif
            ;

host_attr   : "config"
            | "arch"
            | "os"
            | "cluster"
            ;
@end example

The @dfn{hostname} is, typically, the fully qualified hostname of the
machine.

Examples:

@example
host dylan.doc.ic.ac.uk

host @{
    os = hpux
    arch = hp300
@} dougal.doc.ic.ac.uk
@end example

The options that can be given as host attributes are shown below.

@menu
* FSinfo netif Option::         FSinfo host netif.
* FSinfo config Option::        FSinfo host config.
* FSinfo arch Option::          FSinfo host arch.
* FSinfo os Option::            FSinfo host os.
* FSinfo cluster Option::       FSinfo host cluster.
@end menu

@node FSinfo netif Option, FSinfo config Option, , FSinfo host attributes
@comment  node-name,  next,  previous,  up
@subsection netif Option

This defines the set of network interfaces configured on the machine.
The interface attributes collected by @i{FSinfo} are the IP address,
subnet mask and hardware address.  Multiple interfaces may be defined
for hosts with several interfaces by an entry for each interface.  The
values given are sanity checked, but are currently unused for anything
else.

@example
netif       : "netif" @var{<string>} "@{" @i{list(}netif_attrs@i{)} "@}" ;

netif_attrs : netif_attr "=" @var{<string>} ;

netif_attr  : "inaddr" | "netmask" | "hwaddr" ;
@end example

Examples:

@example
netif ie0 @{
    inaddr  = 129.31.81.37
    netmask = 0xfffffe00
    hwaddr  = "08:00:20:01:a6:a5"
@}

netif ec0 @{ @}
@end example

@node FSinfo config Option, FSinfo arch Option, FSinfo netif Option, FSinfo host attributes
@comment  node-name,  next,  previous,  up
@subsection config Option
@cindex FSinfo config host attribute
@cindex config, FSinfo host attribute

This option allows you to specify configuration variables for the
startup scripts (@file{rc} scripts).  A simple string should immediately
follow the keyword.

Example:

@example
config "NFS_SERVER=true"
config "ZEPHYR=true"
@end example

This option is currently unsupported.

@node FSinfo arch Option, FSinfo os Option, FSinfo config Option, FSinfo host attributes
@comment  node-name,  next,  previous,  up
@subsection arch Option
@cindex FSinfo arch host attribute
@cindex arch, FSinfo host attribute

This defines the architecture of the machine.  For example:

@example
arch = hp300
@end example

This is intended to be of use when building architecture specific
mountmaps, however, the option is currently unsupported.

@node FSinfo os Option, FSinfo cluster Option, FSinfo arch Option, FSinfo host attributes
@comment  node-name,  next,  previous,  up
@subsection os Option
@cindex FSinfo os host attribute
@cindex os, FSinfo host attribute

This defines the operating system type of the host.  For example:

@example
os = hpux
@end example

This information is used when creating the @file{fstab} files, for
example in choosing which format to use for the @file{fstab} entries
within the file.

@node FSinfo cluster Option, , FSinfo os Option, FSinfo host attributes
@comment  node-name,  next,  previous,  up
@subsection cluster Option
@cindex FSinfo cluster host attribute
@cindex cluster, FSinfo host attribute

This is used for specifying in which cluster the machine belongs.  For
example:

@example
cluster = "theory"
@end example

The cluster is intended to be used when generating the automount maps,
although it is currently unsupported.

@node FSinfo filesystems, FSinfo static mounts, FSinfo host attributes, FSinfo host definitions
@comment  node-name,  next,  previous,  up
@section @i{FSinfo} filesystems
@cindex FSinfo filesystems

The list of physically attached filesystems follows the machine
attributes.  These should define all the filesystems available from this
machine, whether exported or not.  In addition to the device name,
filesystems have several attributes, such as filesystem type, mount
options, and @samp{fsck} pass number which are needed to generate
@file{fstab} entries.

@example
filesystem  : "fs" @var{<device>} "@{" @i{list(}fs_data@i{)} "@}" ;

fs_data     : fs_data_attr "=" @var{<string>}
            | mount
            ;

fs_data_attr
            : "fstype" | "opts" | "passno"
            | "freq" | "dumpset" | "log"
            ;
@end example

Here, @var{<device>} is the device name of the disk (for example,
@file{/dev/dsk/2s0}).  The device name is used for building the mount
maps and for the @file{fstab} file.  The attributes that can be
specified are shown in the following section.

The @i{FSinfo} configuration file for @code{dylan.doc.ic.ac.uk} is listed below.

@example
host dylan.doc.ic.ac.uk

fs /dev/dsk/0s0 @{
        fstype = swap
@}

fs /dev/dsk/0s0 @{
        fstype = hfs
        opts = rw,noquota,grpid
        passno = 0;
        freq = 1;
        mount / @{ @}
@}

fs /dev/dsk/1s0 @{
        fstype = hfs
        opts = defaults
        passno = 1;
        freq = 1;
        mount /usr @{
                local @{
                        exportfs "dougal eden dylan zebedee brian"
                        volname /nfs/hp300/local
                @}
        @}
@}

fs /dev/dsk/2s0 @{
        fstype = hfs
        opts = defaults
        passno = 1;
        freq = 1;
        mount default @{
                exportfs "toytown_clients hangers_on"
                volname /home/dylan/dk2
        @}
@}

fs /dev/dsk/3s0 @{
        fstype = hfs
        opts = defaults
        passno = 1;
        freq = 1;
        mount default @{
                exportfs "toytown_clients hangers_on"
                volname /home/dylan/dk3
        @}
@}

fs /dev/dsk/5s0 @{
        fstype = hfs
        opts = defaults
        passno = 1;
        freq = 1;
        mount default @{
                exportfs "toytown_clients hangers_on"
                volname /home/dylan/dk5
        @}
@}
@end example

@menu
* FSinfo fstype Option::        FSinfo filesystems fstype.
* FSinfo opts Option::          FSinfo filesystems opts.
* FSinfo passno Option::        FSinfo filesystems passno.
* FSinfo freq Option::          FSinfo filesystems freq.
* FSinfo mount Option::         FSinfo filesystems mount.
* FSinfo dumpset Option::       FSinfo filesystems dumpset.
* FSinfo log Option::           FSinfo filesystems log.
@end menu

@node FSinfo fstype Option, FSinfo opts Option, , FSinfo filesystems
@comment  node-name,  next,  previous,  up
@subsection fstype Option
@cindex FSinfo fstype filesystems option
@cindex fstype, FSinfo filesystems option
@cindex export, FSinfo special fstype

This specifies the type of filesystem being declared and will be placed
into the @file{fstab} file as is.  The value of this option will be
handed to @code{mount} as the filesystem type---it should have such
values as @code{4.2}, @code{nfs} or @code{swap}.  The value is not
examined for correctness.

There is one special case.  If the filesystem type is specified as
@samp{export} then the filesystem information will not be added to the
host's @file{fstab} information, but it will still be visible on the
network.  This is useful for defining hosts which contain referenced
volumes but which are not under full control of @i{FSinfo}.

Example:

@example
fstype = swap
@end example

@node FSinfo opts Option, FSinfo passno Option, FSinfo fstype Option, FSinfo filesystems
@comment  node-name,  next,  previous,  up
@subsection opts Option
@cindex FSinfo opts filesystems option
@cindex opts, FSinfo filesystems option

This defines any options that should be given to @b{mount}(8) in the
@file{fstab} file.  For example:

@example
opts = rw,nosuid,grpid
@end example

@node FSinfo passno Option, FSinfo freq Option, FSinfo opts Option, FSinfo filesystems
@comment  node-name,  next,  previous,  up
@subsection passno Option
@cindex FSinfo passno filesystems option
@cindex passno, FSinfo filesystems option

This defines the @b{fsck}(8) pass number in which to check the
filesystem.  This value will be placed into the @file{fstab} file.

Example:

@example
passno = 1
@end example

@node FSinfo freq Option, FSinfo mount Option, FSinfo passno Option, FSinfo filesystems
@comment  node-name,  next,  previous,  up
@subsection freq Option
@cindex FSinfo freq filesystems option
@cindex freq, FSinfo filesystems option

This defines the interval (in days) between dumps.  The value is placed
as is into the @file{fstab} file.

Example:

@example
freq = 3
@end example

@node FSinfo mount Option, FSinfo dumpset Option, FSinfo freq Option, FSinfo filesystems
@comment  node-name,  next,  previous,  up
@subsection mount Option
@cindex FSinfo mount filesystems option
@cindex mount, FSinfo filesystems option
@cindex exportfs, FSinfo mount option
@cindex volname, FSinfo mount option
@cindex sel, FSinfo mount option

This defines the mountpoint at which to place the filesystem.  If the
mountpoint of the filesystem is specified as @code{default}, then the
filesystem will be mounted in the automounter's tree under its volume
name and the mount will automatically be inherited by the automounter.

Following the mountpoint, namespace information for the filesystem may
be described.  The options that can be given here are @code{exportfs},
@code{volname} and @code{sel}.

The format is:

@example
mount       : "mount" vol_tree ;

vol_tree    : @i{list(}vol_tree_attr@i{)} ;

vol_tree_attr
            :  @var{<string>} "@{" @i{list(}vol_tree_info@i{)} vol_tree "@}" ;

vol_tree_info
            : "exportfs" @var{<export-data>}
            | "volname" @var{<volname>}
            | "sel" @var{<selector-list>}
            ;
@end example

Example:

@example
mount default @{
    exportfs "dylan dougal florence zebedee"
    volname /vol/andrew
@}
@end example

In the above example, the filesystem currently being declared will have
an entry placed into the @file{exports} file allowing the filesystem to
be exported to the machines @code{dylan}, @code{dougal}, @code{florence}
and @code{zebedee}.  The volume name by which the filesystem will be
referred to remotely, is @file{/vol/andrew}.  By declaring the
mountpoint to be @code{default}, the filesystem will be mounted on the
local machine in the automounter tree, where @i{Amd} will automatically
inherit the mount as @file{/vol/andrew}.@refill

@table @samp
@item exportfs
a string defining which machines the filesystem may be exported to.
This is copied, as is, into the @file{exports} file---no sanity checking
is performed on this string.@refill

@item volname
a string which declares the remote name by which to reference the
filesystem.  The string is entered into a dictionary and allows you to
refer to this filesystem in other places by this volume name.@refill

@item sel
a string which is placed into the automounter maps as a selector for the
filesystem.@refill

@end table

@node FSinfo dumpset Option, FSinfo log Option, FSinfo mount Option, FSinfo filesystems
@comment  node-name,  next,  previous,  up
@subsection dumpset Option
@cindex FSinfo dumpset filesystems option
@cindex dumpset, FSinfo filesystems option

This provides support for Imperial College's local file backup tools and
is not documented further here.

@node FSinfo log Option, , FSinfo dumpset Option, FSinfo filesystems
@comment  node-name,  next,  previous,  up
@subsection log Option
@cindex FSinfo log filesystems option
@cindex log, FSinfo filesystems option

Specifies the log device for the current filesystem. This is ignored if
not required by the particular filesystem type.

@node FSinfo static mounts, FSinfo automount definitions , FSinfo filesystems, FSinfo host definitions
@comment  node-name,  next,  previous,  up
@section @i{FSinfo} static mounts
@cindex FSinfo static mounts
@cindex Statically mounts filesystems, FSinfo

Each host may also have a number of statically mounted filesystems.  For
example, the host may be a diskless workstation in which case it will
have no @code{fs} declarations.  In this case the @code{mount}
declaration is used to determine from where its filesystems will be
mounted.  In addition to being added to the @file{fstab} file, this
information can also be used to generate a suitable @file{bootparams}
file.@refill

@example
mount       : "mount" @var{<volname>} @i{list(}localinfo@i{)} ;

localinfo   : localinfo_attr @var{<string>} ;

localinfo_attr
            : "as"
            | "from"
            | "fstype"
            | "opts"
            ;
@end example

The filesystem specified to be mounted will be searched for in the
dictionary of volume names built when scanning the list of hosts'
definitions.

The attributes have the following semantics:
@table @samp
@item from @var{machine}
mount the filesystem from the machine with the hostname of
@dfn{machine}.@refill

@item as @var{mountpoint}
mount the filesystem locally as the name given, in case this is
different from the advertised volume name of the filesystem.

@item opts @var{options}
native @b{mount}(8) options.

@item fstype @var{type}
type of filesystem to be mounted.
@end table

An example:

@example
mount /export/exec/hp300/local as /usr/local
@end example

If the mountpoint specified is either @file{/} or @file{swap}, the
machine will be considered to be booting off the net and this will be
noted for use in generating a @file{bootparams} file for the host which
owns the filesystems.

@node FSinfo automount definitions, FSinfo Command Line Options, FSinfo static mounts, FSinfo
@comment  node-name,  next,  previous,  up
@section Defining an @i{Amd} Mount Map in @i{FSinfo}
@cindex FSinfo automount definitions
@cindex Defining an Amd mount map, FSinfo

The maps used by @i{Amd} can be constructed from @i{FSinfo} by defining
all the automount trees.  @i{FSinfo} takes all the definitions found and
builds one map for each top level tree.

The automount tree is usually defined last.  A single automount
configuration will usually apply to an entire management domain.  One
@code{automount} declaration is needed for each @i{Amd} automount point.
@i{FSinfo} determines whether the automount point is @dfn{direct}
(@pxref{Direct Automount Filesystem}) or @dfn{indirect}
(@pxref{Top-level Filesystem}).  Direct automount points are
distinguished by the fact that there is no underlying
@dfn{automount_tree}.@refill

@example
automount   : "automount" @i{opt(}auto_opts@i{)} automount_tree ;

auto_opts   : "opts" @var{<mount-options>} ;

automount_tree
            : @i{list(}automount_attr@i{)}
            ;

automount_attr
            : @var{<string>} "=" @var{<volname>}
            | @var{<string>} "->" @var{<symlink>}
            | @var{<string>} "@{" automount_tree "@}"
            ;
@end example

If @var{<mount-options>} is given, then it is the string to be placed in
the maps for @i{Amd} for the @code{opts} option.

A @dfn{map} is typically a tree of filesystems, for example @file{home}
normally contains a tree of filesystems representing other machines in
the network.

A map can either be given as a name representing an already defined
volume name, or it can be a tree.  A tree is represented by placing
braces after the name.  For example, to define a tree @file{/vol}, the
following map would be defined:

@example
automount /vol @{ @}
@end example

Within a tree, the only items that can appear are more maps.
For example:

@example
automount /vol @{
    andrew @{ @}
    X11 @{ @}
@}
@end example

In this case, @i{FSinfo} will look for volumes named @file{/vol/andrew}
and @file{/vol/X11} and a map entry will be generated for each.  If the
volumes are defined more than once, then @i{FSinfo} will generate
a series of alternate entries for them in the maps.@refill

Instead of a tree, either a link (@var{name} @code{->}
@var{destination}) or a reference can be specified (@var{name} @code{=}
@var{destination}).  A link creates a symbolic link to the string
specified, without further processing the entry.  A reference will
examine the destination filesystem and optimize the reference.  For
example, to create an entry for @code{njw} in the @file{/homes} map,
either of the two forms can be used:@refill

@example
automount /homes @{
    njw -> /home/dylan/njw
@}
@end example

or

@example
automount /homes @{
    njw = /home/dylan/njw
@}
@end example

In the first example, when @file{/homes/njw} is referenced from @i{Amd},
a link will be created leading to @file{/home/dylan/njw} and the
automounter will be referenced a second time to resolve this filename.
The map entry would be:

@example
njw type:=link;fs:=/home/dylan/njw
@end example

In the second example, the destination directory is analyzed and found
to be in the filesystem @file{/home/dylan} which has previously been
defined in the maps. Hence the map entry will look like:

@example
njw rhost:=dylan;rfs:=/home/dylan;sublink:=njw
@end example

Creating only one symbolic link, and one access to @i{Amd}.

@node FSinfo Command Line Options, FSinfo errors, FSinfo automount definitions, FSinfo
@comment  node-name,  next,  previous,  up
@section @i{FSinfo} Command Line Options
@cindex FSinfo command line options
@cindex Command line options, FSinfo

@i{FSinfo} is started from the command line by using the command:

@example
fsinfo [@i{options}] @i{files} ...
@end example

The input to @i{FSinfo} is a single set of definitions of machines and
automount maps.  If multiple files are given on the command-line, then
the files are concatenated together to form the input source.  The files
are passed individually through the C pre-processor before being parsed.

Several options define a prefix for the name of an output file.  If the
prefix is not specified no output of that type is produced.  The suffix
used will correspond either to the hostname to which a file belongs, or
to the type of output if only one file is produced.  Dumpsets and the
@file{bootparams} file are in the latter class.  To put the output into
a subdirectory simply put a @file{/} at the end of the prefix, making
sure that the directory has already been made before running
@i{Fsinfo}.

@menu
* -a FSinfo Option::    Amd automount directory:
* -b FSinfo Option::    Prefix for bootparams files.
* -d FSinfo Option::    Prefix for dumpset data files.
* -e FSinfo Option::    Prefix for exports files.
* -f FSinfo Option::    Prefix for fstab files.
* -h FSinfo Option::    Local hostname.
* -m FSinfo Option::    Prefix for automount maps.
* -q FSinfo Option::    Ultra quiet mode.
* -v FSinfo Option::    Verbose mode.
* -I FSinfo Option::    Define new #include directory.
* -D-FSinfo Option::    Define macro.
* -U FSinfo Option::    Undefine macro.
@end menu

@node -a FSinfo Option, -b FSinfo Option, FSinfo Command Line Options, FSinfo Command Line Options
@comment  node-name,  next,  previous,  up
@subsection @code{-a} @var{autodir}

Specifies the directory name in which to place the automounter's
mountpoints.  This defaults to @file{/a}.  Some sites have the autodir set
to be @file{/amd}, and this would be achieved by:

@example
fsinfo -a /amd ...
@end example

@node -b FSinfo Option, -d FSinfo Option, -a FSinfo Option, FSinfo Command Line Options
@comment  node-name,  next,  previous,  up
@subsection @code{-b} @var{bootparams}
@cindex bootparams, FSinfo prefix

This specifies the prefix for the @file{bootparams} filename.  If it is
not given, then the file will not be generated.  The @file{bootparams}
file will be constructed for the destination machine and will be placed
into a file named @file{bootparams} and prefixed by this string.  The
file generated contains a list of entries describing each diskless
client that can boot from the destination machine.

As an example, to create a @file{bootparams} file in the directory
@file{generic}, the following would be used:

@example
fsinfo -b generic/ ...
@end example

@node -d FSinfo Option, -e FSinfo Option, -b FSinfo Option, FSinfo Command Line Options
@comment  node-name,  next,  previous,  up
@subsection @code{-d} @var{dumpsets}
@cindex dumpset, FSinfo prefix

This specifies the prefix for the @file{dumpsets} file.  If it is not
specified, then the file will not be generated.  The file will be for
the destination machine and will be placed into a filename
@file{dumpsets}, prefixed by this string.  The @file{dumpsets} file is
for use by Imperial College's local backup system.

For example, to create a @file{dumpsets} file in the directory @file{generic},
then you would use the following:

@example
fsinfo -d generic/ ...
@end example

@node -e FSinfo Option, -f FSinfo Option, -d FSinfo Option, FSinfo Command Line Options
@comment  node-name,  next,  previous,  up
@subsection @code{-e} @var{exportfs}
@cindex exports, FSinfo prefix

Defines the prefix for the @file{exports} files.  If it is not given,
then the file will not be generated.  For each machine defined in the
configuration files as having disks, an @file{exports} file is
constructed and given a filename determined by the name of the machine,
prefixed with this string.  If a machine is defined as diskless, then no
@file{exports} file will be created for it.  The files contain entries
for directories on the machine that may be exported to clients.

Example: To create the @file{exports} files for each diskfull machine
and place them into the directory @file{exports}:

@example
fsinfo -e exports/ ...
@end example

@node -f FSinfo Option, -h FSinfo Option, -e FSinfo Option, FSinfo Command Line Options
@comment  node-name,  next,  previous,  up
@subsection @code{-f} @var{fstab}
@cindex fstab, FSinfo prefix

This defines the prefix for the @file{fstab} files.  The files will only
be created if this prefix is defined.  For each machine defined in the
configuration files, a @file{fstab} file is created with the filename
determined by prefixing this string with the name of the machine.  These
files contain entries for filesystems and partitions to mount at boot
time.

Example, to create the files in the directory @file{fstabs}:

@example
fsinfo -f fstabs/ ...
@end example

@node -h FSinfo Option, -m FSinfo Option, -f FSinfo Option, FSinfo Command Line Options
@comment  node-name,  next,  previous,  up
@subsection @code{-h} @var{hostname}
@cindex hostname, FSinfo command line option

Defines the hostname of the destination machine to process for.  If this
is not specified, it defaults to the local machine name, as returned by
@b{gethostname}(2).

Example:

@example
fsinfo -h dylan.doc.ic.ac.uk ...
@end example

@node -m FSinfo Option, -q FSinfo Option, -h FSinfo Option, FSinfo Command Line Options
@comment  node-name,  next,  previous,  up
@subsection @code{-m} @var{mount-maps}
@cindex maps, FSinfo command line option

Defines the prefix for the automounter files.  The maps will only be
produced if this prefix is defined.  The mount maps suitable for the
network defined by the configuration files will be placed into files
with names calculated by prefixing this string to the name of each map.

For example, to create the automounter maps and place them in the
directory @file{automaps}:

@example
fsinfo -m automaps/ ...
@end example

@node -q FSinfo Option, -v FSinfo Option, -m FSinfo Option, FSinfo Command Line Options
@comment  node-name,  next,  previous,  up
@subsection @code{-q}
@cindex quiet, FSinfo command line option

Selects quiet mode.  @i{FSinfo} suppress the ``running commentary'' and
only outputs any error messages which are generated.

@node -v FSinfo Option, -D-FSinfo Option, -q FSinfo Option, FSinfo Command Line Options
@comment  node-name,  next,  previous,  up
@subsection @code{-v}
@cindex verbose, FSinfo command line option

Selects verbose mode.  When this is activated, the program will display
more messages, and display all the information discovered when
performing the semantic analysis phase.  Each verbose message is output
to @file{stdout} on a line starting with a @samp{#} character.

@node -D-FSinfo Option, -I FSinfo Option, -v FSinfo Option, FSinfo Command Line Options
@comment  node-name,  next,  previous,  up
@subsection @code{-D} @var{name}@i{[=defn]}

Defines a symbol @dfn{name} for the preprocessor when reading the
configuration files.  Equivalent to @code{#define} directive.

@node -I FSinfo Option, -U FSinfo Option, -D-FSinfo Option, FSinfo Command Line Options
@comment  node-name,  next,  previous,  up
@subsection @code{-I} @var{directory}

This option is passed into the preprocessor for the configuration files.
It specifies directories in which to find include files

@node -U FSinfo Option, , -I FSinfo Option, FSinfo Command Line Options
@comment  node-name,  next,  previous,  up
@subsection @code{-U} @var{name}

Removes any initial definition of the symbol @dfn{name}.  Inverse of the
@code{-D} option.

@node FSinfo errors, , FSinfo Command Line Options, FSinfo
@comment  node-name,  next,  previous,  up
@section Errors produced by @i{FSinfo}
@cindex FSinfo error messages

The following table documents the errors and warnings which @i{FSinfo} may produce.

@table @t

@item " expected
Occurs if an unescaped newline is found in a quoted string.

@item ambiguous mount: @var{volume} is a replicated filesystem
If several filesystems are declared as having the same volume name, they
will be considered replicated filesystems.  To mount a replicated
filesystem statically, a specific host will need to be named, to say
which particular copy to try and mount, else this error will
result.

@item can't open @var{filename} for writing
Occurs if any errors are encountered when opening an output file.

@item cannot determine localname since volname @var{volume} is not uniquely defined
If a volume is replicated and an attempt is made to mount the filesystem
statically without specifying a local mountpoint, @i{FSinfo} cannot
calculate a mountpoint, as the desired pathname would be
ambiguous.

@item @var{device} has duplicate exportfs data
Produced if the @samp{exportfs} option is used multiple times within the
same branch of a filesystem definition. For example, if you attempt to
set the @samp{exportfs} data at different levels of the mountpoint
directory tree.

@item dump frequency for @var{host}:@var{device} is non-zero
Occurs if @var{device} has its @samp{fstype} declared to be @samp{swap}
or @samp{export} and the @samp{dump} option is set to a value greater
than zero.  Swap devices should not be dumped.

@item duplicate host @var{hostname}!
If a host has more than one definition.

@item end of file within comment
A comment was unterminated before the end of one of the configuration
files.

@item @var{filename}: cannot open for reading
If a file specified on the command line as containing configuration data
could not be opened.

@item @var{filesystem} has a volname but no exportfs data
Occurs when a volume name is declared for a file system, but the string
specifying what machines the filesystem can be exported to is
missing.

@item fs field "@var{field-name}" already set
Occurs when multiple definitions are given for one of the attributes of a
host's filesystem.

@item host field "@var{field-name}" already set
If duplicate definitions are given for any of the fields with a host
definition.

@item @var{host}:@var{device} has more than one mount point
Occurs if the mount option for a host's filesystem specifies multiple
trees at which to place the mountpoint.

@item @var{host}:@var{device} has no mount point
Occurs if the @samp{mount} option is not specified for a host's
filesystem.

@item @var{host}:@var{device} needs field "@var{field-name}"
Occurs when a filesystem is missing a required field. @var{field-name} could
be one of @samp{fstype}, @samp{opts}, @samp{passno} or
@samp{mount}.

@item @var{host}:mount field specified for swap partition
Occurs if a mountpoint is given for a filesystem whose type is declared
to be @samp{swap}.

@item malformed IP dotted quad: @var{address}
If the Internet address of an interface is incorrectly specified.  An
Internet address definition is handled to @b{inet_addr}(3N) to see if it
can cope.  If not, then this message will be displayed.

@item malformed netmask: @var{netmask}
If the netmask cannot be decoded as though it were a hexadecimal number,
then this message will be displayed.  It will typically be caused by
incorrect characters in the @var{netmask} value.

@item mount field "@var{field-name}" already set
Occurs when a static mount has multiple definitions of the same field.

@item mount tree field "@var{field-name}" already set
Occurs when the @var{field-name} is defined more than once during the
definition of a filesystems mountpoint.

@item netif field @var{field-name} already set
Occurs if you attempt to define an attribute of an interface more than
once.

@item network booting requires both root and swap areas
Occurs if a machine has mount declarations for either the root partition
or the swap area, but not both.  You cannot define a machine to only
partially boot via the network.

@item no disk mounts on @var{hostname}
If there are no static mounts, nor local disk mounts specified for a
machine, this message will be displayed.

@item no volname given for @var{host}:@var{device}
Occurs when a filesystem is defined to be mounted on @file{default}, but
no volume name is given for the file system, then the mountpoint cannot
be determined.

@item not allowed '/' in a directory name
Occurs when a pathname with multiple directory elements is specified as
the name for an automounter tree.  A tree should only have one name at
each level.

@item pass number for @var{host}:@var{device} is non-zero
Occurs if @var{device} has its @samp{fstype} declared to be @samp{swap}
or @samp{export} and the @b{fsck}(8) pass number is set. Swap devices
should not be fsck'd.  @xref{FSinfo fstype Option}.

@item sub-directory @var{directory} of @var{directory-tree} starts with '/'
Within the filesystem specification for a host, if an element
@var{directory} of the mountpoint begins with a @samp{/} and it is not
the start of the tree.

@item sub-directory of @var{directory-tree} is named "default"
@samp{default} is a keyword used to specify if a mountpoint should be
automatically calculated by @i{FSinfo}.  If you attempt to specify a
directory name as this, it will use the filename of @file{default} but
will produce this warning.

@item unknown \ sequence
Occurs if an unknown escape sequence is found inside a string.  Within a
string, you can give the standard C escape sequences for strings, such
as newlines and tab characters.

@item unknown directory attribute
If an unknown keyword is found while reading the definition of a host's
filesystem mount option.

@item unknown filesystem attribute
Occurs if an unrecognized keyword is used when defining a host's
filesystems.

@item unknown host attribute
Occurs if an unrecognized keyword is used when defining a host.

@item unknown mount attribute
Occurs if an unrecognized keyword is found while parsing the list of
static mounts.

@item unknown volname @var{volume} automounted @i{[} on @i{name} @i{]}
Occurs if @var{volume} is used in a definition of an automount map but the volume
name has not been declared during the host filesystem definitions.

@item volname @var{volume} is unknown
Occurs if an attempt is made to mount or reference a volume name which
has not been declared during the host filesystem definitions.

@item volname @var{volume} not exported from @var{machine}
Occurs if you attempt to mount the volume @var{volume} from a machine
which has not declared itself to have such a filesystem
available.

@end table

@c ################################################################
@node Hlfsd, Assorted Tools, FSinfo, Top
@comment  node-name,  next,  previous,  up
@chapter Hlfsd
@pindex Hlfsd
@cindex Home-Link Filesystem

@i{Hlfsd} is a daemon which implements a filesystem containing a
symbolic link to subdirectory within a user's home directory, depending
on the user which accessed that link.  It was primarily designed to
redirect incoming mail to users' home directories, so that it can be read
from anywhere.  It was designed and implemented by
@uref{http://www.cs.sunysb.edu/~ezk,Erez Zadok} and
@email{dupuy AT cs.columbia.edu,Alexander Dupuy}, at the
@uref{http://www.cs.columbia.edu/,Computer Science Department} of
@uref{http://www.columbia.edu/,Columbia University}.  A
@uref{http://www.fsl.cs.sunysb.edu/docs/hlfsd/hlfsd.html,paper}
on @i{Hlfsd} was presented at the Usenix LISA VII conference in 1993.

@i{Hlfsd} operates by mounting itself as an NFS server for the directory
containing @i{linkname}, which defaults to @file{/hlfs/home}.  Lookups
within that directory are handled by @i{Hlfsd}, which uses the
password map to determine how to resolve the lookup.  The directory will
be created if it doesn't already exist.  The symbolic link will be to
the accessing user's home directory, with @i{subdir} appended to it.  If
not specified, @i{subdir} defaults to @file{.hlfsdir}.  This directory
will also be created if it does not already exist.

A @samp{SIGTERM} sent to @i{Hlfsd} will cause it to shutdown.  A
@samp{SIGHUP} will flush the internal caches, and reload the password
map.  It will also close and reopen the log file, to enable the original
log file to be removed or rotated.  A @samp{SIGUSR1} will cause it to
dump its internal table of user IDs and home directories to the file
@file{/tmp/hlfsddump}.

@menu
* Introduction to Hlfsd::
* Background to Mail Delivery::
* Using Hlfsd::
@end menu

@c ================================================================
@node Introduction to Hlfsd, Background to Mail Delivery, Hlfsd, Hlfsd
@comment  node-name,  next,  previous,  up
@section Introduction to Hlfsd
@cindex Introduction to Hlfsd
@cindex Hlfsd; introduction

Electronic mail has become one of the major applications for many
computer networks, and use of this service is expected to increase over
time, as networks proliferate and become faster.  Providing a convenient
environment for users to read, compose, and send electronic mail has
become a requirement for systems administrators (SAs).

Widely used methods for handling mail usually require users to be logged
into a designated ``home'' machine, where their mailbox files reside.
Only on that one machine can they read newly arrived mail.  Since users
have to be logged into that system to read their mail, they often find
it convenient to run all of their other processes on that system as
well, including memory and CPU-intensive jobs.  For example, in our
department, we have allocated and configured several multi-processor
servers to handle such demanding CPU/memory applications, but these were
underutilized, in large part due to the inconvenience of not being able
to read mail on those machines.  (No home directories were located on
these designated CPU-servers, since we did not want NFS service for
users' home directories to have to compete with CPU-intensive jobs.  At the
same time, we discouraged users from running demanding applications on
their home machines.)

Many different solutions have been proposed to allow users to read their
mail on any host.  However, all of these solutions fail in one or more
of several ways:

@itemize @bullet

@item
they introduce new single points of failure

@item
they require using different mail transfer agents (MTAs) or user agents
(UAs)

@item
they do not solve the problem for all cases, i.e.  the solution is only
partially successful for a particular environment.

@end itemize

We have designed a simple filesystem, called the @dfn{Home-Link File
System}, to provide the ability to deliver mail to users' home
directories, without modification to mail-related applications. We have
endeavored to make it as stable as possible.  Of great importance to us
was to make sure the HLFS daemon, @file{hlfsd} , would not hang under
any circumstances, and would take the next-best action when faced with
problems.  Compared to alternative methods, @i{Hlfsd} is a stable, more
general solution, and easier to install/use.  In fact, in some ways, we
have even managed to improve the reliability and security of mail
service.

Our server implements a small filesystem containing a symbolic link
to a subdirectory of the invoking user's home directory, and named symbolic
links to users' mailbox files.

The @i{Hlfsd} server finds out the @var{uid} of the process that is
accessing its mount point, and resolves the pathname component @samp{home} as a
symbolic link to a subdirectory within the home directory given by the
@var{uid}'s entry in the password file.  If the @var{gid} of the process
that attempts to access a mailbox file is a special one (called
HLFS_GID), then the server maps the name of the @emph{next} pathname
component directly to the user's mailbox.  This is necessary so that
access to a mailbox file by users other than the owner can succeed.  The
server has safety features in case of failures such as hung filesystems
or home directory filesystems that are inaccessible or full.

On most of our machines, mail gets delivered to the directory
@file{/var/spool/mail}. Many programs, including UAs, depend on that
path.  @i{Hlfsd} creates a directory @file{/mail}, and mounts itself on
top of that directory.  @i{Hlfsd} implements the path name component
called @samp{home}, pointing to a subdirectory of the user's home directory.
We have made @file{/var/spool/mail} a symbolic link to
@file{/mail/home}, so that accessing @file{/var/spool/mail} actually
causes access to a subdirectory within a user's home directory.

The following table shows an example of how resolving the pathname
@file{/var/mail/@i{NAME}} to @file{/users/ezk/.mailspool/@i{NAME}} proceeds.

@multitable {Resolving Component} {Pathname left to resolve} {Value if symbolic link}

@item @b{Resolving Component}
@tab @b{Pathname left to resolve}
@tab @b{Value if symbolic link}

@item @t{/}
@tab @t{var/mail/}@i{NAME}

@item @t{var/}
@tab @t{mail/}@i{NAME}

@item @t{mail}@@
@tab @t{/mail/home/}@i{NAME}
@tab @t{mail}@@ -> @t{/mail/home}

@item @t{/}
@tab @t{mail/home/}@i{NAME}

@item @t{mail/}
@tab @t{home/}@i{NAME}

@item @t{home}@@
@tab @i{NAME}
@tab @t{home}@@ -> @t{/users/ezk/.mailspool}

@item @t{/}
@tab @t{users/ezk/.mailspool/}@i{NAME}

@item @t{users/}
@tab @t{ezk/.mailspool/}@i{NAME}

@item @t{ezk/}
@tab @t{.mailspool/}@i{NAME}

@item @t{.mailspool/}
@tab @i{NAME}

@item @i{NAME}

@end multitable

@c ================================================================
@node Background to Mail Delivery, Using Hlfsd, Introduction to Hlfsd, Hlfsd
@comment  node-name,  next,  previous,  up
@section Background to Mail Delivery
@cindex Background to Mail Delivery
@cindex Hlfsd; background

This section provides an in-depth discussion of why available methods
for delivering mail to home directories are not as good as the one used
by @i{Hlfsd}.

@menu
* Single-Host Mail Spool Directory::
* Centralized Mail Spool Directory::
* Distributed Mail Spool Service::
* Why Deliver Into the Home Directory?::
@end menu

@c ----------------------------------------------------------------
@node Single-Host Mail Spool Directory, Centralized Mail Spool Directory, Background to Mail Delivery, Background to Mail Delivery
@comment  node-name,  next,  previous,  up
@subsection Single-Host Mail Spool Directory
@cindex Single-Host Mail Spool Directory

The most common method for mail delivery is for mail to be appended to a
mailbox file in a standard spool directory on the designated ``mail
home'' machine of the user. The greatest advantage of this method is
that it is the default method most vendors provide with their systems,
thus very little (if any) configuration is required on the SA's part.
All they need to set up are mail aliases directing mail to the host on
which the user's mailbox file is assigned.  (Otherwise, mail is
delivered locally, and users find mailboxes on many machines.)

As users become more sophisticated, and aided by windowing systems, they
find themselves logging in on multiple hosts at once, performing several
tasks concurrently.  They ask to be able to read their mail on any host
on the network, not just the one designated as their ``mail home''.

@c ----------------------------------------------------------------
@node Centralized Mail Spool Directory, Distributed Mail Spool Service, Single-Host Mail Spool Directory, Background to Mail Delivery
@comment  node-name,  next,  previous,  up
@subsection Centralized Mail Spool Directory
@cindex Centralized Mail Spool Directory

A popular method for providing mail readability from any host is to have
all mail delivered to a mail spool directory on a designated
``mail-server'' which is exported via NFS to all of the hosts on the
network.  Configuring such a system is relatively easy.  On most
systems, the bulk of the work is a one-time addition to one or two
configuration files in @file{/etc}.  The file-server's spool directory
is then hard-mounted across every machine on the local network.  In
small environments with only a handful of hosts this can be an
acceptable solution.  In our department, with a couple of hundred active
hosts and thousands of mail messages processed daily, this was deemed
completely unacceptable, as it introduced several types of problems:

@table @b

@item Scalability and Performance

As more and more machines get added to the network, more mail traffic
has to go over NFS to and from the mail-server. Users like to run
mail-watchers, and read their mail often. The stress on the shared
infrastructure increases with every user and host added; loads on the
mail server would most certainly be high since all mail delivery goes
through that one machine.@footnote{ Delivery via NFS-mounted filesystems
may require usage of @samp{rpc.lockd} and @samp{rpc.statd} to provide
distributed file-locking, both of which are widely regarded as unstable
and unreliable.  Furthermore, this will degrade performance, as local
processes as well as remote @samp{nfsd} processes are kept busy.}  This
leads to lower reliability and performance.  To reduce the number of
concurrent connections between clients and the server host, some SAs
have resorted to automounting the mail-spool directory.  But this
solution only makes things worse: since users often run mail watchers,
and many popular applications such as @samp{trn}, @samp{emacs},
@samp{csh} or @samp{ksh} check periodically for new mail, the
automounted directory would be effectively permanently mounted.  If it
gets unmounted automatically by the automounter program, it is most
likely to get mounted shortly afterwards, consuming more I/O resources
by the constant cycle of mount and umount calls.

@item Reliability

The mail-server host and its network connectivity must be very reliable.
Worse, since the spool directory has to be hard-mounted,@footnote{No SA
in their right minds would soft-mount read/write partitions --- the
chances for data loss are too great.} many processes which access the
spool directory (various shells, @samp{login}, @samp{emacs}, etc.)
would be hung as long as connectivity to the mail-server is severed. To
improve reliability, SAs may choose to backup the mail-server's spool
partition several times a day.  This may make things worse since reading
or delivering mail while backups are in progress may cause backups to be
inconsistent; more backups consume more backup-media resources, and
increase the load on the mail-server host.

@end table

@c ----------------------------------------------------------------
@node Distributed Mail Spool Service, Why Deliver Into the Home Directory?, Centralized Mail Spool Directory, Background to Mail Delivery
@comment  node-name,  next,  previous,  up
@subsection Distributed Mail Spool Service
@cindex Distributed Mail Spool Service

Despite the existence of a few systems that support delivery to users'
home directories, mail delivery to home directories hasn't caught on.
We believe the main reason is that there are too many programs that
``know'' where mailbox files reside.  Besides the obvious (the delivery
program @file{/bin/mail} and mail readers like @file{/usr/ucb/Mail},
@samp{mush}, @samp{mm}, etc.), other programs that know mailbox location
are login, from, almost every shell, @samp{xbiff}, @samp{xmailbox}, and
even some programs not directly related to mail, such as @samp{emacs}
and @samp{trn}.  Although some of these programs can be configured to
look in different directories with the use of environment variables and
other resources, many of them cannot.  The overall porting work is
significant.

Other methods that have yet to catch on require the use of a special
mail-reading server, such as IMAP or POP.  The main disadvantage of
these systems is that UAs need to be modified to use these services ---
a long and involved task.  That is why they are not popular at this
time.

Several other ideas have been proposed and even used in various
environments.  None of them is robust.  They are mostly very
specialized, inflexible, and do not extend to the general case.  Some of
the ideas are plain bad, potentially leading to lost or corrupt mail:

@table @b

@item automounters

Using an automounter such as @i{Amd} to provide a set of symbolic links
from the normal spool directory to user home directories is not
sufficient.  UAs rename, unlink, and recreate the mailbox as a regular
file, therefore it must be a real file, not a symbolic link.
Furthermore, it must reside in a real directory which is writable by the
UAs and MTAs.  This method may also require populating
@file{/var/spool/mail} with symbolic links and making sure they are
updated.  Making @i{Amd} manage that directory directly fails, since
many various lock files need to be managed as well.  Also, @i{Amd} does
not provide all of the NFS operations which are required to write mail
such as write, create, remove, and unlink.

@item @code{$MAIL}

Setting this variable to an automounted directory pointing to the user's
mail spool host only solves the problem for those programs which know
and use @code{$MAIL}.  Many programs don't, therefore this solution is partial
and of limited flexibility.  Also, it requires the SAs or the users to
set it themselves --- an added level of inconvenience and possible
failures.

@item @t{/bin/mail}

Using a different mail delivery agent could be the solution.  One such
example is @samp{hdmail}.  However, @samp{hdmail} still requires
modifying all UAs, the MTA's configuration, installing new daemons, and
changing login scripts.  This makes the system less upgradable or
compatible with others, and adds one more complicated system for SAs to
deal with.  It is not a complete solution because it still requires each
user have their @code{$MAIL} variable setup correctly, and that every program
use this variable.

@end table

@c ----------------------------------------------------------------
@node Why Deliver Into the Home Directory?, , Distributed Mail Spool Service, Background to Mail Delivery
@comment  node-name,  next,  previous,  up
@subsection Why Deliver Into the Home Directory?
@cindex Why Deliver Into the Home Directory?
@cindex Hlfsd; Why Deliver Into the Home Directory?

There are several major reasons why SAs might want to deliver mail
directly into the users' home directories:

@table @b

@item Location

Many mail readers need to move mail from the spool directory to the
user's home directory.  It speeds up this operation if the two are on
the same filesystem.  If for some reason the user's home directory is
inaccessible, it isn't that useful to be able to read mail, since there
is no place to move it to.  In some cases, trying to move mail to a
non-existent or hung filesystem may result in mail loss.

@item Distribution

Having all mail spool directories spread among the many more filesystems
minimizes the chances that complete environments will grind to a halt
when a single server is down.  It does increase the chance that there
will be someone who is not able to read their mail when a machine is
down, but that is usually preferred to having no one be able to read
their mail because a centralized mail server is down.  The problem of
losing some mail due to the (presumably) higher chances that a user's
machine is down is minimized in HLFS.

@item Security

Delivering mail to users' home directories has another advantage ---
enhanced security and privacy.  Since a shared system mail spool
directory has to be world-readable and searchable, any user can see
whether other users have mail, when they last received new mail, or when
they last read their mail.  Programs such as @samp{finger} display this
information, which some consider an infringement of privacy.  While it
is possible to disable this feature of @samp{finger} so that remote
users cannot see a mailbox file's status, this doesn't prevent local
users from getting the information.  Furthermore, there are more
programs which make use of this information.  In shared environments,
disabling such programs has to be done on a system-wide basis, but with
mail delivered to users' home directories, users less concerned with
privacy who do want to let others know when they last received or read
mail can easily do so using file protection bits.

@c Lastly, on systems that do not export their NFS filesystem with
@c @t{anon=0}, superusers are less likely to snoop around others' mail, as
@c they become ``nobodies'' across NFS.

@end table

In summary, delivering mail to home directories provides users the
functionality sought, and also avoids most of the problems just
discussed.

@c ================================================================
@node Using Hlfsd, , Background to Mail Delivery, Hlfsd
@comment  node-name,  next,  previous,  up
@section Using Hlfsd
@cindex Using Hlfsd
@cindex Hlfsd; using

@menu
* Controlling Hlfsd::
* Hlfsd Options::
* Hlfsd Files::
@end menu

@c ----------------------------------------------------------------
@node Controlling Hlfsd, Hlfsd Options, Using Hlfsd, Using Hlfsd
@comment  node-name,  next,  previous,  up
@subsection Controlling Hlfsd
@cindex Controlling Hlfsd
@cindex Hlfsd; controlling
@pindex ctl-hlfsd

Much the same way @i{Amd} is controlled by @file{ctl-amd}, so does
@i{Hlfsd} get controlled by the @file{ctl-hlfsd} script:

@table @t

@item ctl-hlfsd start
Start a new @i{Hlfsd}.

@item ctl-hlfsd stop
Stop a running @i{Hlfsd}.

@item ctl-hlfsd restart
Stop a running @i{Hlfsd}, wait for 10 seconds, and then start a new
one.  It is hoped that within 10 seconds, the previously running
@i{Hlfsd} terminate properly; otherwise, starting a second one could
cause system lockup.

@end table

For example, on our systems, we start @i{Hlfsd} within @file{ctl-hlfsd}
as follows on Solaris 2 systems:

@example
hlfsd -a /var/alt_mail -x all -l /var/log/hlfsd /mail/home .mailspool
@end example

The directory @file{/var/alt_mail} is a directory in the root partition
where alternate mail will be delivered into, when it cannot be delivered
into the user's home directory.

Normal mail gets delivered into @file{/var/mail}, but on our systems,
that is a symbolic link to @file{/mail/home}.  @file{/mail} is managed
by @i{Hlfsd}, which creates a dynamic symlink named @samp{home},
pointing to the subdirectory @file{.mailspool} @emph{within} the
accessing user's home directory.  This results in mail which normally
should go to @file{/var/mail/@code{$USER}}, to go to
@file{@code{$HOME}/.mailspool/@code{$USER}}.

@i{Hlfsd} does not create the @file{/var/mail} symlink.  This needs to
be created (manually) once on each host, by the system administrators,
as follows:

@example
mv /var/mail /var/alt_mail
ln -s /mail/home /var/mail
@end example

@i{Hlfsd} also responds to the following signals:

A @samp{SIGHUP} signal sent to @i{Hlfsd} will force it to reload the
password map immediately.

A @samp{SIGUSR1} signal sent to @i{Hlfsd} will cause it to dump its
internal password map to the file @file{/usr/tmp/hlfsd.dump.XXXXXX},
where @samp{XXXXXX} will be replaced by a random string generated by
@b{mktemp}(3) or (the more secure) @b{mkstemp}(3).

@c ----------------------------------------------------------------
@node Hlfsd Options, Hlfsd Files, Controlling Hlfsd, Using Hlfsd
@comment  node-name,  next,  previous,  up
@subsection Hlfsd Options
@cindex Hlfsd Options
@cindex Hlfsd; Options

@table @t

@item -a @var{alt_dir}
Alternate directory.  The name of the directory to which the symbolic
link returned by @i{Hlfsd} will point, if it cannot access the home
directory of the user.  This defaults to @file{/var/hlfs}.  This
directory will be created if it doesn't exist.  It is expected that
either users will read these files, or the system administrators will
run a script to resend this ``lost mail'' to its owner.

@item -c @var{cache-interval}
Caching interval.  @i{Hlfsd} will cache the validity of home directories
for this interval, in seconds.  Entries which have been verified within
the last @var{cache-interval} seconds will not be verified again, since
the operation could be expensive, and the entries are most likely still
valid.  After the interval has expired, @i{Hlfsd} will re-verify the
validity of the user's home directory, and reset the cache time-counter.
The default value for @var{cache-interval} is 300 seconds (5 minutes).

@item -f
Force fast startup.  This option tells @i{Hlfsd} to skip startup-time
consistency checks such as existence of mount directory, alternate spool
directory, symlink to be hidden under the mount directory, their
permissions and validity.

@item -g @var{group}
Set the special group HLFS_GID to @var{group}.  Programs such as
@file{/usr/ucb/from} or @file{/usr/sbin/in.comsat}, which access the
mailboxes of other users, must be setgid @samp{HLFS_GID} to work properly.  The
default group is @samp{hlfs}.  If no group is provided, and there is no
group @samp{hlfs}, this feature is disabled.

@item -h
Help.  Print a brief help message, and exit.

@item -i @var{reload-interval}
Map-reloading interval.  Each @var{reload-interval} seconds, @i{Hlfsd}
will reload the password map.  @i{Hlfsd} needs the password map for the
UIDs and home directory pathnames.  @i{Hlfsd} schedules a @samp{SIGALRM} to
reload the password maps.  A @samp{SIGHUP} sent to @i{Hlfsd} will force it to
reload the maps immediately.  The default value for
@var{reload-interval} is 900 seconds (15 minutes.)

@item -l @var{logfile}
Specify a log file to which @i{Hlfsd} will record events.  If
@var{logfile} is the string @samp{syslog} then the log messages will be
sent to the system log daemon by @b{syslog}(3), using the @samp{LOG_DAEMON}
facility.  This is also the default.

@item -n
No verify.  @i{Hlfsd} will not verify the validity of the symbolic link
it will be returning, or that the user's home directory contains
sufficient disk-space for spooling.  This can speed up @i{Hlfsd} at the
cost of possibly returning symbolic links to home directories which are
not currently accessible or are full.  By default, @i{Hlfsd} validates
the symbolic-link in the background.  The @code{-n} option overrides the
meaning of the @code{-c} option, since no caching is necessary.

@item -o @var{mount-options}
Mount options which @i{Hlfsd} will use to mount itself on top of
@var{dirname}.  By default, @var{mount-options} is set to @samp{ro}.  If
the system supports symbolic-link caching, default options are set
to @samp{ro,nocache}.

@item -p
Print PID.  Outputs the process-id of @i{Hlfsd} to standard output where
it can be saved into a file.

@item -v
Version.  Displays version information to standard error.

@item -x @var{log-options}
Specify run-time logging options.  The options are a comma separated
list chosen from: @samp{fatal}, @samp{error}, @samp{user}, @samp{warn}, @samp{info}, @samp{map}, @samp{stats}, @samp{all}.

@item -C
Force @i{Hlfsd} to run on systems that cannot turn off the NFS
attribute-cache.  Use of this option on those systems is discouraged, as
it may result in loss or misdelivery of mail.  The option is ignored on
systems that can turn off the attribute-cache.

@item -D @var{log-options}
Select from a variety of debugging options.  Prefixing an option with
the string @samp{no} reverses the effect of that option.  Options are
cumulative.  The most useful option is @samp{all}.  Since this option is
only used for debugging other options are not documented here.  A fuller
description is available in the program source.

@item -P @var{password-file}
Read the user-name, user-id, and home directory information from the
file @var{password-file}.  Normally, @i{Hlfsd} will use @b{getpwent}(3)
to read the password database.  This option allows you to override the
default database, and is useful if you want to map users' mail files to
a directory other than their home directory.  Only the username, uid,
and home-directory fields of the file @var{password-file} are read and
checked.  All other fields are ignored.  The file @var{password-file}
must otherwise be compliant with Unix Version 7 colon-delimited format
@b{passwd}(4).

@end table

@c ----------------------------------------------------------------
@node Hlfsd Files, , Hlfsd Options, Using Hlfsd
@comment  node-name,  next,  previous,  up
@subsection Hlfsd Files
@cindex Hlfsd Files
@cindex Hlfsd; Files

The following files are used by @i{Hlfsd}:

@table @file

@item /hlfs
directory under which @i{Hlfsd} mounts itself and manages the symbolic
link @file{home}.

@item .hlfsdir
default sub-directory in the user's home directory, to which the
@file{home} symbolic link returned by @i{Hlfsd} points.

@item /var/hlfs
directory to which @file{home} symbolic link returned by @i{Hlfsd}
points if it is unable to verify the that user's home directory is
accessible.

@item /usr/tmp/hlfsd.dump.XXXXXX
file to which @i{Hlfsd} will dump its internal password map when it
receives the @samp{SIGUSR1} signal. @samp{XXXXXX} will be replaced by
a random string generated by @b{mktemp}(3) or (the more secure)
@b{mkstemp}(3).

@end table

For discussion on other files used by @i{Hlfsd}, see @xref{lostaltmail}, and
@ref{lostaltmail.conf-sample}.

@c ################################################################
@node Assorted Tools, Examples, Hlfsd, Top
@comment  node-name,  next,  previous,  up
@chapter Assorted Tools
@cindex  Assorted Tools

The following are additional utilities and scripts included with
am-utils, and get installed.

@menu
* am-eject::
* amd.conf-sample::
* amd2ldif::
* amd2sun::
* automount2amd::
* ctl-amd::
* ctl-hlfsd::
* fix-amd-map::
* fixmount::
* fixrmtab::
* lostaltmail::
* lostaltmail.conf-sample::
* mk-amd-map::
* pawd::
* redhat-ctl-amd::
* wait4amd::
* wait4amd2die::
* wire-test::
@end menu

@c ----------------------------------------------------------------
@node am-eject, amd.conf-sample, Assorted Tools, Assorted Tools
@comment  node-name,  next,  previous,  up
@section am-eject
@pindex am-eject

A shell script unmounts a floppy or CD-ROM that is automounted, and
then attempts to eject the removable device.

@c ----------------------------------------------------------------
@node amd.conf-sample, amd2ldif, am-eject, Assorted Tools
@comment  node-name,  next,  previous,  up
@section amd.conf-sample
@pindex amd.conf-sample

A sample @i{Amd} configuration file. @xref{Amd Configuration File}.

@c ----------------------------------------------------------------
@node amd2ldif, amd2sun, amd.conf-sample, Assorted Tools
@comment  node-name,  next,  previous,  up
@section amd2ldif
@pindex amd2ldif

A script to convert @i{Amd} maps to LDAP input files.  Use it as follows:

@example
amd2ldif @i{mapname} @i{base} < @i{amd.mapfile} > @i{mapfile.ldif}
@end example

@c ----------------------------------------------------------------
@node amd2sun, automount2amd, amd2ldif, Assorted Tools
@comment  node-name,  next,  previous,  up
@section amd2sun
@pindex amd2sun

A script to convert @i{Amd} maps to Sun Automounter maps.  Use it as
follows

@example
amd2sun < @i{amd.mapfile} > @i{auto_mapfile}
@end example

@c ----------------------------------------------------------------
@node automount2amd, ctl-amd, amd2sun, Assorted Tools
@comment  node-name,  next,  previous,  up
@section automount2amd
@pindex automount2amd

A script to convert old Sun Automounter maps to @i{Amd} maps.

Say you have the Sun automount file @i{auto.foo}, with these two lines:
@example
home                  earth:/home
moon  -ro,intr        server:/proj/images
@end example
Running
@example
automount2amd auto.foo > amd.foo
@end example

will produce the @i{Amd} map @i{amd.foo} with this content:

@example
# generated by automount2amd on Sat Aug 14 17:59:32 US/Eastern 1999

/defaults \\
  type:=nfs;opts:=rw,grpid,nosuid,utimeout=600

home \
  host==earth;type:=link;fs:=/home \\
  rhost:=earth;rfs:=/home

moon \
  -addopts:=ro,intr \\
  host==server;type:=link;fs:=/proj/images \\
  rhost:=server;rfs:=/proj/images
@end example

This perl script will use the following @i{/default} entry
@example
type:=nfs;opts:=rw,grpid,nosuid,utimeout=600
@end example
If you wish to override that, define the @b{$DEFAULTS} environment
variable, or modify the script.

If you wish to generate Amd maps using the @i{hostd} (@pxref{hostd
Selector Variable}) @i{Amd} map syntax, then define the environment
variable @b{$DOMAIN} or modify the script.

Note that automount2amd does not understand the syntax in newer Sun
Automount maps, those used with autofs.

@c ----------------------------------------------------------------
@node ctl-amd, ctl-hlfsd, automount2amd, Assorted Tools
@comment  node-name,  next,  previous,  up
@section ctl-amd
@pindex ctl-amd

A script to start, stop, or restart @i{Amd}.  Use it as follows:

@table @t
@item ctl-amd start
Start a new @i{Amd} process.
@item ctl-amd stop
Stop the running @i{Amd}.
@item ctl-amd restart
Stop the running @i{Amd} (if any), safely wait for it to terminate, and
then start a new process --- only if the previous one died cleanly.
@end table

@xref{Run-time Administration}, for more details.

@c ----------------------------------------------------------------
@node ctl-hlfsd, fix-amd-map, ctl-amd, Assorted Tools
@comment  node-name,  next,  previous,  up
@section ctl-hlfsd
@pindex ctl-hlfsd

A script for controlling @i{Hlfsd}, much the same way @file{ctl-amd}
controls @i{Amd}.  Use it as follows:

@table @t
@item ctl-hlfsd start
Start a new @i{Hlfsd} process.
@item ctl-hlfsd stop
Stop the running @i{Hlfsd}.
@item ctl-hlfsd restart
Stop the running @i{Hlfsd} (if any), wait for 10 seconds for it to
terminate, and then start a new process --- only if the previous one
died cleanly.
@end table

@xref{Hlfsd}, for more details.

@c ----------------------------------------------------------------
@node fix-amd-map, fixmount, ctl-hlfsd, Assorted Tools
@comment  node-name,  next,  previous,  up
@section fix-amd-map
@pindex fix-amd-map

Am-utils changed some of the syntax and default values of some
variables.  For example, the default value for @samp{$@{os@}} for
Solaris 2.x (aka SunOS 5.x) systems used to be @samp{sos5}, it is now
more automatically generated from @file{config.guess} and its value is
@samp{sunos5}.

This script converts older @i{Amd} maps to new ones.  Use it as follows:

@example
fix-amd-map < @i{old.map} > @i{new.map}
@end example

@c ----------------------------------------------------------------
@node fixmount, fixrmtab, fix-amd-map, Assorted Tools
@comment  node-name,  next,  previous,  up
@section fixmount
@pindex fixmount

@samp{fixmount} is a variant of @b{showmount}(8) that can delete bogus
mount entries in remote @b{mountd}(8) daemons.  This is useful to
cleanup otherwise ever-accumulating ``junk''.  Use it for example:

@example
fixmount -r @i{host}
@end example

See the online manual page for @samp{fixmount} for more details of its
usage.

@c ----------------------------------------------------------------
@node fixrmtab, lostaltmail, fixmount, Assorted Tools
@comment  node-name,  next,  previous,  up
@section fixrmtab
@pindex fixrmtab

A script to invalidate @file{/etc/rmtab} entries for hosts named.  Also
restart mountd for changes to take effect.  Use it for example:

@example
fixrmtab @i{host1} @i{host2} @i{...}
@end example

@c ----------------------------------------------------------------
@node lostaltmail, lostaltmail.conf-sample, fixrmtab, Assorted Tools
@comment  node-name,  next,  previous,  up
@section lostaltmail
@pindex lostaltmail

A script used with @i{Hlfsd} to resend any ``lost'' mail.  @i{Hlfsd}
redirects mail which cannot be written into the user's home directory to
an alternate directory.  This is useful to continue delivering mail,
even if the user's file system was unavailable, full, or over quota.
But, the mail which gets delivered to  the alternate directory needs to
be resent to its respective users.  This is what the @samp{lostaltmail}
script does.

Use it as follows:

@example
lostaltmail
@end example

This script needs a configuration file @samp{lostaltmail.conf} set up
with the right parameters to properly work.  @xref{Hlfsd}, for more
details.

@c ----------------------------------------------------------------
@node lostaltmail.conf-sample, mk-amd-map, lostaltmail, Assorted Tools
@comment  node-name,  next,  previous,  up
@section lostaltmail.conf-sample
@pindex lostaltmail.conf-sample
@cindex lostaltmail; configuration file

This is a text file with configuration parameters needed for the
@samp{lostaltmail} script.  The script includes comments explaining each
of the configuration variables.  See it for more information.  Also
@pxref{Hlfsd} for general information.

@c ----------------------------------------------------------------
@node mk-amd-map, pawd, lostaltmail.conf-sample, Assorted Tools
@comment  node-name,  next,  previous,  up
@section mk-amd-map
@pindex mk-amd-map

This program converts a normal @i{Amd} map file into an ndbm database
with the same prefix as the named file.  Use it as follows:

@example
mk-amd-map @i{mapname}
@end example

@c ----------------------------------------------------------------
@node pawd, redhat-ctl-amd, mk-amd-map, Assorted Tools
@comment  node-name,  next,  previous,  up
@section pawd
@pindex pawd

@i{Pawd} is used to print the current working directory, adjusted to
reflect proper paths that can be reused to go through the automounter
for the shortest possible path.  In particular, the path printed back
does not include any of @i{Amd}'s local mount points.  Using them is
unsafe, because @i{Amd} may unmount managed file systems from the mount
points, and thus including them in paths may not always find the files
within.

Without any arguments, @i{Pawd} will print the automounter adjusted
current working directory.  With any number of arguments, it will print
the adjusted path of each one of the arguments.

@c ----------------------------------------------------------------
@node redhat-ctl-amd, wait4amd, pawd, Assorted Tools
@comment  node-name,  next,  previous,  up
@section redhat-ctl-amd
@pindex redhat-ctl-amd

This script is similar to @i{ctl-amd} (@pxref{ctl-amd}) but is intended
for Red Hat Linux systems.  You can safely copy @i{redhat-ctl-amd} onto
@file{/etc/rc.d/init.d/amd}.  The script supplied by @i{Am-utils} is
usually better than the one provided by Red Hat, because the Red Hat
script does not correctly kill @i{Amd} processes: it is too quick to
kill the wrong processes, leaving stale or hung mount points behind.

@c ----------------------------------------------------------------
@node wait4amd, wait4amd2die, redhat-ctl-amd, Assorted Tools
@comment  node-name,  next,  previous,  up
@section wait4amd
@pindex wait4amd

A script to wait for @i{Amd} to start on a particular host before
performing an arbitrary command.  The command is executed repeatedly,
with 1 second intervals in between.  You may interrupt the script using
@samp{^C} (or whatever keyboard sequence your terminal's @samp{intr} function
is bound to).

Examples:

@table @t
@item wait4amd saturn amq -p -h saturn
When @i{Amd} is up on host @samp{saturn}, get the process ID of that
running @i{Amd}.
@item wait4amd pluto rlogin pluto
Remote login to host @samp{pluto} when @i{Amd} is up on that host.  It
is generally necessary to wait for @i{Amd} to properly start and
initialize on a remote host before logging in to it, because otherwise
user home directories may not be accessible across the network.
@item wait4amd pluto
A short-hand version of the previous command, since the most useful
reason for this script is to login to a remote host.  I use it very
often when testing out new versions of @i{Amd}, and need to reboot hung
hosts.
@end table

@c ----------------------------------------------------------------
@node wait4amd2die, wire-test, wait4amd, Assorted Tools
@comment  node-name,  next,  previous,  up
@section wait4amd2die
@pindex wait4amd2die

This script is used internally by @samp{ctl-amd} when used to restart
@i{Amd}.  It waits for @i{Amd} to terminate.  If it detected that
@i{Amd} terminated cleanly, this script will return an exist status of
zero.  Otherwise, it will return a non-zero exit status.

The script tests for @i{Amd}'s existence once every 5 seconds, six
times, for a total of 30 seconds.  It will return a zero exist status as
soon as it detects that @i{Amd} dies.

@c ----------------------------------------------------------------
@node wire-test, , wait4amd2die, Assorted Tools
@comment  node-name,  next,  previous,  up
@section wire-test
@pindex wire-test

A simple program to test if some of the most basic networking functions
in am-util's library @file{libamu} work.  It also tests the combination
of NFS protocol and version number that are supported from the current
host, to a remote one.

For example, in this test a machine which only supports NFS Version 2 is
contacting a remote host that can support the same version, but using
both UDP and TCP.  If no host name is specified, @samp{wire-test} will
try @file{localhost}.

@example
$ wire-test moisil
Network name is "mcl-lab-net.cs.columbia.edu"
Network number is "128.59.13"
Network name is "old-net.cs.columbia.edu"
Network number is "128.59.16"
My IP address is 0x7f000001.
NFS Version and protocol tests to host "moisil"...
        testing vers=2, proto="udp" -> found version 2.
        testing vers=3, proto="udp" -> failed!
        testing vers=2, proto="tcp" -> found version 2.
        testing vers=3, proto="tcp" -> failed!
@end example

@c ################################################################
@node Examples, Internals, Assorted Tools, Top
@comment  node-name,  next,  previous,  up
@chapter Examples

@menu
* User Filesystems::
* Home Directories::
* Architecture Sharing::
* Wildcard Names::
* rwho servers::
* /vol::
* /defaults with selectors::
* /tftpboot in a chroot-ed environment::

@end menu

@node User Filesystems, Home Directories, Examples, Examples
@comment  node-name,  next,  previous,  up
@section User Filesystems
@cindex User filesystems
@cindex Mounting user filesystems

With more than one fileserver, the directories most frequently
cross-mounted are those containing user home directories.  A common
convention used at Imperial College is to mount the user disks under
@t{/home/}@i{machine}.

Typically, the @samp{/etc/fstab} file contained a long list of entries
such as:

@example
@i{machine}:/home/@i{machine} /home/@i{machine} nfs ...
@end example

for each fileserver on the network.

There are numerous problems with this system.  The mount list can become
quite large and some of the machines may be down when a system is
booted.  When a new fileserver is installed, @samp{/etc/fstab} must be
updated on every machine, the mount directory created and the filesystem
mounted.

In many environments most people use the same few workstations, but
it is convenient to go to a colleague's machine and access your own
files.  When a server goes down, it can cause a process on a client
machine to hang.  By minimizing the mounted filesystems to only include
those actively being used, there is less chance that a filesystem will
be mounted when a server goes down.

The following is a short extract from a map taken from a research fileserver
at Imperial College.

Note the entry for @samp{localhost} which is used for users such as
the operator (@samp{opr}) who have a home directory on most machine as
@samp{/home/localhost/opr}.

@example
/defaults       opts:=rw,intr,grpid,nosuid
charm           host!=$@{key@};type:=nfs;rhost:=$@{key@};rfs:=/home/$@{key@} \
                host==$@{key@};type:=ufs;dev:=/dev/xd0g
#
...

#
localhost       type:=link;fs:=$@{host@}
...
#
# dylan has two user disks so have a
# top directory in which to mount them.
#
dylan           type:=auto;fs:=$@{map@};pref:=$@{key@}/
#
dylan/dk2       host!=dylan;type:=nfs;rhost:=dylan;rfs:=/home/$@{key@} \
                host==dylan;type:=ufs;dev:=/dev/dsk/2s0
#
dylan/dk5       host!=dylan;type:=nfs;rhost:=dylan;rfs:=/home/$@{key@} \
                host==dylan;type:=ufs;dev:=/dev/dsk/5s0
...
#
toytown         host!=$@{key@};type:=nfs;rhost:=$@{key@};rfs:=/home/$@{key@} \
                host==$@{key@};type:=ufs;dev:=/dev/xy1g
...
#
zebedee         host!=$@{key@};type:=nfs;rhost:=$@{key@};rfs:=/home/$@{key@} \
                host==$@{key@};type:=ufs;dev:=/dev/dsk/1s0
#
# Just for access...
#
gould           type:=auto;fs:=$@{map@};pref:=$@{key@}/
gould/staff     host!=gould;type:=nfs;rhost:=gould;rfs:=/home/$@{key@}
#
gummo           host!=$@{key@};type:=nfs;rhost:=$@{key@};rfs:=/home/$@{key@}
...
@end example

This map is shared by most of the machines listed so on those
systems any of the user disks is accessible via a consistent name.
@i{Amd} is started with the following command

@example
amd /home amd.home
@end example

Note that when mounting a remote filesystem, the @dfn{automounted}
mount point is referenced, so that the filesystem will be mounted if
it is not yet (at the time the remote @samp{mountd} obtains the file handle).

@node Home Directories, Architecture Sharing, User Filesystems, Examples
@comment  node-name,  next,  previous,  up
@section Home Directories
@cindex Home directories
@cindex Example of mounting home directories
@cindex Mount home directories

One convention for home directories is to locate them in @samp{/homes}
so user @samp{jsp}'s home directory is @samp{/homes/jsp}.  With more
than a single fileserver it is convenient to spread user files across
several machines.  All that is required is a mount-map which converts
login names to an automounted directory.

Such a map might be started by the command:

@example
amd /homes amd.homes
@end example

where the map @samp{amd.homes} contained the entries:

@example
/defaults   type:=link   # All the entries are of type:=link
jsp         fs:=/home/charm/jsp
njw         fs:=/home/dylan/dk5/njw
...
phjk        fs:=/home/toytown/ai/phjk
sjv         fs:=/home/ganymede/sjv
@end example

Whenever a login name is accessed in @samp{/homes} a symbolic link
appears pointing to the real location of that user's home directory.  In
this example, @samp{/homes/jsp} would appear to be a symbolic link
pointing to @samp{/home/charm/jsp}.  Of course, @samp{/home} would also
be an automount point.

This system causes an extra level of symbolic links to be used.
Although that turns out to be relatively inexpensive, an alternative is
to directly mount the required filesystems in the @samp{/homes}
map.  The required map is simple, but long, and its creation is best automated.
The entry for @samp{jsp} could be:

@example
jsp   -sublink:=$@{key@};rfs:=/home/charm \
               host==charm;type:=ufs;dev:=/dev/xd0g \
               host!=charm;type:=nfs;rhost:=charm
@end example

This map can become quite big if it contains a large number of entries.
By combining two other features of @i{Amd} it can be greatly simplified.

First the UFS partitions should be mounted under the control of
@samp{/etc/fstab}, taking care that they are mounted in the same place
that @i{Amd} would have automounted them.  In most cases this would be
something like @samp{/a/@dfn{host}/home/@dfn{host}} and
@samp{/etc/fstab} on host @samp{charm} would have a line:@refill

@example
/dev/xy0g /a/charm/home/charm 4.2 rw,nosuid,grpid 1 5
@end example

The map can then be changed to:

@example
/defaults    type:=nfs;sublink:=$@{key@};opts:=rw,intr,nosuid,grpid
jsp          rhost:=charm;rfs:=/home/charm
njw          rhost:=dylan;rfs:=/home/dylan/dk5
...
phjk         rhost:=toytown;rfs:=/home/toytown;sublink:=ai/$@{key@}
sjv          rhost:=ganymede;rfs:=/home/ganymede
@end example

This map operates as usual on a remote machine (@i{ie} @code{$@{host@}}
not equal to @code{$@{rhost@}}).  On the machine where the filesystem is
stored (@i{ie} @code{$@{host@}} equal to @code{$@{rhost@}}), @i{Amd}
will construct a local filesystem mount point which corresponds to the
name of the locally mounted UFS partition.  If @i{Amd} is started with
the @code{-r} option then instead of attempting an NFS mount, @i{Amd} will
simply inherit the UFS mount (@pxref{Inheritance Filesystem}).  If
@code{-r} is not used then a loopback NFS mount will be made.  This type of
mount is known to cause a deadlock on many systems.

@node Architecture Sharing, Wildcard Names, Home Directories, Examples
@comment  node-name,  next,  previous,  up
@section Architecture Sharing
@cindex Architecture sharing
@cindex Sharing a fileserver between architectures
@cindex Architecture dependent volumes

@c %At the moment some of the research machines have sets of software
@c %mounted in @samp{/vol}.  This contains subdirectories for \TeX,
@c %system sources, local sources, prolog libraries and so on.
Often a filesystem will be shared by machines of different architectures.
Separate trees can be maintained for the executable images for each
architecture, but it may be more convenient to have a shared tree,
with distinct subdirectories.

A shared tree might have the following structure on the fileserver (called
@samp{fserver} in the example):

@example
local/tex
local/tex/fonts
local/tex/lib
local/tex/bin
local/tex/bin/sun3
local/tex/bin/sun4
local/tex/bin/hp9000
...
@end example

In this example, the subdirectories of @samp{local/tex/bin} should be
hidden when accessed via the automount point (conventionally @samp{/vol}).
A mount-map for @samp{/vol} to achieve this would look like:

@example
/defaults   sublink:=$@{/key@};rhost:=fserver;type:=link
tex         type:=auto;fs:=$@{map@};pref:=$@{key@}/
tex/fonts   host!=fserver;type:=nfs;rfs:=/vol/tex \
            host==fserver;fs:=/usr/local/tex
tex/lib     host!=fserver;type:=nfs;rfs:=/vol/tex \
            host==fserver;fs:=/usr/local/tex
tex/bin     -sublink:=$@{/key@}/$@{arch@} \
            host!=fserver;type:=nfs;rfs:=/vol/tex \
            host:=fserver;fs:=/usr/local/tex
@end example

When @samp{/vol/tex/bin} is referenced, the current machine architecture
is automatically appended to the path by the @code{$@{sublink@}}
variable.  This means that users can have @samp{/vol/tex/bin} in their
@samp{PATH} without concern for architecture dependencies.

@node Wildcard Names, rwho servers, Architecture Sharing, Examples
@comment  node-name,  next,  previous,  up
@section Wildcard Names & Replicated Servers

By using the wildcard facility, @i{Amd} can @dfn{overlay} an existing
directory with additional entries.
The system files are usually mounted under @samp{/usr}.  If instead,
@i{Amd} is mounted on @samp{/usr}, additional
names can be overlayed to augment or replace names in the ``master'' @samp{/usr}.
A map to do this would have the form:

@example
local  type:=auto;fs:=local-map
share  type:=auto;fs:=share-map
*      -type:=nfs;rfs:=/export/exec/$@{arch@};sublink:="$@{key@}" \
        rhost:=fserv1  rhost:=fserv2  rhost:=fserv3
@end example

Note that the assignment to @code{$@{sublink@}} is surrounded by double
quotes to prevent the incoming key from causing the map to be
misinterpreted.  This map has the effect of directing any access to
@samp{/usr/local} or @samp{/usr/share} to another automount point.

In this example, it is assumed that the @samp{/usr} files are replicated
on three fileservers: @samp{fserv1}, @samp{fserv2} and @samp{fserv3}.
For any references other than to @samp{local} and @samp{share} one of
the servers is used and a symbolic link to
@t{$@{autodir@}/$@{rhost@}/export/exec/$@{arch@}/@i{whatever}} is
returned once an appropriate filesystem has been mounted.@refill

@node rwho servers, /vol, Wildcard Names, Examples
@comment  node-name,  next,  previous,  up
@section @samp{rwho} servers
@cindex rwho servers
@cindex Architecture specific mounts
@cindex Example of architecture specific mounts

The @samp{/usr/spool/rwho} directory is a good candidate for automounting.
For efficiency reasons it is best to capture the rwho data on a small
number of machines and then mount that information onto a large number
of clients.  The data written into the rwho files is byte order dependent
so only servers with the correct byte ordering can be used by a client:

@example
/defaults         type:=nfs
usr/spool/rwho    -byte==little;rfs:=/usr/spool/rwho \
                      rhost:=vaxA  rhost:=vaxB \
                  || -rfs:=/usr/spool/rwho \
                      rhost:=sun4  rhost:=hp300
@end example

@node /vol, /defaults with selectors, rwho servers, Examples
@comment  node-name,  next,  previous,  up
@section @samp{/vol}
@cindex /vol
@cindex Catch-all mount point
@cindex Generic volume name

@samp{/vol} is used as a catch-all for volumes which do not have other
conventional names.

Below is part of the @samp{/vol} map for the domain @samp{doc.ic.ac.uk}.
The @samp{r+d} tree is used for new or experimental software that needs
to be available everywhere without installing it on all the fileservers.
Users wishing to try out the new software then simply include
@samp{/vol/r+d/@{bin,ucb@}} in their path.@refill

The main tree resides on one host @samp{gould.doc.ic.ac.uk}, which has
different @samp{bin}, @samp{etc}, @samp{lib} and @samp{ucb}
sub-directories for each machine architecture.  For example,
@samp{/vol/r+d/bin} for a Sun-4 would be stored in the sub-directory
@samp{bin/sun4} of the filesystem @samp{/usr/r+d}.  When it was accessed
a symbolic link pointing to @samp{/a/gould/usr/r+d/bin/sun4} would be
returned.@refill

@example
/defaults    type:=nfs;opts:=rw,grpid,nosuid,intr,soft
wp           -opts:=rw,grpid,nosuid;rhost:=charm \
             host==charm;type:=link;fs:=/usr/local/wp \
             host!=charm;type:=nfs;rfs:=/vol/wp
...
#
src          -opts:=rw,grpid,nosuid;rhost:=charm \
             host==charm;type:=link;fs:=/usr/src \
             host!=charm;type:=nfs;rfs:=/vol/src
#
r+d          type:=auto;fs:=$@{map@};pref:=r+d/
# per architecture bin,etc,lib&ucb...
r+d/bin      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}/$@{arch@}
r+d/etc      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}/$@{arch@}
r+d/include  rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}
r+d/lib      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}/$@{arch@}
r+d/man      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}
r+d/src      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}
r+d/ucb      rhost:=gould.doc.ic.ac.uk;rfs:=/usr/r+d;sublink:=$@{/key@}/$@{arch@}
# hades pictures
pictures     -opts:=rw,grpid,nosuid;rhost:=thpfs \
             host==thpfs;type:=link;fs:=/nbsd/pictures \
             host!=thpfs;type:=nfs;rfs:=/nbsd;sublink:=pictures
# hades tools
hades        -opts:=rw,grpid,nosuid;rhost:=thpfs \
             host==thpfs;type:=link;fs:=/nbsd/hades \
             host!=thpfs;type:=nfs;rfs:=/nbsd;sublink:=hades
# bsd tools for hp.
bsd          -opts:=rw,grpid,nosuid;arch==hp9000;rhost:=thpfs \
             host==thpfs;type:=link;fs:=/nbsd/bsd \
             host!=thpfs;type:=nfs;rfs:=/nbsd;sublink:=bsd
@end example

@node /defaults with selectors, /tftpboot in a chroot-ed environment, /vol, Examples
@comment  node-name,  next,  previous,  up
@section @samp{/defaults} with selectors
@cindex /defaults with selectors
@cindex selectors on default

It is sometimes useful to have different defaults for a given map.  To
achieve this, the @samp{/defaults} entry must be able to process normal
selectors.  This feature is turned on by setting
@samp{selectors_in_defaults = yes} in the @file{amd.conf} file.
@xref{selectors_in_defaults Parameter}.

In this example, I set different default NFS mount options for hosts
which are running over a slower network link.  By setting a smaller size
for the NFS read and write buffer sizes, you can greatly improve remote
file service performance.

@example
/defaults \
  wire==slip-net;opts:=rw,intr,rsize=1024,wsize=1024,timeo=20,retrans=10 \
  wire!=slip-net;opts:=rw,intr
@end example

@node /tftpboot in a chroot-ed environment, , /defaults with selectors, Examples
@comment  node-name,  next,  previous,  up
@section @samp{/tftpboot} in a chroot-ed environment
@cindex /tftpboot in a chroot-ed environment
@cindex chroot; /tftpboot example

In this complex example, we attempt to run an @i{Amd} process
@emph{inside} a chroot-ed environment.  @samp{tftpd} (Trivial FTP) is
used to trivially retrieve files used to boot X-Terminals, Network
Printers, Network routers, diskless workstations, and other such
devices.  For security reasons, @samp{tftpd} (and also @samp{ftpd})
processes are run using the @b{chroot}(2) system call.  This provides an
environment for these processes, where access to any files outside the
directory where the chroot-ed process runs is denied.

For example, if you start @samp{tftpd} on your system with

@example
chroot /tftpboot /usr/sbin/tftpd
@end example

@noindent
then the @samp{tftpd} process will not be able to access any files
outside @file{/tftpboot}.  This ensures that no one can retrieve files
such as @file{/etc/passwd} and run password crackers on it.

Since the TFTP service works by broadcast, it is necessary to have at
least one TFTP server running on each subnet.  If you have lots of files
that you need to make available for @samp{tftp}, and many subnets, it
could take significant amounts of disk space on each host serving them.

A solution we implemented at Columbia University was to have every host
run @samp{tftpd}, but have those servers retrieve the boot files from
two replicated servers.  Those replicated servers have special
partitions dedicated to the many network boot files.

We start @i{Amd} as follows:

@example
amd /tftpboot/.amd amd.tftpboot
@end example

That is, @i{Amd} is serving the directory @file{/tftpboot/.amd}.  The
@samp{tftp} server runs inside @file{/tftpboot} and is chroot-ed in that
directory too.  The @file{amd.tftpboot} map looks like:

@example
#
# Amd /tftpboot directory -> host map
#

/defaults  opts:=nosuid,ro,intr,soft;fs:=/tftpboot/import;type:=nfs

tp         host==lol;rfs:=/n/lol/import/tftpboot;type:=lofs \
           host==ober;rfs:=/n/ober/misc/win/tftpboot;type:=lofs \
           rhost:=ober;rfs:=/n/ober/misc/win/tftpboot \
           rhost:=lol;rfs:=/n/lol/import/tftpboot
@end example

To help understand this example, I list a few of the file entries that
are created inside @file{/tftpboot}:

@example
$ ls -la /tftpboot
dr-xr-xr-x   2 root   512 Aug 30 23:11 .amd
drwxrwsr-x  12 root   512 Aug 30 08:00 import
lrwxrwxrwx   1 root    33 Feb 27  1997 adminpr.cfg -> ./.amd/tp/hplj/adminpr.cfg
lrwxrwxrwx   1 root    22 Dec  5  1996 tekxp -> ./.amd/tp/xterms/tekxp
lrwxrwxrwx   1 root     1 Dec  5  1996 tftpboot -> .
@end example

Here is an explanation of each of the entries listed above:

@table @code

@item .amd
This is the @i{Amd} mount point.  Note that you do not need to run a
separate @i{Amd} process for the TFTP service.  The @b{chroot}(2) system
call only protects against file access, but the same process can still
serve files and directories inside and outside the chroot-ed
environment, because @i{Amd} itself was not run in chroot-ed mode.

@item import
This is the mount point where @i{Amd} will mount the directories
containing the boot files.  The map is designed so that remote
directories will be NFS mounted (even if they are already mounted
elsewhere), and local directories are loopback mounted (since they are
not accessible outside the chroot-ed @file{/tftpboot} directory).

@item adminpr.cfg
@itemx tekxp
Two manually created symbolic links to directories @emph{inside} the
@i{Amd}-managed directory.  The crossing of the component @file{tp} will
cause @i{Amd} to automount one of the remote replicas.  Once crossed,
access to files inside proceeds as usual.  The @samp{adminpr.cfg} is a
configuration file for an HP Laser-Jet 4si printer, and the @samp{tekxp}
is a directory for Tektronix X-Terminal boot files.

@item tftpboot
This innocent looking symlink is important.  Usually, when devices boot
via the TFTP service, they perform the @samp{get file} command to
retrieve @var{file}.  However, some devices assume that @samp{tftpd}
does not run in a chroot-ed environment, but rather ``unprotected'', and
thus use a full pathname for files to retrieve, as in @samp{get
/tftpboot/file}.  This symlink effectively strips out the leading
@file{/tftpboot/}.

@end table

@c ################################################################
@node Internals, Acknowledgments & Trademarks, Examples, Top
@comment  node-name,  next,  previous,  up
@chapter Internals

Note that there are more error and logging messages possible than are
listed here.  Most of them are self-explanatory.  Refer to the program
sources for more details on the rest.

@menu
* Log Messages::
@end menu

@node Log Messages, , Internals, Internals
@comment  node-name,  next,  previous,  up
@section Log Messages

In the following sections a brief explanation is given of some of the
log messages made by @i{Amd}.  Where the message is in @samp{typewriter}
font, it corresponds exactly to the message produced by @i{Amd}.  Words
in @dfn{italic} are replaced by an appropriate string.  Variables,
@code{$@{@i{var}@}}, indicate that the value of the appropriate variable is
output.

Log messages are either sent directly to a file,
or logged via the @b{syslog}(3) mechanism.  @xref{log_file Parameter}.
In either case, entries in the file are of the form:
@example
@i{date-string}  @i{hostname} @t{amd[}@i{pid}@t{]}  @i{message}
@end example

@menu
* Fatal errors::
* Info messages::
@end menu

@node Fatal errors, Info messages, Log Messages, Log Messages
@comment  node-name,  next,  previous,  up
@subsection Fatal errors

@i{Amd} attempts to deal with unusual events.  Whenever it is not
possible to deal with such an error, @i{Amd} will log an appropriate
message and, if it cannot possibly continue, will either exit or abort.
These messages are selected by @samp{-x fatal} on the command line.
When @b{syslog}(3) is being used, they are logged with level
@samp{LOG_FATAL}.  Even if @i{Amd} continues to operate it is likely to
remain in a precarious state and should be restarted at the earliest
opportunity.

@table @t

@item Attempting to inherit not-a-filesystem
The prototype mount point created during a filesystem restart did not
contain a reference to the restarted filesystem.  This error ``should
never happen''.

@item Can't bind to domain "@i{NIS-domain}"
A specific NIS domain was requested on the command line, but no server
for that domain is available on the local net.

@item Can't determine IP address of this host (@i{hostname})
When @i{Amd} starts it determines its own IP address.  If this lookup
fails then @i{Amd} cannot continue.  The hostname it looks up is that
obtained returned by @b{gethostname}(2) system call.

@item Can't find root file handle for @i{automount point}
@i{Amd} creates its own file handles for the automount points.  When it
mounts itself as a server, it must pass these file handles to the local
kernel.  If the filehandle is not obtainable the mount point is ignored.
This error ``should never happen''.

@item Must be root to mount filesystems (euid = @i{euid})
To prevent embarrassment, @i{Amd} makes sure it has appropriate system
privileges.  This amounts to having an euid of 0.  The check is made
after argument processing complete to give non-root users a chance to
access the @code{-v} option.

@item No work to do - quitting
No automount points were given on the command line and so there is no
work to do.

@item Out of memory
While attempting to malloc some memory, the memory space available to
@i{Amd} was exhausted.  This is an unrecoverable error.

@item Out of memory in realloc
While attempting to realloc some memory, the memory space available to
@i{Amd} was exhausted.  This is an unrecoverable error.

@item cannot create rpc/udp service
Either the NFS or AMQ endpoint could not be created.

@item gethostname: @i{description}
The @b{gethostname}(2) system call failed during startup.

@item host name is not set
The @b{gethostname}(2) system call returned a zero length host name.
This can happen if @i{Amd} is started in single user mode just after
booting the system.

@item ifs_match called!
An internal error occurred while restarting a pre-mounted filesystem.
This error ``should never happen''.

@item mount_afs: @i{description}
An error occurred while @i{Amd} was mounting itself.

@item run_rpc failed
Somehow the main NFS server loop failed.  This error ``should never
happen''.

@item unable to free rpc arguments in amqprog_1
The incoming arguments to the AMQ server could not be free'ed.

@item unable to free rpc arguments in nfs_program_1
The incoming arguments to the NFS server could not be free'ed.

@item unable to register (AMQ_PROGRAM, AMQ_VERSION, udp)
The AMQ server could not be registered with the local portmapper or the
internal RPC dispatcher.

@item unable to register (NFS_PROGRAM, NFS_VERSION, 0)
The NFS server could not be registered with the internal RPC dispatcher.

@end table

XXX: This section needs to be updated

@node Info messages, , Fatal errors, Log Messages
@comment  node-name,  next,  previous,  up
@subsection Info messages

@i{Amd} generates information messages to record state changes.  These
messages are selected by @samp{-x info} on the command line.  When
@b{syslog}(3) is being used, they are logged with level @samp{LOG_INFO}.

The messages listed below can be generated and are in a format suitable
for simple statistical analysis.  @dfn{mount-info} is the string
that is displayed by @dfn{Amq} in its mount information column and
placed in the system mount table.

@table @t

@item "@t{$@{@i{path}@}}" forcibly timed out
An automount point has been timed out by the @i{Amq} command.

@item "@t{$@{@i{path}@}}" has timed out
No access to the automount point has been made within the timeout
period.

@item Filehandle denied for "$@{@i{rhost}@}:$@{@i{rfs}@}"
The mount daemon refused to return a file handle for the requested filesystem.

@item Filehandle error for "$@{@i{rhost}@}:$@{@i{rfs}@}": @i{description}
The mount daemon gave some other error for the requested filesystem.

@item Finishing with status @i{exit-status}
@i{Amd} is about to exit with the given exit status.

@item Re-synchronizing cache for map @t{$@{@i{map}@}}
The named map has been modified and the internal cache is being re-synchronized.

@item file server @t{$@{@i{rhost}@}} is down - timeout of "@t{$@{@i{path}@}}" ignored
An automount point has timed out, but the corresponding file server is
known to be down.  This message is only produced once for each mount
point for which the server is down.

@item file server @t{$@{@i{rhost}@}} type nfs is down
An NFS file server that was previously up is now down.

@item file server @t{$@{@i{rhost}@}} type nfs is up
An NFS file server that was previously down is now up.

@item file server @t{$@{@i{rhost}@}} type nfs starts down
A new NFS file server has been referenced and is known to be down.

@item file server @t{$@{@i{rhost}@}} type nfs starts up
A new NFS file server has been referenced and is known to be up.

@item mount of "@t{$@{@i{path}@}}" on @t{$@{@i{fs}@}} timed out
Attempts to mount a filesystem for the given automount point have failed
to complete within 30 seconds.

@item @i{mount-info} mounted fstype @t{$@{@i{type}@}} on @t{$@{@i{fs}@}}
A new file system has been mounted.

@item @i{mount-info} restarted fstype @t{$@{@i{type}@}} on @t{$@{@i{fs}@}}
@i{Amd} is using a pre-mounted filesystem to satisfy a mount request.

@item @i{mount-info} unmounted fstype @t{$@{@i{type}@}} from @t{$@{@i{fs}@}}
A file system has been unmounted.

@item @i{mount-info} unmounted fstype @t{$@{@i{type}@}} from @t{$@{@i{fs}@}} link @t{$@{@i{fs}@}}/@t{$@{@i{sublink}@}}
A file system of which only a sub-directory was in use has been unmounted.

@item restarting @i{mount-info} on @t{$@{@i{fs}@}}
A pre-mounted file system has been noted.

@end table

XXX: This section needs to be updated

@c ################################################################
@node Acknowledgments & Trademarks, Index, Internals, Top
@comment  node-name,  next,  previous,  up
@unnumbered Acknowledgments & Trademarks

Many thanks to the Am-Utils Users
mailing list through the months developing am-utils.  These members
have contributed to the discussions, ideas, code and documentation,
and subjected their systems to alpha quality code.  Special thanks go
to those @uref{http://www.am-utils.org/docs/am-utils/AUTHORS.txt,authors} who have
submitted patches, and especially to the maintainers:

@itemize @bullet
@item @uref{http://www.cs.sunysb.edu/~ezk,Erez Zadok}
@item @email{ionut AT badula.org,Ion Badulescu}
@item @email{ro AT techfak.uni-bielefeld.de,Rainer Orth}
@item @email{nick.williams AT morganstanley.com,Nick Williams}
@end itemize

Thanks to the Formal Methods Group at Imperial College for suffering
patiently while @i{Amd} was being developed on their machines.

Thanks to the many people who have helped with the development of
@i{Amd}, especially Piete Brooks at the Cambridge University Computing
Lab for many hours of testing, experimentation and discussion.

Thanks to the older @email{amd-workers AT majordomo.glue.umd.edu,Amd
Workers} mailing list (now defunct) members for many suggestions and
bug reports to @i{Amd}.

@itemize @bullet
@item
@b{DEC}, @b{VAX} and @b{Ultrix} are registered trademarks of Digital
Equipment Corporation.
@item
@b{AIX} and @b{IBM} are registered trademarks of International Business
Machines Corporation.
@item
@b{Sun}, @b{NFS} and @b{SunOS} are registered trademarks of Sun
Microsystems, Inc.
@item
@b{UNIX} is a registered trademark in the USA and other countries,
exclusively licensed through X/Open Company, Ltd.
@item
All other registered trademarks are owned by their respective owners.
@end itemize

@c ################################################################
@node Index, , Acknowledgments & Trademarks, Top
@comment  node-name,  next,  previous,  up
@unnumbered Index

@printindex cp

@contents
@bye

@c ====================================================================
@c ISPELL LOCAL WORDS:
@c LocalWords:  setfilename amdref overfullrule settitle titlepage titlefont nz
@c LocalWords:  authorfont vskip ifinfo iftex cindex unnumberedsec dfn xref vol
@c LocalWords:  locationN pxref jpo nott concentrix Sjoerd sjoerd cwi Eitan vuw
@c LocalWords:  Mizrotsky eitan shumuji dgux fpx scp hcx metcalf masala hlh OTS
@c LocalWords:  Presnell srp cgl Trost trost ogi pyrOSx OSx tubsibr riscix iX
@c LocalWords:  Piete pb Lindblad cjl ai umax utek xinu Mitchum D'Souza dsouza
@c LocalWords:  mrc apu alliant aviion AViiON fps macII multimax tahoe vax emph
@c LocalWords:  mapdefault valA valB valC YPTSDIR ETCDIR substr MAKEDBM YPDBDIR
@c LocalWords:  NOPUSH njw dylan dk dylan njw anydir domN achilles mjh pref sel
@c LocalWords:  gdef loc loc loc ldots autodir remopts rwho rwho styx styx yoyo
@c LocalWords:  noindent gould rvdmount rvdunmount fserver mtmp unioned logfile
@c LocalWords:  dmn esac phjk toytown toytown toytown toytown phjk RdDir RdLnk
@c LocalWords:  volname attrs netif dougal inaddr hwaddr ec mountmaps passno xy
@c LocalWords:  freq dumpset hfs brian florence localinfo fstabs automaps defn
@c LocalWords:  localname fsck'd opr gummo sjv ganymede sjv fserv fserv fserv
@c LocalWords:  vaxA vaxB wp thpfs nbsd asis ifs amqprog free'ed printindex gov
@c LocalWords:  LocalWords syncodeindex Distrib bsdnet lanl AutoMounter acis ic
@c LocalWords:  ac uk aix bsd Mullender nl il DG lcs hpux irix ucsf NeXT cse cl
@c LocalWords:  mt FX hp ibm mips utils def def Domainname eg hostd getwd tmp
@c LocalWords:  subsubsection rw grpid intr noconn nocto nodevs nosuid retrans
@c LocalWords:  rsize tcp timeo nounmount utimeout DDEBUG nodaemon fd hostnames
@c LocalWords:  pid Amd's pendry vangogh nfsx backoff stats nomap nostats CRIT
@c LocalWords:  noinfo clustername RVD dsk dsk amq hostports osver statfs str
@c LocalWords:  ou counter's amdmaps proj src tftpboot sh mv cd sbin ypcat inet
@c LocalWords:  Getattr getattr localhost fhandles netmask fstype noquota addr
@c LocalWords:  exportfs Dumpsets dumpsets pindex ldif fixmount fixrmtab euid
@c LocalWords:  lostaltmail realloc netnumber itemx primnetnum primnetname ARG
@c LocalWords:  subsnetname subsnetnum netgrp netgroup multitable Shlib dec osf
@c LocalWords:  hppa pc bsdi freebsd netbsd openbsd ncr sysv rs acdirmax fsid
@c LocalWords:  acdirmin acregmax acregmin actimeo dumbtimr nfsv noac noauto sd
@c LocalWords:  nocache nodev noint nosub pgthresh posix rdonly suid symttl mfs
@c LocalWords:  AMFS umapfs myftpdir unionfs es mapname mapfile mapfile slocal
@c LocalWords:  mailspool saturn saturn notknown lol ober dr xr xr drwxrwsr cfg
@c LocalWords:  lrwxrwxrwx adminpr hplj adminpr cfg tekxp xterms tekxp Dupuy tp
@c LocalWords:  linkname hlfsddump dirname rmtab pluto rlogin direntry pg vr dn
@c LocalWords:  maxmem hlfsdir xmailbox showmount cn amdmap amdmapName resvport
@c LocalWords:  objectClass amdmapKey amdmapValue ln powerpc amdmapTimestamp ez
@c LocalWords:  moisil FSinfo Libtool Unmounting sublink fileservers NullProc
@c LocalWords:  gethostname mount's unmounts linkx remounts unmounting UAs SA's
@c LocalWords:  mountpoint mountpoints unescaped UIDs util's overlayed uref EFS
@c LocalWords:  serv maxgroups nfsl cachedir copt cfsadmin efs addopts fg ROMs
@c LocalWords:  nointr extatt setchapternewpage columnfractions alphaev gnulibc
@c LocalWords:  freebsdelf gnuoldld ifhtml defperm nodefperm norrip RRIP rrip
@c LocalWords:  noversion attr XXXXXX netgrpd rh mkstemp uid gid noexec mntfs
@c LocalWords:  nomnttab optionstr hrtime xdrtrace getpwd proplist redhat ctl
@c LocalWords:  texinfo texi ib sp cartouche ified xlatecookie dircategory sc
@c LocalWords:  AddInfo suse Novell softlookup ENOENT USB fullybrowsable LDAPv
@c LocalWords:  amy ie xfffffe zebedee andrew diskfull hdmail searchable si
@c LocalWords:  Orth ESTALE