Source-Changes-HG archive

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

[src/trunk]: src Add a new member to struct vfsstat and grow the unused members



details:   https://anonhg.NetBSD.org/src/rev/8524cadaa957
branches:  trunk
changeset: 845207:8524cadaa957
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Sep 22 22:59:37 2019 +0000

description:
Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=

diffstat:

 bin/df/df.c                                 |   56 +-------
 distrib/sets/lists/base/shl.mi              |    6 +-
 distrib/sets/lists/debug/shl.mi             |    6 +-
 distrib/sets/lists/modules/ad.arm           |    4 +-
 distrib/sets/lists/modules/ad.mips          |    4 +-
 distrib/sets/lists/modules/md.amd64         |    4 +-
 distrib/sets/lists/modules/md.sparc64       |    4 +-
 distrib/sets/lists/modules/mi               |    4 +-
 lib/libc/compat/gen/Makefile.inc            |    5 +-
 lib/libc/compat/gen/compat___getmntinfo13.c |   84 +++++++++++++
 lib/libc/compat/gen/compat_opendir.c        |    4 +-
 lib/libc/compat/sys/Makefile.inc            |    8 +-
 lib/libc/compat/sys/compat___fhstatvfs140.c |   59 +++++++++
 lib/libc/compat/sys/compat___fhstatvfs40.c  |   58 +++++++++
 lib/libc/compat/sys/compat_fhstatvfs.c      |   23 +-
 lib/libc/compat/sys/compat_fhstatvfs1.c     |   20 +-
 lib/libc/compat/sys/compat_statfs.c         |   18 +-
 lib/libc/compat/sys/compat_statvfs.c        |  121 +++++++++++++++++++
 lib/libc/include/namespace.h                |    5 +-
 lib/libc/shlib_version                      |    4 +-
 lib/libc/sys/Makefile.inc                   |   10 +-
 lib/libc/sys/statvfs.c                      |   18 +--
 share/man/man5/statvfs.5                    |   57 ++++----
 sys/compat/common/compat_90_mod.c           |   83 +++++++++++++
 sys/compat/common/compat_mod.h              |   11 +-
 sys/compat/common/files.common              |   10 +-
 sys/compat/common/vfs_syscalls_20.c         |   78 +++---------
 sys/compat/common/vfs_syscalls_30.c         |   26 ++-
 sys/compat/common/vfs_syscalls_90.c         |  163 ++++++++++++++++++++++++++
 sys/compat/netbsd32/files.netbsd32          |    3 +-
 sys/compat/netbsd32/netbsd32.h              |   35 +++++-
 sys/compat/netbsd32/netbsd32_compat_90.c    |  173 ++++++++++++++++++++++++++++
 sys/compat/netbsd32/netbsd32_conv.h         |   45 ++++++-
 sys/compat/netbsd32/netbsd32_fs.c           |   16 +-
 sys/compat/netbsd32/syscalls.conf           |    4 +-
 sys/compat/netbsd32/syscalls.master         |   32 +++-
 sys/conf/compat_netbsd90.config             |    9 +
 sys/conf/files                              |    5 +-
 sys/kern/init_sysent.c                      |   86 ++++++++-----
 sys/kern/syscalls.conf                      |    4 +-
 sys/kern/syscalls.master                    |   34 +++-
 sys/kern/vfs_subr.c                         |    6 +-
 sys/kern/vfs_syscalls.c                     |   13 +-
 sys/miscfs/specfs/spec_vnops.c              |   14 +-
 sys/modules/Makefile                        |    5 +-
 sys/modules/compat_90/Makefile              |   14 ++
 sys/modules/compat_netbsd32_90/Makefile     |   15 ++
 sys/sys/param.h                             |    4 +-
 sys/sys/statvfs.h                           |   53 ++++----
 usr.bin/ktruss/dump.c                       |    6 +-
 50 files changed, 1197 insertions(+), 332 deletions(-)

diffs (truncated from 2627 to 300 lines):

