util-linux/util-linux-2.13-mount-nonfs...

197 lines
5.5 KiB
Diff

--- util-linux-2.13-pre6/mount/Makefile.am.nonfs 2006-09-20 12:45:50.000000000 +0200
+++ util-linux-2.13-pre6/mount/Makefile.am 2006-09-20 12:46:51.000000000 +0200
@@ -1,15 +1,12 @@
include $(top_srcdir)/config/include-Makefile.am
-AM_CPPFLAGS += -DHAVE_NFS
-
bin_PROGRAMS = mount umount
sbin_PROGRAMS = losetup swapon
-man_MANS = fstab.5 nfs.5 mount.8 swapoff.8 swapon.8 umount.8 losetup.8
+man_MANS = fstab.5 mount.8 swapoff.8 swapon.8 umount.8 losetup.8
mount_SOURCES = mount.c fstab.c sundries.c xmalloc.c realpath.c mntent.c \
get_label_uuid.c mount_by_label.c mount_blkid.c mount_guess_fstype.c \
getusername.c \
- nfsmount.c nfsmount_xdr.c nfsmount_clnt.c \
lomount.c
mount_LDADD = $(top_srcdir)/lib/libenv.a $(top_srcdir)/lib/libsetproctitle.a
--- util-linux-2.13-pre6/mount/sundries.c.nonfs 2006-09-20 12:53:09.000000000 +0200
+++ util-linux-2.13-pre6/mount/sundries.c 2006-09-20 12:53:13.000000000 +0200
@@ -15,7 +15,6 @@
#include "fstab.h"
#include "sundries.h"
#include "realpath.h"
-#include "nfsmount.h"
#include "nls.h"
char *
--- util-linux-2.13-pre6/mount/umount.c.nonfs 2006-09-20 12:51:11.000000000 +0200
+++ util-linux-2.13-pre6/mount/umount.c 2006-09-20 12:52:26.000000000 +0200
@@ -20,15 +20,6 @@
#include "env.h"
#include "nls.h"
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <netdb.h>
-#include <rpc/rpc.h>
-#include <rpc/pmap_clnt.h>
-#include <rpc/pmap_prot.h>
-#include "nfsmount.h"
-#include <arpa/inet.h>
-
#if defined(MNT_FORCE) && !defined(__sparc__) && !defined(__arm__)
/* Interesting ... it seems libc knows about MNT_FORCE and presumably
about umount2 as well -- need not do anything */
@@ -144,98 +135,6 @@
return 0;
}
-static int xdr_dir(XDR *xdrsp, char *dirp)
-{
- return (xdr_string(xdrsp, &dirp, MNTPATHLEN));
-}
-
-static int
-nfs_umount_rpc_call(const char *spec, const char *opts)
-{
- register CLIENT *clp;
- struct sockaddr_in saddr;
- struct timeval pertry, try;
- enum clnt_stat clnt_stat;
- int port = 0;
- int so = RPC_ANYSOCK;
- struct hostent *hostp;
- char *hostname;
- char *dirname;
- char *p;
-
- if (spec == NULL || (p = strchr(spec,':')) == NULL)
- return 0;
- hostname = xstrndup(spec, p-spec);
- dirname = xstrdup(p+1);
-#ifdef DEBUG
- printf(_("host: %s, directory: %s\n"), hostname, dirname);
-#endif
-
- if (opts && (p = strstr(opts, "addr="))) {
- char *q;
-
- free(hostname);
- p += 5;
- q = p;
- while (*q && *q != ',') q++;
- hostname = xstrndup(p,q-p);
- }
-
- if (opts && (p = strstr(opts, "mountport=")) && isdigit(*(p+10)))
- port = atoi(p+10);
-
- if (hostname[0] >= '0' && hostname[0] <= '9')
- saddr.sin_addr.s_addr = inet_addr(hostname);
- else {
- if ((hostp = gethostbyname(hostname)) == NULL) {
- fprintf(stderr, _("umount: can't get address for %s\n"),
- hostname);
- return 1;
- }
- if (hostp->h_length > sizeof(struct in_addr)) {
- fprintf(stderr, _("umount: got bad hostp->h_length\n"));
- hostp->h_length = sizeof(struct in_addr);
- }
- memcpy(&saddr.sin_addr, hostp->h_addr, hostp->h_length);
- }
-
- saddr.sin_family = AF_INET;
- saddr.sin_port = htons(port);
- pertry.tv_sec = 3;
- pertry.tv_usec = 0;
- if (opts && (p = strstr(opts, "tcp"))) {
- /* possibly: make sure option is not "notcp"
- possibly: try udp if tcp fails */
- if ((clp = clnttcp_create(&saddr, MOUNTPROG, MOUNTVERS,
- &so, 0, 0)) == NULL) {
- clnt_pcreateerror("Cannot MOUNTPROG RPC (tcp)");
- return 1;
- }
- } else {
- if ((clp = clntudp_create(&saddr, MOUNTPROG, MOUNTVERS,
- pertry, &so)) == NULL) {
- clnt_pcreateerror("Cannot MOUNTPROG RPC");
- return 1;
- }
- }
- clp->cl_auth = authunix_create_default();
- try.tv_sec = 20;
- try.tv_usec = 0;
- clnt_stat = clnt_call(clp, MOUNTPROC_UMNT,
- (xdrproc_t) xdr_dir, dirname,
- (xdrproc_t) xdr_void, (caddr_t) 0,
- try);
-
- if (clnt_stat != RPC_SUCCESS) {
- clnt_perror(clp, "Bad UMNT RPC");
- return 1;
- }
- auth_destroy(clp->cl_auth);
- clnt_destroy(clp);
-
- return 0;
-}
-
/* complain about a failed umount */
static void complain(int err, const char *dev) {
switch (err) {
@@ -289,11 +188,6 @@
if (check_special_umountprog(spec, node, type, &status))
return status;
- /* Ignore any RPC errors, so that you can umount the filesystem
- if the server is down. */
- if (strcasecmp(type, "nfs") == 0)
- nfs_umount_rpc_call(spec, opts);
-
umnt_err = umnt_err2 = 0;
if (lazy) {
res = umount2 (node, MNT_DETACH);
--- util-linux-2.13-pre6/mount/mount.c.nonfs 2006-09-20 12:48:48.000000000 +0200
+++ util-linux-2.13-pre6/mount/mount.c 2006-09-20 12:48:33.000000000 +0200
@@ -966,19 +966,6 @@
goto out;
}
- /*
- * Also nfs requires a separate program, but it is built in.
- */
- if (!fake && types && streq (types, "nfs")) {
-retry_nfs:
- mnt_err = nfsmount (spec, node, &flags, &extra_opts, &mount_opts,
- &nfs_mount_version, bg);
- if (mnt_err) {
- res = mnt_err;
- goto out;
- }
- }
-
block_signals (SIG_BLOCK);
if (!fake) {
@@ -1018,15 +1005,6 @@
block_signals (SIG_UNBLOCK);
- if (mnt_err && types && streq (types, "nfs")) {
- if (nfs_mount_version == 4 && mnt_err != EBUSY && mnt_err != ENOENT) {
- if (verbose)
- printf(_("mount: failed with nfs mount version 4, trying 3..\n"));
- nfs_mount_version = 3;
- goto retry_nfs;
- }
- }
-
/* Mount failed, complain, but don't die. */
if (types == 0) {