1 /* 2 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 3 * unrestricted use provided that this legend is included on all tape 4 * media and as a part of the software program in whole or part. Users 5 * may copy or modify Sun RPC without charge, but are not authorized 6 * to license or distribute it to anyone else except as part of a product or 7 * program developed by the user. 8 * 9 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 10 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 11 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 12 * 13 * Sun RPC is provided with no support and without any obligation on the 14 * part of Sun Microsystems, Inc. to assist in its use, correction, 15 * modification or enhancement. 16 * 17 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 18 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 19 * OR ANY PART THEREOF. 20 * 21 * In no event will Sun Microsystems, Inc. be liable for any lost revenue 22 * or profits or other special, indirect and consequential damages, even if 23 * Sun has been advised of the possibility of such damages. 24 * 25 * Sun Microsystems, Inc. 26 * 2550 Garcia Avenue 27 * Mountain View, California 94043 28 */ 29 30 /* 31 * Protocol description for the mount program 32 */ 33 34 #ifndef RPC_HDR 35 %#ifndef lint 36 %/*static char sccsid[] = "from: @(#)mount.x 1.2 87/09/18 Copyr 1987 Sun Micro";*/ 37 %/*static char sccsid[] = "from: @(#)mount.x 2.1 88/08/01 4.0 RPCSRC";*/ 38 %static const char rcsid[] = "$Id: mount.x,v 1.4 1997/04/18 12:31:26 dfr Exp $"; 39 %#endif /* not lint */ 40 #endif 41 42 const MNTPATHLEN = 1024; /* maximum bytes in a pathname argument */ 43 const MNTNAMLEN = 255; /* maximum bytes in a name argument */ 44 const FHSIZE = 32; /* size in bytes of a file handle */ 45 #ifdef WANT_NFS3 46 const FHSIZE3 = 64; /* size in bytes of a file handle (v3) */ 47 #endif 48 49 /* 50 * The fhandle is the file handle that the server passes to the client. 51 * All file operations are done using the file handles to refer to a file 52 * or a directory. The file handle can contain whatever information the 53 * server needs to distinguish an individual file. 54 */ 55 typedef opaque fhandle[FHSIZE]; 56 #ifdef WANT_NFS3 57 typedef opaque fhandle3<FHSIZE3>; 58 #endif 59 60 /* 61 * If a status of zero is returned, the call completed successfully, and 62 * a file handle for the directory follows. A non-zero status indicates 63 * some sort of error. The status corresponds with UNIX error numbers. 64 */ 65 union fhstatus switch (unsigned fhs_status) { 66 case 0: 67 fhandle fhs_fhandle; 68 default: 69 void; 70 }; 71 72 #ifdef WANT_NFS3 73 /* 74 * Status codes returned by the version 3 mount call. 75 */ 76 enum mountstat3 { 77 MNT3_OK = 0, /* no error */ 78 MNT3ERR_PERM = 1, /* Not owner */ 79 MNT3ERR_NOENT = 2, /* No such file or directory */ 80 MNT3ERR_IO = 5, /* I/O error */ 81 MNT3ERR_ACCES = 13, /* Permission denied */ 82 MNT3ERR_NOTDIR = 20, /* Not a directory */ 83 MNT3ERR_INVAL = 22, /* Invalid argument */ 84 MNT3ERR_NAMETOOLONG = 63, /* Filename too long */ 85 MNT3ERR_NOTSUPP = 10004, /* Operation not supported */ 86 MNT3ERR_SERVERFAULT = 10006 /* A failure on the server */ 87 }; 88 89 struct mountres3_ok { 90 fhandle3 fhandle; 91 int auth_flavors<>; 92 }; 93 94 union mountres3 switch (mountstat3 fhs_status) { 95 case 0: 96 mountres3_ok mountinfo; 97 default: 98 void; 99 }; 100 #endif 101 102 /* 103 * The type dirpath is the pathname of a directory 104 */ 105 typedef string dirpath<MNTPATHLEN>; 106 107 /* 108 * The type name is used for arbitrary names (hostnames, groupnames) 109 */ 110 typedef string name<MNTNAMLEN>; 111 112 /* 113 * A list of who has what mounted 114 */ 115 typedef struct mountbody *mountlist; 116 struct mountbody { 117 name ml_hostname; 118 dirpath ml_directory; 119 mountlist ml_next; 120 }; 121 122 /* 123 * A list of netgroups 124 */ 125 typedef struct groupnode *groups; 126 struct groupnode { 127 name gr_name; 128 groups gr_next; 129 }; 130 131 /* 132 * A list of what is exported and to whom 133 */ 134 typedef struct exportnode *exports; 135 struct exportnode { 136 dirpath ex_dir; 137 groups ex_groups; 138 exports ex_next; 139 }; 140 141 program MOUNTPROG { 142 /* 143 * Version one of the mount protocol communicates with version two 144 * of the NFS protocol. Version three communicates with 145 * version three of the NFS protocol. The only connecting 146 * point is the fhandle structure, which is the same for both 147 * protocols. 148 */ 149 version MOUNTVERS { 150 /* 151 * Does no work. It is made available in all RPC services 152 * to allow server reponse testing and timing 153 */ 154 void 155 MOUNTPROC_NULL(void) = 0; 156 157 /* 158 * If fhs_status is 0, then fhs_fhandle contains the 159 * file handle for the directory. This file handle may 160 * be used in the NFS protocol. This procedure also adds 161 * a new entry to the mount list for this client mounting 162 * the directory. 163 * Unix authentication required. 164 */ 165 fhstatus 166 MOUNTPROC_MNT(dirpath) = 1; 167 168 /* 169 * Returns the list of remotely mounted filesystems. The 170 * mountlist contains one entry for each hostname and 171 * directory pair. 172 */ 173 mountlist 174 MOUNTPROC_DUMP(void) = 2; 175 176 /* 177 * Removes the mount list entry for the directory 178 * Unix authentication required. 179 */ 180 void 181 MOUNTPROC_UMNT(dirpath) = 3; 182 183 /* 184 * Removes all of the mount list entries for this client 185 * Unix authentication required. 186 */ 187 void 188 MOUNTPROC_UMNTALL(void) = 4; 189 190 /* 191 * Returns a list of all the exported filesystems, and which 192 * machines are allowed to import it. 193 */ 194 exports 195 MOUNTPROC_EXPORT(void) = 5; 196 197 /* 198 * Identical to MOUNTPROC_EXPORT above 199 */ 200 exports 201 MOUNTPROC_EXPORTALL(void) = 6; 202 } = 1; 203 #ifdef WANT_NFS3 204 version MOUNTVERS3 { 205 /* 206 * Does no work. It is made available in all RPC services 207 * to allow server reponse testing and timing 208 */ 209 void 210 MOUNTPROC_NULL(void) = 0; 211 212 /* 213 * If mountres3.fhs_status is MNT3_OK, then 214 * mountres3.mountinfo contains the file handle for 215 * the directory and a list of acceptable 216 * authentication flavors. This file handle may only 217 * be used in the NFS version 3 protocol. This 218 * procedure also results in the server adding a new 219 * entry to its mount list recording that this client 220 * has mounted the directory. AUTH_UNIX authentication 221 * or better is required. 222 */ 223 mountres3 224 MOUNTPROC_MNT(dirpath) = 1; 225 226 /* 227 * Returns the list of remotely mounted filesystems. The 228 * mountlist contains one entry for each hostname and 229 * directory pair. 230 */ 231 mountlist 232 MOUNTPROC_DUMP(void) = 2; 233 234 /* 235 * Removes the mount list entry for the directory 236 * Unix authentication required. 237 */ 238 void 239 MOUNTPROC_UMNT(dirpath) = 3; 240 241 /* 242 * Removes all of the mount list entries for this client 243 * Unix authentication required. 244 */ 245 void 246 MOUNTPROC_UMNTALL(void) = 4; 247 248 /* 249 * Returns a list of all the exported filesystems, and which 250 * machines are allowed to import it. 251 */ 252 exports 253 MOUNTPROC_EXPORT(void) = 5; 254 } = 3; 255 #endif 256 } = 100005; 257