mount_nfs.1m (2010 09)

m
mount_nfs(1M) mount_nfs(1M)
Note: Apart from the above mentioned special scenarios, the extension structure need not be used.
Example: Mount exported
nfsserver:/share1
using NFS v3 under client’s
/test:
/* Vairable definitions */
struct nfs_args nfsData;
struct netconfig *netConfig;
struct knetconfig knetConfig;
struct stat statBuf;
struct sockaddr_in addr;
struct netbuf nb;
nfs_fh3 fh3p;
#define NFS_MAXDATA 32768
{
...
/* Get the netconfig entry for tcp */
if (!(netConfig = getnetconfigent("tcp")))
return (errno);
/* Fill up necessary knetconfig structure */
knetConfig.knc_semantics = netConfig->nc_semantics;
knetConfig.knc_protofmly = netConfig->nc_protofmly;
knetConfig.knc_proto = netConfig->nc_proto;
if (stat(netConfig->nc_device, &statBuf) == -1)
return(errno);
knetConfig.knc_rdev = statBuf.st_rdev;
/* Assemble nfs_args structure */
memset(&nfsData, 0, sizeof(nfsData));
/* Fill up IP address & port */
addr.sin_family = AF_INET;
addr.sin_port = 2049;
addr.sin_addr.s_addr = htonl(0xC0A80115);
nb.maxlen = sizeof(addr);
nb.len = sizeof(addr);
nb.buf = &addr;
/* Get the file handle from the mountd running on the remote machine */
getfh();
/* File handle of the mount point */
nfsData.fh = &fh3p;
/* NFS read/write data size */
nfsData.wsize = nfsData.rsize = NFS_MAXDATA;
nfsData.addr = &nb;
nfsData.knconf = &knetConfig;
/* The host name of the remote server */
nfsData.hostname = "nfsserver";
/* The remote machine’s exported path */
nfsData.fsname = "nfsserver:/share1";
nfsData.flags = NFSMNT_INT | NFSMNT_KNCONF | NFSMNT_HOSTNAME |
NFSMNT_WSIZE | NFSMNT_RSIZE | NFSMNT_NOAC |
NFSMNT_FSNAME;
if (mount ("/share1", "/test", MS_DATA | MS_NOSUID, "nfs3",
(caddr_t)&nfsData, sizeof(nfsData)) != 0)
perror("NFS mount failed");
...
HP-UX 11i Version 3: September 2010 7 Hewlett-Packard Company 7