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
|
// Copyright 2018 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package p9
import (
"fmt"
"math"
)
// ErrInvalidMsgType is returned when an unsupported message type is found.
type ErrInvalidMsgType struct {
msgType
}
// Error returns a useful string.
func (e *ErrInvalidMsgType) Error() string {
return fmt.Sprintf("invalid message type: %d", e.msgType)
}
// message is a generic 9P message.
type message interface {
encoder
fmt.Stringer
// Type returns the message type number.
typ() msgType
}
// payloader is a special message which may include an inline payload.
type payloader interface {
// FixedSize returns the size of the fixed portion of this message.
FixedSize() uint32
// Payload returns the payload for sending.
Payload() []byte
// SetPayload returns the decoded message.
//
// This is going to be total message size - FixedSize. But this should
// be validated during decode, which will be called after SetPayload.
SetPayload([]byte)
// PayloadCleanup is called after a payloader message is sent and
// buffers can be reapt.
PayloadCleanup()
}
// tversion is a version request.
type tversion struct {
// MSize is the message size to use.
MSize uint32
// Version is the version string.
//
// For this implementation, this must be 9P2000.L.
Version string
}
// decode implements encoder.decode.
func (t *tversion) decode(b *buffer) {
t.MSize = b.Read32()
t.Version = b.ReadString()
}
// encode implements encoder.encode.
func (t *tversion) encode(b *buffer) {
b.Write32(t.MSize)
b.WriteString(t.Version)
}
// typ implements message.typ.
func (*tversion) typ() msgType {
return msgTversion
}
// String implements fmt.Stringer.
func (t *tversion) String() string {
return fmt.Sprintf("Tversion{MSize: %d, Version: %s}", t.MSize, t.Version)
}
// rversion is a version response.
type rversion struct {
// MSize is the negotiated size.
MSize uint32
// Version is the negotiated version.
Version string
}
// decode implements encoder.decode.
func (r *rversion) decode(b *buffer) {
r.MSize = b.Read32()
r.Version = b.ReadString()
}
// encode implements encoder.encode.
func (r *rversion) encode(b *buffer) {
b.Write32(r.MSize)
b.WriteString(r.Version)
}
// typ implements message.typ.
func (*rversion) typ() msgType {
return msgRversion
}
// String implements fmt.Stringer.
func (r *rversion) String() string {
return fmt.Sprintf("Rversion{MSize: %d, Version: %s}", r.MSize, r.Version)
}
// tflush is a flush request.
type tflush struct {
// OldTag is the tag to wait on.
OldTag tag
}
// decode implements encoder.decode.
func (t *tflush) decode(b *buffer) {
t.OldTag = b.ReadTag()
}
// encode implements encoder.encode.
func (t *tflush) encode(b *buffer) {
b.WriteTag(t.OldTag)
}
// typ implements message.typ.
func (*tflush) typ() msgType {
return msgTflush
}
// String implements fmt.Stringer.
func (t *tflush) String() string {
return fmt.Sprintf("Tflush{OldTag: %d}", t.OldTag)
}
// rflush is a flush response.
type rflush struct {
}
// decode implements encoder.decode.
func (*rflush) decode(b *buffer) {
}
// encode implements encoder.encode.
func (*rflush) encode(b *buffer) {
}
// typ implements message.typ.
func (*rflush) typ() msgType {
return msgRflush
}
// String implements fmt.Stringer.
func (r *rflush) String() string {
return fmt.Sprintf("Rflush{}")
}
// twalk is a walk request.
type twalk struct {
// fid is the fid to be walked.
fid fid
// newFID is the resulting fid.
newFID fid
// Names are the set of names to be walked.
Names []string
}
// decode implements encoder.decode.
func (t *twalk) decode(b *buffer) {
t.fid = b.ReadFID()
t.newFID = b.ReadFID()
n := b.Read16()
t.Names = t.Names[:0]
for i := 0; i < int(n); i++ {
t.Names = append(t.Names, b.ReadString())
}
}
// encode implements encoder.encode.
func (t *twalk) encode(b *buffer) {
b.WriteFID(t.fid)
b.WriteFID(t.newFID)
b.Write16(uint16(len(t.Names)))
for _, name := range t.Names {
b.WriteString(name)
}
}
// typ implements message.typ.
func (*twalk) typ() msgType {
return msgTwalk
}
// String implements fmt.Stringer.
func (t *twalk) String() string {
return fmt.Sprintf("Twalk{FID: %d, newFID: %d, Names: %v}", t.fid, t.newFID, t.Names)
}
// rwalk is a walk response.
type rwalk struct {
// QIDs are the set of QIDs returned.
QIDs []QID
}
// decode implements encoder.decode.
func (r *rwalk) decode(b *buffer) {
n := b.Read16()
r.QIDs = r.QIDs[:0]
for i := 0; i < int(n); i++ {
var q QID
q.decode(b)
r.QIDs = append(r.QIDs, q)
}
}
// encode implements encoder.encode.
func (r *rwalk) encode(b *buffer) {
b.Write16(uint16(len(r.QIDs)))
for _, q := range r.QIDs {
q.encode(b)
}
}
// typ implements message.typ.
func (*rwalk) typ() msgType {
return msgRwalk
}
// String implements fmt.Stringer.
func (r *rwalk) String() string {
return fmt.Sprintf("Rwalk{QIDs: %v}", r.QIDs)
}
// tclunk is a close request.
type tclunk struct {
// fid is the fid to be closed.
fid fid
}
// decode implements encoder.decode.
func (t *tclunk) decode(b *buffer) {
t.fid = b.ReadFID()
}
// encode implements encoder.encode.
func (t *tclunk) encode(b *buffer) {
b.WriteFID(t.fid)
}
// typ implements message.typ.
func (*tclunk) typ() msgType {
return msgTclunk
}
// String implements fmt.Stringer.
func (t *tclunk) String() string {
return fmt.Sprintf("Tclunk{FID: %d}", t.fid)
}
// rclunk is a close response.
type rclunk struct{}
// decode implements encoder.decode.
func (*rclunk) decode(b *buffer) {
}
// encode implements encoder.encode.
func (*rclunk) encode(b *buffer) {
}
// typ implements message.typ.
func (*rclunk) typ() msgType {
return msgRclunk
}
// String implements fmt.Stringer.
func (r *rclunk) String() string {
return fmt.Sprintf("Rclunk{}")
}
// tremove is a remove request.
type tremove struct {
// fid is the fid to be removed.
fid fid
}
// decode implements encoder.decode.
func (t *tremove) decode(b *buffer) {
t.fid = b.ReadFID()
}
// encode implements encoder.encode.
func (t *tremove) encode(b *buffer) {
b.WriteFID(t.fid)
}
// typ implements message.typ.
func (*tremove) typ() msgType {
return msgTremove
}
// String implements fmt.Stringer.
func (t *tremove) String() string {
return fmt.Sprintf("Tremove{FID: %d}", t.fid)
}
// rremove is a remove response.
type rremove struct {
}
// decode implements encoder.decode.
func (*rremove) decode(b *buffer) {
}
// encode implements encoder.encode.
func (*rremove) encode(b *buffer) {
}
// typ implements message.typ.
func (*rremove) typ() msgType {
return msgRremove
}
// String implements fmt.Stringer.
func (r *rremove) String() string {
return fmt.Sprintf("Rremove{}")
}
// rlerror is an error response.
//
// Note that this replaces the error code used in 9p.
type rlerror struct {
Error uint32
}
// decode implements encoder.decode.
func (r *rlerror) decode(b *buffer) {
r.Error = b.Read32()
}
// encode implements encoder.encode.
func (r *rlerror) encode(b *buffer) {
b.Write32(r.Error)
}
// typ implements message.typ.
func (*rlerror) typ() msgType {
return msgRlerror
}
// String implements fmt.Stringer.
func (r *rlerror) String() string {
return fmt.Sprintf("Rlerror{Error: %d}", r.Error)
}
// tauth is an authentication request.
type tauth struct {
// Authenticationfid is the fid to attach the authentication result.
Authenticationfid fid
// UserName is the user to attach.
UserName string
// AttachName is the attach name.
AttachName string
// UserID is the numeric identifier for UserName.
UID UID
}
// decode implements encoder.decode.
func (t *tauth) decode(b *buffer) {
t.Authenticationfid = b.ReadFID()
t.UserName = b.ReadString()
t.AttachName = b.ReadString()
t.UID = b.ReadUID()
}
// encode implements encoder.encode.
func (t *tauth) encode(b *buffer) {
b.WriteFID(t.Authenticationfid)
b.WriteString(t.UserName)
b.WriteString(t.AttachName)
b.WriteUID(t.UID)
}
// typ implements message.typ.
func (*tauth) typ() msgType {
return msgTauth
}
// String implements fmt.Stringer.
func (t *tauth) String() string {
return fmt.Sprintf("Tauth{AuthFID: %d, UserName: %s, AttachName: %s, UID: %d", t.Authenticationfid, t.UserName, t.AttachName, t.UID)
}
// rauth is an authentication response.
//
// encode, decode and Length are inherited directly from QID.
type rauth struct {
QID
}
// typ implements message.typ.
func (*rauth) typ() msgType {
return msgRauth
}
// String implements fmt.Stringer.
func (r *rauth) String() string {
return fmt.Sprintf("Rauth{QID: %s}", r.QID)
}
// tattach is an attach request.
type tattach struct {
// fid is the fid to be attached.
fid fid
// Auth is the embedded authentication request.
//
// See client.Attach for information regarding authentication.
Auth tauth
}
// decode implements encoder.decode.
func (t *tattach) decode(b *buffer) {
t.fid = b.ReadFID()
t.Auth.decode(b)
}
// encode implements encoder.encode.
func (t *tattach) encode(b *buffer) {
b.WriteFID(t.fid)
t.Auth.encode(b)
}
// typ implements message.typ.
func (*tattach) typ() msgType {
return msgTattach
}
// String implements fmt.Stringer.
func (t *tattach) String() string {
return fmt.Sprintf("Tattach{FID: %d, AuthFID: %d, UserName: %s, AttachName: %s, UID: %d}", t.fid, t.Auth.Authenticationfid, t.Auth.UserName, t.Auth.AttachName, t.Auth.UID)
}
// rattach is an attach response.
type rattach struct {
QID
}
// typ implements message.typ.
func (*rattach) typ() msgType {
return msgRattach
}
// String implements fmt.Stringer.
func (r *rattach) String() string {
return fmt.Sprintf("Rattach{QID: %s}", r.QID)
}
// tlopen is an open request.
type tlopen struct {
// fid is the fid to be opened.
fid fid
// Flags are the open flags.
Flags OpenFlags
}
// decode implements encoder.decode.
func (t *tlopen) decode(b *buffer) {
t.fid = b.ReadFID()
t.Flags = b.ReadOpenFlags()
}
// encode implements encoder.encode.
func (t *tlopen) encode(b *buffer) {
b.WriteFID(t.fid)
b.WriteOpenFlags(t.Flags)
}
// typ implements message.typ.
func (*tlopen) typ() msgType {
return msgTlopen
}
// String implements fmt.Stringer.
func (t *tlopen) String() string {
return fmt.Sprintf("Tlopen{FID: %d, Flags: %v}", t.fid, t.Flags)
}
// rlopen is a open response.
type rlopen struct {
// QID is the file's QID.
QID QID
// IoUnit is the recommended I/O unit.
IoUnit uint32
}
// decode implements encoder.decode.
func (r *rlopen) decode(b *buffer) {
r.QID.decode(b)
r.IoUnit = b.Read32()
}
// encode implements encoder.encode.
func (r *rlopen) encode(b *buffer) {
r.QID.encode(b)
b.Write32(r.IoUnit)
}
// typ implements message.typ.
func (*rlopen) typ() msgType {
return msgRlopen
}
// String implements fmt.Stringer.
func (r *rlopen) String() string {
return fmt.Sprintf("Rlopen{QID: %s, IoUnit: %d}", r.QID, r.IoUnit)
}
// tlcreate is a create request.
type tlcreate struct {
// fid is the parent fid.
//
// This becomes the new file.
fid fid
// Name is the file name to create.
Name string
// Mode is the open mode (O_RDWR, etc.).
//
// Note that flags like O_TRUNC are ignored, as is O_EXCL. All
// create operations are exclusive.
OpenFlags OpenFlags
// Permissions is the set of permission bits.
Permissions FileMode
// GID is the group ID to use for creating the file.
GID GID
}
// decode implements encoder.decode.
func (t *tlcreate) decode(b *buffer) {
t.fid = b.ReadFID()
t.Name = b.ReadString()
t.OpenFlags = b.ReadOpenFlags()
t.Permissions = b.ReadPermissions()
t.GID = b.ReadGID()
}
// encode implements encoder.encode.
func (t *tlcreate) encode(b *buffer) {
b.WriteFID(t.fid)
b.WriteString(t.Name)
b.WriteOpenFlags(t.OpenFlags)
b.WritePermissions(t.Permissions)
b.WriteGID(t.GID)
}
// typ implements message.typ.
func (*tlcreate) typ() msgType {
return msgTlcreate
}
// String implements fmt.Stringer.
func (t *tlcreate) String() string {
return fmt.Sprintf("Tlcreate{FID: %d, Name: %s, OpenFlags: %s, Permissions: 0o%o, GID: %d}", t.fid, t.Name, t.OpenFlags, t.Permissions, t.GID)
}
// rlcreate is a create response.
//
// The encode, decode, etc. methods are inherited from Rlopen.
type rlcreate struct {
rlopen
}
// typ implements message.typ.
func (*rlcreate) typ() msgType {
return msgRlcreate
}
// String implements fmt.Stringer.
func (r *rlcreate) String() string {
return fmt.Sprintf("Rlcreate{QID: %s, IoUnit: %d}", r.QID, r.IoUnit)
}
// tsymlink is a symlink request.
type tsymlink struct {
// Directory is the directory fid.
Directory fid
// Name is the new in the directory.
Name string
// Target is the symlink target.
Target string
// GID is the owning group.
GID GID
}
// decode implements encoder.decode.
func (t *tsymlink) decode(b *buffer) {
t.Directory = b.ReadFID()
t.Name = b.ReadString()
t.Target = b.ReadString()
t.GID = b.ReadGID()
}
// encode implements encoder.encode.
func (t *tsymlink) encode(b *buffer) {
b.WriteFID(t.Directory)
b.WriteString(t.Name)
b.WriteString(t.Target)
b.WriteGID(t.GID)
}
// typ implements message.typ.
func (*tsymlink) typ() msgType {
return msgTsymlink
}
// String implements fmt.Stringer.
func (t *tsymlink) String() string {
return fmt.Sprintf("Tsymlink{DirectoryFID: %d, Name: %s, Target: %s, GID: %d}", t.Directory, t.Name, t.Target, t.GID)
}
// rsymlink is a symlink response.
type rsymlink struct {
// QID is the new symlink's QID.
QID QID
}
// decode implements encoder.decode.
func (r *rsymlink) decode(b *buffer) {
r.QID.decode(b)
}
// encode implements encoder.encode.
func (r *rsymlink) encode(b *buffer) {
r.QID.encode(b)
}
// typ implements message.typ.
func (*rsymlink) typ() msgType {
return msgRsymlink
}
// String implements fmt.Stringer.
func (r *rsymlink) String() string {
return fmt.Sprintf("Rsymlink{QID: %s}", r.QID)
}
// tlink is a link request.
type tlink struct {
// Directory is the directory to contain the link.
Directory fid
// fid is the target.
Target fid
// Name is the new source name.
Name string
}
// decode implements encoder.decode.
func (t *tlink) decode(b *buffer) {
t.Directory = b.ReadFID()
t.Target = b.ReadFID()
t.Name = b.ReadString()
}
// encode implements encoder.encode.
func (t *tlink) encode(b *buffer) {
b.WriteFID(t.Directory)
b.WriteFID(t.Target)
b.WriteString(t.Name)
}
// typ implements message.typ.
func (*tlink) typ() msgType {
return msgTlink
}
// String implements fmt.Stringer.
func (t *tlink) String() string {
return fmt.Sprintf("Tlink{DirectoryFID: %d, TargetFID: %d, Name: %s}", t.Directory, t.Target, t.Name)
}
// rlink is a link response.
type rlink struct {
}
// typ implements message.typ.
func (*rlink) typ() msgType {
return msgRlink
}
// decode implements encoder.decode.
func (*rlink) decode(b *buffer) {
}
// encode implements encoder.encode.
func (*rlink) encode(b *buffer) {
}
// String implements fmt.Stringer.
func (r *rlink) String() string {
return fmt.Sprintf("Rlink{}")
}
// trenameat is a rename request.
type trenameat struct {
// OldDirectory is the source directory.
OldDirectory fid
// OldName is the source file name.
OldName string
// NewDirectory is the target directory.
NewDirectory fid
// NewName is the new file name.
NewName string
}
// decode implements encoder.decode.
func (t *trenameat) decode(b *buffer) {
t.OldDirectory = b.ReadFID()
t.OldName = b.ReadString()
t.NewDirectory = b.ReadFID()
t.NewName = b.ReadString()
}
// encode implements encoder.encode.
func (t *trenameat) encode(b *buffer) {
b.WriteFID(t.OldDirectory)
b.WriteString(t.OldName)
b.WriteFID(t.NewDirectory)
b.WriteString(t.NewName)
}
// typ implements message.typ.
func (*trenameat) typ() msgType {
return msgTrenameat
}
// String implements fmt.Stringer.
func (t *trenameat) String() string {
return fmt.Sprintf("TrenameAt{OldDirectoryFID: %d, OldName: %s, NewDirectoryFID: %d, NewName: %s}", t.OldDirectory, t.OldName, t.NewDirectory, t.NewName)
}
// rrenameat is a rename response.
type rrenameat struct {
}
// decode implements encoder.decode.
func (*rrenameat) decode(b *buffer) {
}
// encode implements encoder.encode.
func (*rrenameat) encode(b *buffer) {
}
// typ implements message.typ.
func (*rrenameat) typ() msgType {
return msgRrenameat
}
// String implements fmt.Stringer.
func (r *rrenameat) String() string {
return fmt.Sprintf("Rrenameat{}")
}
// tunlinkat is an unlink request.
type tunlinkat struct {
// Directory is the originating directory.
Directory fid
// Name is the name of the entry to unlink.
Name string
// Flags are extra flags (e.g. O_DIRECTORY). These are not interpreted by p9.
Flags uint32
}
// decode implements encoder.decode.
func (t *tunlinkat) decode(b *buffer) {
t.Directory = b.ReadFID()
t.Name = b.ReadString()
t.Flags = b.Read32()
}
// encode implements encoder.encode.
func (t *tunlinkat) encode(b *buffer) {
b.WriteFID(t.Directory)
b.WriteString(t.Name)
b.Write32(t.Flags)
}
// typ implements message.typ.
func (*tunlinkat) typ() msgType {
return msgTunlinkat
}
// String implements fmt.Stringer.
func (t *tunlinkat) String() string {
return fmt.Sprintf("Tunlinkat{DirectoryFID: %d, Name: %s, Flags: 0x%X}", t.Directory, t.Name, t.Flags)
}
// runlinkat is an unlink response.
type runlinkat struct {
}
// decode implements encoder.decode.
func (*runlinkat) decode(b *buffer) {
}
// encode implements encoder.encode.
func (*runlinkat) encode(b *buffer) {
}
// typ implements message.typ.
func (*runlinkat) typ() msgType {
return msgRunlinkat
}
// String implements fmt.Stringer.
func (r *runlinkat) String() string {
return fmt.Sprintf("Runlinkat{}")
}
// trename is a rename request.
type trename struct {
// fid is the fid to rename.
fid fid
// Directory is the target directory.
Directory fid
// Name is the new file name.
Name string
}
// decode implements encoder.decode.
func (t *trename) decode(b *buffer) {
t.fid = b.ReadFID()
t.Directory = b.ReadFID()
t.Name = b.ReadString()
}
// encode implements encoder.encode.
func (t *trename) encode(b *buffer) {
b.WriteFID(t.fid)
b.WriteFID(t.Directory)
b.WriteString(t.Name)
}
// typ implements message.typ.
func (*trename) typ() msgType {
return msgTrename
}
// String implements fmt.Stringer.
func (t *trename) String() string {
return fmt.Sprintf("Trename{FID: %d, DirectoryFID: %d, Name: %s}", t.fid, t.Directory, t.Name)
}
// rrename is a rename response.
type rrename struct {
}
// decode implements encoder.decode.
func (*rrename) decode(b *buffer) {
}
// encode implements encoder.encode.
func (*rrename) encode(b *buffer) {
}
// typ implements message.typ.
func (*rrename) typ() msgType {
return msgRrename
}
// String implements fmt.Stringer.
func (r *rrename) String() string {
return fmt.Sprintf("Rrename{}")
}
// treadlink is a readlink request.
type treadlink struct {
// fid is the symlink.
fid fid
}
// decode implements encoder.decode.
func (t *treadlink) decode(b *buffer) {
t.fid = b.ReadFID()
}
// encode implements encoder.encode.
func (t *treadlink) encode(b *buffer) {
b.WriteFID(t.fid)
}
// typ implements message.typ.
func (*treadlink) typ() msgType {
return msgTreadlink
}
// String implements fmt.Stringer.
func (t *treadlink) String() string {
return fmt.Sprintf("Treadlink{FID: %d}", t.fid)
}
// rreadlink is a readlink response.
type rreadlink struct {
// Target is the symlink target.
Target string
}
// decode implements encoder.decode.
func (r *rreadlink) decode(b *buffer) {
r.Target = b.ReadString()
}
// encode implements encoder.encode.
func (r *rreadlink) encode(b *buffer) {
b.WriteString(r.Target)
}
// typ implements message.typ.
func (*rreadlink) typ() msgType {
return msgRreadlink
}
// String implements fmt.Stringer.
func (r *rreadlink) String() string {
return fmt.Sprintf("Rreadlink{Target: %s}", r.Target)
}
// tread is a read request.
type tread struct {
// fid is the fid to read.
fid fid
// Offset indicates the file offset.
Offset uint64
// Count indicates the number of bytes to read.
Count uint32
}
// decode implements encoder.decode.
func (t *tread) decode(b *buffer) {
t.fid = b.ReadFID()
t.Offset = b.Read64()
t.Count = b.Read32()
}
// encode implements encoder.encode.
func (t *tread) encode(b *buffer) {
b.WriteFID(t.fid)
b.Write64(t.Offset)
b.Write32(t.Count)
}
// typ implements message.typ.
func (*tread) typ() msgType {
return msgTread
}
// String implements fmt.Stringer.
func (t *tread) String() string {
return fmt.Sprintf("Tread{FID: %d, Offset: %d, Count: %d}", t.fid, t.Offset, t.Count)
}
// rreadServerPayloader is the response for a Tread by p9 servers.
//
// rreadServerPayloader exists so the fuzzer can fuzz rread -- however,
// PayloadCleanup causes it to panic, and putting connState in the fuzzer seems
// excessive.
type rreadServerPayloader struct {
rread
fullBuffer []byte
cs *connState
}
// rread is the response for a Tread.
type rread struct {
// Data is the resulting data.
Data []byte
}
// decode implements encoder.decode.
//
// Data is automatically decoded via Payload.
func (r *rread) decode(b *buffer) {
count := b.Read32()
if count != uint32(len(r.Data)) {
b.markOverrun()
}
}
// encode implements encoder.encode.
//
// Data is automatically encoded via Payload.
func (r *rread) encode(b *buffer) {
b.Write32(uint32(len(r.Data)))
}
// typ implements message.typ.
func (*rread) typ() msgType {
return msgRread
}
// FixedSize implements payloader.FixedSize.
func (*rread) FixedSize() uint32 {
return 4
}
// Payload implements payloader.Payload.
func (r *rread) Payload() []byte {
return r.Data
}
// SetPayload implements payloader.SetPayload.
func (r *rread) SetPayload(p []byte) {
r.Data = p
}
func (*rread) PayloadCleanup() {}
// FixedSize implements payloader.FixedSize.
func (*rreadServerPayloader) FixedSize() uint32 {
return 4
}
// Payload implements payloader.Payload.
func (r *rreadServerPayloader) Payload() []byte {
return r.Data
}
// SetPayload implements payloader.SetPayload.
func (r *rreadServerPayloader) SetPayload(p []byte) {
r.Data = p
}
// PayloadCleanup implements payloader.PayloadCleanup.
func (r *rreadServerPayloader) PayloadCleanup() {
// Fill it with zeros to not risk leaking previous files' data.
copy(r.Data, r.cs.pristineZeros)
r.cs.readBufPool.Put(&r.fullBuffer)
}
// String implements fmt.Stringer.
func (r *rread) String() string {
return fmt.Sprintf("Rread{len(Data): %d}", len(r.Data))
}
// twrite is a write request.
type twrite struct {
// fid is the fid to read.
fid fid
// Offset indicates the file offset.
Offset uint64
// Data is the data to be written.
Data []byte
}
// decode implements encoder.decode.
func (t *twrite) decode(b *buffer) {
t.fid = b.ReadFID()
t.Offset = b.Read64()
count := b.Read32()
if count != uint32(len(t.Data)) {
b.markOverrun()
}
}
// encode implements encoder.encode.
//
// This uses the buffer payload to avoid a copy.
func (t *twrite) encode(b *buffer) {
b.WriteFID(t.fid)
b.Write64(t.Offset)
b.Write32(uint32(len(t.Data)))
}
// typ implements message.typ.
func (*twrite) typ() msgType {
return msgTwrite
}
// FixedSize implements payloader.FixedSize.
func (*twrite) FixedSize() uint32 {
return 16
}
// Payload implements payloader.Payload.
func (t *twrite) Payload() []byte {
return t.Data
}
func (t *twrite) PayloadCleanup() {}
// SetPayload implements payloader.SetPayload.
func (t *twrite) SetPayload(p []byte) {
t.Data = p
}
// String implements fmt.Stringer.
func (t *twrite) String() string {
return fmt.Sprintf("Twrite{FID: %v, Offset %d, len(Data): %d}", t.fid, t.Offset, len(t.Data))
}
// rwrite is the response for a Twrite.
type rwrite struct {
// Count indicates the number of bytes successfully written.
Count uint32
}
// decode implements encoder.decode.
func (r *rwrite) decode(b *buffer) {
r.Count = b.Read32()
}
// encode implements encoder.encode.
func (r *rwrite) encode(b *buffer) {
b.Write32(r.Count)
}
// typ implements message.typ.
func (*rwrite) typ() msgType {
return msgRwrite
}
// String implements fmt.Stringer.
func (r *rwrite) String() string {
return fmt.Sprintf("Rwrite{Count: %d}", r.Count)
}
// tmknod is a mknod request.
type tmknod struct {
// Directory is the parent directory.
Directory fid
// Name is the device name.
Name string
// Mode is the device mode and permissions.
Mode FileMode
// Major is the device major number.
Major uint32
// Minor is the device minor number.
Minor uint32
// GID is the device GID.
GID GID
}
// decode implements encoder.decode.
func (t *tmknod) decode(b *buffer) {
t.Directory = b.ReadFID()
t.Name = b.ReadString()
t.Mode = b.ReadFileMode()
t.Major = b.Read32()
t.Minor = b.Read32()
t.GID = b.ReadGID()
}
// encode implements encoder.encode.
func (t *tmknod) encode(b *buffer) {
b.WriteFID(t.Directory)
b.WriteString(t.Name)
b.WriteFileMode(t.Mode)
b.Write32(t.Major)
b.Write32(t.Minor)
b.WriteGID(t.GID)
}
// typ implements message.typ.
func (*tmknod) typ() msgType {
return msgTmknod
}
// String implements fmt.Stringer.
func (t *tmknod) String() string {
return fmt.Sprintf("Tmknod{DirectoryFID: %d, Name: %s, Mode: 0o%o, Major: %d, Minor: %d, GID: %d}", t.Directory, t.Name, t.Mode, t.Major, t.Minor, t.GID)
}
// rmknod is a mknod response.
type rmknod struct {
// QID is the resulting QID.
QID QID
}
// decode implements encoder.decode.
func (r *rmknod) decode(b *buffer) {
r.QID.decode(b)
}
// encode implements encoder.encode.
func (r *rmknod) encode(b *buffer) {
r.QID.encode(b)
}
// typ implements message.typ.
func (*rmknod) typ() msgType {
return msgRmknod
}
// String implements fmt.Stringer.
func (r *rmknod) String() string {
return fmt.Sprintf("Rmknod{QID: %s}", r.QID)
}
// tmkdir is a mkdir request.
type tmkdir struct {
// Directory is the parent directory.
Directory fid
// Name is the new directory name.
Name string
// Permissions is the set of permission bits.
Permissions FileMode
// GID is the owning group.
GID GID
}
// decode implements encoder.decode.
func (t *tmkdir) decode(b *buffer) {
t.Directory = b.ReadFID()
t.Name = b.ReadString()
t.Permissions = b.ReadPermissions()
t.GID = b.ReadGID()
}
// encode implements encoder.encode.
func (t *tmkdir) encode(b *buffer) {
b.WriteFID(t.Directory)
b.WriteString(t.Name)
b.WritePermissions(t.Permissions)
b.WriteGID(t.GID)
}
// typ implements message.typ.
func (*tmkdir) typ() msgType {
return msgTmkdir
}
// String implements fmt.Stringer.
func (t *tmkdir) String() string {
return fmt.Sprintf("Tmkdir{DirectoryFID: %d, Name: %s, Permissions: 0o%o, GID: %d}", t.Directory, t.Name, t.Permissions, t.GID)
}
// rmkdir is a mkdir response.
type rmkdir struct {
// QID is the resulting QID.
QID QID
}
// decode implements encoder.decode.
func (r *rmkdir) decode(b *buffer) {
r.QID.decode(b)
}
// encode implements encoder.encode.
func (r *rmkdir) encode(b *buffer) {
r.QID.encode(b)
}
// typ implements message.typ.
func (*rmkdir) typ() msgType {
return msgRmkdir
}
// String implements fmt.Stringer.
func (r *rmkdir) String() string {
return fmt.Sprintf("Rmkdir{QID: %s}", r.QID)
}
// tgetattr is a getattr request.
type tgetattr struct {
// fid is the fid to get attributes for.
fid fid
// AttrMask is the set of attributes to get.
AttrMask AttrMask
}
// decode implements encoder.decode.
func (t *tgetattr) decode(b *buffer) {
t.fid = b.ReadFID()
t.AttrMask.decode(b)
}
// encode implements encoder.encode.
func (t *tgetattr) encode(b *buffer) {
b.WriteFID(t.fid)
t.AttrMask.encode(b)
}
// typ implements message.typ.
func (*tgetattr) typ() msgType {
return msgTgetattr
}
// String implements fmt.Stringer.
func (t *tgetattr) String() string {
return fmt.Sprintf("Tgetattr{FID: %d, AttrMask: %s}", t.fid, t.AttrMask)
}
// rgetattr is a getattr response.
type rgetattr struct {
// Valid indicates which fields are valid.
Valid AttrMask
// QID is the QID for this file.
QID
// Attr is the set of attributes.
Attr Attr
}
// decode implements encoder.decode.
func (r *rgetattr) decode(b *buffer) {
r.Valid.decode(b)
r.QID.decode(b)
r.Attr.decode(b)
}
// encode implements encoder.encode.
func (r *rgetattr) encode(b *buffer) {
r.Valid.encode(b)
r.QID.encode(b)
r.Attr.encode(b)
}
// typ implements message.typ.
func (*rgetattr) typ() msgType {
return msgRgetattr
}
// String implements fmt.Stringer.
func (r *rgetattr) String() string {
return fmt.Sprintf("Rgetattr{Valid: %v, QID: %s, Attr: %s}", r.Valid, r.QID, r.Attr)
}
// tsetattr is a setattr request.
type tsetattr struct {
// fid is the fid to change.
fid fid
// Valid is the set of bits which will be used.
Valid SetAttrMask
// SetAttr is the set request.
SetAttr SetAttr
}
// decode implements encoder.decode.
func (t *tsetattr) decode(b *buffer) {
t.fid = b.ReadFID()
t.Valid.decode(b)
t.SetAttr.decode(b)
}
// encode implements encoder.encode.
func (t *tsetattr) encode(b *buffer) {
b.WriteFID(t.fid)
t.Valid.encode(b)
t.SetAttr.encode(b)
}
// typ implements message.typ.
func (*tsetattr) typ() msgType {
return msgTsetattr
}
// String implements fmt.Stringer.
func (t *tsetattr) String() string {
return fmt.Sprintf("Tsetattr{FID: %d, Valid: %v, SetAttr: %s}", t.fid, t.Valid, t.SetAttr)
}
// rsetattr is a setattr response.
type rsetattr struct {
}
// decode implements encoder.decode.
func (*rsetattr) decode(b *buffer) {
}
// encode implements encoder.encode.
func (*rsetattr) encode(b *buffer) {
}
// typ implements message.typ.
func (*rsetattr) typ() msgType {
return msgRsetattr
}
// String implements fmt.Stringer.
func (r *rsetattr) String() string {
return fmt.Sprintf("Rsetattr{}")
}
// txattrwalk walks extended attributes.
type txattrwalk struct {
// fid is the fid to check for attributes.
fid fid
// newFID is the new fid associated with the attributes.
newFID fid
// Name is the attribute name.
Name string
}
// decode implements encoder.decode.
func (t *txattrwalk) decode(b *buffer) {
t.fid = b.ReadFID()
t.newFID = b.ReadFID()
t.Name = b.ReadString()
}
// encode implements encoder.encode.
func (t *txattrwalk) encode(b *buffer) {
b.WriteFID(t.fid)
b.WriteFID(t.newFID)
b.WriteString(t.Name)
}
// typ implements message.typ.
func (*txattrwalk) typ() msgType {
return msgTxattrwalk
}
// String implements fmt.Stringer.
func (t *txattrwalk) String() string {
return fmt.Sprintf("Txattrwalk{FID: %d, newFID: %d, Name: %s}", t.fid, t.newFID, t.Name)
}
// rxattrwalk is a xattrwalk response.
type rxattrwalk struct {
// Size is the size of the extended attribute.
Size uint64
}
// decode implements encoder.decode.
func (r *rxattrwalk) decode(b *buffer) {
r.Size = b.Read64()
}
// encode implements encoder.encode.
func (r *rxattrwalk) encode(b *buffer) {
b.Write64(r.Size)
}
// typ implements message.typ.
func (*rxattrwalk) typ() msgType {
return msgRxattrwalk
}
// String implements fmt.Stringer.
func (r *rxattrwalk) String() string {
return fmt.Sprintf("Rxattrwalk{Size: %d}", r.Size)
}
// txattrcreate prepare to set extended attributes.
type txattrcreate struct {
// fid is input/output parameter, it identifies the file on which
// extended attributes will be set but after successful Rxattrcreate
// it is used to write the extended attribute value.
fid fid
// Name is the attribute name.
Name string
// Size of the attribute value. When the fid is clunked it has to match
// the number of bytes written to the fid.
AttrSize uint64
// Linux setxattr(2) flags.
Flags uint32
}
// decode implements encoder.decode.
func (t *txattrcreate) decode(b *buffer) {
t.fid = b.ReadFID()
t.Name = b.ReadString()
t.AttrSize = b.Read64()
t.Flags = b.Read32()
}
// encode implements encoder.encode.
func (t *txattrcreate) encode(b *buffer) {
b.WriteFID(t.fid)
b.WriteString(t.Name)
b.Write64(t.AttrSize)
b.Write32(t.Flags)
}
// typ implements message.typ.
func (*txattrcreate) typ() msgType {
return msgTxattrcreate
}
// String implements fmt.Stringer.
func (t *txattrcreate) String() string {
return fmt.Sprintf("Txattrcreate{FID: %d, Name: %s, AttrSize: %d, Flags: %d}", t.fid, t.Name, t.AttrSize, t.Flags)
}
// rxattrcreate is a xattrcreate response.
type rxattrcreate struct {
}
// decode implements encoder.decode.
func (r *rxattrcreate) decode(b *buffer) {
}
// encode implements encoder.encode.
func (r *rxattrcreate) encode(b *buffer) {
}
// typ implements message.typ.
func (*rxattrcreate) typ() msgType {
return msgRxattrcreate
}
// String implements fmt.Stringer.
func (r *rxattrcreate) String() string {
return fmt.Sprintf("Rxattrcreate{}")
}
// treaddir is a readdir request.
type treaddir struct {
// Directory is the directory fid to read.
Directory fid
// Offset is the offset to read at.
Offset uint64
// Count is the number of bytes to read.
Count uint32
}
// decode implements encoder.decode.
func (t *treaddir) decode(b *buffer) {
t.Directory = b.ReadFID()
t.Offset = b.Read64()
t.Count = b.Read32()
}
// encode implements encoder.encode.
func (t *treaddir) encode(b *buffer) {
b.WriteFID(t.Directory)
b.Write64(t.Offset)
b.Write32(t.Count)
}
// typ implements message.typ.
func (*treaddir) typ() msgType {
return msgTreaddir
}
// String implements fmt.Stringer.
func (t *treaddir) String() string {
return fmt.Sprintf("Treaddir{DirectoryFID: %d, Offset: %d, Count: %d}", t.Directory, t.Offset, t.Count)
}
// rreaddir is a readdir response.
type rreaddir struct {
// Count is the byte limit.
//
// This should always be set from the Treaddir request.
Count uint32
// Entries are the resulting entries.
//
// This may be constructed in decode.
Entries []Dirent
// payload is the encoded payload.
//
// This is constructed by encode.
payload []byte
}
// decode implements encoder.decode.
func (r *rreaddir) decode(b *buffer) {
r.Count = b.Read32()
entriesBuf := buffer{data: r.payload}
r.Entries = r.Entries[:0]
for {
var d Dirent
d.decode(&entriesBuf)
if entriesBuf.isOverrun() {
// Couldn't decode a complete entry.
break
}
r.Entries = append(r.Entries, d)
}
}
// encode implements encoder.encode.
func (r *rreaddir) encode(b *buffer) {
entriesBuf := buffer{}
payloadSize := 0
for _, d := range r.Entries {
d.encode(&entriesBuf)
if len(entriesBuf.data) > int(r.Count) {
break
}
payloadSize = len(entriesBuf.data)
}
r.Count = uint32(payloadSize)
r.payload = entriesBuf.data[:payloadSize]
b.Write32(r.Count)
}
// typ implements message.typ.
func (*rreaddir) typ() msgType {
return msgRreaddir
}
// FixedSize implements payloader.FixedSize.
func (*rreaddir) FixedSize() uint32 {
return 4
}
// Payload implements payloader.Payload.
func (r *rreaddir) Payload() []byte {
return r.payload
}
func (r *rreaddir) PayloadCleanup() {}
// SetPayload implements payloader.SetPayload.
func (r *rreaddir) SetPayload(p []byte) {
r.payload = p
}
// String implements fmt.Stringer.
func (r *rreaddir) String() string {
return fmt.Sprintf("Rreaddir{Count: %d, Entries: %s}", r.Count, r.Entries)
}
// Tfsync is an fsync request.
type tfsync struct {
// fid is the fid to sync.
fid fid
}
// decode implements encoder.decode.
func (t *tfsync) decode(b *buffer) {
t.fid = b.ReadFID()
}
// encode implements encoder.encode.
func (t *tfsync) encode(b *buffer) {
b.WriteFID(t.fid)
}
// typ implements message.typ.
func (*tfsync) typ() msgType {
return msgTfsync
}
// String implements fmt.Stringer.
func (t *tfsync) String() string {
return fmt.Sprintf("Tfsync{FID: %d}", t.fid)
}
// rfsync is an fsync response.
type rfsync struct {
}
// decode implements encoder.decode.
func (*rfsync) decode(b *buffer) {
}
// encode implements encoder.encode.
func (*rfsync) encode(b *buffer) {
}
// typ implements message.typ.
func (*rfsync) typ() msgType {
return msgRfsync
}
// String implements fmt.Stringer.
func (r *rfsync) String() string {
return fmt.Sprintf("Rfsync{}")
}
// tstatfs is a stat request.
type tstatfs struct {
// fid is the root.
fid fid
}
// decode implements encoder.decode.
func (t *tstatfs) decode(b *buffer) {
t.fid = b.ReadFID()
}
// encode implements encoder.encode.
func (t *tstatfs) encode(b *buffer) {
b.WriteFID(t.fid)
}
// typ implements message.typ.
func (*tstatfs) typ() msgType {
return msgTstatfs
}
// String implements fmt.Stringer.
func (t *tstatfs) String() string {
return fmt.Sprintf("Tstatfs{FID: %d}", t.fid)
}
// rstatfs is the response for a Tstatfs.
type rstatfs struct {
// FSStat is the stat result.
FSStat FSStat
}
// decode implements encoder.decode.
func (r *rstatfs) decode(b *buffer) {
r.FSStat.decode(b)
}
// encode implements encoder.encode.
func (r *rstatfs) encode(b *buffer) {
r.FSStat.encode(b)
}
// typ implements message.typ.
func (*rstatfs) typ() msgType {
return msgRstatfs
}
// String implements fmt.Stringer.
func (r *rstatfs) String() string {
return fmt.Sprintf("Rstatfs{FSStat: %v}", r.FSStat)
}
// twalkgetattr is a walk request.
type twalkgetattr struct {
// fid is the fid to be walked.
fid fid
// newFID is the resulting fid.
newFID fid
// Names are the set of names to be walked.
Names []string
}
// decode implements encoder.decode.
func (t *twalkgetattr) decode(b *buffer) {
t.fid = b.ReadFID()
t.newFID = b.ReadFID()
n := b.Read16()
t.Names = t.Names[:0]
for i := 0; i < int(n); i++ {
t.Names = append(t.Names, b.ReadString())
}
}
// encode implements encoder.encode.
func (t *twalkgetattr) encode(b *buffer) {
b.WriteFID(t.fid)
b.WriteFID(t.newFID)
b.Write16(uint16(len(t.Names)))
for _, name := range t.Names {
b.WriteString(name)
}
}
// typ implements message.typ.
func (*twalkgetattr) typ() msgType {
return msgTwalkgetattr
}
// String implements fmt.Stringer.
func (t *twalkgetattr) String() string {
return fmt.Sprintf("Twalkgetattr{FID: %d, newFID: %d, Names: %v}", t.fid, t.newFID, t.Names)
}
// rwalkgetattr is a walk response.
type rwalkgetattr struct {
// Valid indicates which fields are valid in the Attr below.
Valid AttrMask
// Attr is the set of attributes for the last QID (the file walked to).
Attr Attr
// QIDs are the set of QIDs returned.
QIDs []QID
}
// decode implements encoder.decode.
func (r *rwalkgetattr) decode(b *buffer) {
r.Valid.decode(b)
r.Attr.decode(b)
n := b.Read16()
r.QIDs = r.QIDs[:0]
for i := 0; i < int(n); i++ {
var q QID
q.decode(b)
r.QIDs = append(r.QIDs, q)
}
}
// encode implements encoder.encode.
func (r *rwalkgetattr) encode(b *buffer) {
r.Valid.encode(b)
r.Attr.encode(b)
b.Write16(uint16(len(r.QIDs)))
for _, q := range r.QIDs {
q.encode(b)
}
}
// typ implements message.typ.
func (*rwalkgetattr) typ() msgType {
return msgRwalkgetattr
}
// String implements fmt.Stringer.
func (r *rwalkgetattr) String() string {
return fmt.Sprintf("Rwalkgetattr{Valid: %s, Attr: %s, QIDs: %v}", r.Valid, r.Attr, r.QIDs)
}
// tucreate is a tlcreate message that includes a UID.
type tucreate struct {
tlcreate
// UID is the UID to use as the effective UID in creation messages.
UID UID
}
// decode implements encoder.decode.
func (t *tucreate) decode(b *buffer) {
t.tlcreate.decode(b)
t.UID = b.ReadUID()
}
// encode implements encoder.encode.
func (t *tucreate) encode(b *buffer) {
t.tlcreate.encode(b)
b.WriteUID(t.UID)
}
// typ implements message.typ.
func (t *tucreate) typ() msgType {
return msgTucreate
}
// String implements fmt.Stringer.
func (t *tucreate) String() string {
return fmt.Sprintf("Tucreate{Tlcreate: %v, UID: %d}", &t.tlcreate, t.UID)
}
// rucreate is a file creation response.
type rucreate struct {
rlcreate
}
// typ implements message.typ.
func (*rucreate) typ() msgType {
return msgRucreate
}
// String implements fmt.Stringer.
func (r *rucreate) String() string {
return fmt.Sprintf("Rucreate{%v}", &r.rlcreate)
}
// tumkdir is a Tmkdir message that includes a UID.
type tumkdir struct {
tmkdir
// UID is the UID to use as the effective UID in creation messages.
UID UID
}
// decode implements encoder.decode.
func (t *tumkdir) decode(b *buffer) {
t.tmkdir.decode(b)
t.UID = b.ReadUID()
}
// encode implements encoder.encode.
func (t *tumkdir) encode(b *buffer) {
t.tmkdir.encode(b)
b.WriteUID(t.UID)
}
// typ implements message.typ.
func (t *tumkdir) typ() msgType {
return msgTumkdir
}
// String implements fmt.Stringer.
func (t *tumkdir) String() string {
return fmt.Sprintf("Tumkdir{Tmkdir: %v, UID: %d}", &t.tmkdir, t.UID)
}
// rumkdir is a umkdir response.
type rumkdir struct {
rmkdir
}
// typ implements message.typ.
func (*rumkdir) typ() msgType {
return msgRumkdir
}
// String implements fmt.Stringer.
func (r *rumkdir) String() string {
return fmt.Sprintf("Rumkdir{%v}", &r.rmkdir)
}
// tumknod is a Tmknod message that includes a UID.
type tumknod struct {
tmknod
// UID is the UID to use as the effective UID in creation messages.
UID UID
}
// decode implements encoder.decode.
func (t *tumknod) decode(b *buffer) {
t.tmknod.decode(b)
t.UID = b.ReadUID()
}
// encode implements encoder.encode.
func (t *tumknod) encode(b *buffer) {
t.tmknod.encode(b)
b.WriteUID(t.UID)
}
// typ implements message.typ.
func (t *tumknod) typ() msgType {
return msgTumknod
}
// String implements fmt.Stringer.
func (t *tumknod) String() string {
return fmt.Sprintf("Tumknod{Tmknod: %v, UID: %d}", &t.tmknod, t.UID)
}
// rumknod is a umknod response.
type rumknod struct {
rmknod
}
// typ implements message.typ.
func (*rumknod) typ() msgType {
return msgRumknod
}
// String implements fmt.Stringer.
func (r *rumknod) String() string {
return fmt.Sprintf("Rumknod{%v}", &r.rmknod)
}
// tusymlink is a Tsymlink message that includes a UID.
type tusymlink struct {
tsymlink
// UID is the UID to use as the effective UID in creation messages.
UID UID
}
// decode implements encoder.decode.
func (t *tusymlink) decode(b *buffer) {
t.tsymlink.decode(b)
t.UID = b.ReadUID()
}
// encode implements encoder.encode.
func (t *tusymlink) encode(b *buffer) {
t.tsymlink.encode(b)
b.WriteUID(t.UID)
}
// typ implements message.typ.
func (t *tusymlink) typ() msgType {
return msgTusymlink
}
// String implements fmt.Stringer.
func (t *tusymlink) String() string {
return fmt.Sprintf("Tusymlink{Tsymlink: %v, UID: %d}", &t.tsymlink, t.UID)
}
// rusymlink is a usymlink response.
type rusymlink struct {
rsymlink
}
// typ implements message.typ.
func (*rusymlink) typ() msgType {
return msgRusymlink
}
// String implements fmt.Stringer.
func (r *rusymlink) String() string {
return fmt.Sprintf("Rusymlink{%v}", &r.rsymlink)
}
// LockType is lock type for Tlock
type LockType uint8
// These constants define Lock operations: Read, Write, and Un(lock)
// They map to Linux values of F_RDLCK, F_WRLCK, F_UNLCK.
// If that seems a little Linux-centric, recall that the "L"
// in 9P2000.L means "Linux" :-)
const (
ReadLock LockType = iota
WriteLock
Unlock
)
func (l LockType) String() string {
switch l {
case ReadLock:
return "ReadLock"
case WriteLock:
return "WriteLock"
case Unlock:
return "Unlock"
}
return "unknown lock type"
}
// LockFlags are flags for the lock. Currently, and possibly forever, only one
// is really used: LockFlagsBlock
type LockFlags uint32
const (
// LockFlagsBlock indicates a blocking request.
LockFlagsBlock LockFlags = 1
// LockFlagsReclaim is "Reserved for future use."
// It's been some time since 9P2000.L came about,
// I suspect "future" in this case is "never"?
LockFlagsReclaim LockFlags = 2
)
// LockStatus contains lock status result.
type LockStatus uint8
// These are the four current return values for Rlock.
const (
LockStatusOK LockStatus = iota
LockStatusBlocked
LockStatusError
LockStatusGrace
)
func (s LockStatus) String() string {
switch s {
case LockStatusOK:
return "LockStatusOK"
case LockStatusBlocked:
return "LockStatusBlocked"
case LockStatusError:
return "LockStatusError"
case LockStatusGrace:
return "LockStatusGrace"
}
return "unknown lock status"
}
// tlock is a Tlock message
type tlock struct {
// fid is the fid to lock.
fid fid
Type LockType // Type of lock: F_RDLCK, F_WRLCK, F_UNLCK */
Flags LockFlags // flags, not whence, docs are wrong.
Start uint64 // Starting offset for lock
Length uint64 // Number of bytes to lock
PID int32 // PID of process blocking our lock (F_GETLK only)
// "client_id is an additional mechanism for uniquely
// identifying the lock requester and is set to the nodename
// by the Linux v9fs client."
// https://github.com/chaos/diod/blob/master/protocol.md#lock---acquire-or-release-a-posix-record-lock
Client string // Client id -- but technically can be anything.
}
// decode implements encoder.decode.
func (t *tlock) decode(b *buffer) {
t.fid = b.ReadFID()
t.Type = LockType(b.Read8())
t.Flags = LockFlags(b.Read32())
t.Start = b.Read64()
t.Length = b.Read64()
t.PID = int32(b.Read32())
t.Client = b.ReadString()
}
// encode implements encoder.encode.
func (t *tlock) encode(b *buffer) {
b.WriteFID(t.fid)
b.Write8(uint8(t.Type))
b.Write32(uint32(t.Flags))
b.Write64(t.Start)
b.Write64(t.Length)
b.Write32(uint32(t.PID))
b.WriteString(t.Client)
}
// typ implements message.typ.
func (*tlock) typ() msgType {
return msgTlock
}
// String implements fmt.Stringer.
func (t *tlock) String() string {
return fmt.Sprintf("Tlock{Type: %s, Flags: %#x, Start: %d, Length: %d, PID: %d, Client: %s}", t.Type.String(), t.Flags, t.Start, t.Length, t.PID, t.Client)
}
// rlock is a lock response.
type rlock struct {
Status LockStatus
}
// decode implements encoder.decode.
func (r *rlock) decode(b *buffer) {
r.Status = LockStatus(b.Read8())
}
// encode implements encoder.encode.
func (r *rlock) encode(b *buffer) {
b.Write8(uint8(r.Status))
}
// typ implements message.typ.
func (*rlock) typ() msgType {
return msgRlock
}
// String implements fmt.Stringer.
func (r *rlock) String() string {
return fmt.Sprintf("Rlock{Status: %s}", r.Status)
}
// Let's wait until we need this? POSIX locks over a network make 0 sense.
// getlock - test for the existence of a POSIX record lock
// size[4] Tgetlock tag[2] fid[4] type[1] start[8] length[8] proc_id[4] client_id[s]
// size[4] Rgetlock tag[2] type[1] start[8] length[8] proc_id[4] client_id[s]
// getlock tests for the existence of a POSIX record lock and has semantics similar to Linux fcntl(F_GETLK).
// As with lock, type has one of the values defined above, and start,
// length, and proc_id correspond to the analogous fields in struct
// flock passed to Linux fcntl(F_GETLK), and client_Id is an
// additional mechanism for uniquely identifying the lock requester
// and is set to the nodename by the Linux v9fs client. tusymlink is
// a Tsymlink message that includes a UID.
/// END LOCK
const maxCacheSize = 3
// msgFactory is used to reduce allocations by caching messages for reuse.
type msgFactory struct {
create func() message
cache chan message
}
// msgDotLRegistry indexes all 9P2000.L(.Google.N) message factories by type.
var msgDotLRegistry registry
type registry struct {
factories [math.MaxUint8 + 1]msgFactory
// largestFixedSize is computed so that given some message size M, you can
// compute the maximum payload size (e.g. for Twrite, Rread) with
// M-largestFixedSize. You could do this individual on a per-message basis,
// but it's easier to compute a single maximum safe payload.
largestFixedSize uint32
}
// get returns a new message by type.
//
// An error is returned in the case of an unknown message.
//
// This takes, and ignores, a message tag so that it may be used directly as a
// lookuptagAndType function for recv (by design).
func (r *registry) get(_ tag, t msgType) (message, error) {
entry := &r.factories[t]
if entry.create == nil {
return nil, &ErrInvalidMsgType{t}
}
select {
case msg := <-entry.cache:
return msg, nil
default:
return entry.create(), nil
}
}
func (r *registry) put(msg message) {
if p, ok := msg.(payloader); ok {
p.SetPayload(nil)
}
entry := &r.factories[msg.typ()]
select {
case entry.cache <- msg:
default:
}
}
// register registers the given message type.
//
// This may cause panic on failure and should only be used from init.
func (r *registry) register(t msgType, fn func() message) {
if int(t) >= len(r.factories) {
panic(fmt.Sprintf("message type %d is too large. It must be smaller than %d", t, len(r.factories)))
}
if r.factories[t].create != nil {
panic(fmt.Sprintf("duplicate message type %d: first is %T, second is %T", t, r.factories[t].create(), fn()))
}
r.factories[t] = msgFactory{
create: fn,
cache: make(chan message, maxCacheSize),
}
if size := calculateSize(fn()); size > r.largestFixedSize {
r.largestFixedSize = size
}
}
func calculateSize(m message) uint32 {
if p, ok := m.(payloader); ok {
return p.FixedSize()
}
var dataBuf buffer
m.encode(&dataBuf)
return uint32(len(dataBuf.data))
}
func init() {
msgDotLRegistry.register(msgRlerror, func() message { return &rlerror{} })
msgDotLRegistry.register(msgTstatfs, func() message { return &tstatfs{} })
msgDotLRegistry.register(msgRstatfs, func() message { return &rstatfs{} })
msgDotLRegistry.register(msgTlopen, func() message { return &tlopen{} })
msgDotLRegistry.register(msgRlopen, func() message { return &rlopen{} })
msgDotLRegistry.register(msgTlcreate, func() message { return &tlcreate{} })
msgDotLRegistry.register(msgRlcreate, func() message { return &rlcreate{} })
msgDotLRegistry.register(msgTsymlink, func() message { return &tsymlink{} })
msgDotLRegistry.register(msgRsymlink, func() message { return &rsymlink{} })
msgDotLRegistry.register(msgTmknod, func() message { return &tmknod{} })
msgDotLRegistry.register(msgRmknod, func() message { return &rmknod{} })
msgDotLRegistry.register(msgTrename, func() message { return &trename{} })
msgDotLRegistry.register(msgRrename, func() message { return &rrename{} })
msgDotLRegistry.register(msgTreadlink, func() message { return &treadlink{} })
msgDotLRegistry.register(msgRreadlink, func() message { return &rreadlink{} })
msgDotLRegistry.register(msgTgetattr, func() message { return &tgetattr{} })
msgDotLRegistry.register(msgRgetattr, func() message { return &rgetattr{} })
msgDotLRegistry.register(msgTsetattr, func() message { return &tsetattr{} })
msgDotLRegistry.register(msgRsetattr, func() message { return &rsetattr{} })
msgDotLRegistry.register(msgTxattrwalk, func() message { return &txattrwalk{} })
msgDotLRegistry.register(msgRxattrwalk, func() message { return &rxattrwalk{} })
msgDotLRegistry.register(msgTxattrcreate, func() message { return &txattrcreate{} })
msgDotLRegistry.register(msgRxattrcreate, func() message { return &rxattrcreate{} })
msgDotLRegistry.register(msgTreaddir, func() message { return &treaddir{} })
msgDotLRegistry.register(msgRreaddir, func() message { return &rreaddir{} })
msgDotLRegistry.register(msgTfsync, func() message { return &tfsync{} })
msgDotLRegistry.register(msgRfsync, func() message { return &rfsync{} })
msgDotLRegistry.register(msgTlink, func() message { return &tlink{} })
msgDotLRegistry.register(msgRlink, func() message { return &rlink{} })
msgDotLRegistry.register(msgTlock, func() message { return &tlock{} })
msgDotLRegistry.register(msgRlock, func() message { return &rlock{} })
msgDotLRegistry.register(msgTmkdir, func() message { return &tmkdir{} })
msgDotLRegistry.register(msgRmkdir, func() message { return &rmkdir{} })
msgDotLRegistry.register(msgTrenameat, func() message { return &trenameat{} })
msgDotLRegistry.register(msgRrenameat, func() message { return &rrenameat{} })
msgDotLRegistry.register(msgTunlinkat, func() message { return &tunlinkat{} })
msgDotLRegistry.register(msgRunlinkat, func() message { return &runlinkat{} })
msgDotLRegistry.register(msgTversion, func() message { return &tversion{} })
msgDotLRegistry.register(msgRversion, func() message { return &rversion{} })
msgDotLRegistry.register(msgTauth, func() message { return &tauth{} })
msgDotLRegistry.register(msgRauth, func() message { return &rauth{} })
msgDotLRegistry.register(msgTattach, func() message { return &tattach{} })
msgDotLRegistry.register(msgRattach, func() message { return &rattach{} })
msgDotLRegistry.register(msgTflush, func() message { return &tflush{} })
msgDotLRegistry.register(msgRflush, func() message { return &rflush{} })
msgDotLRegistry.register(msgTwalk, func() message { return &twalk{} })
msgDotLRegistry.register(msgRwalk, func() message { return &rwalk{} })
msgDotLRegistry.register(msgTread, func() message { return &tread{} })
msgDotLRegistry.register(msgRread, func() message { return &rread{} })
msgDotLRegistry.register(msgTwrite, func() message { return &twrite{} })
msgDotLRegistry.register(msgRwrite, func() message { return &rwrite{} })
msgDotLRegistry.register(msgTclunk, func() message { return &tclunk{} })
msgDotLRegistry.register(msgRclunk, func() message { return &rclunk{} })
msgDotLRegistry.register(msgTremove, func() message { return &tremove{} })
msgDotLRegistry.register(msgRremove, func() message { return &rremove{} })
msgDotLRegistry.register(msgTwalkgetattr, func() message { return &twalkgetattr{} })
msgDotLRegistry.register(msgRwalkgetattr, func() message { return &rwalkgetattr{} })
msgDotLRegistry.register(msgTucreate, func() message { return &tucreate{} })
msgDotLRegistry.register(msgRucreate, func() message { return &rucreate{} })
msgDotLRegistry.register(msgTumkdir, func() message { return &tumkdir{} })
msgDotLRegistry.register(msgRumkdir, func() message { return &rumkdir{} })
msgDotLRegistry.register(msgTumknod, func() message { return &tumknod{} })
msgDotLRegistry.register(msgRumknod, func() message { return &rumknod{} })
msgDotLRegistry.register(msgTusymlink, func() message { return &tusymlink{} })
msgDotLRegistry.register(msgRusymlink, func() message { return &rusymlink{} })
}
|