Date: Wed, 20 May 2009 22:28:39 +0000 (UTC) From: Kip Macy <kmacy@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r192491 - in stable/7/sys: kern sys Message-ID: <200905202228.n4KMSdsE046212@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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), \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905202228.n4KMSdsE046212>