1 /* $OpenBSD: mount.x,v 1.6 2022/12/27 17:10:07 jmc Exp $ */ 2 3 /* 4 * Copyright (c) 2010, Oracle America, Inc. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: 9 * 10 * * Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * * Redistributions in binary form must reproduce the above 13 * copyright notice, this list of conditions and the following 14 * disclaimer in the documentation and/or other materials 15 * provided with the distribution. 16 * * Neither the name of the "Oracle America, Inc." nor the names of its 17 * contributors may be used to endorse or promote products derived 18 * from this software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 25 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 27 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 30 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 /* 35 * Protocol description for the mount program 36 */ 37 38 #ifndef RPC_HDR 39 #endif 40 41 const MNTPATHLEN = 1024; /* maximum bytes in a pathname argument */ 42 const MNTNAMLEN = 255; /* maximum bytes in a name argument */ 43 const FHSIZE = 32; /* size in bytes of a file handle */ 44 45 /* 46 * The fhandle is the file handle that the server passes to the client. 47 * All file operations are done using the file handles to refer to a file 48 * or a directory. The file handle can contain whatever information the 49 * server needs to distinguish an individual file. 50 */ 51 typedef opaque fhandle[FHSIZE]; 52 53 /* 54 * If a status of zero is returned, the call completed successfully, and 55 * a file handle for the directory follows. A non-zero status indicates 56 * some sort of error. The status corresponds with UNIX error numbers. 57 */ 58 union fhstatus switch (unsigned fhs_status) { 59 case 0: 60 fhandle fhs_fhandle; 61 default: 62 void; 63 }; 64 65 /* 66 * The type dirpath is the pathname of a directory 67 */ 68 typedef string dirpath<MNTPATHLEN>; 69 70 /* 71 * The type name is used for arbitrary names (hostnames, groupnames) 72 */ 73 typedef string name<MNTNAMLEN>; 74 75 /* 76 * A list of who has what mounted 77 */ 78 typedef struct mountbody *mountlist; 79 struct mountbody { 80 name ml_hostname; 81 dirpath ml_directory; 82 mountlist ml_next; 83 }; 84 85 /* 86 * A list of netgroups 87 */ 88 typedef struct groupnode *groups; 89 struct groupnode { 90 name gr_name; 91 groups gr_next; 92 }; 93 94 /* 95 * A list of what is exported and to whom 96 */ 97 typedef struct exportnode *exports; 98 struct exportnode { 99 dirpath ex_dir; 100 groups ex_groups; 101 exports ex_next; 102 }; 103 104 program MOUNTPROG { 105 /* 106 * Version one of the mount protocol communicates with version two 107 * of the NFS protocol. The only connecting point is the fhandle 108 * structure, which is the same for both protocols. 109 */ 110 version MOUNTVERS { 111 /* 112 * Does no work. It is made available in all RPC services 113 * to allow server response testing and timing 114 */ 115 void 116 MOUNTPROC_NULL(void) = 0; 117 118 /* 119 * If fhs_status is 0, then fhs_fhandle contains the 120 * file handle for the directory. This file handle may 121 * be used in the NFS protocol. This procedure also adds 122 * a new entry to the mount list for this client mounting 123 * the directory. 124 * Unix authentication required. 125 */ 126 fhstatus 127 MOUNTPROC_MNT(dirpath) = 1; 128 129 /* 130 * Returns the list of remotely mounted filesystems. The 131 * mountlist contains one entry for each hostname and 132 * directory pair. 133 */ 134 mountlist 135 MOUNTPROC_DUMP(void) = 2; 136 137 /* 138 * Removes the mount list entry for the directory 139 * Unix authentication required. 140 */ 141 void 142 MOUNTPROC_UMNT(dirpath) = 3; 143 144 /* 145 * Removes all of the mount list entries for this client 146 * Unix authentication required. 147 */ 148 void 149 MOUNTPROC_UMNTALL(void) = 4; 150 151 /* 152 * Returns a list of all the exported filesystems, and which 153 * machines are allowed to import it. 154 */ 155 exports 156 MOUNTPROC_EXPORT(void) = 5; 157 158 /* 159 * Identical to MOUNTPROC_EXPORT above 160 */ 161 exports 162 MOUNTPROC_EXPORTALL(void) = 6; 163 } = 1; 164 } = 100005; 165