Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-4]: src/sbin/mount_lfs Pull up revision 1.8:



details:   https://anonhg.NetBSD.org/src/rev/9047704acbe1
branches:  netbsd-1-4
changeset: 469337:9047704acbe1
user:      he <he%NetBSD.org@localhost>
date:      Sun Sep 05 15:12:41 1999 +0000

description:
Pull up revision 1.8:
  Regularize error reporting of mount_* commands for failure of
  mount(2) to the form "mount_xxx: dev on dir: reason for failure"
  (as opposed to the old "mount_xxx: : reason for failure").
  (perseant)

diffstat:

 sbin/mount_lfs/mount_lfs.c |  28 +++++++++++++++++++++++-----
 1 files changed, 23 insertions(+), 5 deletions(-)

diffs (70 lines):

diff -r fafc611ccd74 -r 9047704acbe1 sbin/mount_lfs/mount_lfs.c
--- a/sbin/mount_lfs/mount_lfs.c        Sun Sep 05 15:09:54 1999 +0000
+++ b/sbin/mount_lfs/mount_lfs.c        Sun Sep 05 15:12:41 1999 +0000
@@ -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.7.2.1 1999/09/05 15:12:41 he Exp $     */
 
 /*-
  * Copyright (c) 1993, 1994
@@ -43,7 +43,7 @@
 #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.7.2.1 1999/09/05 15:12:41 he Exp $");
 #endif
 #endif /* not lint */
 
@@ -53,6 +53,7 @@
 #include <ufs/ufs/ufsmount.h>
 
 #include <err.h>
+#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -81,6 +82,7 @@
        struct ufs_args args;
        int ch, mntflags, noclean;
        char *fs_name, *options;
+       const char *errcause;
 
        options = NULL;
        mntflags = noclean = 0;
@@ -108,7 +110,7 @@
        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 @@
        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);



Home | Main Index | Thread Index | Old Index