Source-Changes-HG archive

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

[src/netbsd-6]: src/sys Pull up following revision(s) (requested by dsl in ti...



details:   https://anonhg.NetBSD.org/src/rev/34ca852d2481
branches:  netbsd-6
changeset: 774189:34ca852d2481
user:      riz <riz%NetBSD.org@localhost>
date:      Tue Jun 12 17:13:56 2012 +0000

description:
Pull up following revision(s) (requested by dsl in ticket #306):
        sys/kern/vfs_bio.c: revision 1.238
        sys/dev/bluetooth/bcsp.c: revision 1.21
        sys/dev/acpi/asus_acpi.c: revision 1.24
        sys/miscfs/syncfs/sync_subr.c: revision 1.48
Some calls to sysctl_createv() have mismatches betwwen the data type
and the CTLTYPE_xxx flags.
Fixes bugs in sys/dev/acpi/asus_acpi.c sys/dev/bluetooth/bcsp.c
  sys/kern/vfs_bio.c sys/miscfs/syncfs/sync_subr.c
(mostly passing the address of a uint64_t when typed as CTLTYPE_INT).
The vm.bufmem_lowater (etc) sysctls needs to be processed with a
  64bit temporary value on 64bit systems.
Fixes PR kern/46536.

diffstat:

 sys/dev/acpi/asus_acpi.c      |   8 ++++----
 sys/dev/bluetooth/bcsp.c      |   6 +++---
 sys/kern/vfs_bio.c            |  36 +++++++++++++++++++-----------------
 sys/miscfs/syncfs/sync_subr.c |  12 ++++++------
 4 files changed, 32 insertions(+), 30 deletions(-)

diffs (211 lines):

diff -r 9d03fecc272e -r 34ca852d2481 sys/dev/acpi/asus_acpi.c
--- a/sys/dev/acpi/asus_acpi.c  Tue Jun 12 17:06:38 2012 +0000
+++ b/sys/dev/acpi/asus_acpi.c  Tue Jun 12 17:13:56 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: asus_acpi.c,v 1.23 2012/01/21 18:13:56 jmcneill Exp $ */
+/* $NetBSD: asus_acpi.c,v 1.23.2.1 2012/06/12 17:13:57 riz Exp $ */
 
 /*-
  * Copyright (c) 2007, 2008, 2009 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: asus_acpi.c,v 1.23 2012/01/21 18:13:56 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: asus_acpi.c,v 1.23.2.1 2012/06/12 17:13:57 riz Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -355,7 +355,7 @@
                goto sysctl_err;
        node_mib = node->sysctl_num;
        err = sysctl_createv(&sc->sc_log, 0, NULL, &node_ncfv,
-           CTLFLAG_READONLY, CTLTYPE_INT, "ncfv",
+           CTLFLAG_READONLY, CTLTYPE_QUAD, "ncfv",
            SYSCTL_DESCR("Number of CPU frequency/voltage modes"),
            NULL, 0, &sc->sc_cfvnum, 0,
            CTL_HW, node_mib, CTL_CREATE, CTL_EOL);
@@ -365,7 +365,7 @@
        err = sysctl_createv(&sc->sc_log, 0, NULL, &node_cfv,
            CTLFLAG_READWRITE, CTLTYPE_INT, "cfv",
            SYSCTL_DESCR("Current CPU frequency/voltage mode"),
-           asus_sysctl_verify, 0, sc, 0,
+           asus_sysctl_verify, 0, (void *)sc, 0,
            CTL_HW, node_mib, CTL_CREATE, CTL_EOL);
        if (err)
                goto sysctl_err;
diff -r 9d03fecc272e -r 34ca852d2481 sys/dev/bluetooth/bcsp.c
--- a/sys/dev/bluetooth/bcsp.c  Tue Jun 12 17:06:38 2012 +0000
+++ b/sys/dev/bluetooth/bcsp.c  Tue Jun 12 17:13:56 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcsp.c,v 1.20 2011/07/31 13:51:53 uebayasi Exp $       */
+/*     $NetBSD: bcsp.c,v 1.20.8.1 2012/06/12 17:13:57 riz Exp $        */
 /*
  * Copyright (c) 2007 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcsp.c,v 1.20 2011/07/31 13:51:53 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcsp.c,v 1.20.8.1 2012/06/12 17:13:57 riz Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -300,7 +300,7 @@
        }
        bcsp_node_num = node->sysctl_num;
        if ((rc = sysctl_createv(&sc->sc_log, 0, NULL, &node,
-           CTLFLAG_READWRITE, CTLTYPE_INT,
+           CTLFLAG_READWRITE, CTLTYPE_BOOL,
            "muzzled", SYSCTL_DESCR("muzzled for Link-establishment Layer"),
            NULL, 0, &sc->sc_le_muzzled,
            0, CTL_HW, bcsp_node_num, CTL_CREATE, CTL_EOL)) != 0) {
diff -r 9d03fecc272e -r 34ca852d2481 sys/kern/vfs_bio.c
--- a/sys/kern/vfs_bio.c        Tue Jun 12 17:06:38 2012 +0000
+++ b/sys/kern/vfs_bio.c        Tue Jun 12 17:13:56 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_bio.c,v 1.236 2012/02/01 23:43:49 para Exp $       */
+/*     $NetBSD: vfs_bio.c,v 1.236.2.1 2012/06/12 17:13:56 riz Exp $    */
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -123,7 +123,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.236 2012/02/01 23:43:49 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.236.2.1 2012/06/12 17:13:56 riz Exp $");
 
 #include "opt_bufcache.h"
 
@@ -1730,39 +1730,41 @@
 static int
 sysctl_bufvm_update(SYSCTLFN_ARGS)
 {
-       int t, error, rv;
+       int error, rv;
        struct sysctlnode node;
+       union u_int_long { unsigned int i; unsigned long l; } t;
 
+       /* Take a copy of the supplied node and its data */
        node = *rnode;
        node.sysctl_data = &t;
-       t = *(int *)rnode->sysctl_data;
+       t = *(union u_int_long *)rnode->sysctl_data;
+
+       /* Update the copy */
        error = sysctl_lookup(SYSCTLFN_CALL(&node));
        if (error || newp == NULL)
                return (error);
 
-       if (t < 0)
-               return EINVAL;
        if (rnode->sysctl_data == &bufcache) {
-               if (t > 100)
+               if (t.i > 100)
                        return (EINVAL);
-               bufcache = t;
+               bufcache = t.i;
                buf_setwm();
        } else if (rnode->sysctl_data == &bufmem_lowater) {
-               if (bufmem_hiwater - t < 16)
+               if (bufmem_hiwater - t.l < 16)
                        return (EINVAL);
-               bufmem_lowater = t;
+               bufmem_lowater = t.l;
        } else if (rnode->sysctl_data == &bufmem_hiwater) {
-               if (t - bufmem_lowater < 16)
+               if (t.l - bufmem_lowater < 16)
                        return (EINVAL);
-               bufmem_hiwater = t;
+               bufmem_hiwater = t.l;
        } else
                return (EINVAL);
 
        /* Drain until below new high water mark */
        sysctl_unlock();
        mutex_enter(&bufcache_lock);
-       while ((t = bufmem - bufmem_hiwater) >= 0) {
-               rv = buf_drain(t / (2 * 1024));
+       while (bufmem > bufmem_hiwater) {
+               rv = buf_drain((bufmem - bufmem_hiwater) / (2 * 1024));
                if (rv <= 0)
                        break;
        }
@@ -1809,21 +1811,21 @@
                       CTL_VM, CTL_CREATE, CTL_EOL);
        sysctl_createv(&vfsbio_sysctllog, 0, NULL, NULL,
                       CTLFLAG_PERMANENT|CTLFLAG_READONLY,
-                      CTLTYPE_INT, "bufmem",
+                      CTLTYPE_LONG, "bufmem",
                       SYSCTL_DESCR("Amount of kernel memory used by buffer "
                                    "cache"),
                       NULL, 0, &bufmem, 0,
                       CTL_VM, CTL_CREATE, CTL_EOL);
        sysctl_createv(&vfsbio_sysctllog, 0, NULL, NULL,
                       CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
-                      CTLTYPE_INT, "bufmem_lowater",
+                      CTLTYPE_LONG, "bufmem_lowater",
                       SYSCTL_DESCR("Minimum amount of kernel memory to "
                                    "reserve for buffer cache"),
                       sysctl_bufvm_update, 0, &bufmem_lowater, 0,
                       CTL_VM, CTL_CREATE, CTL_EOL);
        sysctl_createv(&vfsbio_sysctllog, 0, NULL, NULL,
                       CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
-                      CTLTYPE_INT, "bufmem_hiwater",
+                      CTLTYPE_LONG, "bufmem_hiwater",
                       SYSCTL_DESCR("Maximum amount of kernel memory to use "
                                    "for buffer cache"),
                       sysctl_bufvm_update, 0, &bufmem_hiwater, 0,
diff -r 9d03fecc272e -r 34ca852d2481 sys/miscfs/syncfs/sync_subr.c
--- a/sys/miscfs/syncfs/sync_subr.c     Tue Jun 12 17:06:38 2012 +0000
+++ b/sys/miscfs/syncfs/sync_subr.c     Tue Jun 12 17:13:56 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sync_subr.c,v 1.47 2011/09/23 01:57:32 manu Exp $      */
+/*     $NetBSD: sync_subr.c,v 1.47.8.1 2012/06/12 17:13:58 riz Exp $   */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sync_subr.c,v 1.47 2011/09/23 01:57:32 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sync_subr.c,v 1.47.8.1 2012/06/12 17:13:58 riz Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -317,28 +317,28 @@
 
        sysctl_createv(clog, 0, &rnode, &cnode,
                        CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
-                       CTLTYPE_INT, "delay",
+                       CTLTYPE_QUAD, "delay",
                        SYSCTL_DESCR("max time to delay syncing data"),
                        NULL, 0, &syncdelay, 0,
                        CTL_CREATE, CTL_EOL);
 
        sysctl_createv(clog, 0, &rnode, &cnode,
                        CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
-                       CTLTYPE_INT, "filedelay",
+                       CTLTYPE_QUAD, "filedelay",
                        SYSCTL_DESCR("time to delay syncing files"),
                        NULL, 0, &filedelay, 0,
                        CTL_CREATE, CTL_EOL);
 
        sysctl_createv(clog, 0, &rnode, &cnode,
                        CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
-                       CTLTYPE_INT, "dirdelay",
+                       CTLTYPE_QUAD, "dirdelay",
                        SYSCTL_DESCR("time to delay syncing directories"),
                        NULL, 0, &dirdelay, 0,
                        CTL_CREATE, CTL_EOL);
 
        sysctl_createv(clog, 0, &rnode, &cnode,
                        CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
-                       CTLTYPE_INT, "metadelay",
+                       CTLTYPE_QUAD, "metadelay",
                        SYSCTL_DESCR("time to delay syncing metadata"),
                        NULL, 0, &metadelay, 0,
                        CTL_CREATE, CTL_EOL);



Home | Main Index | Thread Index | Old Index