summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Andres Granados <jgranado@redhat.com>2008-05-05 19:07:02 +0200
committerJoel Andres Granados <jgranado@redhat.com>2008-05-05 19:07:02 +0200
commitf1b5f19ecc11e0c0594ea45bac98a2ffccb51167 (patch)
tree58520b1c3cf6a1574090f9cabc9892fc9a3bbfee
parent159597a4e96789713e74112b0349a1a950c2fbce (diff)
downloadanaconda-f1b5f19ecc11e0c0594ea45bac98a2ffccb51167.tar.gz
anaconda-f1b5f19ecc11e0c0594ea45bac98a2ffccb51167.tar.xz
anaconda-f1b5f19ecc11e0c0594ea45bac98a2ffccb51167.zip
Revert "Tell the nfs server when we unmount the nfs mountpoints (#208103)"
This reverts commit acab28e75d11b5ce7d9ece0cdf5a54391dea954b. This made the init and shutdown files bigger than what they needed to be.
-rw-r--r--loader2/Makefile6
-rw-r--r--loader2/undomounts.c112
2 files changed, 10 insertions, 108 deletions
diff --git a/loader2/Makefile b/loader2/Makefile
index 8413f0e59..fd8d7b6d7 100644
--- a/loader2/Makefile
+++ b/loader2/Makefile
@@ -94,16 +94,16 @@ linuxrc.s390:
@echo "Nothing to do for $@"
init: init.o undomounts.o shutdown.o
- $(REALCC) $(STATIC) $(COPTS) $(LDFLAGS) -o $@ $^ ../isys/libisys.a -lresolv
+ $(CC) $(STATIC) $(COPTS) $(LDFLAGS) -o $@ $^
shutdown: shutdown.o undomounts.o
- $(CC) $(STATIC) $(COPTS) $(SHUTDOWNOPTS) $(LDFLAGS) -o $@ $^ ../isys/libisys.a -lresolv
+ $(CC) $(STATIC) $(COPTS) $(SHUTDOWNOPTS) $(LDFLAGS) -o $@ $^
init.o: init.c
$(CC) $(COPTS) -c -o init.o init.c
undomounts.o: undomounts.c
- $(REALCC) $(COPTS) -c -o undomounts.o undomounts.c
+ $(CC) $(COPTS) -c -o undomounts.o undomounts.c
shutdown.o: shutdown.c
$(CC) $(COPTS) $(SHUTDOWNOPTS) -c -o shutdown.o shutdown.c
diff --git a/loader2/undomounts.c b/loader2/undomounts.c
index ea1cdbc45..07892af57 100644
--- a/loader2/undomounts.c
+++ b/loader2/undomounts.c
@@ -27,17 +27,11 @@
#include <sys/stat.h>
#include <sys/swap.h>
#include <unistd.h>
-#include <ctype.h>
-#include <arpa/inet.h>
#include "devt.h"
-#include "../isys/nfsmount.h"
-#include "../isys/dns.h"
struct unmountInfo {
char * name;
- char * fstype;
- char * device;
int mounted;
int loopDevice;
enum { FS, LOOP } what;
@@ -51,87 +45,6 @@ static void printstr(char * string) {
write(1, string, strlen(string));
}
-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;
- char *hostname;
- char *dirname;
- char *p;
- char *tmp;
-
- if (spec == NULL || (p = strchr(spec,':')) == NULL)
- return 0;
- tmp = strdup(spec);
- hostname = strtok(tmp, ":");
- dirname = strtok(NULL, ":");
-
- if (opts && (p = strstr(opts, "addr="))) {
-
- free(hostname);
- tmp = strdup(p);
- strtok(tmp, "= ,");
- hostname = strtok(NULL, "= ,");
- }
-
- if (opts && (p = strstr(opts, "mountport=")) && isdigit(*(p+10)))
- port = atoi(p+10);
-
- sleep(5);
- if (hostname[0] >= '0' && hostname[0] <= '9'){
- saddr.sin_addr.s_addr = inet_addr(hostname);
- } else {
- if (mygethostbyname(hostname, &saddr.sin_addr) < 0)
- return 1;
- }
-
- 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;
-}
-
void undoMount(struct unmountInfo * fs, int numFs, int this) {
int len = strlen(fs[this].name);
int i;
@@ -154,18 +67,11 @@ void undoMount(struct unmountInfo * fs, int numFs, int this) {
printf("\t%s", fs[this].name);
/* don't need to unmount /tmp. it is busy anyway. */
if (!testing) {
- if(strcmp(fs[this].fstype, "nfs") == 0){
- if(nfs_umount_rpc_call(fs[this].device, "") != 0){
- printf(" umount failed (%d)", errno);
- }else{
- printf(" done");
- }
- } else{
- if (umount2(fs[this].name, 0) < 0)
- printf(" umount failed (%d)", errno);
- else
- printf(" done");
- }
+ if (umount2(fs[this].name, 0) < 0) {
+ printf(" umount failed (%d)", errno);
+ } else {
+ printf(" done");
+ }
}
printf("\n");
}
@@ -206,11 +112,12 @@ void undoLoop(struct unmountInfo * fs, int numFs, int this) {
void unmountFilesystems(void) {
int fd, size;
char buf[65535]; /* this should be big enough */
- char * chptr, * start, * device, * fst;
+ char * chptr, * start;
struct unmountInfo filesystems[500];
int numFilesystems = 0;
int i;
struct loop_info li;
+ char * device;
struct stat sb;
fd = open("/proc/mounts", O_RDONLY, 0);
@@ -234,16 +141,11 @@ void unmountFilesystems(void) {
start = chptr;
while (*chptr != ' ') chptr++;
*chptr++ = '\0';
- fst = chptr;
- while (*chptr != ' ') chptr++;
- *chptr++ = '\0';
if (strcmp(start, "/") && strcmp(start, "/tmp")) {
filesystems[numFilesystems].name = strdup(start);
filesystems[numFilesystems].what = FS;
filesystems[numFilesystems].mounted = 1;
- filesystems[numFilesystems].fstype = strdup(fst);
- filesystems[numFilesystems].device = strdup(device);
stat(start, &sb);
if ((sb.st_dev >> 8) == 7) {