rpc.umntall.c (80146) | rpc.umntall.c (81070) |
---|---|
1/* 2 * Copyright (c) 1999 Martin Blapp 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 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28#ifndef lint 29static const char rcsid[] = | 1/* 2 * Copyright (c) 1999 Martin Blapp 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 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28#ifndef lint 29static const char rcsid[] = |
30 "$FreeBSD: head/usr.sbin/rpc.umntall/rpc.umntall.c 80146 2001-07-22 12:17:51Z iedowse $"; | 30 "$FreeBSD: head/usr.sbin/rpc.umntall/rpc.umntall.c 81070 2001-08-02 21:46:21Z iedowse $"; |
31#endif /* not lint */ 32 33#include <sys/param.h> 34#include <sys/ucred.h> 35#include <sys/mount.h> 36 37#include <rpc/rpc.h> 38#include <nfs/rpcv2.h> --- 136 unchanged lines hidden (view full) --- 175do_umntall(char *hostname) { 176 enum clnt_stat clnt_stat; 177 struct timeval try; 178 CLIENT *clp; 179 180 clp = clnt_create(hostname, RPCPROG_MNT, RPCMNT_VER1, "udp"); 181 if (clp == NULL) { 182 warnx("%s: %s", hostname, clnt_spcreateerror("RPCPROG_MNT")); | 31#endif /* not lint */ 32 33#include <sys/param.h> 34#include <sys/ucred.h> 35#include <sys/mount.h> 36 37#include <rpc/rpc.h> 38#include <nfs/rpcv2.h> --- 136 unchanged lines hidden (view full) --- 175do_umntall(char *hostname) { 176 enum clnt_stat clnt_stat; 177 struct timeval try; 178 CLIENT *clp; 179 180 clp = clnt_create(hostname, RPCPROG_MNT, RPCMNT_VER1, "udp"); 181 if (clp == NULL) { 182 warnx("%s: %s", hostname, clnt_spcreateerror("RPCPROG_MNT")); |
183 return (1); | 183 return (0); |
184 } 185 clp->cl_auth = authunix_create_default(); 186 try.tv_sec = 3; 187 try.tv_usec = 0; 188 clnt_stat = clnt_call(clp, RPCMNT_UMNTALL, xdr_void, (caddr_t)0, 189 xdr_void, (caddr_t)0, try); | 184 } 185 clp->cl_auth = authunix_create_default(); 186 try.tv_sec = 3; 187 try.tv_usec = 0; 188 clnt_stat = clnt_call(clp, RPCMNT_UMNTALL, xdr_void, (caddr_t)0, 189 xdr_void, (caddr_t)0, try); |
190 clnt_destroy(clp); 191 if (clnt_stat != RPC_SUCCESS) { | 190 if (clnt_stat != RPC_SUCCESS) |
192 warnx("%s: %s", hostname, clnt_sperror(clp, "RPCMNT_UMNTALL")); | 191 warnx("%s: %s", hostname, clnt_sperror(clp, "RPCMNT_UMNTALL")); |
193 return (0); 194 } else 195 return (1); | 192 auth_destroy(clp->cl_auth); 193 clnt_destroy(clp); 194 return (clnt_stat == RPC_SUCCESS); |
196} 197 198/* 199 * Send a RPC_MNT UMOUNT request for dirp to hostname. 200 */ 201int 202do_umount(char *hostname, char *dirp) { 203 enum clnt_stat clnt_stat; 204 struct timeval try; 205 CLIENT *clp; 206 207 clp = clnt_create(hostname, RPCPROG_MNT, RPCMNT_VER1, "udp"); 208 if (clp == NULL) { 209 warnx("%s: %s", hostname, clnt_spcreateerror("RPCPROG_MNT")); | 195} 196 197/* 198 * Send a RPC_MNT UMOUNT request for dirp to hostname. 199 */ 200int 201do_umount(char *hostname, char *dirp) { 202 enum clnt_stat clnt_stat; 203 struct timeval try; 204 CLIENT *clp; 205 206 clp = clnt_create(hostname, RPCPROG_MNT, RPCMNT_VER1, "udp"); 207 if (clp == NULL) { 208 warnx("%s: %s", hostname, clnt_spcreateerror("RPCPROG_MNT")); |
210 return (1); | 209 return (0); |
211 } 212 clp->cl_auth = authsys_create_default(); 213 try.tv_sec = 3; 214 try.tv_usec = 0; 215 clnt_stat = clnt_call(clp, RPCMNT_UMOUNT, xdr_dir, dirp, 216 xdr_void, (caddr_t)0, try); | 210 } 211 clp->cl_auth = authsys_create_default(); 212 try.tv_sec = 3; 213 try.tv_usec = 0; 214 clnt_stat = clnt_call(clp, RPCMNT_UMOUNT, xdr_dir, dirp, 215 xdr_void, (caddr_t)0, try); |
217 clnt_destroy(clp); 218 if (clnt_stat != RPC_SUCCESS) { | 216 if (clnt_stat != RPC_SUCCESS) |
219 warnx("%s: %s", hostname, clnt_sperror(clp, "RPCMNT_UMOUNT")); | 217 warnx("%s: %s", hostname, clnt_sperror(clp, "RPCMNT_UMOUNT")); |
220 return (0); 221 } 222 return (1); | 218 auth_destroy(clp->cl_auth); 219 clnt_destroy(clp); 220 return (clnt_stat == RPC_SUCCESS); |
223} 224 225/* 226 * Check if the entry is still/already mounted. 227 */ 228int 229is_mounted(char *hostname, char *dirp) { 230 struct statfs *mntbuf; --- 38 unchanged lines hidden --- | 221} 222 223/* 224 * Check if the entry is still/already mounted. 225 */ 226int 227is_mounted(char *hostname, char *dirp) { 228 struct statfs *mntbuf; --- 38 unchanged lines hidden --- |