https:///weradocs/nfsInit.shtml Last update:

WERA HF Radar Software - CL7 NFS Mounts

nfsInit performs the NFS mounts to the Linux host machine required by the WERA realtime software. It is called before the WERA realtime software is started. As it can happen during a power-up or reboot sequence of the Linux and CL7 machines that the CL7 is faster booted up than the Linux machine, it is necessary to wait with the CL7's NFS mounts until the required directories are exported by the Linux machine. Otherwise the CL7's NFS mounts will fail and problems accessing files and directories on the Linux machine will be the consequence. nfsInit runs in a loop until the directories from the Linux machine are successfully mounted.

For the NFS mounts to be executed successfully, you must export the required directories from the Linux machine. Look here for instructions.

The following box shows the source code of nfsInit.c

//***************************************************************************
// NFS-Init für CompactPCI / Intel x86
//                                                                          
//***************************************************************************

#define PROGRAM_NAME  		"NFS-Init"
#define PROGRAM_VERSION		"CompactPCI/x86:Alpha-2003-03-12"
#define PROGRAM_COPYRIGHT  	"2002 Uni Hamburg - Institut fuer Meereskunde"

#define WERAHOST			"vxwhost"
#define U_ID				500	// User ID for user "wera" on "vxwhost:"
#define G_ID				100 // Group ID for group "users" on "vxwhost:"

# include <vxWorks.h>
# include <sysLib.h>
# include <semLib.h>
# include <vxLib.h>
# include <taskLib.h>
# include <vmLib.h>
# include <tickLib.h>

# include <errno.h>
# include <string.h>
# include <ctype.h>
# include <stdio.h>
# include <stdarg.h>
# include <fcntl.h>
# include <math.h>

#include "errno.h"


#include <sockLib.h>
#include <inetLib.h>
#include <stdioLib.h>
#include <strLib.h>
#include <ioLib.h>
#include <fioLib.h>
#include <nfsLib.h>

#include <sys/stat.h>
#include <unistd.h>

#include "tcpAll.h"

void delay (float seconds);
int nfsInit();

int nfsInit()
{
char	*	host={"vxwhost"};
char	*	fileSystem1={"/home/wera/data"};
char	*	localName1={"/home/wera/data"};

char	*	fileSystem2={"/home/wera/weralogs"};
char	*	localName2={"/log/"}; 

char	*	fileSystem3={"/home/wera/vxworks"};
char	*	localName3={"/vxworks/"};

char	*	fileSystem4={"/home/wera/etc"};
char	*	localName4={"/etc/"};

int			ret;
int			errCnt=0;
int		*	aup_gids;

printf ("\n%s\n    %s\n    (c)%s\n", PROGRAM_NAME, PROGRAM_VERSION, PROGRAM_COPYRIGHT);

nfsAuthUnixSet(WERAHOST,U_ID,G_ID,0,aup_gids);
printf ("\nnfsAuthUnixSet done...\n");


errCnt=0;
while ((ret = nfsMount(host, fileSystem1, localName1)) == ERROR) {
       	if (ret == ERROR) {
			printf ("<%4.4d> Try to mount NFS Filesystem: %s on %s\n",errCnt++, localName1, fileSystem1);
			delay (1.0);
		} else {
			printf ("%s mounted on %s \n", localName1, fileSystem1);
		}
}

errCnt=0;
while ((ret = nfsMount(host, fileSystem2, localName2)) == ERROR) {
       	if (ret == ERROR) {
			printf ("<%4.4d> Try to mount NFS Filesystem: %s on %s\n",errCnt++, localName2, fileSystem2);
			delay (1.0);
		} else {
			printf ("%s mounted on %s \n", localName2, fileSystem2);
		}
}


errCnt=0;
while ((ret = nfsMount(host, fileSystem3, localName3)) == ERROR) {
       	if (ret == ERROR) {
			printf ("<%4.4d> Try to mount NFS Filesystem: %s on %s\n",errCnt++, localName3, fileSystem3);
			delay (1.0);
		} else {
			printf ("%s mounted on %s \n", localName3, fileSystem3);
		}
}


errCnt=0;
while ((ret = nfsMount(host, fileSystem4, localName4)) == ERROR) {
       	if (ret == ERROR) {
			printf ("<%4.4d> Try to mount NFS Filesystem: %s on %s\n",errCnt++, localName4, fileSystem4);
			delay (1.0);
		} else {
			printf ("%s mounted on %s \n", localName4, fileSystem4);
		}
}

nfsDevShow();	

}


//------------------------------------------------------------------------
// delay
//------------------------------------------------------------------------

void delay (float seconds)
{	
	taskDelay (seconds * (double) sysClkRateGet());
}


Comments to: gurgel@ifm.uni-hamburg.de (Klaus-Werner Gurgel)