Merge pull request #82 from plieven/readahead
[deb_libnfs.git] / mount / mount.x
1 /*
2 Copyright (c) 2014, Ronnie Sahlberg
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7
8 1. Redistributions of source code must retain the above copyright notice, this
9 list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright notice,
11 this list of conditions and the following disclaimer in the documentation
12 and/or other materials provided with the distribution.
13
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
25 The views and conclusions contained in the software and documentation are those
26 of the authors and should not be interpreted as representing official policies,
27 either expressed or implied, of the FreeBSD Project.
28 */
29
30 const MNTPATHLEN = 1024; /* Maximum bytes in a path name */
31 const MNTNAMLEN = 255; /* Maximum bytes in a name */
32 const FHSIZE3 = 64; /* Maximum bytes in a V3 file handle */
33
34
35 typedef opaque fhandle3<FHSIZE3>;
36 typedef string dirpath<MNTPATHLEN>;
37 typedef string name<MNTNAMLEN>;
38
39 enum mountstat3 {
40 MNT3_OK = 0, /* no error */
41 MNT3ERR_PERM = 1, /* Not owner */
42 MNT3ERR_NOENT = 2, /* No such file or directory */
43 MNT3ERR_IO = 5, /* I/O error */
44 MNT3ERR_ACCES = 13, /* Permission denied */
45 MNT3ERR_NOTDIR = 20, /* Not a directory */
46 MNT3ERR_INVAL = 22, /* Invalid argument */
47 MNT3ERR_NAMETOOLONG = 63, /* Filename too long */
48 MNT3ERR_NOTSUPP = 10004, /* Operation not supported */
49 MNT3ERR_SERVERFAULT = 10006 /* A failure on the server */
50 };
51
52
53 typedef struct mountbody *mountlist;
54
55 struct mountbody {
56 name ml_hostname;
57 dirpath ml_directory;
58 mountlist ml_next;
59 };
60
61 typedef struct groupnode *groups;
62
63 struct groupnode {
64 name gr_name;
65 groups gr_next;
66 };
67
68
69 typedef struct exportnode *exports;
70
71 struct exportnode {
72 dirpath ex_dir;
73 groups ex_groups;
74 exports ex_next;
75 };
76
77 struct mountres3_ok {
78 fhandle3 fhandle;
79 int auth_flavors<>;
80 };
81
82 union mountres3 switch (mountstat3 fhs_status) {
83 case MNT3_OK:
84 mountres3_ok mountinfo;
85 default:
86 void;
87 };
88
89
90 enum mountstat1 {
91 MNT1_OK = 0, /* no error */
92 MNT1ERR_PERM = 1, /* Not owner */
93 MNT1ERR_NOENT = 2, /* No such file or directory */
94 MNT1ERR_IO = 5, /* I/O error */
95 MNT1ERR_ACCES = 13, /* Permission denied */
96 MNT1ERR_NOTDIR = 20, /* Not a directory */
97 MNT1ERR_INVAL = 22, /* Invalid argument */
98 MNT1ERR_NAMETOOLONG = 63, /* Filename too long */
99 MNT1ERR_NOTSUPP = 10004, /* Operation not supported */
100 MNT1ERR_SERVERFAULT = 10006 /* A failure on the server */
101 };
102
103 const FHSIZE = 32;
104 typedef opaque fhandle1[FHSIZE];
105
106 struct mountres1_ok {
107 fhandle1 fhandle;
108 };
109
110 union mountres1 switch (mountstat1 fhs_status) {
111 case MNT1_OK:
112 mountres1_ok mountinfo;
113 default:
114 void;
115 };
116
117 program MOUNT_PROGRAM {
118 version MOUNT_V1 {
119 void MOUNT1_NULL(void) = 0;
120 mountres1 MOUNT1_MNT(dirpath) = 1;
121 mountlist MOUNT1_DUMP(void) = 2;
122 void MOUNT1_UMNT(dirpath) = 3;
123 void MOUNT1_UMNTALL(void) = 4;
124 exports MOUNT1_EXPORT(void) = 5;
125 } = 1;
126 version MOUNT_V3 {
127 void MOUNT3_NULL(void) = 0;
128 mountres3 MOUNT3_MNT(dirpath) = 1;
129 mountlist MOUNT3_DUMP(void) = 2;
130 void MOUNT3_UMNT(dirpath) = 3;
131 void MOUNT3_UMNTALL(void) = 4;
132 exports MOUNT3_EXPORT(void) = 5;
133 } = 3;
134 } = 100005;