diff -r 9be3f82f6c4d -r 8524cadaa957 bin/df/df.c
--- a/bin/df/df.c       Sun Sep 22 19:51:18 2019 +0000
+++ b/bin/df/df.c       Sun Sep 22 22:59:37 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: df.c,v 1.94 2019/09/18 20:14:44 christos Exp $ */
+/*     $NetBSD: df.c,v 1.95 2019/09/22 22:59:37 christos Exp $ */
 
 /*
  * Copyright (c) 1980, 1990, 1993, 1994
@@ -45,15 +45,13 @@
 #if 0
 static char sccsid[] = "@(#)df.c       8.7 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: df.c,v 1.94 2019/09/18 20:14:44 christos Exp $");
+__RCSID("$NetBSD: df.c,v 1.95 2019/09/22 22:59:37 christos Exp $");
 #endif
 #endif /* not lint */
 
 #include <sys/param.h>
 #include <sys/stat.h>
 #include <sys/mount.h>
-#include <sys/disk.h>
-#include <sys/ioctl.h>
 
 #include <assert.h>
 #include <err.h>
@@ -69,13 +67,11 @@
 #include <util.h>
 
 static char    *getmntpt(const char *);
-static void     prtstat(const struct dkwedge_info *, const struct statvfs *,
-    int);
+static void     prtstat(const struct statvfs *, int);
 static int      selected(const char *, size_t);
 static void     maketypelist(char *);
 static size_t   regetmntinfo(struct statvfs **, size_t);
 __dead static void usage(void);
-static struct dkwedge_info *getwedgeinfo(const struct statvfs *, size_t);
 static void     prthumanval(int64_t, const char *);
 static void     prthuman(const struct statvfs *, int64_t, int64_t);
 
@@ -88,7 +84,6 @@
 {
        struct stat stbuf;
        struct statvfs *mntbuf;
-       struct dkwedge_info *wedge_info;
        int ch, maxwidth, width;
        size_t i, mntcount;
        char *mntpt;
@@ -208,18 +203,15 @@
                }
        }
 
-       wedge_info = Wflag ? getwedgeinfo(mntbuf, mntcount) : NULL;
-
        maxwidth = 0;
        for (i = 0; i < mntcount; i++) {
-               width = (int)strlen(Wflag && wedge_info[i].dkw_wname[0] ?
-                   (const char *)wedge_info[i].dkw_wname :
-                   mntbuf[i].f_mntfromname);
+               width = (int)strlen(Wflag && mntbuf[i].f_mntfromlabel[0] ?
+                   mntbuf[i].f_mntfromlabel : mntbuf[i].f_mntfromname);
                if (width > maxwidth)
                        maxwidth = width;
        }
        for (i = 0; i < mntcount; i++)
-               prtstat(&wedge_info[i], &mntbuf[i], maxwidth);
+               prtstat(&mntbuf[i], maxwidth);
        return 0;
 }
 
@@ -293,33 +285,6 @@
        av[i] = NULL;
 }
 
-static struct dkwedge_info *
-getwedgeinfo(const struct statvfs *mntbuf, size_t mntcount)
-{
-       struct dkwedge_info *wi = calloc(mntcount, sizeof(*wi));
-       char buf[1024];
-
-       if (wi == NULL)
-               err(EXIT_FAILURE, "can't allocate wedge info array");
-       
-       for (size_t i = 0; i < mntcount; i++) {
-               const char *dname = mntbuf[i].f_mntfromname;
-               const char *rdn = strrchr(dname, '/');
-               if (rdn == NULL) {
-                       continue;
-               }
-               rdn++;
-               int fd = opendisk(rdn, O_RDONLY, buf, sizeof(buf), false);
-               if (fd == -1)
-                       err(EXIT_FAILURE, "opendisk on `%s' failed", rdn);
-               if (ioctl(fd, DIOCGWEDGEINFO, &wi[i]) == -1) {
-                       warn("DIOCGWEDGEINFO for `%s' failed", buf);
-               }
-               close(fd);
-       }
-       return wi;
-}
-
 /*
  * Make a pass over the filesystem info in ``mntbuf'' filtering out
  * filesystem types not in ``fsmask'' and possibly re-stating to get
@@ -396,8 +361,7 @@
  * Print out status about a filesystem.
  */
 static void
