Module Name: src Committed By: christos Date: Sun Sep 22 22:59:40 UTC 2019
Modified Files: src/bin/df: df.c src/distrib/sets/lists/base: shl.mi src/distrib/sets/lists/debug: shl.mi src/distrib/sets/lists/modules: ad.arm ad.mips md.amd64 md.sparc64 mi src/lib/libc: shlib_version src/lib/libc/compat/gen: Makefile.inc compat_opendir.c src/lib/libc/compat/sys: Makefile.inc compat_fhstatvfs.c compat_fhstatvfs1.c compat_statfs.c src/lib/libc/include: namespace.h src/lib/libc/sys: Makefile.inc statvfs.c src/share/man/man5: statvfs.5 src/sys/compat/common: compat_mod.h files.common vfs_syscalls_20.c vfs_syscalls_30.c src/sys/compat/netbsd32: files.netbsd32 netbsd32.h netbsd32_conv.h netbsd32_fs.c syscalls.conf syscalls.master src/sys/conf: files src/sys/kern: init_sysent.c syscalls.conf syscalls.master vfs_subr.c vfs_syscalls.c src/sys/miscfs/specfs: spec_vnops.c src/sys/modules: Makefile src/sys/sys: param.h statvfs.h src/usr.bin/ktruss: dump.c Added Files: src/lib/libc/compat/gen: compat___getmntinfo13.c src/lib/libc/compat/sys: compat___fhstatvfs140.c compat___fhstatvfs40.c compat_statvfs.c src/sys/compat/common: compat_90_mod.c vfs_syscalls_90.c src/sys/compat/netbsd32: netbsd32_compat_90.c src/sys/conf: compat_netbsd90.config src/sys/modules/compat_90: Makefile src/sys/modules/compat_netbsd32_90: Makefile Log Message: 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= To generate a diff of this commit: cvs rdiff -u -r1.94 -r1.95 src/bin/df/df.c cvs rdiff -u -r1.871 -r1.872 src/distrib/sets/lists/base/shl.mi cvs rdiff -u -r1.228 -r1.229 src/distrib/sets/lists/debug/shl.mi cvs rdiff -u -r1.12 -r1.13 src/distrib/sets/lists/modules/ad.arm \ src/distrib/sets/lists/modules/ad.mips cvs rdiff -u -r1.80 -r1.81 src/distrib/sets/lists/modules/md.amd64 cvs rdiff -u -r1.7 -r1.8 src/distrib/sets/lists/modules/md.sparc64 cvs rdiff -u -r1.125 -r1.126 src/distrib/sets/lists/modules/mi cvs rdiff -u -r1.284 -r1.285 src/lib/libc/shlib_version cvs rdiff -u -r1.17 -r1.18 src/lib/libc/compat/gen/Makefile.inc cvs rdiff -u -r0 -r1.1 src/lib/libc/compat/gen/compat___getmntinfo13.c cvs rdiff -u -r1.1 -r1.2 src/lib/libc/compat/gen/compat_opendir.c cvs rdiff -u -r1.9 -r1.10 src/lib/libc/compat/sys/Makefile.inc cvs rdiff -u -r0 -r1.1 src/lib/libc/compat/sys/compat___fhstatvfs140.c \ src/lib/libc/compat/sys/compat___fhstatvfs40.c \ src/lib/libc/compat/sys/compat_statvfs.c cvs rdiff -u -r1.3 -r1.4 src/lib/libc/compat/sys/compat_fhstatvfs.c \ src/lib/libc/compat/sys/compat_fhstatvfs1.c cvs rdiff -u -r1.7 -r1.8 src/lib/libc/compat/sys/compat_statfs.c cvs rdiff -u -r1.196 -r1.197 src/lib/libc/include/namespace.h cvs rdiff -u -r1.241 -r1.242 src/lib/libc/sys/Makefile.inc cvs rdiff -u -r1.6 -r1.7 src/lib/libc/sys/statvfs.c cvs rdiff -u -r1.14 -r1.15 src/share/man/man5/statvfs.5 cvs rdiff -u -r0 -r1.1 src/sys/compat/common/compat_90_mod.c \ src/sys/compat/common/vfs_syscalls_90.c cvs rdiff -u -r1.5 -r1.6 src/sys/compat/common/compat_mod.h cvs rdiff -u -r1.4 -r1.5 src/sys/compat/common/files.common cvs rdiff -u -r1.41 -r1.42 src/sys/compat/common/vfs_syscalls_20.c cvs rdiff -u -r1.38 -r1.39 src/sys/compat/common/vfs_syscalls_30.c cvs rdiff -u -r1.48 -r1.49 src/sys/compat/netbsd32/files.netbsd32 cvs rdiff -u -r1.123 -r1.124 src/sys/compat/netbsd32/netbsd32.h cvs rdiff -u -r0 -r1.1 src/sys/compat/netbsd32/netbsd32_compat_90.c cvs rdiff -u -r1.38 -r1.39 src/sys/compat/netbsd32/netbsd32_conv.h cvs rdiff -u -r1.83 -r1.84 src/sys/compat/netbsd32/netbsd32_fs.c cvs rdiff -u -r1.16 -r1.17 src/sys/compat/netbsd32/syscalls.conf cvs rdiff -u -r1.127 -r1.128 src/sys/compat/netbsd32/syscalls.master cvs rdiff -u -r0 -r1.1 src/sys/conf/compat_netbsd90.config cvs rdiff -u -r1.1239 -r1.1240 src/sys/conf/files cvs rdiff -u -r1.323 -r1.324 src/sys/kern/init_sysent.c cvs rdiff -u -r1.29 -r1.30 src/sys/kern/syscalls.conf cvs rdiff -u -r1.295 -r1.296 src/sys/kern/syscalls.master cvs rdiff -u -r1.471 -r1.472 src/sys/kern/vfs_subr.c cvs rdiff -u -r1.535 -r1.536 src/sys/kern/vfs_syscalls.c cvs rdiff -u -r1.175 -r1.176 src/sys/miscfs/specfs/spec_vnops.c cvs rdiff -u -r1.226 -r1.227 src/sys/modules/Makefile cvs rdiff -u -r0 -r1.1 src/sys/modules/compat_90/Makefile cvs rdiff -u -r0 -r1.1 src/sys/modules/compat_netbsd32_90/Makefile cvs rdiff -u -r1.612 -r1.613 src/sys/sys/param.h cvs rdiff -u -r1.18 -r1.19 src/sys/sys/statvfs.h cvs rdiff -u -r1.43 -r1.44 src/usr.bin/ktruss/dump.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/bin/df/df.c diff -u src/bin/df/df.c:1.94 src/bin/df/df.c:1.95 --- src/bin/df/df.c:1.94 Wed Sep 18 16:14:44 2019 +++ src/bin/df/df.c Sun Sep 22 18:59:37 2019 @@ -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 @@ __COPYRIGHT( #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 @@ __RCSID("$NetBSD: df.c,v 1.94 2019/09/18 #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 @@ main(int argc, char *argv[]) { 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 @@ main(int argc, char *argv[]) } } - 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 @@ maketypelist(char *fslist) 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 @@ prthuman(const struct statvfs *sfsp, int * 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 @@ prtstat(const struct dkwedge_info *dkwp, 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)); } Index: src/distrib/sets/lists/base/shl.mi diff -u src/distrib/sets/lists/base/shl.mi:1.871 src/distrib/sets/lists/base/shl.mi:1.872 --- src/distrib/sets/lists/base/shl.mi:1.871 Sun Sep 22 14:45:19 2019 +++ src/distrib/sets/lists/base/shl.mi Sun Sep 22 18:59:37 2019 @@ -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 Index: src/distrib/sets/lists/debug/shl.mi diff -u src/distrib/sets/lists/debug/shl.mi:1.228 src/distrib/sets/lists/debug/shl.mi:1.229 --- src/distrib/sets/lists/debug/shl.mi:1.228 Fri Sep 6 07:12:06 2019 +++ src/distrib/sets/lists/debug/shl.mi Sun Sep 22 18:59:37 2019 @@ -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 Index: src/distrib/sets/lists/modules/ad.arm diff -u src/distrib/sets/lists/modules/ad.arm:1.12 src/distrib/sets/lists/modules/ad.arm:1.13 --- src/distrib/sets/lists/modules/ad.arm:1.12 Sun Feb 3 03:02:58 2019 +++ src/distrib/sets/lists/modules/ad.arm Sun Sep 22 18:59:37 2019 @@ -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 Index: src/distrib/sets/lists/modules/ad.mips diff -u src/distrib/sets/lists/modules/ad.mips:1.12 src/distrib/sets/lists/modules/ad.mips:1.13 --- src/distrib/sets/lists/modules/ad.mips:1.12 Sun Feb 3 03:02:58 2019 +++ src/distrib/sets/lists/modules/ad.mips Sun Sep 22 18:59:37 2019 @@ -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 Index: src/distrib/sets/lists/modules/md.amd64 diff -u src/distrib/sets/lists/modules/md.amd64:1.80 src/distrib/sets/lists/modules/md.amd64:1.81 --- src/distrib/sets/lists/modules/md.amd64:1.80 Sun Feb 3 03:02:58 2019 +++ src/distrib/sets/lists/modules/md.amd64 Sun Sep 22 18:59:37 2019 @@ -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 Index: src/distrib/sets/lists/modules/md.sparc64 diff -u src/distrib/sets/lists/modules/md.sparc64:1.7 src/distrib/sets/lists/modules/md.sparc64:1.8 --- src/distrib/sets/lists/modules/md.sparc64:1.7 Sun Feb 3 03:02:58 2019 +++ src/distrib/sets/lists/modules/md.sparc64 Sun Sep 22 18:59:37 2019 @@ -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 Index: src/distrib/sets/lists/modules/mi diff -u src/distrib/sets/lists/modules/mi:1.125 src/distrib/sets/lists/modules/mi:1.126 --- src/distrib/sets/lists/modules/mi:1.125 Tue Sep 17 03:36:51 2019 +++ src/distrib/sets/lists/modules/mi Sun Sep 22 18:59:37 2019 @@ -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 Index: src/lib/libc/shlib_version diff -u src/lib/libc/shlib_version:1.284 src/lib/libc/shlib_version:1.285 --- src/lib/libc/shlib_version:1.284 Tue Jun 4 04:44:08 2019 +++ src/lib/libc/shlib_version Sun Sep 22 18:59:37 2019 @@ -1,4 +1,4 @@ -# $NetBSD: shlib_version,v 1.284 2019/06/04 08:44:08 hannken Exp $ +# $NetBSD: shlib_version,v 1.285 2019/09/22 22:59:37 christos Exp $ # Remember to update distrib/sets/lists/base/shl.* when changing # # things we wish to do on next major version bump: @@ -54,4 +54,4 @@ # - move statfs() to libcompat since we have statvfs() # - the syscall stubs for the (obsolete) lfs syscalls should be removed major=12 -minor=213 +minor=214 Index: src/lib/libc/compat/gen/Makefile.inc diff -u src/lib/libc/compat/gen/Makefile.inc:1.17 src/lib/libc/compat/gen/Makefile.inc:1.18 --- src/lib/libc/compat/gen/Makefile.inc:1.17 Thu Jan 16 15:31:42 2014 +++ src/lib/libc/compat/gen/Makefile.inc Sun Sep 22 18:59:38 2019 @@ -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 @@ SRCS+=compat_errlist.c compat_fts.c comp 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 Index: src/lib/libc/compat/gen/compat_opendir.c diff -u src/lib/libc/compat/gen/compat_opendir.c:1.1 src/lib/libc/compat/gen/compat_opendir.c:1.2 --- src/lib/libc/compat/gen/compat_opendir.c:1.1 Mon Sep 12 21:44:09 2005 +++ src/lib/libc/compat/gen/compat_opendir.c Sun Sep 22 18:59:38 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_opendir.c,v 1.1 2005/09/13 01:44:09 christos Exp $ */ +/* $NetBSD: compat_opendir.c,v 1.2 2019/09/22 22:59:38 christos Exp $ */ #include "namespace.h" #include <sys/stat.h> @@ -7,6 +7,7 @@ #define __LIBC12_SOURCE__ #include <dirent.h> #include <compat/include/dirent.h> +#include <compat/sys/statvfs.h> #ifdef __weak_alias __weak_alias(opendir,_opendir) @@ -20,5 +21,6 @@ __warn_references(__opendir2, #endif #define dirent dirent12 +#define fstatvfs1 __fstatvfs190 #include "gen/opendir.c" Index: src/lib/libc/compat/sys/Makefile.inc diff -u src/lib/libc/compat/sys/Makefile.inc:1.9 src/lib/libc/compat/sys/Makefile.inc:1.10 --- src/lib/libc/compat/sys/Makefile.inc:1.9 Thu Mar 28 22:09:58 2013 +++ src/lib/libc/compat/sys/Makefile.inc Sun Sep 22 18:59:38 2019 @@ -1,10 +1,10 @@ -# $NetBSD: Makefile.inc,v 1.9 2013/03/29 02:09:58 christos Exp $ +# $NetBSD: Makefile.inc,v 1.10 2019/09/22 22:59:38 christos Exp $ .PATH: ${COMPATDIR}/sys SRCS+= compat_getdents.c compat_getdirentries.c compat_msync.c \ compat_ntp_gettime.c compat_sched.c \ compat_semctl.c compat_sigaltstack.c compat_stat.c compat___stat13.c \ - compat_statfs.c compat_socket.c compat_getfh.c \ + compat_statfs.c compat_statvfs.c compat_socket.c compat_getfh.c \ compat_fhopen.c compat___fhstat30.c compat_fhstatvfs.c compat_fhstatvfs1.c \ compat_mount.c compat_getrusage.c compat_gettimeofday.c compat_utimes.c \ compat_wait4.c compat_sigtimedwait.c compat_settimeofday.c compat_timer.c \ @@ -12,7 +12,9 @@ SRCS+= compat_getdents.c compat_getdiren compat___stat30.c compat_aio_suspend.c compat_adjtime.c compat_mknod.c \ compat_mqueue.c compat__lwp_park.c compat_lfs_segwait.c compat_kevent.c \ compat___ntp_gettime30.c compat___semctl13.c compat___shmctl13.c \ - compat___msgctl13.c compat___lwp_park50.c + compat___msgctl13.c compat___lwp_park50.c \ + compat___fhstatvfs140.c compat___fhstatvfs40.c + MAN+= getdirentries.3 .if ${MKLINT} != "no" Index: src/lib/libc/compat/sys/compat_fhstatvfs.c diff -u src/lib/libc/compat/sys/compat_fhstatvfs.c:1.3 src/lib/libc/compat/sys/compat_fhstatvfs.c:1.4 --- src/lib/libc/compat/sys/compat_fhstatvfs.c:1.3 Mon Apr 28 16:22:59 2008 +++ src/lib/libc/compat/sys/compat_fhstatvfs.c Sun Sep 22 18:59:38 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_fhstatvfs.c,v 1.3 2008/04/28 20:22:59 martin Exp $ */ +/* $NetBSD: compat_fhstatvfs.c,v 1.4 2019/09/22 22:59:38 christos Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: compat_fhstatvfs.c,v 1.3 2008/04/28 20:22:59 martin Exp $"); +__RCSID("$NetBSD: compat_fhstatvfs.c,v 1.4 2019/09/22 22:59:38 christos Exp $"); #endif /* LIBC_SCCS and not lint */ #define __LIBC12_SOURCE__ @@ -40,23 +40,22 @@ __RCSID("$NetBSD: compat_fhstatvfs.c,v 1 #include <sys/types.h> #include <sys/statvfs.h> #include <compat/include/fstypes.h> +#include <compat/sys/statvfs.h> __warn_references(fhstatvfs, - "warning: reference to compatibility fhstatvfs(); include <sys/mount.h> to generate correct reference") + "warning: reference to compatibility fhstatvfs(); include <sys/statvfs.h> to generate correct reference") -#ifdef __weak_alias -__weak_alias(fhstatvfs, _fhstatvfs) -#endif - -int _fhstatvfs(const struct compat_30_fhandle *fhp, struct statvfs *buf); -int __fhstatvfs140(const void *fhp, size_t fh_size, struct statvfs *buf, - int flags); +int fhstatvfs(const struct compat_30_fhandle *fhp, struct statvfs90 *buf); /* * Convert old fhstatvs() call to new calling convention */ int -_fhstatvfs(const struct compat_30_fhandle *fhp, struct statvfs *buf) +fhstatvfs(const struct compat_30_fhandle *fhp, struct statvfs90 *buf) { - return __fhstatvfs140(fhp, FHANDLE30_SIZE, buf, ST_WAIT); + struct statvfs sb; + int error = __fhstatvfs190(fhp, FHANDLE30_SIZE, &sb, 0); + if (error != -1) + statvfs_to_statvfs90(&sb, buf); + return error; } Index: src/lib/libc/compat/sys/compat_fhstatvfs1.c diff -u src/lib/libc/compat/sys/compat_fhstatvfs1.c:1.3 src/lib/libc/compat/sys/compat_fhstatvfs1.c:1.4 --- src/lib/libc/compat/sys/compat_fhstatvfs1.c:1.3 Mon Apr 28 16:22:59 2008 +++ src/lib/libc/compat/sys/compat_fhstatvfs1.c Sun Sep 22 18:59:38 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_fhstatvfs1.c,v 1.3 2008/04/28 20:22:59 martin Exp $ */ +/* $NetBSD: compat_fhstatvfs1.c,v 1.4 2019/09/22 22:59:38 christos Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: compat_fhstatvfs1.c,v 1.3 2008/04/28 20:22:59 martin Exp $"); +__RCSID("$NetBSD: compat_fhstatvfs1.c,v 1.4 2019/09/22 22:59:38 christos Exp $"); #endif /* LIBC_SCCS and not lint */ #define __LIBC12_SOURCE__ @@ -40,20 +40,24 @@ __RCSID("$NetBSD: compat_fhstatvfs1.c,v #include <sys/types.h> #include <sys/statvfs.h> #include <compat/include/fstypes.h> +#include <compat/sys/statvfs.h> __warn_references(fhstatvfs1, - "warning: reference to compatibility fhstatvfs1(); include <sys/mount.h> to generate correct reference") + "warning: reference to compatibility fhstatvfs1(); include <sys/statvfs.h> to generate correct reference") -int fhstatvfs1(const struct compat_30_fhandle *fhp, struct statvfs *buf, - int flags); -int __fhstatvfs140(const void *fhp, size_t fh_size, struct statvfs *buf, +int fhstatvfs1(const struct compat_30_fhandle *fhp, struct statvfs90 *buf, int flags); /* * Convert old fhstatvs1() call to new calling convention */ int -fhstatvfs1(const struct compat_30_fhandle *fhp, struct statvfs *buf, int flags) +fhstatvfs1(const struct compat_30_fhandle *fhp, struct statvfs90 *buf, + int flags) { - return __fhstatvfs140(fhp, FHANDLE30_SIZE, buf, flags); + struct statvfs sb; + int error = __fhstatvfs190(fhp, FHANDLE30_SIZE, &sb, flags); + if (error != -1) + statvfs_to_statvfs90(&sb, buf); + return error; } Index: src/lib/libc/compat/sys/compat_statfs.c diff -u src/lib/libc/compat/sys/compat_statfs.c:1.7 src/lib/libc/compat/sys/compat_statfs.c:1.8 --- src/lib/libc/compat/sys/compat_statfs.c:1.7 Fri Oct 4 17:07:37 2013 +++ src/lib/libc/compat/sys/compat_statfs.c Sun Sep 22 18:59:38 2019 @@ -1,7 +1,7 @@ -/* $NetBSD: compat_statfs.c,v 1.7 2013/10/04 21:07:37 christos Exp $ */ +/* $NetBSD: compat_statfs.c,v 1.8 2019/09/22 22:59:38 christos Exp $ */ /*- - * Copyright (c) 2004 The NetBSD Foundation, Inc. + * Copyright (c) 2004, 2019 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -31,7 +31,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: compat_statfs.c,v 1.7 2013/10/04 21:07:37 christos Exp $"); +__RCSID("$NetBSD: compat_statfs.c,v 1.8 2019/09/22 22:59:38 christos Exp $"); #endif /* LIBC_SCCS and not lint */ #define __LIBC12_SOURCE__ @@ -42,6 +42,7 @@ __RCSID("$NetBSD: compat_statfs.c,v 1.7 #include <sys/mount.h> #include <compat/sys/mount.h> #include <compat/include/fstypes.h> +#include <compat/sys/statvfs.h> #include <string.h> #include <stdlib.h> @@ -135,7 +136,7 @@ __compat_statfs(const char *file, struct struct statvfs nst; int ret; - if ((ret = statvfs(file, &nst)) == -1) + if ((ret = __statvfs90(file, &nst)) == -1) return ret; vfs2fs(ost, &nst); return ret; @@ -147,22 +148,19 @@ __compat_fstatfs(int f, struct statfs12 struct statvfs nst; int ret; - if ((ret = fstatvfs(f, &nst)) == -1) + if ((ret = __fstatvfs90(f, &nst)) == -1) return ret; vfs2fs(ost, &nst); return ret; } -int __fhstatvfs140(const void *fhp, size_t fh_size, struct statvfs *buf, - int flags); - int __compat_fhstatfs(const struct compat_30_fhandle *fh, struct statfs12 *ost) { struct statvfs nst; int ret; - if ((ret = __fhstatvfs140(fh, FHANDLE30_SIZE, &nst, ST_WAIT)) == -1) + if ((ret = __fhstatvfs190(fh, FHANDLE30_SIZE, &nst, ST_WAIT)) == -1) return ret; vfs2fs(ost, &nst); return ret; @@ -181,7 +179,7 @@ __compat_getfsstat(struct statfs12 *ost, } else nst = NULL; - if ((ret = getvfsstat(nst, bsize, flags)) == -1) + if ((ret = __getvfsstat90(nst, bsize, flags)) == -1) goto done; if (nst) for (i = 0; i < ret; i++) Index: src/lib/libc/include/namespace.h diff -u src/lib/libc/include/namespace.h:1.196 src/lib/libc/include/namespace.h:1.197 --- src/lib/libc/include/namespace.h:1.196 Tue Jan 16 20:24:29 2018 +++ src/lib/libc/include/namespace.h Sun Sep 22 18:59:38 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: namespace.h,v 1.196 2018/01/17 01:24:29 kamil Exp $ */ +/* $NetBSD: namespace.h,v 1.197 2019/09/22 22:59:38 christos Exp $ */ /*- * Copyright (c) 1997-2004 The NetBSD Foundation, Inc. @@ -325,7 +325,6 @@ #define fdopen _fdopen #define fgetln _fgetln #define fgetwln _fgetwln -#define fhstatvfs _fhstatvfs #define flockfile _flockfile #define ftrylockfile _ftrylockfile #define funlockfile _funlockfile @@ -345,7 +344,6 @@ #define freeifaddrs _freeifaddrs #define freelocale _freelocale #define fscanf_l _fscanf_l -#define fstatvfs _fstatvfs #define ftok _ftok #define ftruncate _ftruncate #define fts_children _fts_children @@ -668,7 +666,6 @@ #define srand48 _srand48 #define srandom _srandom #define sscanf_l _sscanf_l -#define statvfs(a, b) _statvfs(a, b) #define strcasecmp _strcasecmp #define strcoll_l _strcoll_l #define strdup _strdup Index: src/lib/libc/sys/Makefile.inc diff -u src/lib/libc/sys/Makefile.inc:1.241 src/lib/libc/sys/Makefile.inc:1.242 --- src/lib/libc/sys/Makefile.inc:1.241 Sun Sep 15 12:55:00 2019 +++ src/lib/libc/sys/Makefile.inc Sun Sep 22 18:59:38 2019 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.241 2019/09/15 16:55:00 christos Exp $ +# $NetBSD: Makefile.inc,v 1.242 2019/09/22 22:59:38 christos Exp $ # @(#)Makefile.inc 8.3 (Berkeley) 10/24/94 # sys sources @@ -106,9 +106,9 @@ ASM= access.S acct.S \ fsetxattr.S fgetxattr.S flistxattr.S fremovexattr.S \ faccessat.S fchdir.S fchflags.S fchmod.S fchmodat.S fchown.S \ fchownat.S fchroot.S fexecve.S __fhopen40.S __fhstat50.S \ - __fhstatvfs140.S fktrace.S flock.S fpathconf.S __fstat50.S \ - fstatvfs1.S fstatat.S __futimes50.S futimens.S \ - __getcwd.S __getdents30.S __getfh30.S getvfsstat.S getgroups.S\ + __fhstatvfs190.S fktrace.S flock.S fpathconf.S __fstat50.S \ + __fstatvfs190.S fstatat.S __futimes50.S futimens.S \ + __getcwd.S __getdents30.S __getfh30.S __getvfsstat90.S getgroups.S\ __getitimer50.S __getlogin.S getpeername.S getpgid.S getpgrp.S \ getpriority.S getrlimit.S __getrusage50.S getsid.S \ getsockname.S getsockopt.S getsockopt2.S __gettimeofday50.S \ @@ -145,7 +145,7 @@ ASM= access.S acct.S \ sigqueueinfo.S \ __sigaltstack14.S __sigpending14.S __sigaction_sigtramp.S \ ____sigtimedwait50.S __socket30.S socketpair.S __stat50.S \ - statvfs1.S swapctl.S symlink.S symlinkat.S __sysctl.S \ + __statvfs190.S swapctl.S symlink.S symlinkat.S __sysctl.S \ timer_create.S timer_delete.S __timer_gettime50.S timer_getoverrun.S \ ____semctl50.S __timer_settime50.S \ umask.S undelete.S unlink.S unlinkat.S unmount.S __utimes50.S \ Index: src/lib/libc/sys/statvfs.c diff -u src/lib/libc/sys/statvfs.c:1.6 src/lib/libc/sys/statvfs.c:1.7 --- src/lib/libc/sys/statvfs.c:1.6 Mon Apr 28 16:23:00 2008 +++ src/lib/libc/sys/statvfs.c Sun Sep 22 18:59:38 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: statvfs.c,v 1.6 2008/04/28 20:23:00 martin Exp $ */ +/* $NetBSD: statvfs.c,v 1.7 2019/09/22 22:59:38 christos Exp $ */ /*- * Copyright (c) 2004 The NetBSD Foundation, Inc. @@ -31,17 +31,11 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: statvfs.c,v 1.6 2008/04/28 20:23:00 martin Exp $"); +__RCSID("$NetBSD: statvfs.c,v 1.7 2019/09/22 22:59:38 christos Exp $"); #endif /* LIBC_SCCS and not lint */ -#include "namespace.h" #include <sys/statvfs.h> -#ifdef __weak_alias -__weak_alias(statvfs,_statvfs) -__weak_alias(fstatvfs,_fstatvfs) -#endif - int statvfs(const char *file, struct statvfs *st) { @@ -54,12 +48,8 @@ fstatvfs(int f, struct statvfs *st) return fstatvfs1(f, st, ST_WAIT); } -int __fhstatvfs140(const void *fhp, size_t fh_size, struct statvfs *buf, - int flags); -int __fhstatvfs40(const void *fh, size_t fh_size, struct statvfs *st); - int -__fhstatvfs40(const void *fh, size_t fh_size, struct statvfs *st) +fhstatvfs(const void *fh, size_t fh_size, struct statvfs *st) { - return __fhstatvfs140(fh, fh_size, st, ST_WAIT); + return fhstatvfs1(fh, fh_size, st, ST_WAIT); } Index: src/share/man/man5/statvfs.5 diff -u src/share/man/man5/statvfs.5:1.14 src/share/man/man5/statvfs.5:1.15 --- src/share/man/man5/statvfs.5:1.14 Mon Jun 6 11:02:32 2016 +++ src/share/man/man5/statvfs.5 Sun Sep 22 18:59:38 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: statvfs.5,v 1.14 2016/06/06 15:02:32 abhinav Exp $ +.\" $NetBSD: statvfs.5,v 1.15 2019/09/22 22:59:38 christos Exp $ .\" .\" Copyright (c) 1989, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)statfs.2 8.5 (Berkeley) 5/24/95 .\" -.Dd June 2, 2016 +.Dd September 22, 2019 .Dt STATVFS 5 .Os .Sh NAME @@ -53,39 +53,40 @@ typedef struct { int32_t val[2]; } fsid_ #define VFS_MNAMELEN 1024 /* length of buffer for returned name */ struct statvfs { - unsigned long f_flag; /* copy of mount exported flags */ - unsigned long f_bsize; /* system block size */ - unsigned long f_frsize; /* system fragment size */ - unsigned long f_iosize; /* optimal file system block size */ - - /* The following are in units of f_frsize */ - fsblkcnt_t f_blocks; /* number of blocks in file system */ - fsblkcnt_t f_bfree; /* free blocks avail in file system */ - fsblkcnt_t f_bavail; /* free blocks avail to non-root */ - fsblkcnt_t f_bresvd; /* blocks reserved for root */ - - fsfilcnt_t f_files; /* total file nodes in file system */ - fsfilcnt_t f_ffree; /* free file nodes in file system */ - fsfilcnt_t f_favail; /* free file nodes avail to non-root */ - fsfilcnt_t f_fresvd; /* file nodes reserved for root */ - - uint64_t f_syncreads; /* count of sync reads since mount */ - uint64_t f_syncwrites; /* count of sync writes since mount */ - - uint64_t f_asyncreads; /* count of async reads since mount */ - uint64_t f_asyncwrites; /* count of async writes since mount */ - - unsigned long f_fsid; /* POSIX compliant file system id */ - fsid_t f_fsidx; /* NetBSD compatible file system id */ - - unsigned long f_namemax;/* maximum filename length */ - uid_t f_owner; /* user that mounted the file system */ - - uint32_t f_spare[4]; /* spare space */ - - char f_fstypename[VFS_NAMELEN]; /* fs type name */ - char f_mntonname[VFS_MNAMELEN]; /* directory on which mounted */ - char f_mntfromname[VFS_MNAMELEN]; /* mounted file system */ + unsigned long f_flag; /* copy of mount exported flags */ + unsigned long f_bsize; /* system block size */ + unsigned long f_frsize; /* system fragment size */ + unsigned long f_iosize; /* optimal file system block size */ + + /* The following are in units of f_frsize */ + fsblkcnt_t f_blocks; /* number of blocks in file system */ + fsblkcnt_t f_bfree; /* free blocks avail in file system */ + fsblkcnt_t f_bavail; /* free blocks avail to non-root */ + fsblkcnt_t f_bresvd; /* blocks reserved for root */ + + fsfilcnt_t f_files; /* total file nodes in file system */ + fsfilcnt_t f_ffree; /* free file nodes in file system */ + fsfilcnt_t f_favail /* free file nodes avail to non-root */ + fsfilcnt_t f_fresvd; /* file nodes reserved for root */ + + uint64_t f_syncreads; /* count of sync reads since mount */ + uint64_t f_syncwrites; /* count of sync writes since mount */ + + uint64_t f_asyncreads; /* count of async reads since mount */ + uint64_t f_asyncwrites; /* count of async writes since mount */ + + unsigned long f_fsid; /* POSIX compliant file system id */ + fsid_t f_fsidx; /* NetBSD compatible file system id */ + + unsigned long f_namemax; /* maximum filename length */ + uid_t f_owner; /* user that mounted the file system */ + + uint64_t f_spare[4]; /* spare space */ + + char f_fstypename[VFS_NAMELEN]; /* fs type name */ + char f_mntonname[VFS_MNAMELEN]; /* directory on which mounted */ + char f_mntfromname[VFS_MNAMELEN]; /* mounted file system */ + char f_mntfromlabel[_VFS_MNAMELEN]; /* disk label name if avail */ }; .Ed .Pp Index: src/sys/compat/common/compat_mod.h diff -u src/sys/compat/common/compat_mod.h:1.5 src/sys/compat/common/compat_mod.h:1.6 --- src/sys/compat/common/compat_mod.h:1.5 Fri May 17 03:37:11 2019 +++ src/sys/compat/common/compat_mod.h Sun Sep 22 18:59:38 2019 @@ -1,7 +1,7 @@ -/* $NetBSD: compat_mod.h,v 1.5 2019/05/17 07:37:11 msaitoh Exp $ */ +/* $NetBSD: compat_mod.h,v 1.6 2019/09/22 22:59:38 christos Exp $ */ /*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. + * Copyright (c) 2013, 2019 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -32,6 +32,13 @@ #ifndef _COMPAT_MOD_H #define _COMPAT_MOD_H +#ifdef COMPAT_90 +int compat_90_init(void); +int compat_90_fini(void); +int vfs_syscalls_90_init(void); +int vfs_syscalls_90_fini(void); +#endif + #ifdef COMPAT_80 int compat_80_init(void); int compat_80_fini(void); Index: src/sys/compat/common/files.common diff -u src/sys/compat/common/files.common:1.4 src/sys/compat/common/files.common:1.5 --- src/sys/compat/common/files.common:1.4 Fri May 17 03:37:11 2019 +++ src/sys/compat/common/files.common Sun Sep 22 18:59:38 2019 @@ -1,4 +1,4 @@ -# $NetBSD: files.common,v 1.4 2019/05/17 07:37:11 msaitoh Exp $ +# $NetBSD: files.common,v 1.5 2019/09/22 22:59:38 christos Exp $ # # Generic utility files, used by various compat options. @@ -100,16 +100,20 @@ file compat/common/compat_70_mod.c comp file compat/common/rtsock_70.c compat_70 file compat/common/uipc_usrreq_70.c compat_70 -# Compatability code for NetBSD 8.0 +# Compatibility code for NetBSD 8.0 file compat/common/compat_80_mod.c compat_80 file compat/common/kern_mod_80.c compat_80 file compat/common/if_media_80.c compat_80 +# Compatibility code for NetBSD 9.0 +file compat/common/compat_90_mod.c compat_90 +file compat/common/vfs_syscalls_90.c compat_90 + # # Sources for sysv ipc compatibility across the versions. # -# Module interface for sysv ipc compatability options +# Module interface for sysv ipc compatibility options # Compatibility code for NetBSD 1.0 file compat/common/compat_sysv_10_mod.c compat_10 & Index: src/sys/compat/common/vfs_syscalls_20.c diff -u src/sys/compat/common/vfs_syscalls_20.c:1.41 src/sys/compat/common/vfs_syscalls_20.c:1.42 --- src/sys/compat/common/vfs_syscalls_20.c:1.41 Sat Jan 26 21:08:39 2019 +++ src/sys/compat/common/vfs_syscalls_20.c Sun Sep 22 18:59:38 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls_20.c,v 1.41 2019/01/27 02:08:39 pgoyette Exp $ */ +/* $NetBSD: vfs_syscalls_20.c,v 1.42 2019/09/22 22:59:38 christos Exp $ */ /* * Copyright (c) 1989, 1993 @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_20.c,v 1.41 2019/01/27 02:08:39 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_20.c,v 1.42 2019/09/22 22:59:38 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -54,17 +54,18 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls #include <sys/mount.h> #include <sys/proc.h> #include <sys/uio.h> -#include <sys/malloc.h> #include <sys/dirent.h> #include <sys/sysctl.h> #include <sys/syscall.h> #include <sys/syscallvar.h> #include <sys/syscallargs.h> #include <sys/kauth.h> +#include <sys/vfs_syscalls.h> #include <compat/common/compat_mod.h> #include <compat/sys/mount.h> +#include <compat/sys/statvfs.h> #define MOUNTNO_NONE 0 #define MOUNTNO_UFS 1 /* UNIX "Fast" Filesystem */ @@ -99,9 +100,10 @@ static const struct syscall_package vfs_ }; static int -vfs2fs(struct statfs12 *bfs, const struct statvfs *fs) +statvfs_to_statfs12(const void *vfs, void *vbfs, size_t len) { - struct statfs12 ofs; + struct statfs12 ofs, *bfs = vbfs; + const struct statvfs *fs = vfs; int i; ofs.f_type = 0; ofs.f_oflags = (short)fs->f_flag; @@ -161,14 +163,14 @@ compat_20_sys_statfs(struct lwp *l, cons mp = vp->v_mount; - sbuf = malloc(sizeof(*sbuf), M_TEMP, M_WAITOK); + sbuf = STATVFSBUF_GET(); if ((error = dostatvfs(mp, sbuf, l, 0, 1)) != 0) goto done; - error = vfs2fs(SCARG(uap, buf), sbuf); + error = statvfs_to_statfs12(sbuf, SCARG(uap, buf), 0); done: vrele(vp); - free(sbuf, M_TEMP); + STATVFSBUF_PUT(sbuf); return error; } @@ -192,13 +194,13 @@ compat_20_sys_fstatfs(struct lwp *l, con if ((error = fd_getvnode(SCARG(uap, fd), &fp)) != 0) return (error); mp = fp->f_vnode->v_mount; - sbuf = malloc(sizeof(*sbuf), M_TEMP, M_WAITOK); + sbuf = STATVFSBUF_GET(); if ((error = dostatvfs(mp, sbuf, l, 0, 1)) != 0) goto out; - error = vfs2fs(SCARG(uap, buf), sbuf); + error = statvfs_to_statfs12(sbuf, SCARG(uap, buf), 0); out: fd_putfile(SCARG(uap, fd)); - free(sbuf, M_TEMP); + STATVFSBUF_PUT(sbuf); return error; } @@ -214,51 +216,9 @@ compat_20_sys_getfsstat(struct lwp *l, c syscallarg(long) bufsize; syscallarg(int) flags; } */ - int root = 0; - mount_iterator_t *iter; - struct mount *mp; - struct statvfs *sbuf; - struct statfs12 *sfsp; - size_t count, maxcount; - int error = 0; - - sbuf = malloc(sizeof(*sbuf), M_TEMP, M_WAITOK); - maxcount = (size_t)SCARG(uap, bufsize) / sizeof(struct statfs12); - sfsp = SCARG(uap, buf); - count = 0; - mountlist_iterator_init(&iter); - while ((mp = mountlist_iterator_next(iter)) != NULL) { - if (sfsp && count < maxcount) { - error = dostatvfs(mp, sbuf, l, SCARG(uap, flags), 0); - if (error) - continue; - error = vfs2fs(sfsp, sbuf); - if (error) - goto out; - sfsp++; - root |= strcmp(sbuf->f_mntonname, "/") == 0; - } - count++; - } - if (root == 0 && l->l_proc->p_cwdi->cwdi_rdir) { - /* - * fake a root entry - */ - if ((error = dostatvfs(l->l_proc->p_cwdi->cwdi_rdir->v_mount, - sbuf, l, SCARG(uap, flags), 1)) != 0) - goto out; - if (sfsp) - error = vfs2fs(sfsp, sbuf); - count++; - } - if (sfsp && count > maxcount) - *retval = maxcount; - else - *retval = count; -out: - mountlist_iterator_destroy(iter); - free(sbuf, M_TEMP); - return error; + return do_sys_getvfsstat(l, SCARG(uap, buf), SCARG(uap, bufsize), + SCARG(uap, flags), statvfs_to_statfs12, + sizeof(struct statvfs90), retval); } int @@ -290,13 +250,13 @@ compat_20_sys_fhstatfs(struct lwp *l, co return (error); mp = vp->v_mount; VOP_UNLOCK(vp); - sbuf = malloc(sizeof(*sbuf), M_TEMP, M_WAITOK); + sbuf = STATVFSBUF_GET(); if ((error = VFS_STATVFS(mp, sbuf)) != 0) goto out; - error = vfs2fs(SCARG(uap, buf), sbuf); + error = statvfs_to_statfs12(sbuf, SCARG(uap, buf), 0); out: vrele(vp); - free(sbuf, M_TEMP); + STATVFSBUF_PUT(sbuf); return error; } Index: src/sys/compat/common/vfs_syscalls_30.c diff -u src/sys/compat/common/vfs_syscalls_30.c:1.38 src/sys/compat/common/vfs_syscalls_30.c:1.39 --- src/sys/compat/common/vfs_syscalls_30.c:1.38 Sat Jan 26 21:08:39 2019 +++ src/sys/compat/common/vfs_syscalls_30.c Sun Sep 22 18:59:38 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls_30.c,v 1.38 2019/01/27 02:08:39 pgoyette Exp $ */ +/* $NetBSD: vfs_syscalls_30.c,v 1.39 2019/09/22 22:59:38 christos Exp $ */ /*- * Copyright (c) 2005, 2008 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.38 2019/01/27 02:08:39 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.39 2019/09/22 22:59:38 christos Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -57,9 +57,11 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls #include <compat/common/compat_mod.h> #include <compat/common/compat_util.h> + #include <compat/sys/stat.h> #include <compat/sys/dirent.h> #include <compat/sys/mount.h> +#include <compat/sys/statvfs.h> static void cvtstat(struct stat13 *, const struct stat *); @@ -441,21 +443,25 @@ compat_30_sys___fhstat30(struct lwp *l, /* ARGSUSED */ int compat_30_sys_fhstatvfs1(struct lwp *l, - const struct compat_30_sys_fhstatvfs1_args *uap_30, register_t *retval) + const struct compat_30_sys_fhstatvfs1_args *uap, register_t *retval) { /* { syscallarg(const fhandle_t *) fhp; - syscallarg(struct statvfs *) buf; + syscallarg(struct statvfs90 *) buf; syscallarg(int) flags; } */ - struct sys___fhstatvfs140_args uap; + struct statvfs *sb = STATVFSBUF_GET(); + int error = do_fhstatvfs(l, SCARG(uap, fhp), FHANDLE_SIZE_COMPAT, + sb, SCARG(uap, flags)); + + if (!error) { + error = statvfs_to_statvfs90_copy(sb, SCARG(uap, buf), + sizeof(struct statvfs90)); + } - SCARG(&uap, fhp) = SCARG(uap_30, fhp); - SCARG(&uap, fh_size) = FHANDLE_SIZE_COMPAT; - SCARG(&uap, buf) = SCARG(uap_30, buf); - SCARG(&uap, flags) = SCARG(uap_30, flags); + STATVFSBUF_PUT(sb); - return sys___fhstatvfs140(l, &uap, retval); + return error; } int Index: src/sys/compat/netbsd32/files.netbsd32 diff -u src/sys/compat/netbsd32/files.netbsd32:1.48 src/sys/compat/netbsd32/files.netbsd32:1.49 --- src/sys/compat/netbsd32/files.netbsd32:1.48 Tue Aug 20 10:12:33 2019 +++ src/sys/compat/netbsd32/files.netbsd32 Sun Sep 22 18:59:38 2019 @@ -1,4 +1,4 @@ -# $NetBSD: files.netbsd32,v 1.48 2019/08/20 14:12:33 christos Exp $ +# $NetBSD: files.netbsd32,v 1.49 2019/09/22 22:59:38 christos Exp $ # # config file description for machine-independent netbsd32 compat code. # included by ports that need it. @@ -59,3 +59,4 @@ file compat/netbsd32/netbsd32_compat_50_ (sysvmsg | sysvsem | sysvshm) file compat/netbsd32/netbsd32_compat_60.c compat_netbsd32 & compat_60 file compat/netbsd32/netbsd32_compat_80.c compat_netbsd32 & compat_80 +file compat/netbsd32/netbsd32_compat_90.c compat_netbsd32 & compat_90 Index: src/sys/compat/netbsd32/netbsd32.h diff -u src/sys/compat/netbsd32/netbsd32.h:1.123 src/sys/compat/netbsd32/netbsd32.h:1.124 --- src/sys/compat/netbsd32/netbsd32.h:1.123 Wed Feb 20 01:04:28 2019 +++ src/sys/compat/netbsd32/netbsd32.h Sun Sep 22 18:59:38 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32.h,v 1.123 2019/02/20 06:04:28 mrg Exp $ */ +/* $NetBSD: netbsd32.h,v 1.124 2019/09/22 22:59:38 christos Exp $ */ /* * Copyright (c) 1998, 2001, 2008, 2015 Matthew R. Green @@ -852,6 +852,34 @@ struct netbsd32_stat { }; /* from <sys/statvfs.h> */ +typedef netbsd32_pointer_t netbsd32_statvfs90p_t; +struct netbsd32_statvfs90 { + netbsd32_u_long f_flag; /* copy of mount exported flags */ + netbsd32_u_long f_bsize; /* system block size */ + netbsd32_u_long f_frsize; /* system fragment size */ + netbsd32_u_long f_iosize; /* optimal file system block size */ + netbsd32_uint64 f_blocks; /* number of blocks in file system */ + netbsd32_uint64 f_bfree; /* free blocks avail in file system */ + netbsd32_uint64 f_bavail; /* free blocks avail to non-root */ + netbsd32_uint64 f_bresvd; /* blocks reserved for root */ + netbsd32_uint64 f_files; /* total file nodes in file system */ + netbsd32_uint64 f_ffree; /* free file nodes in file system */ + netbsd32_uint64 f_favail; /* free file nodes avail to non-root */ + netbsd32_uint64 f_fresvd; /* file nodes reserved for root */ + netbsd32_uint64 f_syncreads; /* count of sync reads since mount */ + netbsd32_uint64 f_syncwrites; /* count of sync writes since mount */ + netbsd32_uint64 f_asyncreads; /* count of async reads since mount */ + netbsd32_uint64 f_asyncwrites; /* count of async writes since mount */ + fsid_t f_fsidx; /* NetBSD compatible fsid */ + netbsd32_u_long f_fsid; /* Posix compatible fsid */ + netbsd32_u_long f_namemax; /* maximum filename length */ + uid_t f_owner; /* user that mounted the file system */ + uint32_t f_spare[4]; /* spare space */ + char f_fstypename[_VFS_NAMELEN]; /* fs type name */ + char f_mntonname[_VFS_MNAMELEN]; /* directory on which mounted */ + char f_mntfromname[_VFS_MNAMELEN]; /* mounted file system */ +}; + typedef netbsd32_pointer_t netbsd32_statvfsp_t; struct netbsd32_statvfs { netbsd32_u_long f_flag; /* copy of mount exported flags */ @@ -874,10 +902,11 @@ struct netbsd32_statvfs { netbsd32_u_long f_fsid; /* Posix compatible fsid */ netbsd32_u_long f_namemax; /* maximum filename length */ uid_t f_owner; /* user that mounted the file system */ - uint32_t f_spare[4]; /* spare space */ + uint64_t f_spare[4]; /* spare space */ char f_fstypename[_VFS_NAMELEN]; /* fs type name */ char f_mntonname[_VFS_MNAMELEN]; /* directory on which mounted */ char f_mntfromname[_VFS_MNAMELEN]; /* mounted file system */ + char f_mntfromlabel[_VFS_MNAMELEN]; /* disk label name if available */ }; /* from <sys/timex.h> */ Index: src/sys/compat/netbsd32/netbsd32_conv.h diff -u src/sys/compat/netbsd32/netbsd32_conv.h:1.38 src/sys/compat/netbsd32/netbsd32_conv.h:1.39 --- src/sys/compat/netbsd32/netbsd32_conv.h:1.38 Wed Feb 20 22:37:19 2019 +++ src/sys/compat/netbsd32/netbsd32_conv.h Sun Sep 22 18:59:38 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_conv.h,v 1.38 2019/02/21 03:37:19 mrg Exp $ */ +/* $NetBSD: netbsd32_conv.h,v 1.39 2019/09/22 22:59:38 christos Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -307,7 +307,7 @@ netbsd32_from_mmsghdr(struct netbsd32_mm } static __inline void -netbsd32_from_statvfs(const struct statvfs *sbp, struct netbsd32_statvfs *sb32p) +netbsd32_from_statvfs90(const struct statvfs *sbp, struct netbsd32_statvfs90 *sb32p) { sb32p->f_flag = sbp->f_flag; sb32p->f_bsize = (netbsd32_u_long)sbp->f_bsize; @@ -347,6 +347,47 @@ netbsd32_from_statvfs(const struct statv } static __inline void +netbsd32_from_statvfs(const struct statvfs *sbp, struct netbsd32_statvfs *sb32p) +{ + sb32p->f_flag = sbp->f_flag; + sb32p->f_bsize = (netbsd32_u_long)sbp->f_bsize; + sb32p->f_frsize = (netbsd32_u_long)sbp->f_frsize; + sb32p->f_iosize = (netbsd32_u_long)sbp->f_iosize; + sb32p->f_blocks = sbp->f_blocks; + sb32p->f_bfree = sbp->f_bfree; + sb32p->f_bavail = sbp->f_bavail; + sb32p->f_bresvd = sbp->f_bresvd; + sb32p->f_files = sbp->f_files; + sb32p->f_ffree = sbp->f_ffree; + sb32p->f_favail = sbp->f_favail; + sb32p->f_fresvd = sbp->f_fresvd; + sb32p->f_syncreads = sbp->f_syncreads; + sb32p->f_syncwrites = sbp->f_syncwrites; + sb32p->f_asyncreads = sbp->f_asyncreads; + sb32p->f_asyncwrites = sbp->f_asyncwrites; + sb32p->f_fsidx = sbp->f_fsidx; + sb32p->f_fsid = (netbsd32_u_long)sbp->f_fsid; + sb32p->f_namemax = (netbsd32_u_long)sbp->f_namemax; + sb32p->f_owner = sbp->f_owner; + sb32p->f_spare[0] = 0; + sb32p->f_spare[1] = 0; + sb32p->f_spare[2] = 0; + sb32p->f_spare[3] = 0; +#if 1 + /* May as well do the whole batch in one go */ + memcpy(sb32p->f_fstypename, sbp->f_fstypename, + sizeof(sb32p->f_fstypename) + sizeof(sb32p->f_mntonname) + + sizeof(sb32p->f_mntfromname) + sizeof(sb32p->f_mntfromlabel)); +#else + /* If we want to be careful */ + memcpy(sb32p->f_fstypename, sbp->f_fstypename, sizeof(sb32p->f_fstypename)); + memcpy(sb32p->f_mntonname, sbp->f_mntonname, sizeof(sb32p->f_mntonname)); + memcpy(sb32p->f_mntfromname, sbp->f_mntfromname, sizeof(sb32p->f_mntfromname)); + memcpy(sb32p->f_mntfromlabel, sbp->f_mntfromlabel, sizeof(sb32p->f_mntfromlabel)); +#endif +} + +static __inline void netbsd32_from_timex(const struct timex *txp, struct netbsd32_timex *tx32p) { Index: src/sys/compat/netbsd32/netbsd32_fs.c diff -u src/sys/compat/netbsd32/netbsd32_fs.c:1.83 src/sys/compat/netbsd32/netbsd32_fs.c:1.84 --- src/sys/compat/netbsd32/netbsd32_fs.c:1.83 Sat Sep 21 02:56:51 2019 +++ src/sys/compat/netbsd32/netbsd32_fs.c Sun Sep 22 18:59:38 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_fs.c,v 1.83 2019/09/21 06:56:51 maxv Exp $ */ +/* $NetBSD: netbsd32_fs.c,v 1.84 2019/09/22 22:59:38 christos Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.83 2019/09/21 06:56:51 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.84 2019/09/22 22:59:38 christos Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -400,7 +400,8 @@ netbsd32_copyout_statvfs(const void *kp, } int -netbsd32_statvfs1(struct lwp *l, const struct netbsd32_statvfs1_args *uap, register_t *retval) +netbsd32___statvfs190(struct lwp *l, + const struct netbsd32___statvfs190_args *uap, register_t *retval) { /* { syscallarg(const netbsd32_charp) path; @@ -419,7 +420,8 @@ netbsd32_statvfs1(struct lwp *l, const s } int -netbsd32_fstatvfs1(struct lwp *l, const struct netbsd32_fstatvfs1_args *uap, register_t *retval) +netbsd32___fstatvfs190(struct lwp *l, + const struct netbsd32___fstatvfs190_args *uap, register_t *retval) { /* { syscallarg(int) fd; @@ -438,7 +440,8 @@ netbsd32_fstatvfs1(struct lwp *l, const } int -netbsd32_getvfsstat(struct lwp *l, const struct netbsd32_getvfsstat_args *uap, register_t *retval) +netbsd32___getvfsstat90(struct lwp *l, + const struct netbsd32___getvfsstat90_args *uap, register_t *retval) { /* { syscallarg(netbsd32_statvfsp_t) buf; @@ -452,7 +455,8 @@ netbsd32_getvfsstat(struct lwp *l, const } int -netbsd32___fhstatvfs140(struct lwp *l, const struct netbsd32___fhstatvfs140_args *uap, register_t *retval) +netbsd32___fhstatvfs190(struct lwp *l, + const struct netbsd32___fhstatvfs190_args *uap, register_t *retval) { /* { syscallarg(const netbsd32_pointer_t) fhp; Index: src/sys/compat/netbsd32/syscalls.conf diff -u src/sys/compat/netbsd32/syscalls.conf:1.16 src/sys/compat/netbsd32/syscalls.conf:1.17 --- src/sys/compat/netbsd32/syscalls.conf:1.16 Sat Jan 26 21:08:40 2019 +++ src/sys/compat/netbsd32/syscalls.conf Sun Sep 22 18:59:38 2019 @@ -1,4 +1,4 @@ -# $NetBSD: syscalls.conf,v 1.16 2019/01/27 02:08:40 pgoyette Exp $ +# $NetBSD: syscalls.conf,v 1.17 2019/09/22 22:59:38 christos Exp $ sysnames="netbsd32_syscalls.c" sysnumhdr="netbsd32_syscall.h" @@ -6,7 +6,7 @@ syssw="netbsd32_sysent.c" sysarghdr="netbsd32_syscallargs.h" systrace="netbsd32_systrace_args.c" sysautoload="netbsd32_syscalls_autoload.c" -compatopts="compat_43 compat_09 compat_10 compat_11 compat_12 compat_13 compat_14 compat_15 compat_16 compat_20 compat_30 compat_40 compat_50 compat_60 compat_70 compat_80" +compatopts="compat_43 compat_09 compat_10 compat_11 compat_12 compat_13 compat_14 compat_15 compat_16 compat_20 compat_30 compat_40 compat_50 compat_60 compat_70 compat_80 compat_90" libcompatopts="" switchname="netbsd32_sysent" Index: src/sys/compat/netbsd32/syscalls.master diff -u src/sys/compat/netbsd32/syscalls.master:1.127 src/sys/compat/netbsd32/syscalls.master:1.128 --- src/sys/compat/netbsd32/syscalls.master:1.127 Tue Jun 18 12:23:24 2019 +++ src/sys/compat/netbsd32/syscalls.master Sun Sep 22 18:59:38 2019 @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.127 2019/06/18 16:23:24 christos Exp $ + $NetBSD: syscalls.master,v 1.128 2019/09/22 22:59:38 christos Exp $ ; from: NetBSD: syscalls.master,v 1.81 1998/07/05 08:49:50 jonathan Exp ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 @@ -803,15 +803,18 @@ netbsd32_off_t start, netbsd32_off_t length); } 355 STD { int|netbsd32||uuidgen(netbsd32_uuidp_t store, \ int count); } -356 STD { int|netbsd32||getvfsstat(netbsd32_statvfsp_t buf, \ +356 COMPAT_90 MODULAR compat_netbsd32_90 \ + { int|netbsd32||getvfsstat(netbsd32_statvfs90p_t buf, \ netbsd32_size_t bufsize, int flags); } -357 STD { int|netbsd32||statvfs1(netbsd32_charp path, \ - netbsd32_statvfsp_t buf, int flags); } -358 STD { int|netbsd32||fstatvfs1(int fd, \ - netbsd32_statvfsp_t buf, int flags); } +357 COMPAT_90 MODULAR compat_netbsd32_90 \ + { int|netbsd32||statvfs1(netbsd32_charp path, \ + netbsd32_statvfs90p_t buf, int flags); } +358 COMPAT_90 MODULAR compat_netbsd32_90 \ + { int|netbsd32||fstatvfs1(int fd, \ + netbsd32_statvfs90p_t buf, int flags); } 359 COMPAT_30 MODULAR compat_netbsd32_30 \ { int|netbsd32||fhstatvfs1(netbsd32_fhandlep_t fhp, \ - netbsd32_statvfsp_t buf, int flags); } + netbsd32_statvfs90p_t buf, int flags); } 360 STD { int|netbsd32||extattrctl(netbsd32_charp path, \ int cmd, netbsd32_charp filename, \ int attrnamespace, netbsd32_charp attrname); } @@ -914,9 +917,10 @@ netbsd32_pointer_t fhp, netbsd32_size_tp fh_size); } 396 STD { int|netbsd32|40|fhopen(netbsd32_pointer_t fhp, \ netbsd32_size_t fh_size, int flags); } -397 STD { int|netbsd32|40|fhstatvfs1( \ +397 COMPAT_90 MODULAR compat_netbsd90 \ + { int|netbsd32||fhstatvfs1( \ netbsd32_pointer_t fhp, netbsd32_size_t fh_size,\ - netbsd32_statvfsp_t buf, int flags); } + netbsd32_statvfs90p_t buf, int flags); } 398 COMPAT_50 MODULAR compat_netbsd32_50 \ { int|netbsd32|40|fhstat( \ netbsd32_pointer_t fhp, netbsd32_size_t fh_size,\ @@ -1163,3 +1167,13 @@ netbsd32_wrusagep_t wru, netbsd32_siginfop_t info); } 482 STD { int|netbsd32||clock_getcpuclockid2(idtype_t idtype, \ id_t id, netbsd32_clockidp_t clock_id); } +483 STD { int|netbsd32|90|getvfsstat( \ + netbsd32_statvfsp_t buf, \ + size_t bufsize, int flags); } +484 STD { int|netbsd32|90|statvfs1(netbsd32_charp path, \ + netbsd32_statvfsp_t buf, int flags); } +485 STD { int|netbsd32|90|fstatvfs1(int fd, \ + netbsd32_statvfsp_t buf, int flags); } +486 STD { int|netbsd32|90|fhstatvfs1(netbsd32_voidp fhp, \ + size_t fh_size, netbsd32_statvfsp_t buf, \ + int flags); } Index: src/sys/conf/files diff -u src/sys/conf/files:1.1239 src/sys/conf/files:1.1240 --- src/sys/conf/files:1.1239 Sat Sep 14 02:57:52 2019 +++ src/sys/conf/files Sun Sep 22 18:59:38 2019 @@ -1,4 +1,4 @@ -# $NetBSD: files,v 1.1239 2019/09/14 06:57:52 maxv Exp $ +# $NetBSD: files,v 1.1240 2019/09/22 22:59:38 christos Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 version 20171118 @@ -141,7 +141,8 @@ defflag opt_todr.h TODR_DEBUG # compatibility options # defflag opt_compat_netbsd.h COMPAT_NETBSD -defflag opt_compat_netbsd.h COMPAT_80: COMPAT_NETBSD +defflag opt_compat_netbsd.h COMPAT_90: COMPAT_NETBSD +defflag opt_compat_netbsd.h COMPAT_80: COMPAT_90, COMPAT_NETBSD defflag opt_compat_netbsd.h COMPAT_70: COMPAT_80, COMPAT_NETBSD defflag opt_compat_netbsd.h COMPAT_60: COMPAT_70, COMPAT_NETBSD defflag opt_compat_netbsd.h COMPAT_50: COMPAT_60, COMPAT_NETBSD Index: src/sys/kern/init_sysent.c diff -u src/sys/kern/init_sysent.c:1.323 src/sys/kern/init_sysent.c:1.324 --- src/sys/kern/init_sysent.c:1.323 Sat Jan 26 21:08:43 2019 +++ src/sys/kern/init_sysent.c Sun Sep 22 18:59:39 2019 @@ -1,18 +1,20 @@ -/* $NetBSD: init_sysent.c,v 1.323 2019/01/27 02:08:43 pgoyette Exp $ */ +/* $NetBSD: init_sysent.c,v 1.324 2019/09/22 22:59:39 christos Exp $ */ /* * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.293 2018/07/31 13:00:13 rjs Exp + * created from NetBSD: syscalls.master,v 1.295 2019/06/18 16:06:45 christos Exp */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: init_sysent.c,v 1.323 2019/01/27 02:08:43 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: init_sysent.c,v 1.324 2019/09/22 22:59:39 christos Exp $"); +#ifdef _KERNEL_OPT #include "opt_modular.h" #include "opt_ntp.h" #include "opt_sysv.h" +#endif #include <sys/param.h> #include <sys/systm.h> #include <sys/signal.h> @@ -112,6 +114,18 @@ __KERNEL_RCSID(0, "$NetBSD: init_sysent. #define compat_70(func) sys_nosys #endif +#ifdef COMPAT_80 +#define compat_80(func) __CONCAT(compat_80_,func) +#else +#define compat_80(func) sys_nosys +#endif + +#ifdef COMPAT_90 +#define compat_90(func) __CONCAT(compat_90_,func) +#else +#define compat_90(func) sys_nosys +#endif + #define s(type) sizeof(type) #define n(type) (sizeof(type)/sizeof (register_t)) #define ns(type) .sy_narg = n(type), .sy_argsize = s(type) @@ -1698,20 +1712,20 @@ struct sysent sysent[] = { .sy_call = (sy_call_t *)sys_uuidgen }, /* 355 = uuidgen */ { - ns(struct sys_getvfsstat_args), + ns(struct compat_90_sys_getvfsstat_args), .sy_flags = SYCALL_ARG_PTR, - .sy_call = (sy_call_t *)sys_getvfsstat - }, /* 356 = getvfsstat */ + .sy_call = (sy_call_t *)sys_nomodule + }, /* 356 = compat_90_getvfsstat */ { - ns(struct sys_statvfs1_args), + ns(struct compat_90_sys_statvfs1_args), .sy_flags = SYCALL_ARG_PTR, - .sy_call = (sy_call_t *)sys_statvfs1 - }, /* 357 = statvfs1 */ + .sy_call = (sy_call_t *)sys_nomodule + }, /* 357 = compat_90_statvfs1 */ { - ns(struct sys_fstatvfs1_args), + ns(struct compat_90_sys_fstatvfs1_args), .sy_flags = SYCALL_ARG_PTR, - .sy_call = (sy_call_t *)sys_fstatvfs1 - }, /* 358 = fstatvfs1 */ + .sy_call = (sy_call_t *)sys_nomodule + }, /* 358 = compat_90_fstatvfs1 */ { ns(struct compat_30_sys_fhstatvfs1_args), .sy_flags = SYCALL_ARG_PTR, @@ -1900,10 +1914,10 @@ struct sysent sysent[] = { .sy_call = (sy_call_t *)sys___fhopen40 }, /* 396 = __fhopen40 */ { - ns(struct sys___fhstatvfs140_args), + ns(struct compat_90_sys_fhstatvfs1_args), .sy_flags = SYCALL_ARG_PTR, - .sy_call = (sy_call_t *)sys___fhstatvfs140 - }, /* 397 = __fhstatvfs140 */ + .sy_call = (sy_call_t *)sys_nomodule + }, /* 397 = compat_90_fhstatvfs1 */ { ns(struct compat_50_sys___fhstat40_args), .sy_flags = SYCALL_ARG_PTR, @@ -2325,17 +2339,25 @@ struct sysent sysent[] = { .sy_call = (sy_call_t *)sys_clock_getcpuclockid2 }, /* 482 = clock_getcpuclockid2 */ { - .sy_call = sys_nosys, - }, /* 483 = filler */ + ns(struct sys___getvfsstat90_args), + .sy_flags = SYCALL_ARG_PTR, + .sy_call = (sy_call_t *)sys___getvfsstat90 + }, /* 483 = __getvfsstat90 */ { - .sy_call = sys_nosys, - }, /* 484 = filler */ + ns(struct sys___statvfs190_args), + .sy_flags = SYCALL_ARG_PTR, + .sy_call = (sy_call_t *)sys___statvfs190 + }, /* 484 = __statvfs190 */ { - .sy_call = sys_nosys, - }, /* 485 = filler */ + ns(struct sys___fstatvfs190_args), + .sy_flags = SYCALL_ARG_PTR, + .sy_call = (sy_call_t *)sys___fstatvfs190 + }, /* 485 = __fstatvfs190 */ { - .sy_call = sys_nosys, - }, /* 486 = filler */ + ns(struct sys___fhstatvfs190_args), + .sy_flags = SYCALL_ARG_PTR, + .sy_call = (sy_call_t *)sys___fhstatvfs190 + }, /* 486 = __fhstatvfs190 */ { .sy_call = sys_nosys, }, /* 487 = filler */ @@ -2419,14 +2441,14 @@ const uint32_t sysent_nomodbits[] = { 0x23f80083, /* syscalls 64- 95 */ 0x2437f0ea, /* syscalls 96-127 */ 0x7877f406, /* syscalls 128-159 */ - 0x7f000e1e, /* syscalls 160-191 */ + 0x7f008e1e, /* syscalls 160-191 */ 0xf0044010, /* syscalls 192-223 */ 0xff9167ff, /* syscalls 224-255 */ 0x01d107ff, /* syscalls 256-287 */ 0x0000fc88, /* syscalls 288-319 */ - 0x02000001, /* syscalls 320-351 */ - 0x00600080, /* syscalls 352-383 */ - 0x007fc338, /* syscalls 384-415 */ + 0x0200fc01, /* syscalls 320-351 */ + 0x006000f0, /* syscalls 352-383 */ + 0x007fe338, /* syscalls 384-415 */ 0x1c470040, /* syscalls 416-447 */ 0x00000000, /* syscalls 448-479 */ 0x00000000, /* syscalls 480-511 */ Index: src/sys/kern/syscalls.conf diff -u src/sys/kern/syscalls.conf:1.29 src/sys/kern/syscalls.conf:1.30 --- src/sys/kern/syscalls.conf:1.29 Sat Jan 26 21:08:43 2019 +++ src/sys/kern/syscalls.conf Sun Sep 22 18:59:39 2019 @@ -1,4 +1,4 @@ -# $NetBSD: syscalls.conf,v 1.29 2019/01/27 02:08:43 pgoyette Exp $ +# $NetBSD: syscalls.conf,v 1.30 2019/09/22 22:59:39 christos Exp $ sysnames="syscalls.c" sysnumhdr="../sys/syscall.h" @@ -11,7 +11,7 @@ sysalign=1 rumpcalls="../rump/librump/rumpkern/rump_syscalls.c" rumpcallshdr="../rump/include/rump/rump_syscalls.h" rumpsysmap="../rump/rump.sysmap" -compatopts="compat_43 compat_09 compat_10 compat_11 compat_12 compat_13 compat_14 compat_15 compat_16 compat_20 compat_30 compat_40 compat_50 compat_60 compat_70 compat_80" +compatopts="compat_43 compat_09 compat_10 compat_11 compat_12 compat_13 compat_14 compat_15 compat_16 compat_20 compat_30 compat_40 compat_50 compat_60 compat_70 compat_80 compat_90" libcompatopts="" switchname="sysent" Index: src/sys/kern/syscalls.master diff -u src/sys/kern/syscalls.master:1.295 src/sys/kern/syscalls.master:1.296 --- src/sys/kern/syscalls.master:1.295 Tue Jun 18 12:06:45 2019 +++ src/sys/kern/syscalls.master Sun Sep 22 18:59:39 2019 @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.295 2019/06/18 16:06:45 christos Exp $ + $NetBSD: syscalls.master,v 1.296 2019/09/22 22:59:39 christos Exp $ ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 @@ -45,9 +45,11 @@ ; #ifdef's, etc. may be included, and are copied to the output files. ; #include's are copied to the syscall names and switch definition files only. +#ifdef _KERNEL_OPT #include "opt_modular.h" #include "opt_ntp.h" #include "opt_sysv.h" +#endif #include <sys/param.h> #include <sys/systm.h> @@ -714,15 +716,16 @@ 354 STD RUMP { int|sys||fsync_range(int fd, int flags, off_t start, \ off_t length); } 355 STD { int|sys||uuidgen(struct uuid *store, int count); } -356 STD RUMP { int|sys||getvfsstat(struct statvfs *buf, \ +356 COMPAT_90 MODULAR compat_90 { \ + int|sys||getvfsstat(struct statvfs90 *buf, \ size_t bufsize, int flags); } -357 STD RUMP { int|sys||statvfs1(const char *path, \ - struct statvfs *buf, int flags); } -358 STD RUMP { int|sys||fstatvfs1(int fd, struct statvfs *buf, \ - int flags); } -359 COMPAT_30 MODULAR compat_30 \ - { int|sys||fhstatvfs1(const struct compat_30_fhandle *fhp, \ - struct statvfs *buf, int flags); } +357 COMPAT_90 MODULAR compat_90 { int|sys||statvfs1(const char *path, \ + struct statvfs90 *buf, int flags); } +358 COMPAT_90 MODULAR compat_90 { int|sys||fstatvfs1(int fd, \ + struct statvfs90 *buf, int flags); } +359 COMPAT_30 MODULAR compat_30 { int|sys||fhstatvfs1( \ + const struct compat_30_fhandle *fhp, \ + struct statvfs90 *buf, int flags); } 360 STD RUMP { int|sys||extattrctl(const char *path, int cmd, \ const char *filename, int attrnamespace, \ const char *attrname); } @@ -808,8 +811,9 @@ size_t *fh_size); } 396 STD RUMP { int|sys|40|fhopen(const void *fhp, size_t fh_size,\ int flags); } -397 STD RUMP { int|sys|40|fhstatvfs1(const void *fhp, \ - size_t fh_size, struct statvfs *buf, int flags); } +397 COMPAT_90 MODULAR compat_90 { \ + int|sys||fhstatvfs1(const void *fhp, \ + size_t fh_size, struct statvfs90 *buf, int flags); } 398 COMPAT_50 MODULAR compat_50 RUMP { int|sys|40|fhstat(const void *fhp, \ size_t fh_size, struct stat30 *sb); } @@ -1001,3 +1005,11 @@ siginfo_t *info); } 482 STD { int|sys||clock_getcpuclockid2(idtype_t idtype, \ id_t id, clockid_t *clock_id); } +483 STD RUMP { int|sys|90|getvfsstat(struct statvfs *buf, \ + size_t bufsize, int flags); } +484 STD RUMP { int|sys|90|statvfs1(const char *path, \ + struct statvfs *buf, int flags); } +485 STD RUMP { int|sys|90|fstatvfs1(int fd, \ + struct statvfs *buf, int flags); } +486 STD RUMP { int|sys|90|fhstatvfs1(const void *fhp, \ + size_t fh_size, struct statvfs *buf, int flags); } Index: src/sys/kern/vfs_subr.c diff -u src/sys/kern/vfs_subr.c:1.471 src/sys/kern/vfs_subr.c:1.472 --- src/sys/kern/vfs_subr.c:1.471 Tue Jan 1 05:06:54 2019 +++ src/sys/kern/vfs_subr.c Sun Sep 22 18:59:39 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_subr.c,v 1.471 2019/01/01 10:06:54 hannken Exp $ */ +/* $NetBSD: vfs_subr.c,v 1.472 2019/09/22 22:59:39 christos Exp $ */ /*- * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.471 2019/01/01 10:06:54 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.472 2019/09/22 22:59:39 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -1198,6 +1198,8 @@ copy_statvfs_info(struct statvfs *sbp, c sizeof(sbp->f_mntonname)); (void)memcpy(sbp->f_mntfromname, mp->mnt_stat.f_mntfromname, sizeof(sbp->f_mntfromname)); + (void)memcpy(sbp->f_mntfromlabel, mp->mnt_stat.f_mntfromlabel, + sizeof(sbp->f_mntfromlabel)); sbp->f_namemax = mbp->f_namemax; } Index: src/sys/kern/vfs_syscalls.c diff -u src/sys/kern/vfs_syscalls.c:1.535 src/sys/kern/vfs_syscalls.c:1.536 --- src/sys/kern/vfs_syscalls.c:1.535 Fri Sep 20 09:29:31 2019 +++ src/sys/kern/vfs_syscalls.c Sun Sep 22 18:59:39 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls.c,v 1.535 2019/09/20 13:29:31 kamil Exp $ */ +/* $NetBSD: vfs_syscalls.c,v 1.536 2019/09/22 22:59:39 christos Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.535 2019/09/20 13:29:31 kamil Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.536 2019/09/22 22:59:39 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_fileassoc.h" @@ -1187,7 +1187,7 @@ do_sys_pstatvfs(struct lwp *l, const cha /* ARGSUSED */ int -sys_statvfs1(struct lwp *l, const struct sys_statvfs1_args *uap, register_t *retval) +sys___statvfs190(struct lwp *l, const struct sys___statvfs190_args *uap, register_t *retval) { /* { syscallarg(const char *) path; @@ -1226,7 +1226,7 @@ do_sys_fstatvfs(struct lwp *l, int fd, i /* ARGSUSED */ int -sys_fstatvfs1(struct lwp *l, const struct sys_fstatvfs1_args *uap, register_t *retval) +sys___fstatvfs190(struct lwp *l, const struct sys___fstatvfs190_args *uap, register_t *retval) { /* { syscallarg(int) fd; @@ -1307,7 +1307,8 @@ out: } int -sys_getvfsstat(struct lwp *l, const struct sys_getvfsstat_args *uap, register_t *retval) +sys___getvfsstat90(struct lwp *l, const struct sys___getvfsstat90_args *uap, + register_t *retval) { /* { syscallarg(struct statvfs *) buf; @@ -2139,7 +2140,7 @@ do_fhstatvfs(struct lwp *l, const void * /* ARGSUSED */ int -sys___fhstatvfs140(struct lwp *l, const struct sys___fhstatvfs140_args *uap, register_t *retval) +sys___fhstatvfs190(struct lwp *l, const struct sys___fhstatvfs190_args *uap, register_t *retval) { /* { syscallarg(const void *) fhp; Index: src/sys/miscfs/specfs/spec_vnops.c diff -u src/sys/miscfs/specfs/spec_vnops.c:1.175 src/sys/miscfs/specfs/spec_vnops.c:1.176 --- src/sys/miscfs/specfs/spec_vnops.c:1.175 Mon Sep 3 12:29:35 2018 +++ src/sys/miscfs/specfs/spec_vnops.c Sun Sep 22 18:59:39 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: spec_vnops.c,v 1.175 2018/09/03 16:29:35 riastradh Exp $ */ +/* $NetBSD: spec_vnops.c,v 1.176 2019/09/22 22:59:39 christos Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -58,7 +58,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.175 2018/09/03 16:29:35 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.176 2019/09/22 22:59:39 christos Exp $"); #include <sys/param.h> #include <sys/proc.h> @@ -75,6 +75,7 @@ __KERNEL_RCSID(0, "$NetBSD: spec_vnops.c #include <sys/poll.h> #include <sys/file.h> #include <sys/disklabel.h> +#include <sys/disk.h> #include <sys/lockf.h> #include <sys/tty.h> #include <sys/kauth.h> @@ -366,10 +367,19 @@ spec_node_getmountedfs(vnode_t *devvp) void spec_node_setmountedfs(vnode_t *devvp, struct mount *mp) { + struct dkwedge_info dkw; KASSERT(devvp->v_type == VBLK); KASSERT(devvp->v_specnode->sn_dev->sd_mountpoint == NULL || mp == NULL); devvp->v_specnode->sn_dev->sd_mountpoint = mp; + if (mp == NULL) + return; + + if (bdev_ioctl(devvp->v_rdev, DIOCGWEDGEINFO, &dkw, FREAD, curlwp) != 0) + return; + + strlcpy(mp->mnt_stat.f_mntfromlabel, dkw.dkw_wname, + sizeof(mp->mnt_stat.f_mntfromlabel)); } /* Index: src/sys/modules/Makefile diff -u src/sys/modules/Makefile:1.226 src/sys/modules/Makefile:1.227 --- src/sys/modules/Makefile:1.226 Tue Sep 17 03:36:51 2019 +++ src/sys/modules/Makefile Sun Sep 22 18:59:39 2019 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.226 2019/09/17 07:36:51 mrg Exp $ +# $NetBSD: Makefile,v 1.227 2019/09/22 22:59:39 christos Exp $ .include <bsd.own.mk> @@ -10,7 +10,7 @@ SUBDIR+= compat_util SUBDIR+= compat_43 compat_sysctl_09_43 SUBDIR+= compat_09 compat_10 compat_12 compat_13 compat_14 SUBDIR+= compat_16 compat_20 compat_30 compat_40 compat_50 -SUBDIR+= compat_60 compat_70 compat_80 +SUBDIR+= compat_60 compat_70 compat_80 compat_90 SUBDIR+= compat_sysv_10 compat_sysv_14 compat_sysv_50 @@ -292,6 +292,7 @@ SUBDIR+= compat_netbsd32_13 compat_netbs SUBDIR+= compat_netbsd32_20 compat_netbsd32_30 SUBDIR+= compat_netbsd32_40 compat_netbsd32_50 SUBDIR+= compat_netbsd32_60 compat_netbsd32_80 +SUBDIR+= compat_netbsd32_90 SUBDIR+= compat_netbsd32_43 SUBDIR+= compat_netbsd32_mqueue SUBDIR+= compat_netbsd32_nfssrv Index: src/sys/sys/param.h diff -u src/sys/sys/param.h:1.612 src/sys/sys/param.h:1.613 --- src/sys/sys/param.h:1.612 Tue Sep 17 11:20:05 2019 +++ src/sys/sys/param.h Sun Sep 22 18:59:40 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.612 2019/09/17 15:20:05 christos Exp $ */ +/* $NetBSD: param.h,v 1.613 2019/09/22 22:59:40 christos Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -67,7 +67,7 @@ * 2.99.9 (299000900) */ -#define __NetBSD_Version__ 999001200 /* NetBSD 9.99.12 */ +#define __NetBSD_Version__ 999001300 /* NetBSD 9.99.13 */ #define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \ (m) * 1000000) + (p) * 100) <= __NetBSD_Version__) Index: src/sys/sys/statvfs.h diff -u src/sys/sys/statvfs.h:1.18 src/sys/sys/statvfs.h:1.19 --- src/sys/sys/statvfs.h:1.18 Fri Apr 5 13:34:27 2013 +++ src/sys/sys/statvfs.h Sun Sep 22 18:59:40 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: statvfs.h,v 1.18 2013/04/05 17:34:27 christos Exp $ */ +/* $NetBSD: statvfs.h,v 1.19 2019/09/22 22:59:40 christos Exp $ */ /*- * Copyright (c) 2004 The NetBSD Foundation, Inc. @@ -91,11 +91,12 @@ struct statvfs { unsigned long f_namemax; /* maximum filename length */ uid_t f_owner; /* user that mounted the file system */ - uint32_t f_spare[4]; /* spare space */ + uint64_t f_spare[4]; /* spare space */ - char f_fstypename[_VFS_NAMELEN]; /* fs type name */ - char f_mntonname[_VFS_MNAMELEN]; /* directory on which mounted */ - char f_mntfromname[_VFS_MNAMELEN]; /* mounted file system */ + char f_fstypename[_VFS_NAMELEN]; /* fs type name */ + char f_mntonname[_VFS_MNAMELEN]; /* directory on which mounted */ + char f_mntfromname[_VFS_MNAMELEN]; /* mounted file system */ + char f_mntfromlabel[_VFS_MNAMELEN]; /* disk label name if avail */ }; @@ -146,34 +147,36 @@ int set_statvfs_info(const char *, int, const char *, struct mount *, struct lwp *); void copy_statvfs_info(struct statvfs *, const struct mount *); int dostatvfs(struct mount *, struct statvfs *, struct lwp *, int, int); + +#include <sys/kmem.h> +#define STATVFSBUF_GET() kmem_zalloc(sizeof(struct statvfs), KM_SLEEP) +#define STATVFSBUF_PUT(sb) kmem_free(sb, sizeof(struct statvfs)) + #else __BEGIN_DECLS -int statvfs(const char *__restrict, struct statvfs *__restrict); -int fstatvfs(int, struct statvfs *); -int getvfsstat(struct statvfs *, size_t, int); #ifndef __LIBC12_SOURCE__ -int getmntinfo(struct statvfs **, int) __RENAME(__getmntinfo13); -#endif /* __LIBC12_SOURCE__ */ +int getmntinfo(struct statvfs **, int) + __RENAME(__getmntinfo90); + +int statvfs(const char *__restrict, struct statvfs *__restrict) + __RENAME(__statvfs90); +int fstatvfs(int, struct statvfs *) + __RENAME(__fstatvfs90); +int getvfsstat(struct statvfs *, size_t, int) + __RENAME(__getvfsstat90); + #if defined(_NETBSD_SOURCE) -#ifndef __LIBC12_SOURCE__ int fhstatvfs(const void *, size_t, struct statvfs *) - __RENAME(__fhstatvfs40); -#endif - -int statvfs1(const char *__restrict, struct statvfs *__restrict, int); -int fstatvfs1(int, struct statvfs *, int); -#ifndef __LIBC12_SOURCE__ + __RENAME(__fhstatvfs90); +int statvfs1(const char *__restrict, struct statvfs *__restrict, int) + __RENAME(__statvfs190); +int fstatvfs1(int, struct statvfs *, int) + __RENAME(__fstatvfs190); int fhstatvfs1(const void *, size_t, struct statvfs *, int) - __RENAME(__fhstatvfs140); -#endif + __RENAME(__fhstatvfs190); #endif /* _NETBSD_SOURCE */ +#endif /* __LIBC12_SOURCE__ */ __END_DECLS #endif /* _KERNEL || _STANDALONE */ -#if defined(_KERNEL) -#include <sys/kmem.h> -#define STATVFSBUF_GET() kmem_alloc(sizeof(struct statvfs), KM_SLEEP) -#define STATVFSBUF_PUT(sb) kmem_free(sb, sizeof(struct statvfs)) -#endif /* defined(_KERNEL) */ - #endif /* !_SYS_STATVFS_H_ */ Index: src/usr.bin/ktruss/dump.c diff -u src/usr.bin/ktruss/dump.c:1.43 src/usr.bin/ktruss/dump.c:1.44 --- src/usr.bin/ktruss/dump.c:1.43 Sun Jun 3 09:41:30 2018 +++ src/usr.bin/ktruss/dump.c Sun Sep 22 18:59:40 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: dump.c,v 1.43 2018/06/03 13:41:30 kamil Exp $ */ +/* $NetBSD: dump.c,v 1.44 2019/09/22 22:59:40 christos Exp $ */ /*- * Copyright (c) 1988, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19 #if 0 static char sccsid[] = "@(#)kdump.c 8.4 (Berkeley) 4/28/95"; #endif -__RCSID("$NetBSD: dump.c,v 1.43 2018/06/03 13:41:30 kamil Exp $"); +__RCSID("$NetBSD: dump.c,v 1.44 2019/09/22 22:59:40 christos Exp $"); #endif /* not lint */ #include <sys/param.h> @@ -528,7 +528,7 @@ syscallprint(struct ktr_header *kth) case SYS___utimes50: case SYS_compat_50_quotactl: case SYS___quotactl: - case SYS_statvfs1: + case SYS___statvfs190: case SYS_compat_30_getfh: case SYS_pathconf: case SYS_truncate: Added files: Index: src/lib/libc/compat/gen/compat___getmntinfo13.c diff -u /dev/null src/lib/libc/compat/gen/compat___getmntinfo13.c:1.1 --- /dev/null Sun Sep 22 18:59:40 2019 +++ src/lib/libc/compat/gen/compat___getmntinfo13.c Sun Sep 22 18:59:38 2019 @@ -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 + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <sys/cdefs.h> +#if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD: compat___getmntinfo13.c,v 1.1 2019/09/22 22:59:38 christos Exp $"); +#endif /* LIBC_SCCS and not lint */ + +#define __LIBC12_SOURCE__ + +#include "namespace.h" + +#include <sys/types.h> +#include <sys/param.h> + +#include <assert.h> +#include <compat/sys/statvfs.h> +#include <string.h> +#include <stdlib.h> + +__warn_references(__getmntinfo13, + "warning: reference to obsolete __getmntinfo13(); use statvfs()") + +__strong_alias(__getmntinfo13, __compat___getmntinfo13) + +/* + * Return information about mounted filesystems. + */ +int +__compat___getmntinfo13(struct statvfs90 **mntbufp, int flags) +{ + static struct statvfs90 *mntbuf; + static int mntsize; + static size_t bufsize; + + _DIAGASSERT(mntbufp != NULL); + + if (mntsize <= 0 && + (mntsize = __compat_getvfsstat(NULL, 0L, MNT_NOWAIT)) == -1) + return (0); + if (bufsize > 0 && + (mntsize = __compat_getvfsstat(mntbuf, bufsize, flags)) == -1) + return (0); + while (bufsize <= mntsize * sizeof(struct statvfs90)) { + if (mntbuf) + free(mntbuf); + bufsize = (mntsize + 1) * sizeof(struct statvfs90); + if ((mntbuf = malloc(bufsize)) == NULL) + return (0); + if ((mntsize = __compat_getvfsstat(mntbuf, bufsize, + flags)) == -1) + return (0); + } + *mntbufp = mntbuf; + return (mntsize); +} Index: src/lib/libc/compat/sys/compat___fhstatvfs140.c diff -u /dev/null src/lib/libc/compat/sys/compat___fhstatvfs140.c:1.1 --- /dev/null Sun Sep 22 18:59:40 2019 +++ src/lib/libc/compat/sys/compat___fhstatvfs140.c Sun Sep 22 18:59:38 2019 @@ -0,0 +1,59 @@ +/* $NetBSD: compat___fhstatvfs140.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 + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + + +#include <sys/cdefs.h> +#if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD: compat___fhstatvfs140.c,v 1.1 2019/09/22 22:59:38 christos Exp $"); +#endif /* LIBC_SCCS and not lint */ + +#define __LIBC12_SOURCE__ + +#include <sys/types.h> +#include <sys/statvfs.h> +#include <compat/include/fstypes.h> +#include <compat/sys/statvfs.h> + +__warn_references(__fhstatvfs140, + "warning: reference to compatibility __fhstatvfs140(); include <sys/statvfs.h> to generate correct reference") + +__strong_alias(__fhstatvfs140, __compat___fhstatvfs140) + +int +__compat___fhstatvfs140(const void *fhp, size_t len, struct statvfs90 *buf, + int flags) +{ + struct statvfs sb; + int error = __fhstatvfs190(fhp, len, &sb, flags); + if (error != -1) + statvfs_to_statvfs90(&sb, buf); + return error; +} Index: src/lib/libc/compat/sys/compat___fhstatvfs40.c diff -u /dev/null src/lib/libc/compat/sys/compat___fhstatvfs40.c:1.1 --- /dev/null Sun Sep 22 18:59:40 2019 +++ src/lib/libc/compat/sys/compat___fhstatvfs40.c Sun Sep 22 18:59:38 2019 @@ -0,0 +1,58 @@ +/* $NetBSD: compat___fhstatvfs40.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 + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + + +#include <sys/cdefs.h> +#if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD: compat___fhstatvfs40.c,v 1.1 2019/09/22 22:59:38 christos Exp $"); +#endif /* LIBC_SCCS and not lint */ + +#define __LIBC12_SOURCE__ + +#include <sys/types.h> +#include <sys/statvfs.h> +#include <compat/include/fstypes.h> +#include <compat/sys/statvfs.h> + +__warn_references(__fhstatvfs40, + "warning: reference to compatibility __fhstatvfs40(); include <sys/statvfs.h> to generate correct reference") + +__strong_alias(__fhstatvfs40, __compat___fhstatvfs40) + +int +__compat___fhstatvfs40(const void *fhp, size_t len, struct statvfs90 *buf) +{ + struct statvfs sb; + int error = __fhstatvfs190(fhp, len, &sb, 0); + if (error != -1) + statvfs_to_statvfs90(&sb, buf); + return error; +} Index: src/lib/libc/compat/sys/compat_statvfs.c diff -u /dev/null src/lib/libc/compat/sys/compat_statvfs.c:1.1 --- /dev/null Sun Sep 22 18:59:40 2019 +++ src/lib/libc/compat/sys/compat_statvfs.c Sun Sep 22 18:59:38 2019 @@ -0,0 +1,121 @@ +/* $NetBSD: compat_statvfs.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 + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + + +#include <sys/cdefs.h> +#if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD: compat_statvfs.c,v 1.1 2019/09/22 22:59:38 christos Exp $"); +#endif /* LIBC_SCCS and not lint */ + +#define __LIBC12_SOURCE__ + +#include <stdlib.h> +#include <sys/types.h> +#include <sys/statvfs.h> +#include <compat/include/fstypes.h> +#include <compat/sys/statvfs.h> + +__warn_references(statvfs, + "warning: reference to compatibility statvfs(); include <sys/statvfs.h> to generate correct reference") +__warn_references(statvfs1, + "warning: reference to compatibility statvfs1(); include <sys/statvfs.h> to generate correct reference") + +__warn_references(fstatvfs, + "warning: reference to compatibility fstatvfs(); include <sys/statvfs.h> to generate correct reference") +__warn_references(fstatvfs1, + "warning: reference to compatibility fstatvfs1(); include <sys/statvfs.h> to generate correct reference") + +__warn_references(getvfsstat, + "warning: reference to compatibility getvfsstat(); include <sys/statvfs.h> to generate correct reference") + +__strong_alias(statvfs, __compat_statvfs) +__strong_alias(statvfs1, __compat_statvfs1) +__strong_alias(fstatvfs, __compat_fstatvfs) +__strong_alias(fstatvfs1, __compat_fstatvfs1) +__strong_alias(getvfsstat, __compat_getvfsstat) + +int +__compat_statvfs(const char *path, struct statvfs90 *buf) +{ + struct statvfs sb; + int error = __statvfs190(path, &sb, 0); + if (error != -1) + statvfs_to_statvfs90(&sb, buf); + return error; +} + +int +__compat_statvfs1(const char *path, struct statvfs90 *buf, int flags) +{ + struct statvfs sb; + int error = __statvfs190(path, &sb, flags); + if (error != -1) + statvfs_to_statvfs90(&sb, buf); + return error; +} + +int +__compat_fstatvfs(int fd, struct statvfs90 *buf) +{ + struct statvfs sb; + int error = __fstatvfs190(fd, &sb, 0); + if (error != -1) + statvfs_to_statvfs90(&sb, buf); + return error; +} + +int +__compat_fstatvfs1(int fd, struct statvfs90 *buf, int flags) +{ + struct statvfs sb; + int error = __fstatvfs190(fd, &sb, flags); + if (error != -1) + statvfs_to_statvfs90(&sb, buf); + return error; +} + +int +__compat_getvfsstat(struct statvfs90 *buf, size_t size, int flags) +{ + size_t count = size / sizeof(*buf); + struct statvfs *sb = calloc(count, sizeof(*sb)); + + if (sb == NULL) + return -1; + + int error = __getvfsstat90(sb, count * sizeof(*sb), flags); + if (error != -1) { + for (size_t i = 0; i < count; i++) + statvfs_to_statvfs90(sb + i, buf + i); + } + free(sb); + return error; +} Index: src/sys/compat/common/compat_90_mod.c diff -u /dev/null src/sys/compat/common/compat_90_mod.c:1.1 --- /dev/null Sun Sep 22 18:59:40 2019 +++ src/sys/compat/common/compat_90_mod.c Sun Sep 22 18:59:38 2019 @@ -0,0 +1,83 @@ +/* $NetBSD: compat_90_mod.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 developed for The NetBSD Foundation + * by Paul Goyette + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Linkage for the compat module: spaghetti. + */ + +#if defined(_KERNEL_OPT) +#include "opt_compat_netbsd.h" +#endif + +#include <sys/cdefs.h> +__KERNEL_RCSID(0, "$NetBSD: compat_90_mod.c,v 1.1 2019/09/22 22:59:38 christos Exp $"); + +#include <sys/systm.h> +#include <sys/module.h> + +#include <compat/common/compat_util.h> +#include <compat/common/compat_mod.h> + +int +compat_90_init(void) +{ + + vfs_syscalls_90_init(); + + return 0; +} + +int +compat_90_fini(void) +{ + + vfs_syscalls_90_fini(); + + return 0; +} + +MODULE(MODULE_CLASS_EXEC, compat_90, NULL); + +static int +compat_90_modcmd(modcmd_t cmd, void *arg) +{ + + switch (cmd) { + case MODULE_CMD_INIT: + return compat_90_init(); + + case MODULE_CMD_FINI: + return compat_90_fini(); + + default: + return ENOTTY; + } +} Index: src/sys/compat/common/vfs_syscalls_90.c diff -u /dev/null src/sys/compat/common/vfs_syscalls_90.c:1.1 --- /dev/null Sun Sep 22 18:59:40 2019 +++ src/sys/compat/common/vfs_syscalls_90.c Sun Sep 22 18:59:38 2019 @@ -0,0 +1,163 @@ +/* $NetBSD: vfs_syscalls_90.c,v 1.1 2019/09/22 22:59:38 christos Exp $ */ + +/*- + * Copyright (c) 2005, 2008 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 + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include <sys/cdefs.h> +__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_90.c,v 1.1 2019/09/22 22:59:38 christos Exp $"); + +#if defined(_KERNEL_OPT) +#include "opt_compat_netbsd.h" +#endif + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/namei.h> +#include <sys/filedesc.h> +#include <sys/kernel.h> +#include <sys/file.h> +#include <sys/stat.h> +#include <sys/socketvar.h> +#include <sys/vnode.h> +#include <sys/mount.h> +#include <sys/proc.h> +#include <sys/uio.h> +#include <sys/dirent.h> +#include <sys/malloc.h> +#include <sys/kauth.h> +#include <sys/vfs_syscalls.h> +#include <sys/syscall.h> +#include <sys/syscallvar.h> +#include <sys/syscallargs.h> + +#include <compat/common/compat_mod.h> +#include <compat/common/compat_util.h> +#include <compat/sys/statvfs.h> + +static const struct syscall_package vfs_syscalls_90_syscalls[] = { + { SYS_compat_90_getvfsstat, 0, (sy_call_t *)compat_90_sys_getvfsstat }, + { SYS_compat_90_statvfs1, 0, (sy_call_t *)compat_90_sys_statvfs1 }, + { SYS_compat_90_fstatvfs1, 0, (sy_call_t *)compat_90_sys_fstatvfs1 }, + { SYS_compat_90_fhstatvfs1, 0, (sy_call_t *)compat_90_sys_fhstatvfs1 }, + { 0,0, NULL } +}; + + +int +compat_90_sys_getvfsstat(struct lwp *l, + const struct compat_90_sys_getvfsstat_args *uap, register_t *retval) +{ + /* { + syscallarg(struct statvfs90 *) buf; + syscallarg(size_t) bufsize; + syscallarg(int) flags; + } */ + + return do_sys_getvfsstat(l, SCARG(uap, buf), SCARG(uap, bufsize), + SCARG(uap, flags), statvfs_to_statvfs90_copy, + sizeof(struct statvfs90), retval); +} + +int +compat_90_sys_statvfs1(struct lwp *l, + const struct compat_90_sys_statvfs1_args *uap, register_t *retval) +{ + /* { + syscallarg(const char *) path; + syscallarg(struct statvfs90 *) buf; + syscallarg(int) flags; + } */ + + struct statvfs *sb = STATVFSBUF_GET(); + int error = do_sys_pstatvfs(l, SCARG(uap, path), SCARG(uap, flags), sb); + + if (!error) + error = statvfs_to_statvfs90_copy(sb, SCARG(uap, buf), + sizeof(struct statvfs90)); + + STATVFSBUF_PUT(sb); + return error; +} + +int +compat_90_sys_fstatvfs1(struct lwp *l, + const struct compat_90_sys_fstatvfs1_args *uap, register_t *retval) +{ + /* { + syscallarg(int) fd; + syscallarg(struct statvfs90 *) buf; + syscallarg(int) flags; + } */ + + struct statvfs *sb = STATVFSBUF_GET(); + int error = do_sys_fstatvfs(l, SCARG(uap, fd), SCARG(uap, flags), sb); + + if (!error) + error = statvfs_to_statvfs90_copy(sb, SCARG(uap, buf), + sizeof(struct statvfs90)); + + STATVFSBUF_PUT(sb); + return error; +} + +int +compat_90_sys_fhstatvfs1(struct lwp *l, + const struct compat_90_sys_fhstatvfs1_args *uap, register_t *retval) +{ + /* { + syscallarg(const void *) fhp; + syscallarg(size_t) fh_size; + syscallarg(struct statvfs90 *) buf; + syscallarg(int) flags; + } */ + + struct statvfs *sb = STATVFSBUF_GET(); + int error = do_fhstatvfs(l, SCARG(uap, fhp), SCARG(uap, fh_size), + sb, SCARG(uap, flags)); + + if (!error) + error = statvfs_to_statvfs90_copy(sb, SCARG(uap, buf), + sizeof(struct statvfs90)); + + STATVFSBUF_PUT(sb); + return error; +} + +int +vfs_syscalls_90_init(void) +{ + + return syscall_establish(NULL, vfs_syscalls_90_syscalls); +} + +int +vfs_syscalls_90_fini(void) +{ + + return syscall_disestablish(NULL, vfs_syscalls_90_syscalls); +} Index: src/sys/compat/netbsd32/netbsd32_compat_90.c diff -u /dev/null src/sys/compat/netbsd32/netbsd32_compat_90.c:1.1 --- /dev/null Sun Sep 22 18:59:40 2019 +++ src/sys/compat/netbsd32/netbsd32_compat_90.c Sun Sep 22 18:59:38 2019 @@ -0,0 +1,173 @@ +/* $NetBSD: netbsd32_compat_90.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 developed for The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <sys/cdefs.h> +__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_90.c,v 1.1 2019/09/22 22:59:38 christos Exp $"); + +#include <sys/param.h> +#include <sys/kmem.h> +#include <sys/module.h> +#include <sys/filedesc.h> +#include <sys/statvfs.h> +#include <sys/vfs_syscalls.h> +#include <sys/syscallvar.h> + +#include <compat/netbsd32/netbsd32.h> +#include <compat/netbsd32/netbsd32_syscall.h> +#include <compat/netbsd32/netbsd32_syscallargs.h> +#include <compat/netbsd32/netbsd32_conv.h> + +static int +netbsd32_copyout_statvfs90(const void *kp, void *up, size_t len) +{ + struct netbsd32_statvfs90 *sbuf_32; + int error; + + sbuf_32 = kmem_alloc(sizeof(*sbuf_32), KM_SLEEP); + netbsd32_from_statvfs90(kp, sbuf_32); + error = copyout(sbuf_32, up, sizeof(*sbuf_32)); + kmem_free(sbuf_32, sizeof(*sbuf_32)); + + return error; +} + +int +compat_90_netbsd32_getvfsstat(struct lwp *l, + const struct compat_90_netbsd32_getvfsstat_args *uap, register_t *retval) +{ + /* { + syscallarg(netbsd32_statvfs90p_t) buf; + syscallarg(netbsd32_size_t) bufsize; + syscallarg(int) flags; + } */ + + return do_sys_getvfsstat(l, SCARG_P32(uap, buf), SCARG(uap, bufsize), + SCARG(uap, flags), netbsd32_copyout_statvfs90, + sizeof(struct netbsd32_statvfs90), retval); +} + +int +compat_90_netbsd32_statvfs1(struct lwp *l, + const struct compat_90_netbsd32_statvfs1_args *uap, register_t *retval) +{ + /* { + syscallarg(const netbsd32_charp) path; + syscallarg(netbsd32_statvfs90p_t) buf; + syscallarg(int) flags; + } */ + struct statvfs *sb; + int error; + + sb = STATVFSBUF_GET(); + error = do_sys_pstatvfs(l, SCARG_P32(uap, path), SCARG(uap, flags), sb); + if (error == 0) + error = netbsd32_copyout_statvfs90(sb, SCARG_P32(uap, buf), + sizeof(struct netbsd32_statvfs90)); + STATVFSBUF_PUT(sb); + return error; +} + +int +compat_90_netbsd32_fstatvfs1(struct lwp *l, + const struct compat_90_netbsd32_fstatvfs1_args *uap, register_t *retval) +{ + /* { + syscallarg(int) fd; + syscallarg(netbsd32_statvfs90p_t) buf; + syscallarg(int) flags; + } */ + struct statvfs *sb; + int error; + + sb = STATVFSBUF_GET(); + error = do_sys_fstatvfs(l, SCARG(uap, fd), SCARG(uap, flags), sb); + if (error == 0) + error = netbsd32_copyout_statvfs90(sb, SCARG_P32(uap, buf), 0); + STATVFSBUF_PUT(sb); + return error; +} + + +int +compat_90_netbsd32_fhstatvfs1(struct lwp *l, + const struct compat_90_netbsd32_fhstatvfs1_args *uap, register_t *retval) +{ + /* { + syscallarg(const netbsd32_pointer_t) fhp; + syscallarg(netbsd32_size_t) fh_size; + syscallarg(netbsd32_statvfs90p_t) buf; + syscallarg(int) flags; + } */ + struct statvfs *sb; + int error; + + sb = STATVFSBUF_GET(); + error = do_fhstatvfs(l, SCARG_P32(uap, fhp), SCARG(uap, fh_size), sb, + SCARG(uap, flags)); + + if (error == 0) + error = netbsd32_copyout_statvfs90(sb, SCARG_P32(uap, buf), 0); + STATVFSBUF_PUT(sb); + + return error; +} + +static struct syscall_package compat_netbsd32_90_syscalls[] = { + { NETBSD32_SYS_compat_90_netbsd32_getvfsstat, 0, + (sy_call_t *)compat_90_netbsd32_getvfsstat }, + { NETBSD32_SYS_compat_90_netbsd32_statvfs1, 0, + (sy_call_t *)compat_90_netbsd32_statvfs1 }, + { NETBSD32_SYS_compat_90_netbsd32_fstatvfs1, 0, + (sy_call_t *)compat_90_netbsd32_fstatvfs1 }, + { NETBSD32_SYS_compat_90_netbsd32_fhstatvfs1, 0, + (sy_call_t *)compat_90_netbsd32_fhstatvfs1 }, + { 0, 0, NULL } +}; + +MODULE(MODULE_CLASS_EXEC, compat_netbsd32_90, "compat_netbsd32,compat_90"); + +static int +compat_netbsd32_90_modcmd(modcmd_t cmd, void *arg) +{ + + switch (cmd) { + case MODULE_CMD_INIT: + return syscall_establish(&emul_netbsd32, + compat_netbsd32_90_syscalls); + + case MODULE_CMD_FINI: + return syscall_disestablish(&emul_netbsd32, + compat_netbsd32_90_syscalls); + + default: + return ENOTTY; + } +} Index: src/sys/conf/compat_netbsd90.config diff -u /dev/null src/sys/conf/compat_netbsd90.config:1.1 --- /dev/null Sun Sep 22 18:59:40 2019 +++ src/sys/conf/compat_netbsd90.config Sun Sep 22 18:59:38 2019 @@ -0,0 +1,9 @@ +# $NetBSD: compat_netbsd90.config,v 1.1 2019/09/22 22:59:38 christos Exp $ + +# Common fragment for all NetBSD targets wanting NetBSD 7.0 and newer +# compatibility support. +# +# Note that COMPAT_80 implies all newer COMPAT_XX options. + +include "conf/compat_netbsd.config" +options COMPAT_90 # NetBSD 9.0 and beyond. Index: src/sys/modules/compat_90/Makefile diff -u /dev/null src/sys/modules/compat_90/Makefile:1.1 --- /dev/null Sun Sep 22 18:59:40 2019 +++ src/sys/modules/compat_90/Makefile Sun Sep 22 18:59:39 2019 @@ -0,0 +1,14 @@ +# $NetBSD: Makefile,v 1.1 2019/09/22 22:59:39 christos Exp $ + +.include "../Makefile.inc" + +.PATH: ${S}/compat/common + +KMOD= compat_90 + +CPPFLAGS+= -DCOMPAT_90 + +SRCS+= compat_90_mod.c +SRCS+= vfs_syscalls_90.c + +.include <bsd.kmodule.mk> Index: src/sys/modules/compat_netbsd32_90/Makefile diff -u /dev/null src/sys/modules/compat_netbsd32_90/Makefile:1.1 --- /dev/null Sun Sep 22 18:59:40 2019 +++ src/sys/modules/compat_netbsd32_90/Makefile Sun Sep 22 18:59:40 2019 @@ -0,0 +1,15 @@ +# $NetBSD: Makefile,v 1.1 2019/09/22 22:59:40 christos Exp $ + +.include "../Makefile.inc" + +.PATH: ${S}/compat/netbsd32 + +KMOD= compat_netbsd32_90 + +CPPFLAGS+= -DCOMPAT_NETBSD32 +CPPFLAGS+= -DCOMPAT_90 +CPPFLAGS+= -I${NETBSDSRCDIR}/sys/external/bsd/libnv/dist + +SRCS+= netbsd32_compat_90.c + +.include <bsd.kmodule.mk>