Regularize error reporting of mount_* commands for failure of mount(2)
to the form: mount_xxx: dev on dir: reason for failure
This commit is contained in:
parent
c951c272b0
commit
8847804fc3
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mount_ados.c,v 1.8 1998/03/01 02:20:11 fvdl Exp $ */
|
||||
/* $NetBSD: mount_ados.c,v 1.9 1999/06/25 19:28:35 perseant Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Christopher G. Demetriou
|
||||
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: mount_ados.c,v 1.8 1998/03/01 02:20:11 fvdl Exp $");
|
||||
__RCSID("$NetBSD: mount_ados.c,v 1.9 1999/06/25 19:28:35 perseant Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
@ -134,7 +134,7 @@ main(argc, argv)
|
|||
}
|
||||
|
||||
if (mount(MOUNT_ADOSFS, dir, mntflags, &args) < 0)
|
||||
err(1, "mount");
|
||||
err(1, "%s on %s", dev, dir);
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mount_cd9660.c,v 1.7 1999/05/28 10:10:25 mjl Exp $ */
|
||||
/* $NetBSD: mount_cd9660.c,v 1.8 1999/06/25 19:28:35 perseant Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
|
@ -50,7 +50,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993, 1994\n\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)mount_cd9660.c 8.7 (Berkeley) 5/1/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: mount_cd9660.c,v 1.7 1999/05/28 10:10:25 mjl Exp $");
|
||||
__RCSID("$NetBSD: mount_cd9660.c,v 1.8 1999/06/25 19:28:35 perseant Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -124,7 +124,7 @@ main(argc, argv)
|
|||
args.flags = opts;
|
||||
|
||||
if (mount(MOUNT_CD9660, dir, mntflags, &args) < 0)
|
||||
err(1, "%s", "");
|
||||
err(1, "%s on %s", dev, dir);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mount_fdesc.c,v 1.9 1997/09/16 12:26:56 lukem Exp $ */
|
||||
/* $NetBSD: mount_fdesc.c,v 1.10 1999/06/25 19:28:36 perseant Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1992 Jan-Simon Pendry
|
||||
|
@ -47,7 +47,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993, 1994\n\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)mount_fdesc.c 8.3 (Berkeley) 4/26/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: mount_fdesc.c,v 1.9 1997/09/16 12:26:56 lukem Exp $");
|
||||
__RCSID("$NetBSD: mount_fdesc.c,v 1.10 1999/06/25 19:28:36 perseant Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -94,7 +94,7 @@ main(argc, argv)
|
|||
usage();
|
||||
|
||||
if (mount(MOUNT_FDESC, argv[1], mntflags, NULL))
|
||||
err(1, "%s", "");
|
||||
err(1, "fdesc on %s", argv[1]);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mount_filecore.c,v 1.1 1998/08/14 03:38:51 mark Exp $ */
|
||||
/* $NetBSD: mount_filecore.c,v 1.2 1999/06/25 19:28:36 perseant Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 Andrew McMurry
|
||||
|
@ -138,7 +138,7 @@ main(argc, argv)
|
|||
args.flags = opts;
|
||||
|
||||
if (mount(MOUNT_FILECORE, dir, mntflags, &args) < 0)
|
||||
err(1, "%s", "");
|
||||
err(1, "%s on %s", dev, dir);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mount_kernfs.c,v 1.10 1997/09/16 12:29:16 lukem Exp $ */
|
||||
/* $NetBSD: mount_kernfs.c,v 1.11 1999/06/25 19:28:36 perseant Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1992 Jan-Simon Pendry
|
||||
|
@ -47,7 +47,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993, 1994\n\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)mount_kernfs.c 8.3 (Berkeley) 5/4/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: mount_kernfs.c,v 1.10 1997/09/16 12:29:16 lukem Exp $");
|
||||
__RCSID("$NetBSD: mount_kernfs.c,v 1.11 1999/06/25 19:28:36 perseant Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -94,7 +94,7 @@ main(argc, argv)
|
|||
usage();
|
||||
|
||||
if (mount(MOUNT_KERNFS, argv[1], mntflags, NULL))
|
||||
err(1, "%s", "");
|
||||
err(1, "kernfs on %s", argv[1]);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mount_lfs.c,v 1.7 1998/03/01 02:20:41 fvdl Exp $ */
|
||||
/* $NetBSD: mount_lfs.c,v 1.8 1999/06/25 19:28:36 perseant Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993, 1994
|
||||
|
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1993, 1994\n\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)mount_lfs.c 8.4 (Berkeley) 4/26/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: mount_lfs.c,v 1.7 1998/03/01 02:20:41 fvdl Exp $");
|
||||
__RCSID("$NetBSD: mount_lfs.c,v 1.8 1999/06/25 19:28:36 perseant Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -53,6 +53,7 @@ __RCSID("$NetBSD: mount_lfs.c,v 1.7 1998/03/01 02:20:41 fvdl Exp $");
|
|||
#include <ufs/ufs/ufsmount.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -81,6 +82,7 @@ main(argc, argv)
|
|||
struct ufs_args args;
|
||||
int ch, mntflags, noclean;
|
||||
char *fs_name, *options;
|
||||
const char *errcause;
|
||||
|
||||
options = NULL;
|
||||
mntflags = noclean = 0;
|
||||
|
@ -108,7 +110,7 @@ main(argc, argv)
|
|||
if (argc != 2)
|
||||
usage();
|
||||
|
||||
args.fspec = argv[0]; /* the name of the device file */
|
||||
args.fspec = argv[0]; /* the name of the device file */
|
||||
fs_name = argv[1]; /* the mount point */
|
||||
|
||||
#define DEFAULT_ROOTUID -2
|
||||
|
@ -118,8 +120,24 @@ main(argc, argv)
|
|||
else
|
||||
args.export.ex_flags = 0;
|
||||
|
||||
if (mount(MOUNT_LFS, fs_name, mntflags, &args))
|
||||
err(1, "%s", "");
|
||||
if (mount(MOUNT_LFS, fs_name, mntflags, &args)) {
|
||||
switch (errno) {
|
||||
case EMFILE:
|
||||
errcause = "mount table full";
|
||||
break;
|
||||
case EINVAL:
|
||||
if (mntflags & MNT_UPDATE)
|
||||
errcause =
|
||||
"specified device does not match mounted device";
|
||||
else
|
||||
errcause = "incorrect super block";
|
||||
break;
|
||||
default:
|
||||
errcause = strerror(errno);
|
||||
break;
|
||||
}
|
||||
errx(1, "%s on %s: %s", args.fspec, fs_name, errcause);
|
||||
}
|
||||
|
||||
if (!noclean)
|
||||
invoke_cleaner(fs_name);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mount_msdos.c,v 1.19 1998/03/01 02:20:45 fvdl Exp $ */
|
||||
/* $NetBSD: mount_msdos.c,v 1.20 1999/06/25 19:28:36 perseant Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Christopher G. Demetriou
|
||||
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: mount_msdos.c,v 1.19 1998/03/01 02:20:45 fvdl Exp $");
|
||||
__RCSID("$NetBSD: mount_msdos.c,v 1.20 1999/06/25 19:28:36 perseant Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
@ -146,7 +146,7 @@ main(argc, argv)
|
|||
}
|
||||
|
||||
if (mount(MOUNT_MSDOS, dir, mntflags, &args) < 0)
|
||||
err(1, "mount");
|
||||
err(1, "%s on %s", dev, dir);
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mount_nfs.c,v 1.22 1998/05/14 07:44:09 tron Exp $ */
|
||||
/* $NetBSD: mount_nfs.c,v 1.23 1999/06/25 19:28:37 perseant Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
|
@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993, 1994\n\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)mount_nfs.c 8.11 (Berkeley) 5/4/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: mount_nfs.c,v 1.22 1998/05/14 07:44:09 tron Exp $");
|
||||
__RCSID("$NetBSD: mount_nfs.c,v 1.23 1999/06/25 19:28:37 perseant Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -205,7 +205,7 @@ main(argc, argv)
|
|||
struct nfs_args nfsargs;
|
||||
struct nfsd_cargs ncd;
|
||||
int mntflags, altflags, i, nfssvc_flag, num;
|
||||
char *name, *p, *spec;
|
||||
char *name, *p, *spec, *ospec;
|
||||
#ifdef NFSKERB
|
||||
uid_t last_ruid;
|
||||
|
||||
|
@ -431,11 +431,14 @@ main(argc, argv)
|
|||
|
||||
spec = *argv++;
|
||||
name = *argv;
|
||||
if((ospec = strdup(spec))==NULL) {
|
||||
err(1,"strdup");
|
||||
}
|
||||
|
||||
if (!getnfsargs(spec, nfsargsp))
|
||||
exit(1);
|
||||
if (mount(MOUNT_NFS, name, mntflags, nfsargsp))
|
||||
err(1, "%s", name);
|
||||
err(1, "%s on %s", ospec, name);
|
||||
if (nfsargsp->flags & (NFSMNT_NQNFS | NFSMNT_KERB)) {
|
||||
if ((opflags & ISBGRND) == 0) {
|
||||
if ((i = fork()) != 0) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mount_ntfs.c,v 1.2 1999/05/06 16:08:55 christos Exp $ */
|
||||
/* $NetBSD: mount_ntfs.c,v 1.3 1999/06/25 19:28:37 perseant Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Christopher G. Demetriou
|
||||
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: mount_ntfs.c,v 1.2 1999/05/06 16:08:55 christos Exp $");
|
||||
__RCSID("$NetBSD: mount_ntfs.c,v 1.3 1999/06/25 19:28:37 perseant Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
@ -187,7 +187,7 @@ main(argc, argv)
|
|||
#else
|
||||
if (mount(MOUNT_NTFS, dir, mntflags, &args) < 0)
|
||||
#endif
|
||||
err(EX_OSERR, "%s", dev);
|
||||
err(EX_OSERR, "%s on %s", dev, dir);
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mount_null.c,v 1.5 1997/09/16 12:31:02 lukem Exp $ */
|
||||
/* $NetBSD: mount_null.c,v 1.6 1999/06/25 19:28:37 perseant Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
|
@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993, 1994\n\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)mount_null.c 8.6 (Berkeley) 4/26/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: mount_null.c,v 1.5 1997/09/16 12:31:02 lukem Exp $");
|
||||
__RCSID("$NetBSD: mount_null.c,v 1.6 1999/06/25 19:28:37 perseant Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -106,7 +106,7 @@ main(argc, argv)
|
|||
args.target = target;
|
||||
|
||||
if (mount(MOUNT_NULL, argv[1], mntflags, &args))
|
||||
err(1, "%s", "");
|
||||
err(1, "%s on %s", target, argv[1]);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mount_procfs.c,v 1.9 1997/09/16 12:32:04 lukem Exp $ */
|
||||
/* $NetBSD: mount_procfs.c,v 1.10 1999/06/25 19:28:37 perseant Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1992, 1993 Jan-Simon Pendry
|
||||
|
@ -47,7 +47,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993, 1994\n\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)mount_procfs.c 8.4 (Berkeley) 4/26/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: mount_procfs.c,v 1.9 1997/09/16 12:32:04 lukem Exp $");
|
||||
__RCSID("$NetBSD: mount_procfs.c,v 1.10 1999/06/25 19:28:37 perseant Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -94,7 +94,7 @@ main(argc, argv)
|
|||
usage();
|
||||
|
||||
if (mount(MOUNT_PROCFS, argv[1], mntflags, NULL))
|
||||
err(1, "%s", "");
|
||||
err(1, "procfs on %s", argv[1]);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mount_umap.c,v 1.8 1999/06/01 19:16:49 perseant Exp $ */
|
||||
/* $NetBSD: mount_umap.c,v 1.9 1999/06/25 19:28:37 perseant Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
|
@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993, 1994\n\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)mount_umap.c 8.5 (Berkeley) 4/26/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: mount_umap.c,v 1.8 1999/06/01 19:16:49 perseant Exp $");
|
||||
__RCSID("$NetBSD: mount_umap.c,v 1.9 1999/06/25 19:28:37 perseant Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -230,7 +230,7 @@ main(argc, argv)
|
|||
args.gmapdata = gmapdata;
|
||||
|
||||
if (mount(MOUNT_UMAP, argv[1], mntflags, &args))
|
||||
err(1, "%s", "");
|
||||
err(1, "%s on %s", source, argv[1]);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mount_union.c,v 1.5 1997/09/16 12:32:54 lukem Exp $ */
|
||||
/* $NetBSD: mount_union.c,v 1.6 1999/06/25 19:28:38 perseant Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
|
@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993, 1994\n\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)mount_union.c 8.6 (Berkeley) 4/26/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: mount_union.c,v 1.5 1997/09/16 12:32:54 lukem Exp $");
|
||||
__RCSID("$NetBSD: mount_union.c,v 1.6 1999/06/25 19:28:38 perseant Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -117,7 +117,7 @@ main(argc, argv)
|
|||
args.target = target;
|
||||
|
||||
if (mount(MOUNT_UNION, argv[1], mntflags, &args))
|
||||
err(1, "%s", "");
|
||||
err(1, "%s on %s", target, argv[1]);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue