175b63130SGarrett Wollman /* 275b63130SGarrett Wollman * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 375b63130SGarrett Wollman * unrestricted use provided that this legend is included on all tape 475b63130SGarrett Wollman * media and as a part of the software program in whole or part. Users 575b63130SGarrett Wollman * may copy or modify Sun RPC without charge, but are not authorized 675b63130SGarrett Wollman * to license or distribute it to anyone else except as part of a product or 775b63130SGarrett Wollman * program developed by the user. 875b63130SGarrett Wollman * 975b63130SGarrett Wollman * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 1075b63130SGarrett Wollman * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 1175b63130SGarrett Wollman * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 1275b63130SGarrett Wollman * 1375b63130SGarrett Wollman * Sun RPC is provided with no support and without any obligation on the 1475b63130SGarrett Wollman * part of Sun Microsystems, Inc. to assist in its use, correction, 1575b63130SGarrett Wollman * modification or enhancement. 1675b63130SGarrett Wollman * 1775b63130SGarrett Wollman * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 1875b63130SGarrett Wollman * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 1975b63130SGarrett Wollman * OR ANY PART THEREOF. 2075b63130SGarrett Wollman * 2175b63130SGarrett Wollman * In no event will Sun Microsystems, Inc. be liable for any lost revenue 2275b63130SGarrett Wollman * or profits or other special, indirect and consequential damages, even if 2375b63130SGarrett Wollman * Sun has been advised of the possibility of such damages. 2475b63130SGarrett Wollman * 2575b63130SGarrett Wollman * Sun Microsystems, Inc. 2675b63130SGarrett Wollman * 2550 Garcia Avenue 2775b63130SGarrett Wollman * Mountain View, California 94043 2875b63130SGarrett Wollman */ 2975b63130SGarrett Wollman 3075b63130SGarrett Wollman /* 3175b63130SGarrett Wollman * Protocol description for the mount program 3275b63130SGarrett Wollman */ 3375b63130SGarrett Wollman 3475b63130SGarrett Wollman #ifndef RPC_HDR 3575b63130SGarrett Wollman %#ifndef lint 3675b63130SGarrett Wollman %/*static char sccsid[] = "from: @(#)mount.x 1.2 87/09/18 Copyr 1987 Sun Micro";*/ 3775b63130SGarrett Wollman %/*static char sccsid[] = "from: @(#)mount.x 2.1 88/08/01 4.0 RPCSRC";*/ 3875b63130SGarrett Wollman %#endif /* not lint */ 391542dbb4SDavid E. O'Brien %#include <sys/cdefs.h> 401542dbb4SDavid E. O'Brien %__FBSDID("$FreeBSD$"); 4175b63130SGarrett Wollman #endif 4275b63130SGarrett Wollman 4375b63130SGarrett Wollman const MNTPATHLEN = 1024; /* maximum bytes in a pathname argument */ 4475b63130SGarrett Wollman const MNTNAMLEN = 255; /* maximum bytes in a name argument */ 4575b63130SGarrett Wollman const FHSIZE = 32; /* size in bytes of a file handle */ 467538921eSDoug Rabson #ifdef WANT_NFS3 477538921eSDoug Rabson const FHSIZE3 = 64; /* size in bytes of a file handle (v3) */ 487538921eSDoug Rabson #endif 4975b63130SGarrett Wollman 5075b63130SGarrett Wollman /* 5175b63130SGarrett Wollman * The fhandle is the file handle that the server passes to the client. 5275b63130SGarrett Wollman * All file operations are done using the file handles to refer to a file 5375b63130SGarrett Wollman * or a directory. The file handle can contain whatever information the 5475b63130SGarrett Wollman * server needs to distinguish an individual file. 5575b63130SGarrett Wollman */ 5675b63130SGarrett Wollman typedef opaque fhandle[FHSIZE]; 577538921eSDoug Rabson #ifdef WANT_NFS3 587538921eSDoug Rabson typedef opaque fhandle3<FHSIZE3>; 597538921eSDoug Rabson #endif 6075b63130SGarrett Wollman 6175b63130SGarrett Wollman /* 6275b63130SGarrett Wollman * If a status of zero is returned, the call completed successfully, and 6375b63130SGarrett Wollman * a file handle for the directory follows. A non-zero status indicates 6475b63130SGarrett Wollman * some sort of error. The status corresponds with UNIX error numbers. 6575b63130SGarrett Wollman */ 6675b63130SGarrett Wollman union fhstatus switch (unsigned fhs_status) { 6775b63130SGarrett Wollman case 0: 6875b63130SGarrett Wollman fhandle fhs_fhandle; 6975b63130SGarrett Wollman default: 7075b63130SGarrett Wollman void; 7175b63130SGarrett Wollman }; 7275b63130SGarrett Wollman 737538921eSDoug Rabson #ifdef WANT_NFS3 747538921eSDoug Rabson /* 757538921eSDoug Rabson * Status codes returned by the version 3 mount call. 767538921eSDoug Rabson */ 777538921eSDoug Rabson enum mountstat3 { 787538921eSDoug Rabson MNT3_OK = 0, /* no error */ 797538921eSDoug Rabson MNT3ERR_PERM = 1, /* Not owner */ 807538921eSDoug Rabson MNT3ERR_NOENT = 2, /* No such file or directory */ 817538921eSDoug Rabson MNT3ERR_IO = 5, /* I/O error */ 827538921eSDoug Rabson MNT3ERR_ACCES = 13, /* Permission denied */ 837538921eSDoug Rabson MNT3ERR_NOTDIR = 20, /* Not a directory */ 847538921eSDoug Rabson MNT3ERR_INVAL = 22, /* Invalid argument */ 857538921eSDoug Rabson MNT3ERR_NAMETOOLONG = 63, /* Filename too long */ 867538921eSDoug Rabson MNT3ERR_NOTSUPP = 10004, /* Operation not supported */ 877538921eSDoug Rabson MNT3ERR_SERVERFAULT = 10006 /* A failure on the server */ 887538921eSDoug Rabson }; 897538921eSDoug Rabson 907538921eSDoug Rabson struct mountres3_ok { 917538921eSDoug Rabson fhandle3 fhandle; 927538921eSDoug Rabson int auth_flavors<>; 937538921eSDoug Rabson }; 947538921eSDoug Rabson 957538921eSDoug Rabson union mountres3 switch (mountstat3 fhs_status) { 967538921eSDoug Rabson case 0: 977538921eSDoug Rabson mountres3_ok mountinfo; 987538921eSDoug Rabson default: 997538921eSDoug Rabson void; 1007538921eSDoug Rabson }; 1017538921eSDoug Rabson #endif 1027538921eSDoug Rabson 10375b63130SGarrett Wollman /* 10475b63130SGarrett Wollman * The type dirpath is the pathname of a directory 10575b63130SGarrett Wollman */ 10675b63130SGarrett Wollman typedef string dirpath<MNTPATHLEN>; 10775b63130SGarrett Wollman 10875b63130SGarrett Wollman /* 10975b63130SGarrett Wollman * The type name is used for arbitrary names (hostnames, groupnames) 11075b63130SGarrett Wollman */ 11175b63130SGarrett Wollman typedef string name<MNTNAMLEN>; 11275b63130SGarrett Wollman 11375b63130SGarrett Wollman /* 11475b63130SGarrett Wollman * A list of who has what mounted 11575b63130SGarrett Wollman */ 11675b63130SGarrett Wollman typedef struct mountbody *mountlist; 11775b63130SGarrett Wollman struct mountbody { 11875b63130SGarrett Wollman name ml_hostname; 11975b63130SGarrett Wollman dirpath ml_directory; 12075b63130SGarrett Wollman mountlist ml_next; 12175b63130SGarrett Wollman }; 12275b63130SGarrett Wollman 12375b63130SGarrett Wollman /* 12475b63130SGarrett Wollman * A list of netgroups 12575b63130SGarrett Wollman */ 12675b63130SGarrett Wollman typedef struct groupnode *groups; 12775b63130SGarrett Wollman struct groupnode { 12875b63130SGarrett Wollman name gr_name; 12975b63130SGarrett Wollman groups gr_next; 13075b63130SGarrett Wollman }; 13175b63130SGarrett Wollman 13275b63130SGarrett Wollman /* 13375b63130SGarrett Wollman * A list of what is exported and to whom 13475b63130SGarrett Wollman */ 13575b63130SGarrett Wollman typedef struct exportnode *exports; 13675b63130SGarrett Wollman struct exportnode { 13775b63130SGarrett Wollman dirpath ex_dir; 13875b63130SGarrett Wollman groups ex_groups; 13975b63130SGarrett Wollman exports ex_next; 14075b63130SGarrett Wollman }; 14175b63130SGarrett Wollman 14275b63130SGarrett Wollman program MOUNTPROG { 14375b63130SGarrett Wollman /* 14475b63130SGarrett Wollman * Version one of the mount protocol communicates with version two 1457538921eSDoug Rabson * of the NFS protocol. Version three communicates with 1467538921eSDoug Rabson * version three of the NFS protocol. The only connecting 1477538921eSDoug Rabson * point is the fhandle structure, which is the same for both 1487538921eSDoug Rabson * protocols. 14975b63130SGarrett Wollman */ 15075b63130SGarrett Wollman version MOUNTVERS { 15175b63130SGarrett Wollman /* 15275b63130SGarrett Wollman * Does no work. It is made available in all RPC services 15375b63130SGarrett Wollman * to allow server reponse testing and timing 15475b63130SGarrett Wollman */ 15575b63130SGarrett Wollman void 15675b63130SGarrett Wollman MOUNTPROC_NULL(void) = 0; 15775b63130SGarrett Wollman 15875b63130SGarrett Wollman /* 15975b63130SGarrett Wollman * If fhs_status is 0, then fhs_fhandle contains the 16075b63130SGarrett Wollman * file handle for the directory. This file handle may 16175b63130SGarrett Wollman * be used in the NFS protocol. This procedure also adds 16275b63130SGarrett Wollman * a new entry to the mount list for this client mounting 16375b63130SGarrett Wollman * the directory. 16475b63130SGarrett Wollman * Unix authentication required. 16575b63130SGarrett Wollman */ 16675b63130SGarrett Wollman fhstatus 16775b63130SGarrett Wollman MOUNTPROC_MNT(dirpath) = 1; 16875b63130SGarrett Wollman 16975b63130SGarrett Wollman /* 17075b63130SGarrett Wollman * Returns the list of remotely mounted filesystems. The 17175b63130SGarrett Wollman * mountlist contains one entry for each hostname and 17275b63130SGarrett Wollman * directory pair. 17375b63130SGarrett Wollman */ 17475b63130SGarrett Wollman mountlist 17575b63130SGarrett Wollman MOUNTPROC_DUMP(void) = 2; 17675b63130SGarrett Wollman 17775b63130SGarrett Wollman /* 17875b63130SGarrett Wollman * Removes the mount list entry for the directory 17975b63130SGarrett Wollman * Unix authentication required. 18075b63130SGarrett Wollman */ 18175b63130SGarrett Wollman void 18275b63130SGarrett Wollman MOUNTPROC_UMNT(dirpath) = 3; 18375b63130SGarrett Wollman 18475b63130SGarrett Wollman /* 18575b63130SGarrett Wollman * Removes all of the mount list entries for this client 18675b63130SGarrett Wollman * Unix authentication required. 18775b63130SGarrett Wollman */ 18875b63130SGarrett Wollman void 18975b63130SGarrett Wollman MOUNTPROC_UMNTALL(void) = 4; 19075b63130SGarrett Wollman 19175b63130SGarrett Wollman /* 19275b63130SGarrett Wollman * Returns a list of all the exported filesystems, and which 19375b63130SGarrett Wollman * machines are allowed to import it. 19475b63130SGarrett Wollman */ 19575b63130SGarrett Wollman exports 19675b63130SGarrett Wollman MOUNTPROC_EXPORT(void) = 5; 19775b63130SGarrett Wollman 19875b63130SGarrett Wollman /* 19975b63130SGarrett Wollman * Identical to MOUNTPROC_EXPORT above 20075b63130SGarrett Wollman */ 20175b63130SGarrett Wollman exports 20275b63130SGarrett Wollman MOUNTPROC_EXPORTALL(void) = 6; 20375b63130SGarrett Wollman } = 1; 2047538921eSDoug Rabson #ifdef WANT_NFS3 2057538921eSDoug Rabson version MOUNTVERS3 { 2067538921eSDoug Rabson /* 2077538921eSDoug Rabson * Does no work. It is made available in all RPC services 2087538921eSDoug Rabson * to allow server reponse testing and timing 2097538921eSDoug Rabson */ 2107538921eSDoug Rabson void 2117538921eSDoug Rabson MOUNTPROC_NULL(void) = 0; 2127538921eSDoug Rabson 2137538921eSDoug Rabson /* 2147538921eSDoug Rabson * If mountres3.fhs_status is MNT3_OK, then 2157538921eSDoug Rabson * mountres3.mountinfo contains the file handle for 2167538921eSDoug Rabson * the directory and a list of acceptable 2177538921eSDoug Rabson * authentication flavors. This file handle may only 2187538921eSDoug Rabson * be used in the NFS version 3 protocol. This 2197538921eSDoug Rabson * procedure also results in the server adding a new 2207538921eSDoug Rabson * entry to its mount list recording that this client 2217538921eSDoug Rabson * has mounted the directory. AUTH_UNIX authentication 2227538921eSDoug Rabson * or better is required. 2237538921eSDoug Rabson */ 2247538921eSDoug Rabson mountres3 2257538921eSDoug Rabson MOUNTPROC_MNT(dirpath) = 1; 2267538921eSDoug Rabson 2277538921eSDoug Rabson /* 2287538921eSDoug Rabson * Returns the list of remotely mounted filesystems. The 2297538921eSDoug Rabson * mountlist contains one entry for each hostname and 2307538921eSDoug Rabson * directory pair. 2317538921eSDoug Rabson */ 2327538921eSDoug Rabson mountlist 2337538921eSDoug Rabson MOUNTPROC_DUMP(void) = 2; 2347538921eSDoug Rabson 2357538921eSDoug Rabson /* 2367538921eSDoug Rabson * Removes the mount list entry for the directory 2377538921eSDoug Rabson * Unix authentication required. 2387538921eSDoug Rabson */ 2397538921eSDoug Rabson void 2407538921eSDoug Rabson MOUNTPROC_UMNT(dirpath) = 3; 2417538921eSDoug Rabson 2427538921eSDoug Rabson /* 2437538921eSDoug Rabson * Removes all of the mount list entries for this client 2447538921eSDoug Rabson * Unix authentication required. 2457538921eSDoug Rabson */ 2467538921eSDoug Rabson void 2477538921eSDoug Rabson MOUNTPROC_UMNTALL(void) = 4; 2487538921eSDoug Rabson 2497538921eSDoug Rabson /* 2507538921eSDoug Rabson * Returns a list of all the exported filesystems, and which 2517538921eSDoug Rabson * machines are allowed to import it. 2527538921eSDoug Rabson */ 2537538921eSDoug Rabson exports 2547538921eSDoug Rabson MOUNTPROC_EXPORT(void) = 5; 2557538921eSDoug Rabson } = 3; 2567538921eSDoug Rabson #endif 25775b63130SGarrett Wollman } = 100005; 258