From owner-svn-src-all@FreeBSD.ORG Wed May 20 22:28:39 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD9E31065670; Wed, 20 May 2009 22:28:39 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B20888FC0A; Wed, 20 May 2009 22:28:39 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4KMSd69046215; Wed, 20 May 2009 22:28:39 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4KMSdsE046212; Wed, 20 May 2009 22:28:39 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905202228.n4KMSdsE046212@svn.freebsd.org> From: Kip Macy Date: Wed, 20 May 2009 22:28:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192491 - in stable/7/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 May 2009 22:28:40 -0000 Author: kmacy Date: Wed May 20 22:28:39 2009 New Revision: 192491 URL: http://svn.freebsd.org/changeset/base/192491 Log: MFC quad tunables and sysctls for setting ZFS arc cache size Modified: stable/7/sys/kern/kern_environment.c stable/7/sys/sys/kernel.h stable/7/sys/sys/sysctl.h Modified: stable/7/sys/kern/kern_environment.c ============================================================================== --- stable/7/sys/kern/kern_environment.c Wed May 20 22:27:18 2009 (r192490) +++ stable/7/sys/kern/kern_environment.c Wed May 20 22:28:39 2009 (r192491) @@ -553,6 +553,14 @@ tunable_ulong_init(void *data) } void +tunable_quad_init(void *data) +{ + struct tunable_quad *d = (struct tunable_quad *)data; + + TUNABLE_QUAD_FETCH(d->path, d->var); +} + +void tunable_str_init(void *data) { struct tunable_str *d = (struct tunable_str *)data; Modified: stable/7/sys/sys/kernel.h ============================================================================== --- stable/7/sys/sys/kernel.h Wed May 20 22:27:18 2009 (r192490) +++ stable/7/sys/sys/kernel.h Wed May 20 22:28:39 2009 (r192491) @@ -329,6 +329,25 @@ struct tunable_ulong { #define TUNABLE_ULONG_FETCH(path, var) getenv_ulong((path), (var)) +/* + * quad + */ +extern void tunable_quad_init(void *); +struct tunable_quad { + const char *path; + quad_t *var; +}; +#define TUNABLE_QUAD(path, var) \ + static struct tunable_quad __CONCAT(__tunable_quad_, __LINE__) = { \ + (path), \ + (var), \ + }; \ + SYSINIT(__CONCAT(__Tunable_init_, __LINE__), \ + SI_SUB_TUNABLES, SI_ORDER_MIDDLE, tunable_quad_init, \ + &__CONCAT(__tunable_quad_, __LINE__)) + +#define TUNABLE_QUAD_FETCH(path, var) getenv_quad((path), (var)) + extern void tunable_str_init(void *); struct tunable_str { const char *path; Modified: stable/7/sys/sys/sysctl.h ============================================================================== --- stable/7/sys/sys/sysctl.h Wed May 20 22:27:18 2009 (r192490) +++ stable/7/sys/sys/sysctl.h Wed May 20 22:28:39 2009 (r192491) @@ -295,6 +295,15 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_ULONG|CTLFLAG_MPSAFE|(access), \ ptr, 0, sysctl_handle_long, "LX", __DESCR(descr)) +/* Oid for a quad. The pointer must be non NULL. */ +#define SYSCTL_QUAD(parent, nbr, name, access, ptr, val, descr) \ + SYSCTL_OID(parent, nbr, name, CTLTYPE_QUAD|CTLFLAG_MPSAFE|(access), \ + ptr, val, sysctl_handle_quad, "Q", __DESCR(descr)) + +#define SYSCTL_ADD_QUAD(ctx, parent, nbr, name, access, ptr, descr) \ + sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_QUAD|CTLFLAG_MPSAFE|(access), \ + ptr, 0, sysctl_handle_quad, "Q", __DESCR(descr)) + /* Oid for an opaque object. Specified by a pointer and a length. */ #define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \ SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \