summaryrefslogtreecommitdiff
path: root/usr.sbin/amd/doc/amdref.texinfo
blob: 762d5f2538c7acbb6623110684cbe13f4aa286e0 (plain)
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
\input texinfo		@c -*-texinfo-*-
@c
@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. All advertising materials mentioning features or use of this software
@c    must display the following acknowledgement:
@c      This product includes software developed by the University of
@c      California, Berkeley and its contributors.
@c 4. 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	from: @(#)amdref.texinfo	8.1 (Berkeley) 6/6/93
@c	$Id: amdref.texinfo,v 1.14 2017/08/22 16:59:40 schwarze Exp $
@c
@setfilename amdref.info
@c @setfilename /usr/local/emacs/info/amd
@tex
\overfullrule=0pt
@end tex

@settitle 4.4 BSD Automounter Reference Manual
@dircategory Miscellaneous
@direntry
* Amdref: (amdref).                 4.4 BSD Automounter Reference Manual
@end direntry

@titlepage
@sp 6
@center @titlefont{Amd}
@sp 2
@center @titlefont{The 4.4 BSD Automounter}
@sp 2
@center @titlefont{Reference Manual}
@sp 2
@center @authorfont{Jan-Simon Pendry}
@sp
@center @i{and}
@sp
@center @authorfont{Nick Williams}
@sp 4
@center Last updated March 1991
@center Documentation for software revision 5.3 Alpha
@page
Copyright @copyright{} 1989 Jan-Simon Pendry
@sp -1
Copyright @copyright{} 1989 Imperial College of Science, Technology & Medicine
@sp -1
Copyright @copyright{} 1989 The Regents of the University of California.
@sp 0
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
@ifinfo
@node Top, License, , (DIR)

Amd - The 4.4 BSD Automounter
*****************************

Amd is the 4.4 BSD Automounter.  This Info file describes how
to use and understand Amd.
@end ifinfo

@menu
* License::                  Explains the terms and conditions for using
                             and distributing Amd.
* Distrib::                  How to get the latest Amd distribution.
* Intro::                    An introduction to Automounting concepts.
* 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.
* Run-time Administration::  How to start, stop and control Amd.
* Examples::                 Some examples showing how Amd might be used.
* Internals::                Implementation details.
* Acknowledgements & Trademarks:: Legal notes.

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

@iftex
@unnumbered Preface

This manual documents the use of the 4.4 BSD automounter---@i{Amd}.
This is primarily a reference manual.  Unfortunately, no tutorial
exists.

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 Emacs.  Both forms contain substantially the
same text and are generated from a common source file, which is
distributed with the @i{Amd} source.
@end iftex

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

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

Redistribution and use in source and binary forms are permitted provided
that: (1) source distributions  retain this entire  copyright notice and
comment, and (2) distributions including  binaries display the following
acknowledgement: ``This product  includes  software  developed  by   The
University  of California,   Berkeley  and its  Contributors''  in   the
documentation  or other materials provided with  the distribution and in
all advertising materials mentioning  features  or use of this software.
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.

THIS SOFTWARE IS  PROVIDED ``AS IS''  AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING,  WITHOUT  LIMITATION,  THE IMPLIED  WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

@node Distrib, Intro, License, Top
@unnumbered Source Distribution
@cindex Source code distribution
@cindex Obtaining the source code

If you have access to the Internet, you can get the latest distribution
version of @i{Amd} from host @file{usc.edu} using anonymous FTP.  Move to
the directory @file{/pub/amd} on that host and fetch the file @file{amd.tar.Z}.

If you are in the UK, you can get the latest distribution version of
@i{Amd} from the UKnet info-server.  Start by sending email to
@file{info-server@@doc.ic.ac.uk}.

Sites on the UK JANET network can get the latest distribution by using
anonymous NIFTP to fetch the file @samp{<AMD>amd.tar.Z} from host
@samp{uk.ac.imperial.doc.src}.

Revision 5.2 was part of the 4.3 BSD Reno distribution.

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

@unnumberedsec Bug Reports
@cindex Bug reports

Send all bug reports to @file{jsp@@doc.ic.ac.uk} quoting the details of
the release and your configuration.  These can be obtained by running
the command @samp{amd -v}.

@unnumberedsec Mailing List
@cindex Mailing list

There is a mailing list for people interested in keeping uptodate with
developments.  To subscribe, send a note to @file{amd-workers-request@@acl.lanl.gov}.

@node Intro, Overview, Distrib, 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 so 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 flavours of Unix.

@node Overview, Supported Platforms, Intro, 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 flavours of Unix.  @xref{Supported Operating
Systems}.@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.

@c @i{Amd} supports the notion of @dfn{replicated} filesystems by evaluating
@c each member of a list of possible filesystem locations in parallel.
@c @i{Amd} checks that each cached mapping remains valid.  Should a mapping be
@c lost -- such as happens when a fileserver goes down -- @i{Amd} automatically
@c selects a replacement should one be available.
@c
@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-organised 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 containg 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 ``-w'' command-line option (@pxref{-w
Option, -w}).  It is also possible to set this value on a per-mount
basis (@pxref{opts Option, opts, opts}).@refill

Filesystems can be forcefully timed out using the @i{Amq} command.
@xref{Run-time Administration}.

@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 recognised when an
NFS server crashes and the behaviour 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.

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.

By default, fileserver state is not maintained for NFS/TCP mounts.  The
remote fileserver is always assumed to be up.
@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.

@node     Supported Platforms, Mount Maps, Overview, Top
@comment  node-name,  next,  previous,  up
@chapter Supported Platforms

@i{Amd} has been ported to a wide variety of machines and operating systems.
The table below lists those platforms supported by the current release.

@menu
* Supported Operating Systems::
* Supported Machine Architectures::
@end menu

@node     Supported Operating Systems, Supported Machine Architectures, Supported Platforms, Supported Platforms
@comment  node-name,  next,  previous,  up
@section Supported Operating Systems
@cindex Operating system names
@cindex Operating systems supported by Amd
@cindex Supported operating systems

The following operating systems are currently supported by @i{Amd}.
@i{Amd}'s conventional name for each system is given.

@table @code
@item acis43
4.3 BSD for IBM RT.  Contributed by Jan-Simon Pendry @t{<jsp@@doc.ic.ac.uk>}
@item aix3
AIX 3.1.  Contributed by Jan-Simon Pendry @t{<jsp@@doc.ic.ac.uk>}
@item aux
System V for Mac-II.  Contributed by Julian Onions @t{<jpo@@cs.nott.ac.uk>}
@item bsd44
4.4 BSD.  Contributed by Jan-Simon Pendry @t{<jsp@@doc.ic.ac.uk>}
@item concentrix
Concentrix 5.0.  Contributed by Sjoerd Mullender @t{<sjoerd@@cwi.nl>}
@item convex
Convex OS 7.1.  Contributed by Eitan Mizrotsky @t{<eitan@@shumuji.ac.il>}
@item dgux
Data General DG/UX.  Contributed by Mark Davies @t{<mark@@comp.vuw.ac.nz>}
@item fpx4
Celerity FPX 4.1/2.  Contributed by Stephen Pope @t{<scp@@grizzly.acl.lanl.gov>}
@item hcx
Harris HCX/UX.  Contributed by Chris Metcalf @t{<metcalf@@masala.lcs.mit.edu>}
@item hlh42
HLH OTS 1.@i{x} (4.2 BSD).  Contributed by Jan-Simon Pendry @t{<jsp@@doc.ic.ac.uk>}
@item hpux
HP-UX 6.@i{x} or 7.0.  Contributed by Jan-Simon Pendry @t{<jsp@@doc.ic.ac.uk>}
@item irix
SGI Irix.  Contributed by Scott R. Presnell @t{<srp@@cgl.ucsf.edu>}
@item next
Mach for NeXT.  Contributed by Bill Trost @t{<trost%reed@@cse.ogi.edu>}
@item pyrOSx
Pyramid OSx.  Contributed by Stefan Petri @t{<petri@@tubsibr.UUCP>}
@item riscix
Acorn RISC iX.  Contributed by Piete Brooks @t{<pb@@cam.cl.ac.uk>}
@item sos3
SunOS 3.4 & 3.5.  Contributed by Jan-Simon Pendry @t{<jsp@@doc.ic.ac.uk>}
@item sos4
SunOS 4.@i{x}.  Contributed by Jan-Simon Pendry @t{<jsp@@doc.ic.ac.uk>}
@item u2_2
Ultrix 2.2.  Contributed by Piete Brooks @t{<pb@@cam.cl.ac.uk>}
@item u3_0
Ultrix 3.  Contributed by Piete Brooks @t{<pb@@cam.cl.ac.uk>}
@item u4_0
Ultrix 4.0.  Contributed by Chris Lindblad @t{<cjl@@ai.mit.edu>}
@item umax43
Umax 4.3 BSD.  Contributed by Sjoerd Mullender @t{<sjoerd@@cwi.nl>}
@item utek
Utek 4.0.  Contributed by Bill Trost @t{<trost%reed@@cse.ogi.edu>}
@item xinu43
mt Xinu MORE/bsd.  Contributed by Jan-Simon Pendry @t{<jsp@@doc.ic.ac.uk>}
@end table

@node     Supported Machine Architectures, , Supported Operating Systems, Supported Platforms
@comment  node-name,  next,  previous,  up
@section Supported Machine Architectures
@cindex Supported machine architectures
@cindex Machine architecture names
@cindex Machine architectures supported by Amd

@table @code
@item alliant
Alliant FX/4
@item arm
Acorn ARM
@item aviion
Data General AViiON
@item encore
Encore
@item fps500
FPS Model 500
@item hp9000
HP 9000/300 family
@item hp9k8
HP 9000/800 family
@item ibm032
IBM RT
@item ibm6000
IBM RISC System/6000
@item iris4d
SGI Iris 4D
@item macII
Apple Mac II
@item mips
MIPS RISC
@item multimax
Encore Multimax
@item orion105
HLH Orion 1/05
@item sun3
Sun-3 family
@item sun4
Sun-4 family
@item tahoe
Tahoe family
@item vax
DEC Vax
@end table

@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, 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 a 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 configure when @i{Amd} is built and
can be displayed by running the command @samp{amd -v}.

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 behaviour (@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::
* NIS maps::
* Hesiod maps::
* Password maps::
* Union maps::
@end menu

@node     File maps, NIS 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.

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

@node     NIS maps, Hesiod maps, File 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 do not support cache mode @code{all} and, when caching is
enabled, have a default cache mode of @code{inc} (@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.

@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.  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

@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 @samp{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:=jsp
@end example

@node     Union 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 subsection Gdbm

@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{*}.

@group
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
@end group

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
@samp{white-space}.

A @dfn{location-selection} is a list of possible volumes with which to
satisfy the request.  @dfn{location-selection}s are 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{/tmp_mnt} and
@code{$@{fs@}} was `@t{$@{autodir@}}@t{/local/}@t{$@{key@}}' then
after expansion @code{$@{fs@}} would have the value @samp{/tmp_mnt/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
then 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

@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==sos4} would only
apply on Sun-3s running SunOS 4.x.

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 selectors currently implemented are:

@table @samp
@cindex arch, mount selector
@cindex Mount selector; arch
@cindex Selector; arch
@item arch
the machine architecture which was automatically determined at compile
time.  The architecture type can be displayed by running the command
@samp{amd -v}.  @xref{Supported Machine Architectures}.@refill

@item autodir
@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 ``-a'' command line option.  See the @var{fs} option.

@item byte
@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}).

@item cluster
@cindex cluster, mount selector
@cindex Mount selector; cluster
@cindex Selector; cluster
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 ``-C''
command line option.

@item domain
@cindex domain, mount selector
@cindex Mount selector; domain
@cindex Selector; domain
the local domain name as specified by the ``-d'' command line option.
See @samp{host}.

@item host
@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

@item hostd
@cindex hostd, mount selector
@cindex Mount selector; hostd
@cindex Selector; hostd
is @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.

@item karch
@cindex karch, mount selector
@cindex Mount selector; karch
@cindex Selector; karch
is provided as a hook for the kernel architecture.  This is used on
SunOS 4, for example, to distinguish between different @samp{/usr/kvm}
volumes.  @code{$@{karch@}} defaults to the value of @code{$@{arch@}}
unless a different value is set with the ``-k'' command line option.

@item os
@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
Operating Systems}.@refill

@end table

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.

@table @samp
@item key
@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

@item map
@cindex map, mount selector
@cindex Mount selector; map
@cindex Selector; map
the name of the mount map being used.

@item path
@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.

@item wire
@cindex wire, mount selector
@cindex Mount selector; wire
@cindex Selector; wire
the name of the network to which the primary network interface is
attached.  If a symbolic name cannot be found in the hosts
database then dotted IP address format is used.  This value is also
output by the ``-v'' option.

@end table

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.

@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
* delay Option::
* fs Option::
* opts Option::
* remopts Option::
* sublink Option::
* type Option::
@end menu

@node     delay Option, fs Option, Map Options, 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.
Auxilliary 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{getwd}(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{/tmp_mnt}
but may be changed with the ``-a'' command line option.
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 recognised 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.4
BSD is known to implement the @code{compress} and @code{spongy} options.

@table @code
@item compress
Use NFS compression protocol.
@item grpid
Use BSD directory group-id semantics.
@item intr
Allow keyboard interrupts on hard mounts.
@item noconn
Don't make a connection on datagram transports.
@item nocto
No close-to-open consistency.
@item nodevs
Don't allow local special devices on this filesystem.
@item nolooklease
When nqnfs is selected, disable the automatic acquiring of leases on
lookups.
@item nosuid
Don't allow set-uid or set-gid executables on this filesystem.
@item nqnfs
Enable leasing extensions to the NFS protocol know as Not Quite NFS.
Only supported by the 4.4BSD NFS implementation.
@item quota
Enable quota checking on this mount.
@item resvport
Use a reserved port number (one less than 1024).  Some NFS servers
require this.
@item retrans=@i{n}
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 ro
Mount this filesystem readonly.
@item rsize=@var{n}
The NFS read packet size.  You may need to set this if you are using
NFS/UDP through a gateway.
@item soft
Give up after @dfn{retrans} retransmissions.
@item spongy
Like @samp{soft} for status requests, and @samp{hard} for data transfers.
@item tcp
Use TCP/IP instead of UDP/IP, ignored if the NFS implementation does not
support TCP/IP mounts.
@item timeo=@var{n}
The NFS timeout, in tenth-seconds, before a request is retransmitted.
@item wsize=@var{n}
The NFS write packet size.  You may need to set this if you are using
NFS/UDP through a gateway.
@end table

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

@table @code
@item nounmount
Configures the mount so that its time-to-live will
never expire.  This is also the default for some filesystem types.
@c
@c Implementation broken:
@item ping=@var{n}
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 less than zero,
no pings are sent and the host is assumed to be always
up.  By default, pings are not sent for an NFS/TCP mount.
@item retry=@var{n}
The number of times to retry the mount system call.
@item utimeout=@var{n}
The interval, in seconds, by which the mount's
time-to-live is extended after an unmount attempt
has failed.  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 ``-w'' command line option.
@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{$@{rem@}} 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

@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, @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.  @xref{Map Defaults}, for more details.

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} it will still
background itself and disassociate itself from the controlling terminal.
To use a debugger it is necessary to specify @samp{-D nodaemon} on the
command line.

@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 normalisation.
* -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.
* -C-Option::	Cluster name.
* -D-Option::	Debug flags.
@end menu

@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{/tmp_mnt}.  For example,
some sites prefer @file{/amd}.

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

@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).

@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

@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{arch -k} and its only effect is to set the variable
@code{$@{karch@}}.  If this option is not given, @code{$@{karch@}} has
the same value as @code{$@{arch@}}.

This would be used as follows:

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

@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.  Two special @dfn{log-options}
are recognised.

@enumerate
@item
If @dfn{log-option} is the string @samp{syslog}, @i{Amd} will use the
@b{syslog}(3) mechanism.@refill

@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.

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.

Using @samp{syslog} is usually best, in which case @i{Amd} would be
started as follows:

@example
amd -l syslog ...
@end example

@node     -n Option, -p Option, -l Option, Amd Command Line Options
@comment  node-name,  next,  previous,  up
@section @code{-n}
@cindex Hostname normalisation
@cindex Aliased hostnames
@cindex Resolving aliased hostnames
@cindex Normalising hostnames

Normalises the remote hostname before using it.  Normalisation is done
by replacing the value of @code{$@{rhost@}} with the 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.

@node     -p Option, -r Option, -n 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 nodaemon} debug flag, this
option is ignored.

@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.}

@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} and @dfn{retransmit} intervals used by
the kernel to communicate to @i{Amd}.  These are used to set the
@samp{timeo} and @samp{retrans} mount options.

@i{Amd} relies on the kernel RPC retransmit mechanism to trigger mount
retries.  The value of this parameter changes the retry interval.  Too
long an interval gives poor interactive response, too short an interval
causes excessive retries.

@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
amd 5.2.1.11 of 91/03/17 18:04:05 5.3Alpha11 #0: Sun Mar 17 18:07:28 GMT 1991
Built by pendry@@vangogh.Berkeley.EDU for a hp300 running bsd44 (big-endian).
Map support for: root, passwd, union, file, error.
FS: ufs, nfs, nfsx, host, link, program, union, auto, direct, toplvl, error.
Primary network is 128.32.130.0.
@end example

The information includes the version number, release date and name of
the release.  The architecture (@pxref{Supported Machine Architectures}),
operating system (@pxref{Supported Operating Systems})
and byte ordering are also printed as they appear in the @code{$@{os@}},
@code{$@{arch@}} and @code{$@{byte@}} variables.@refill

@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).

@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
@item error
Non-fatal errors
@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
@end table

Initially a set of default logging flags is enabled.  This is as if
@samp{-x all,nomap,nostats} had been selected.  The command line is
parsed and logging is controlled by the ``-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 priorites used for each
of the message types.@refill

@table @code
@item fatal
LOG_CRIT
@item error
LOG_ERR
@item user
LOG_WARNING
@item warning
LOG_WARNING
@item info
LOG_INFO
@item debug
LOG_DEBUG
@item map
LOG_DEBUG
@item stats
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.

@node     -y Option, -C-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 ``-m'' option
@c is specified, and whenever required in a mount map.

@node     -C-Option, -D-Option, -y 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

@node     -D-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 ``-D'' option is
only available if @i{Amd} was compiled with @samp{-DDEBUG}.  The memory
debugging facilities are only available if @i{Amd} was compiled with
@samp{-DDEBUG_MEM} (in addition to @samp{-DDEBUG}).

The most common options to use are @samp{-D trace} and @samp{-D test}
(which turns on all the useful debug options).  See the program source
for a more detailed explanation of the available options.

@node     Filesystem Types, Run-time Administration, 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.
* Program Filesystem::		Generic Program mounts.
* Symbolic Link Filesystem::	Local link referencing filesystem.
* Symbolic Link Filesystem II::	Local link referencing existing filesystem.
* Automount Filesystem::
* Direct Automount Filesystem::
* Union Filesystem::
* Error Filesystem::
* Top-level Filesystem::
* Root Filesystem::
* Inheritance Filesystem::
@end menu

@node     Network Filesystem, Network Host Filesystem, Filesystem Types, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Network Filesystem (@samp{type:=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} 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.  @i{Amd} @dfn{does not} wait for
a response; it notes that one of the locations needs retrying, but
continues with any remaining locations.  When the file handle becomes
available, and assuming none of the other locations was successfully
mounted, @i{Amd} will retry the mount.  This mechanism allows several
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.}
The first one which responds with a valid file handle will be used.

@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 possibilty of blocking @i{Amd}.

@node     Network Host Filesystem, Network Filesystem Group, Network Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Network Host Filesystem (@samp{type:=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} 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 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
/defaults  type:=host;fs:=$@{autodir@}/$@{rhost@}/root;rhost:=$@{key@}
*          opts:=rw,nosuid,grpid
@end example

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

@example
amd /n 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.

@node     Network Filesystem Group, Unix Filesystem, Network Host Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Network Filesystem Group (@samp{type:=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} 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.

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

@noindent
The following options must be specified:

@table @code
@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.

@item rfs
as a list of filesystems to mount.  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 parallel 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

@node     Unix Filesystem, Program Filesystem, Network Filesystem Group, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Unix Filesystem (@samp{type:=ufs})
@cindex Unix filesystem
@cindex UFS
@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

The @dfn{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/xd0g;sublink:=jsp
@end example

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

The @dfn{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
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 Mount option; unmount
@item unmount
the program which will perform the unmount.
@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 quote character.

To run the program @samp{rvdmount} with a host name and filesystem as
arguments would be specified by @samp{mount:="/etc/rvdmount rvdmount
fserver $@{path@}"}.

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}.  This means
that the split string must have at least two elements.  The program is
directly executed by @i{Amd}, not via a shell.  This means that scripts
must begin with a @code{#!} interpreter specification.

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 ``-l''
command line option has no effect on standard error.

@node     Symbolic Link Filesystem, Symbolic Link Filesystem II, Program Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Symbolic Link Filesystem (@samp{type:=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 though 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}.

@node     Symbolic Link Filesystem II, Automount Filesystem, Symbolic Link Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Symbolic Link Filesystem II (@samp{type:=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 @samp{linkx} filesystem type is identical to @samp{link} with the
exception that the target of the link must exist.  Existence is checked
with the @samp{lstat} system call.

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

@node     Automount Filesystem, Direct Automount Filesystem, Symbolic Link Filesystem II, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Automount Filesystem (@samp{type:=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 synchronising
@cindex Synchronising the map cache
@cindex Map cache options
@cindex Regular expressions in maps

The @dfn{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 option
@cindex Mount 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, synchronised 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.
@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

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

The @dfn{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{/}.

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

The @dfn{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 uptodate with respect to the
underlying directories.  Similarly, if a link is removed, for example
with the @samp{rm} command, it will be lost forever.

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

The @dfn{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.

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

The @dfn{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.

@node     Root Filesystem, Inheritance Filesystem, Top-level Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Root Filesystem
@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 creating a second root node is undefined.

@node     Inheritance Filesystem, , Root Filesystem, Filesystem Types
@comment  node-name,  next,  previous,  up
@section Inheritance Filesystem
@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 ``-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 @code{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.

@node     Run-time Administration, Examples, Filesystem Types, Top
@comment  node-name,  next,  previous,  up
@chapter Run-time Administration
@cindex Run-time administration
@cindex Amq command

@menu
* Starting Amd::
* Stopping 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 /etc/amd.start

@i{Amd} is best started from @samp{/etc/rc.local}:

@example
if [ -f /etc/amd.start ]; then
        sh /etc/amd.start; (echo -n ' amd')      >/dev/console
fi
@end example

@noindent
The shell script, @samp{amd.start}, contains:

@example
#!/bin/sh -
PATH=/etc:/bin:/usr/bin:/usr/ucb:$PATH export PATH

#
# Either name of logfile or "syslog"
#
LOGFILE=syslog
#LOGFILE=/var/log/amd

#
# Figure out whether domain name is in host name
# If the hostname is just the machine name then
# pass in the name of the local domain so that the
# hostnames in the map are domain stripped correctly.
#
case `hostname` in
*.*) dmn= ;;
*) dmn='-d doc.ic.ac.uk'
esac

#
# Zap earlier log file
#
case "$LOGFILE" in
*/*)
        mv "$LOGFILE" "$LOGFILE"-
        > "$LOGFILE"
        ;;
syslog)
        : nothing
        ;;
esac

cd /usr/sbin
#
# -r            restart
# -d dmn        local domain
# -w wait       wait between unmount attempts
# -l log        logfile or "syslog"
#
eval ./amd -r $dmn -w 240 -l "$LOGFILE" \
        /homes amd.homes -cache:=inc \
        /home amd.home -cache:=inc \
        /vol amd.vol -cache:=inc \
        /n amd.net -cache:=inc
@end example

If the list of automount points and maps is contained in a file or NIS map
it is easily incorporated onto the command line:

@example
...
eval ./amd -r $dmn -w 240 -l "$LOGFILE" `ypcat -k auto.master`
@end example

@node     Stopping Amd, Controlling 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 ``-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 primarly used for debugging.@refill
@end table

Actions taken for other signals are undefined.

@node     Controlling Amd, , Stopping 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 behaviour.
* Amq -f option::     Flushing the map cache.
* Amq -h option::     Controlling a non-local host.
* Amq -m option::     Obtaining mount statistics.
* Amq -s option::     Obtaining global statistics.
* Amq -u option::     Forcing volumes to time out.
* Amq -v option::     Version information.
* Other Amq options:: Three other special options.
@end menu

@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         /tmp_mnt/charm/home/charm/jsp
/homes/phjk  nfs    toytown:/home/toytown     /tmp_mnt/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 could 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

@node     Amq -f option, Amq -h option, Amq default, Controlling Amd
@comment  node-name,  next,  previous,  up
@subsection @i{Amq} -f option
@cindex Flushing the map cache
@cindex Map cache, flushing

The ``-f'' option causes @i{Amd} to flush the internal mount map cache.
This is useful for Hesiod maps since @i{Amd} will not automatically
notice when they have been updated.  The map cache can also be
synchronised with the map source by using the @samp{sync} option
(@pxref{Automount Filesystem}).@refill

@node     Amq -h option, Amq -m option, Amq -f option, Controlling Amd
@comment  node-name,  next,  previous,  up
@subsection @i{Amq} -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 ``-h'' option should
be used.

@node     Amq -m option, Amq -s option, Amq -h option, Controlling Amd
@comment  node-name,  next,  previous,  up
@subsection @i{Amq} -m option

The ``-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 occured.
@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    /tmp_mnt/amy/home/amy    nfs    5 amy is up
swan:/home/swan  /tmp_mnt/swan/home/swan  nfs    0 swan is up (Permission denied)
ex:/home/ex      /tmp_mnt/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}.

@node     Amq -s option, Amq -u option, Amq -m option, Controlling Amd
@comment  node-name,  next,  previous,  up
@subsection @i{Amq} -s option
@cindex Global statistics
@cindex Statistics

The ``-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

@node     Amq -u option, Amq -v option, Amq -s option, Controlling Amd
@comment  node-name,  next,  previous,  up
@subsection @i{Amq} -u option
@cindex Forcing filesystem to time out
@cindex Unmounting a filesystem

The ``-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.  It is not possible to
unmount a filesystem which has been mounted with the @samp{nounmount}
flag.

@c The ``-H'' option informs @i{Amd} that the specified mount point has hung -
@c as if its keepalive timer had expired.

@node     Amq -v option, Other Amq options, Amq -u option, Controlling Amd
@comment  node-name,  next,  previous,  up
@subsection @i{Amq} -v option
@cindex Version information at run-time

The ``-v'' option displays the version of @i{Amd} in a similar way to
@i{Amd}'s ``-v'' option.

@node     Other Amq options, , Amq -v option, Controlling Amd
@comment  node-name,  next,  previous,  up
@subsection Other @i{Amq} options

Three other operations are implemented.  These modify the state of
@i{Amd} as a whole, rather than any particular filesystem.  The ``-l'',
``-x'' and ``-D'' options have exactly the same effect as @i{Amd}'s
corresponding command line options.  The ``-l'' option is rejected by
@i{Amd} in the current version for obvious security reasons.  When
@i{Amd} receives a ``-x''flag it limits the log options being modified
to those which were not enabled at startup.  This prevents a user
turning @emph{off} any logging option which was specified at startup,
though any which have been turned off since then can still be turned
off.  The ``-D'' option has a similar behaviour.

@node     Examples, Internals, Run-time Administration, Top
@comment  node-name,  next,  previous,  up
@chapter Examples

@menu
* User Filesystems::
* Home Directories::
* Architecture Sharing::
* Wildcard Names::
* rwho servers::
* /vol::
@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 minimising 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{/tmp_mnt/@dfn{host}/home/@dfn{host}} and
@samp{/etc/fstab} on host @samp{charm} would have a line:@refill

@example
/dev/xy0g /tmp_mnt/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 ``-r'' option then instead of attempting an NFS mount, @i{Amd} will
simply inherit the UFS mount (@pxref{Inheritance Filesystem}).  If
``-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, , 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{/tmp_mnt/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     Internals, Acknowledgements & Trademarks, Examples, Top
@comment  node-name,  next,  previous,  up
@chapter Internals

@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{$@{var@}}, indicate that the value of the appropriate variable is
output.

Log messages are either sent direct to a file,
or logged via the @b{syslog}(3) mechanism.
Messages are logged with facility @samp{LOG_DAEMON} when using @b{syslog}(3).
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 @asis
@item @t{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 erorr ``should
never happen''.

@item @t{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 @t{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 @t{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 @t{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 ``-v'' option.

@item @t{No work to do - quitting}
No automount points were given on the command line and so there is no
work to do.

@item @t{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 @t{Out of memory}
While attempting to malloc some memory, the memory space available to
@i{Amd} was exhausted.  This is an unrecoverable error.

@item @t{cannot create rpc/udp service}
Either the NFS or AMQ endpoint could not be created.

@item @t{gethostname:} @i{description}
The @b{gethostname}(2) system call failed during startup.

@item @t{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 @t{ifs_match called!}
An internal error occurred while restarting a pre-mounted filesystem.
This error ``should never happen''.

@item @t{mount_afs:} @i{description}
An error occured while @i{Amd} was mounting itself.

@item @t{run_rpc failed}
Somehow the main NFS server loop failed.  This error ``should never
happen''.

@item @t{unable to free rpc arguments in amqprog_1}
The incoming arguments to the AMQ server could not be free'ed.

@item @t{unable to free rpc arguments in nfs_program_1}
The incoming arguments to the NFS server could not be free'ed.

@item @t{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 @t{unable to register (NFS_PROGRAM, NFS_VERSION, 0)}
The NFS server could not be registered with the internal RPC dispatcher.

@end table

@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 @asis
@item @t{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 @t{"@t{$@{@i{path}@}}" forcibly timed out}
An automount point has been timed out by the @i{Amq} command.

@item @t{restarting @i{mount-info} on @t{$@{@i{fs}@}}}
A pre-mounted file system has been noted.

@item @t{"@t{$@{@i{path}@}}" has timed out}
No access to the automount point has been made within the timeout
period.

@item @t{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 @t{Re-synchronizing cache for map @t{$@{@i{map}@}}}
The named map has been modified and the internal cache is being re-synchronized.

@item @t{Filehandle denied for "@t{$@{@i{rhost}@}}:@t{$@{@i{rfs}@}}"}
The mount daemon refused to return a file handle for the requested filesystem.

@item @t{Filehandle error for "$@{@i{rhost}@}:$@{@i{rfs}@}":} @i{description}
The mount daemon gave some other error for the requested filesystem.

@item @t{file server @t{$@{@i{rhost}@}} type nfs starts up}
A new NFS file server has been referenced and is known to be up.

@item @t{file server @t{$@{@i{rhost}@}} type nfs starts down}
A new NFS file server has been referenced and is known to be down.

@item @t{file server @t{$@{@i{rhost}@}} type nfs is up}
An NFS file server that was previously down is now up.

@item @t{file server @t{$@{@i{rhost}@}} type nfs is down}
An NFS file server that was previously up is now down.

@item @t{Finishing with status @i{exit-status}}
@i{Amd} is about to exit with the given exit status. 

@item @t{@i{mount-info} mounted fstype @t{$@{@i{type}@}} on @t{$@{@i{fs}@}}}
A new file system has been mounted.

@item @t{@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 @t{@i{mount-info} unmounted fstype @t{$@{@i{type}@}} from @t{$@{@i{fs}@}}}
A file system has been unmounted.

@item @t{@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.

@end table

@node     Acknowledgements & Trademarks, Index, Internals, Top
@comment  node-name,  next,  previous,  up
@unnumbered Acknowledgements & Trademarks

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.

@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 of AT&T Unix Systems Laboratories
in the USA and other countries.
@end itemize

@node Index, , Acknowledgements & Trademarks, Top
@comment  node-name,  next,  previous,  up
@unnumbered Index

@printindex cp

@contents
@bye