[SSI] openssi/nfs-utils/utils/mountd Makefile, 1.1.15.1, 1.1.15.1.4.1 mountd.c, 1.1.15.2, 1.1.15.2.2.1

Roger Tsang <[email protected]> Thu, 15 Jul 2010 03:47:19 +0000
Newsgroups gmane.linux.cluster.ssic.cvs
Message-ID <[email protected]>
Update of /cvsroot/ssic-linux/openssi/nfs-utils/utils/mountd
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv13321/utils/mountd

Modified Files:
      Tag: OPENSSI-CENTOS
	Makefile mountd.c 
Log Message:
OpenSSI changes for nfs-utils-1.0.6-93.EL4 CentOS 4


Index: Makefile
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/nfs-utils/utils/mountd/Attic/Makefile,v
retrieving revision 1.1.15.1
retrieving revision 1.1.15.1.4.1
diff -u -d -r1.1.15.1 -r1.1.15.1.4.1
--- Makefile	4 Jul 2010 22:21:51 -0000	1.1.15.1
+++ Makefile	15 Jul 2010 03:47:17 -0000	1.1.15.1.4.1
@@ -6,7 +6,7 @@
 PREFIX	= rpc.
 OBJS	= mountd.o mount_dispatch.o auth.o rmtab.o cache.o svc_run.o
 LIBDEPS	= $(TOP)support/lib/libexport.a $(TOP)/support/lib/libnfs.a
-LIBS	= -lexport -lnfs -lmisc $(LIBBSD) $(LIBWRAP) $(LIBNSL)
+LIBS	= -lexport -lnfs -lmisc $(LIBBSD) $(LIBWRAP) $(LIBNSL) -lcluster
 MAN8	= mountd
 
 include $(TOP)rules.mk

Index: mountd.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/nfs-utils/utils/mountd/Attic/mountd.c,v
retrieving revision 1.1.15.2
retrieving revision 1.1.15.2.2.1
diff -u -d -r1.1.15.2 -r1.1.15.2.2.1
--- mountd.c	15 Jul 2010 03:38:31 -0000	1.1.15.2
+++ mountd.c	15 Jul 2010 03:47:17 -0000	1.1.15.2.2.1
@@ -34,6 +34,9 @@
 static void		usage(const char *, int exitcode);
 static exports		get_exportlist(void);
 static struct nfs_fh_len *get_rootfh(struct svc_req *, dirpath *, int *, int v3);
+int ssi;
+
+#define	CVIP_PROG_BIT	(LONG_MIN)
 
 int reverse_resolve = 0;
 int new_cache = 0;
@@ -69,12 +72,21 @@
 static void 
 killer (int sig)
 {
+  if (ssi) {
+    if (nfs_version & 0x1)
+      pmap_unset (MOUNTPROG|CVIP_PROG_BIT, MOUNTVERS);
+    if (nfs_version & (0x1 << 1))
+      pmap_unset (MOUNTPROG|CVIP_PROG_BIT, MOUNTVERS_POSIX);
+    if (nfs_version & (0x1 << 2))
+      pmap_unset (MOUNTPROG|CVIP_PROG_BIT, MOUNTVERS_NFSV3);
+  } else {
   if (nfs_version & 0x1)
     pmap_unset (MOUNTPROG, MOUNTVERS);
   if (nfs_version & (0x1 << 1))
     pmap_unset (MOUNTPROG, MOUNTVERS_POSIX);
   if (nfs_version & (0x1 << 2))
     pmap_unset (MOUNTPROG, MOUNTVERS_NFSV3);
+  }
   xlog (L_FATAL, "Caught signal %d, un-registering and exiting.", sig);
 }
 
@@ -471,6 +483,8 @@
 	return elist;
 }
 
+#define NAMESIZE	256
+
 int
 main(int argc, char **argv)
 {
@@ -481,6 +495,8 @@
 	int	c;
 	struct sigaction sa;
 	struct rlimit rlim;
+	char buffer[NAMESIZE];
+	struct hostent *cvip_hp;
 
 	/* Parse the command line options and arguments. */
 	opterr = 0;
@@ -605,15 +621,46 @@
 	if (new_cache)
 		cache_open();
 
-	if (nfs_version & 0x1)
+	/*
+	 * See if we are running on an SSI kernel
+	 */
+	ssi = cluster_ssiconfig();
+
+	if (ssi) {
+		if (cluster_get_clustername(&buffer, NAMESIZE) == -1) {
+			xlog(L_FATAL, "mountd: cannot uname: %s\n",
+						strerror(errno));
+			exit(1);
+		 }
+		if ((cvip_hp = gethostbyname(buffer)) == NULL) {
+			xlog(L_FATAL, "mountd: gethostbyname for IPVS error\n");
+			exit(1);
+		}
+	}
+	if (nfs_version & 0x1) {
+	    if (ssi)
+		rpc_init_addr("mountd", MOUNTPROG, MOUNTVERS,
+			 mount_dispatch, port, *(unsigned long *)cvip_hp->h_addr, SSI_PMAP_CVIP);
+	    else
 		rpc_init("mountd", MOUNTPROG, MOUNTVERS,
 			 mount_dispatch, port);
-	if (nfs_version & (0x1 << 1))
+	}
+	if (nfs_version & (0x1 << 1)) {
+	    if (ssi)
+		rpc_init_addr("mountd", MOUNTPROG, MOUNTVERS_POSIX,
+			 mount_dispatch, port, *(unsigned long *)cvip_hp->h_addr, SSI_PMAP_CVIP);
+	    else
 		rpc_init("mountd", MOUNTPROG, MOUNTVERS_POSIX,
 			 mount_dispatch, port);
-	if (nfs_version & (0x1 << 2))
+	}
+	if (nfs_version & (0x1 << 2)) {
+	    if (ssi)
+		rpc_init_addr("mountd", MOUNTPROG, MOUNTVERS_NFSV3,
+			 mount_dispatch, port, *(unsigned long *)cvip_hp->h_addr, SSI_PMAP_CVIP);
+	    else
 		rpc_init("mountd", MOUNTPROG, MOUNTVERS_NFSV3,
 			 mount_dispatch, port);
+	}
 
 	sa.sa_handler = killer;
 	sigaction(SIGHUP, &sa, NULL);


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first