SCCS-vsn: sbin/mount/mount.c 5.43
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)mount.c 5.42 (Berkeley) %G%";
+static char sccsid[] = "@(#)mount.c 5.43 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
if (verbose || fake || type)
usage();
if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0) {
if (verbose || fake || type)
usage();
if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0) {
"mount: cannot get mount information\n");
exit(1);
}
"mount: cannot get mount information\n");
exit(1);
}
if (argc == 1 && updateflg) {
if ((mntbuf = getmntpt(*argv)) == NULL) {
if (argc == 1 && updateflg) {
if ((mntbuf = getmntpt(*argv)) == NULL) {
"mount: unknown special file or file system %s.\n",
*argv);
exit(1);
"mount: unknown special file or file system %s.\n",
*argv);
exit(1);
updateflg, type, options, (char *)NULL);
} else if (argc == 1) {
if (!(fs = getfsfile(*argv)) && !(fs = getfsspec(*argv))) {
updateflg, type, options, (char *)NULL);
} else if (argc == 1) {
if (!(fs = getfsfile(*argv)) && !(fs = getfsspec(*argv))) {
"mount: unknown special file or file system %s.\n",
*argv);
exit(1);
}
if (BADTYPE(fs->fs_type)) {
"mount: unknown special file or file system %s.\n",
*argv);
exit(1);
}
if (BADTYPE(fs->fs_type)) {
"mount: %s has unknown file system type.\n", *argv);
exit(1);
}
"mount: %s has unknown file system type.\n", *argv);
exit(1);
}
goto out;
}
execve(execname, argv, envp);
goto out;
}
execve(execname, argv, envp);
- fprintf(stderr, "mount: cannot exec %s for %s: ",
+ (void) fprintf(stderr, "mount: cannot exec %s for %s: ",
execname, name);
perror((char *)NULL);
exit (1);
execname, name);
perror((char *)NULL);
exit (1);
if (!fake && mount(mnttype, name, flags, argp)) {
if (opflags & ISBGRND)
exit(1);
if (!fake && mount(mnttype, name, flags, argp)) {
if (opflags & ISBGRND)
exit(1);
- fprintf(stderr, "%s on %s: ", spec, name);
+ (void) fprintf(stderr, "%s on %s: ", spec, name);
switch (errno) {
case EMFILE:
switch (errno) {
case EMFILE:
- fprintf(stderr, "Mount table full\n");
+ (void) fprintf(stderr, "Mount table full\n");
break;
case EINVAL:
if (flags & MNT_UPDATE)
break;
case EINVAL:
if (flags & MNT_UPDATE)
- fprintf(stderr, "Specified device does %s\n",
- "not match mounted device");
+ (void) fprintf(stderr, "Specified device %s\n",
+ "does not match mounted device");
else if (mnttype == MOUNT_UFS)
else if (mnttype == MOUNT_UFS)
- fprintf(stderr, "Bogus super block\n");
+ (void) fprintf(stderr, "Bogus super block\n");
else
perror((char *)NULL);
break;
else
perror((char *)NULL);
break;
- case EOPNOTSUPP:
- fprintf(stderr, "Operation not supported\n");
- break;
default:
perror((char *)NULL);
break;
default:
perror((char *)NULL);
break;
- fprintf(stderr, "usage:\n mount %s %s\n mount %s\n mount %s\n",
+ (void) fprintf(stderr,
+ "usage:\n mount %s %s\n mount %s\n mount %s\n",
"[ -frwu ] [ -t nfs | ufs | external_type ]",
"[ -o options ] special node",
"[ -afrwu ] [ -t nfs | ufs | external_type ]",
"[ -frwu ] [ -t nfs | ufs | external_type ]",
"[ -o options ] special node",
"[ -afrwu ] [ -t nfs | ufs | external_type ]",
+exclusive(a, b)
+ char *a, *b;
+{
+
+ (void) fprintf(stderr, "mount: Options %s, %s mutually exclusive\n",
+ a, b);
+ exit(1);
+}
+
/*
* Handle the getoption arg.
* Essentially update "opflags", "retrycnt" and "nfsargs"
*/
getnfsopts(optarg, nfsargsp, opflagsp, retrycntp)
char *optarg;
/*
* Handle the getoption arg.
* Essentially update "opflags", "retrycnt" and "nfsargs"
*/
getnfsopts(optarg, nfsargsp, opflagsp, retrycntp)
char *optarg;
- struct nfs_args *nfsargsp;
+ register struct nfs_args *nfsargsp;
int *opflagsp;
int *retrycntp;
{
int *opflagsp;
int *retrycntp;
{
- cp = optarg;
- while (cp != NULL && *cp != '\0') {
+ for (cp = optarg; cp != NULL && *cp != '\0'; cp = nextcp) {
if ((nextcp = index(cp, ',')) != NULL)
*nextcp++ = '\0';
if ((nump = index(cp, '=')) != NULL) {
if ((nextcp = index(cp, ',')) != NULL)
*nextcp++ = '\0';
if ((nump = index(cp, '=')) != NULL) {
if (!strcmp(cp, "bg")) {
*opflagsp |= BGRND;
} else if (!strcmp(cp, "soft")) {
if (!strcmp(cp, "bg")) {
*opflagsp |= BGRND;
} else if (!strcmp(cp, "soft")) {
- if (nfsargsp->flags & NFSMNT_SPONGY) {
- fprintf(stderr,
- "Options soft, spongy mutually exclusive\n");
- exit(1);
- }
+ if (nfsargsp->flags & NFSMNT_SPONGY)
+ exclusive("soft, spongy");
nfsargsp->flags |= NFSMNT_SOFT;
} else if (!strcmp(cp, "spongy")) {
nfsargsp->flags |= NFSMNT_SOFT;
} else if (!strcmp(cp, "spongy")) {
- if (nfsargsp->flags & NFSMNT_SOFT) {
- fprintf(stderr,
- "Options soft, spongy mutually exclusive\n");
- exit(1);
- }
+ if (nfsargsp->flags & NFSMNT_SOFT)
+ exclusive("soft, spongy");
nfsargsp->flags |= NFSMNT_SPONGY;
} else if (!strcmp(cp, "compress")) {
nfsargsp->flags |= NFSMNT_COMPRESS;
nfsargsp->flags |= NFSMNT_SPONGY;
} else if (!strcmp(cp, "compress")) {
nfsargsp->flags |= NFSMNT_COMPRESS;
nfsargsp->retrans = num;
nfsargsp->flags |= NFSMNT_RETRANS;
}
nfsargsp->retrans = num;
nfsargsp->flags |= NFSMNT_RETRANS;
}
}
if (nfsargsp->sotype == SOCK_DGRAM) {
if (nfsargsp->rsize > NFS_MAXDGRAMDATA)
}
if (nfsargsp->sotype == SOCK_DGRAM) {
if (nfsargsp->rsize > NFS_MAXDGRAMDATA)
hostp = buf;
fsp = delimp + 1;
} else {
hostp = buf;
fsp = delimp + 1;
} else {
- fprintf(stderr,
- "No <host>:<dirpath> or <dirpath>@<host> spec\n");
+ (void) fprintf(stderr,
+ "mount: No <host>:<dirpath> or <dirpath>@<host> spec\n");
return (0);
}
*delimp = '\0';
if ((hp = gethostbyname(hostp)) == NULL) {
return (0);
}
*delimp = '\0';
if ((hp = gethostbyname(hostp)) == NULL) {
- fprintf(stderr, "Can't get net id for host\n");
+ (void) fprintf(stderr, "mount: Can't get net id for host\n");
return (0);
}
bcopy(hp->h_addr, (caddr_t)&saddr.sin_addr, hp->h_length);
return (0);
}
bcopy(hp->h_addr, (caddr_t)&saddr.sin_addr, hp->h_length);
if (nfhret.stat) {
if (opflags & ISBGRND)
exit(1);
if (nfhret.stat) {
if (opflags & ISBGRND)
exit(1);
- fprintf(stderr, "Mount RPC error on %s: ", spec);
+ (void) fprintf(stderr, "Mount RPC error on %s: ", spec);
errno = nfhret.stat;
perror((char *)NULL);
return (0);
errno = nfhret.stat;
perror((char *)NULL);
return (0);