Source-Changes-HG archive

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

[src/trunk]: src/sys/kern make the copy_statfs_args() function copy all the f...



details:   https://anonhg.NetBSD.org/src/rev/40d614b2e606
branches:  trunk
changeset: 546001:40d614b2e606
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Apr 18 22:44:45 2003 +0000

description:
make the copy_statfs_args() function copy all the fields that are not
set by the filesystems. Before my changes, the statfs code depended
on calling it with mp->mnt_stat, and did not explicitly initialize
anything!

diffstat:

 sys/kern/vfs_subr.c |  22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diffs (45 lines):

diff -r 83b1c322b39b -r 40d614b2e606 sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c       Fri Apr 18 22:39:56 2003 +0000
+++ b/sys/kern/vfs_subr.c       Fri Apr 18 22:44:45 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_subr.c,v 1.192 2003/04/16 21:44:20 christos Exp $  */
+/*     $NetBSD: vfs_subr.c,v 1.193 2003/04/18 22:44:45 christos Exp $  */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.192 2003/04/16 21:44:20 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.193 2003/04/18 22:44:45 christos Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -2776,12 +2776,22 @@
 void
 copy_statfs_info(struct statfs *sbp, const struct mount *mp)
 {
-       if (sbp == &mp->mnt_stat)
+       const struct statfs *mbp;
+
+       if (sbp == (mbp = &mp->mnt_stat))
                return;
-       (void)strncpy(sbp->f_fstypename, mp->mnt_stat.f_fstypename,
+
+       sbp->f_oflags = mbp->f_oflags;
+       sbp->f_type = mbp->f_type;
+       (void)memcpy(&sbp->f_fsid, &mbp->f_fsid, sizeof(sbp->f_fsid));
+       sbp->f_owner = mbp->f_owner;
+       sbp->f_flags = mbp->f_flags;
+       sbp->f_syncwrites = mbp->f_syncwrites;
+       sbp->f_asyncwrites = mbp->f_asyncwrites;
+       sbp->f_spare[0] = mbp->f_spare[0];
+       (void)memcpy(sbp->f_fstypename, mbp->f_fstypename,
            sizeof(sbp->f_fstypename));
-       (void)memcpy(&sbp->f_fsid, &mp->mnt_stat.f_fsid, sizeof(sbp->f_fsid));
-       (void)memcpy(sbp->f_mntonname, mp->mnt_stat.f_mntonname,
+       (void)memcpy(sbp->f_mntonname, mbp->f_mntonname,
            sizeof(sbp->f_mntonname));
        (void)memcpy(sbp->f_mntfromname, mp->mnt_stat.f_mntfromname,
            sizeof(sbp->f_mntfromname));



Home | Main Index | Thread Index | Old Index