-prtstat(const struct dkwedge_info *dkwp, const struct statvfs *sfsp,
-    int maxwidth)
+prtstat(const struct statvfs *sfsp, int maxwidth)
 {
        static long blocksize;
        static int headerlen, timesthrough;
@@ -407,11 +371,11 @@
        int64_t used, availblks, inodes;
        int64_t bavail;
        char pb[64];
-       char mntfromname[sizeof(sfsp->f_mntfromname)];
+       char mntfromname[sizeof(sfsp->f_mntfromname) + 10];
 
-       if (Wflag && dkwp->dkw_wname[0]) {
+       if (Wflag && sfsp->f_mntfromlabel[0]) {
                snprintf(mntfromname, sizeof(mntfromname), "NAME=%s",
-                   (const char *)dkwp->dkw_wname);
+                   sfsp->f_mntfromlabel);
        } else {
                strlcpy(mntfromname, sfsp->f_mntfromname, sizeof(mntfromname));
        }
diff -r 9be3f82f6c4d -r 8524cadaa957 distrib/sets/lists/base/shl.mi
--- a/distrib/sets/lists/base/shl.mi    Sun Sep 22 19:51:18 2019 +0000
+++ b/distrib/sets/lists/base/shl.mi    Sun Sep 22 22:59:37 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.871 2019/09/22 18:45:19 brad Exp $
+# $NetBSD: shl.mi,v 1.872 2019/09/22 22:59:37 christos Exp $
 #
 # Note:        Don't delete entries from here - mark them as "obsolete" instead,
 #      unless otherwise stated below.
@@ -21,7 +21,7 @@
 ./lib/libblacklist.so.0.0                      base-sys-shlib          dynamicroot
 ./lib/libc.so                                  base-sys-shlib          dynamicroot
 ./lib/libc.so.12                               base-sys-shlib          dynamicroot
-./lib/libc.so.12.213                           base-sys-shlib          dynamicroot
+./lib/libc.so.12.214                           base-sys-shlib          dynamicroot
 ./lib/libcrypt.so                              base-sys-shlib          dynamicroot
 ./lib/libcrypt.so.1                            base-sys-shlib          dynamicroot
 ./lib/libcrypt.so.1.0                          base-sys-shlib          dynamicroot
@@ -245,7 +245,7 @@
 ./usr/lib/libc++.so.1.0                                base-sys-shlib          compatfile,libcxx
 ./usr/lib/libc.so                              base-sys-shlib          compatfile
 ./usr/lib/libc.so.12                           base-sys-shlib          compatfile
-./usr/lib/libc.so.12.213                       base-sys-shlib          compatfile
+./usr/lib/libc.so.12.214                       base-sys-shlib          compatfile
 ./usr/lib/libcdk.so                            base-obsolete           compatfile,obsolete
 ./usr/lib/libcom_err.so                                base-krb5-shlib         compatfile,kerberos
 ./usr/lib/libcom_err.so.8                      base-krb5-shlib         compatfile,kerberos
diff -r 9be3f82f6c4d -r 8524cadaa957 distrib/sets/lists/debug/shl.mi
--- a/distrib/sets/lists/debug/shl.mi   Sun Sep 22 19:51:18 2019 +0000
+++ b/distrib/sets/lists/debug/shl.mi   Sun Sep 22 22:59:37 2019 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: shl.mi,v 1.228 2019/09/06 11:12:06 christos Exp $
+# $NetBSD: shl.mi,v 1.229 2019/09/22 22:59:37 christos Exp $
 ./usr/lib/libbfd_g.a                                           comp-c-debuglib debuglib,compatfile,binutils
 ./usr/libdata/debug/lib                                                base-sys-usr    debug,dynamicroot,compatdir
 ./usr/libdata/debug/lib/libblacklist.so.0.0.debug              comp-sys-debug  debug,dynamicroot
-./usr/libdata/debug/lib/libc.so.12.213.debug                   comp-sys-debug  debug,dynamicroot
+./usr/libdata/debug/lib/libc.so.12.214.debug                   comp-sys-debug  debug,dynamicroot
 ./usr/libdata/debug/lib/libcrypt.so.1.0.debug                  comp-sys-debug  debug,dynamicroot
 ./usr/libdata/debug/lib/libcrypto.so.12.0.debug                        comp-sys-debug  debug,dynamicroot,openssl=10
 ./usr/libdata/debug/lib/libcrypto.so.14.0.debug                        comp-sys-debug  debug,dynamicroot,openssl=11
@@ -71,7 +71,7 @@
 ./usr/libdata/debug/usr/lib/libbsdmalloc.so.0.0.debug          comp-sys-debug  debug,compatfile
 ./usr/libdata/debug/usr/lib/libbz2.so.1.1.debug                        comp-sys-debug  debug,compatfile
 ./usr/libdata/debug/usr/lib/libc++.so.1.0.debug                        comp-sys-debug  debug,compatfile,libcxx
-./usr/libdata/debug/usr/lib/libc.so.12.213.debug               comp-sys-debug  debug,compatfile
+./usr/libdata/debug/usr/lib/libc.so.12.214.debug               comp-sys-debug  debug,compatfile
 ./usr/libdata/debug/usr/lib/libcom_err.so.8.0.debug            comp-krb5-debug debug,compatfile,kerberos
 ./usr/libdata/debug/usr/lib/libcrypt.so.1.0.debug              comp-sys-debug  debug,compatfile
 ./usr/libdata/debug/usr/lib/libcrypto.so.12.0.debug            comp-crypto-debug       debug,compatfile,openssl=10
diff -r 9be3f82f6c4d -r 8524cadaa957 distrib/sets/lists/modules/ad.arm
--- a/distrib/sets/lists/modules/ad.arm Sun Sep 22 19:51:18 2019 +0000
+++ b/distrib/sets/lists/modules/ad.arm Sun Sep 22 22:59:37 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: ad.arm,v 1.12 2019/02/03 08:02:58 pgoyette Exp $
+# $NetBSD: ad.arm,v 1.13 2019/09/22 22:59:37 christos Exp $
 
 ./@MODULEDIR@/compat_netbsd32                  base-kernel-modules     kmod
 ./@MODULEDIR@/compat_netbsd32/compat_netbsd32.kmod base-kernel-modules kmod
@@ -26,6 +26,8 @@
 ./@MODULEDIR@/compat_netbsd32_60/compat_netbsd32_60.kmod base-kernel-modules   kmod
 ./@MODULEDIR@/compat_netbsd32_80               base-kernel-modules     kmod
 ./@MODULEDIR@/compat_netbsd32_80/compat_netbsd32_80.kmod base-kernel-modules   kmod
+./@MODULEDIR@/compat_netbsd32_90               base-kernel-modules     kmod
+./@MODULEDIR@/compat_netbsd32_90/compat_netbsd32_90.kmod base-kernel-modules   kmod
 ./@MODULEDIR@/compat_netbsd32_43               base-kernel-modules     kmod
 ./@MODULEDIR@/compat_netbsd32_43/compat_netbsd32_43.kmod base-kernel-modules   kmod
 ./@MODULEDIR@/compat_netbsd32_mqueue           base-kernel-modules     kmod
diff -r 9be3f82f6c4d -r 8524cadaa957 distrib/sets/lists/modules/ad.mips
--- a/distrib/sets/lists/modules/ad.mips        Sun Sep 22 19:51:18 2019 +0000
+++ b/distrib/sets/lists/modules/ad.mips        Sun Sep 22 22:59:37 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: ad.mips,v 1.12 2019/02/03 08:02:58 pgoyette Exp $
+# $NetBSD: ad.mips,v 1.13 2019/09/22 22:59:37 christos Exp $
 ./@MODULEDIR@/compat_netbsd32                  base-kernel-modules     kmod,arch64,nocompatmodules
 ./@MODULEDIR@/compat_netbsd32/compat_netbsd32.kmod base-kernel-modules kmod,arch64,nocompatmodules
 ./@MODULEDIR@/compat_netbsd32_09               base-kernel-modules     kmod,arch64,nocompatmodules
@@ -25,6 +25,8 @@
 ./@MODULEDIR@/compat_netbsd32_60/compat_netbsd32_60.kmod base-kernel-modules   kmod,arch64,nocompatmodules
 ./@MODULEDIR@/compat_netbsd32_80               base-kernel-modules     kmod,arch64,nocompatmodules
 ./@MODULEDIR@/compat_netbsd32_80/compat_netbsd32_80.kmod base-kernel-modules   kmod,arch64,nocompatmodules
+./@MODULEDIR@/compat_netbsd32_90               base-kernel-modules     kmod,arch64,nocompatmodules
+./@MODULEDIR@/compat_netbsd32_90/compat_netbsd32_90.kmod base-kernel-modules   kmod,arch64,nocompatmodules
 ./@MODULEDIR@/compat_netbsd32_43               base-kernel-modules     kmod,arch64,nocompatmodules
 ./@MODULEDIR@/compat_netbsd32_43/compat_netbsd32_43.kmod base-kernel-modules   kmod,arch64,nocompatmodules
 ./@MODULEDIR@/compat_netbsd32_mqueue                   base-kernel-modules     kmod,arch64,nocompatmodules
diff -r 9be3f82f6c4d -r 8524cadaa957 distrib/sets/lists/modules/md.amd64
--- a/distrib/sets/lists/modules/md.amd64       Sun Sep 22 19:51:18 2019 +0000
+++ b/distrib/sets/lists/modules/md.amd64       Sun Sep 22 22:59:37 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.80 2019/02/03 08:02:58 pgoyette Exp $
+# $NetBSD: md.amd64,v 1.81 2019/09/22 22:59:37 christos Exp $
 #
 # NOTE that there are two sets of files here:
 # @MODULEDIR@ and amd64-xen
@@ -79,6 +79,8 @@
 ./@MODULEDIR@/compat_netbsd32_60/compat_netbsd32_60.kmod base-kernel-modules   kmod
 ./@MODULEDIR@/compat_netbsd32_80               base-kernel-modules     kmod
 ./@MODULEDIR@/compat_netbsd32_80/compat_netbsd32_80.kmod base-kernel-modules   kmod
+./@MODULEDIR@/compat_netbsd32_90               base-kernel-modules     kmod
+./@MODULEDIR@/compat_netbsd32_90/compat_netbsd32_90.kmod base-kernel-modules   kmod
 ./@MODULEDIR@/compat_netbsd32_43               base-kernel-modules     kmod
 ./@MODULEDIR@/compat_netbsd32_43/compat_netbsd32_43.kmod base-kernel-modules   kmod
 ./@MODULEDIR@/compat_netbsd32_mqueue           base-kernel-modules     kmod
diff -r 9be3f82f6c4d -r 8524cadaa957 distrib/sets/lists/modules/md.sparc64
--- a/distrib/sets/lists/modules/md.sparc64     Sun Sep 22 19:51:18 2019 +0000
+++ b/distrib/sets/lists/modules/md.sparc64     Sun Sep 22 22:59:37 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: md.sparc64,v 1.7 2019/02/03 08:02:58 pgoyette Exp $
+# $NetBSD: md.sparc64,v 1.8 2019/09/22 22:59:37 christos Exp $
 
 ./@MODULEDIR@/compat_netbsd32                  base-kernel-modules     kmod
 ./@MODULEDIR@/compat_netbsd32/compat_netbsd32.kmod base-kernel-modules kmod
@@ -26,6 +26,8 @@
 ./@MODULEDIR@/compat_netbsd32_60/compat_netbsd32_60.kmod base-kernel-modules   kmod
 ./@MODULEDIR@/compat_netbsd32_80               base-kernel-modules     kmod
 ./@MODULEDIR@/compat_netbsd32_80/compat_netbsd32_80.kmod base-kernel-modules   kmod
+./@MODULEDIR@/compat_netbsd32_90               base-kernel-modules     kmod
+./@MODULEDIR@/compat_netbsd32_90/compat_netbsd32_90.kmod base-kernel-modules   kmod
 ./@MODULEDIR@/compat_netbsd32_43               base-kernel-modules     kmod
 ./@MODULEDIR@/compat_netbsd32_43/compat_netbsd32_43.kmod base-kernel-modules   kmod
 ./@MODULEDIR@/compat_netbsd32_mqueue           base-kernel-modules     kmod
diff -r 9be3f82f6c4d -r 8524cadaa957 distrib/sets/lists/modules/mi
--- a/distrib/sets/lists/modules/mi     Sun Sep 22 19:51:18 2019 +0000
+++ b/distrib/sets/lists/modules/mi     Sun Sep 22 22:59:37 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.125 2019/09/17 07:36:51 mrg Exp $
+# $NetBSD: mi,v 1.126 2019/09/22 22:59:37 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -100,6 +100,8 @@
 ./@MODULEDIR@/compat_70/compat_70.kmod         base-kernel-modules     kmod
 ./@MODULEDIR@/compat_80                                base-kernel-modules     kmod
 ./@MODULEDIR@/compat_80/compat_80.kmod         base-kernel-modules     kmod
+./@MODULEDIR@/compat_90                                base-kernel-modules     kmod
+./@MODULEDIR@/compat_90/compat_90.kmod         base-kernel-modules     kmod
 ./@MODULEDIR@/compat_ossaudio                  base-kernel-modules     kmod
 ./@MODULEDIR@/compat_ossaudio/compat_ossaudio.kmod base-kernel-modules kmod
 ./@MODULEDIR@/compat_crypto_50                 base-kernel-modules     kmod
diff -r 9be3f82f6c4d -r 8524cadaa957 lib/libc/compat/gen/Makefile.inc
--- a/lib/libc/compat/gen/Makefile.inc  Sun Sep 22 19:51:18 2019 +0000
+++ b/lib/libc/compat/gen/Makefile.inc  Sun Sep 22 22:59:37 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.17 2014/01/16 20:31:42 christos Exp $
+#      $NetBSD: Makefile.inc,v 1.18 2019/09/22 22:59:38 christos Exp $
 
 .PATH: ${COMPATDIR}/gen
 SRCS+=compat_errlist.c compat_fts.c compat___fts13.c compat___fts30.c \
@@ -8,4 +8,5 @@
     compat_times.c compat_timezone.c compat_unvis.c compat_utmpx.c \
     compat_time.c compat_utime.c compat_devname.c compat_alphasort.c \
     compat_getpwent.c compat___fts32.c compat_utmp.c compat___fts50.c \
-    compat___unvis13.c compat_syslog.c compat_alloca.c
+    compat___unvis13.c compat_syslog.c compat_alloca.c \
+    compat___getmntinfo13.c
diff -r 9be3f82f6c4d -r 8524cadaa957 lib/libc/compat/gen/compat___getmntinfo13.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/compat/gen/compat___getmntinfo13.c       Sun Sep 22 22:59:37 2019 +0000
@@ -0,0 +1,84 @@
+/*     $NetBSD: compat___getmntinfo13.c,v 1.1 2019/09/22 22:59:38 christos Exp $       */
+
+/*-
+ * Copyright (c) 2019 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * Redistribution and use in source and binary forms, with or without



Home | Main Index | Thread Index | Old Index