-/*
- * This file is part of the SPL: Solaris Porting Layer.
- *
- * Copyright (c) 2008 Lawrence Livermore National Security, LLC.
- * Produced at Lawrence Livermore National Laboratory
- * Written by:
- * Brian Behlendorf <behlendorf1@llnl.gov>,
- * Herb Wartens <wartens2@llnl.gov>,
- * Jim Garlick <garlick@llnl.gov>
+/*****************************************************************************\
+ * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
+ * Copyright (C) 2007 The Regents of the University of California.
+ * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
+ * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
* UCRL-CODE-235197
*
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This file is part of the SPL, Solaris Porting Layer.
+ * For details, see <http://github.com/behlendorf/spl/>.
+ *
+ * The SPL is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
*
- * This is distributed in the hope that it will be useful, but WITHOUT
+ * The SPL is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
+ * with the SPL. If not, see <http://www.gnu.org/licenses/>.
+ *****************************************************************************
+ * Solaris Porting Layer (SPL) Proc Implementation.
+\*****************************************************************************/
#include <sys/proc.h>
return size;
}
-static int
-proc_dobitmasks(struct ctl_table *table, int write, struct file *filp,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+SPL_PROC_HANDLER(proc_dobitmasks)
{
unsigned long *mask = table->data;
int is_subsys = (mask == &spl_debug_subsys) ? 1 : 0;
RETURN(rc);
}
-static int
-proc_debug_mb(struct ctl_table *table, int write, struct file *filp,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+SPL_PROC_HANDLER(proc_debug_mb)
{
char str[32];
int rc, len;
if (*ppos >= len)
rc = 0;
else
- rc = proc_copyout_string(buffer, *lenp, str + *ppos, "\n");
+ rc = proc_copyout_string(buffer,*lenp,str+*ppos,"\n");
if (rc >= 0) {
*lenp = rc;
RETURN(rc);
}
-static int
-proc_dump_kernel(struct ctl_table *table, int write, struct file *filp,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+SPL_PROC_HANDLER(proc_dump_kernel)
{
ENTRY;
RETURN(0);
}
-static int
-proc_force_bug(struct ctl_table *table, int write, struct file *filp,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+SPL_PROC_HANDLER(proc_force_bug)
{
ENTRY;
RETURN(0);
}
-static int
-proc_console_max_delay_cs(struct ctl_table *table, int write, struct file *filp,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+SPL_PROC_HANDLER(proc_console_max_delay_cs)
{
int rc, max_delay_cs;
struct ctl_table dummy = *table;
if (write) {
max_delay_cs = 0;
- rc = proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
+ rc = spl_proc_dointvec(&dummy,write,filp,buffer,lenp,ppos);
if (rc < 0)
RETURN(rc);
spl_console_max_delay = d;
} else {
max_delay_cs = (spl_console_max_delay * 100) / HZ;
- rc = proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
+ rc = spl_proc_dointvec(&dummy,write,filp,buffer,lenp,ppos);
}
RETURN(rc);
}
-static int
-proc_console_min_delay_cs(struct ctl_table *table, int write, struct file *filp,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+SPL_PROC_HANDLER(proc_console_min_delay_cs)
{
int rc, min_delay_cs;
struct ctl_table dummy = *table;
if (write) {
min_delay_cs = 0;
- rc = proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
+ rc = spl_proc_dointvec(&dummy,write,filp,buffer,lenp,ppos);
if (rc < 0)
RETURN(rc);
spl_console_min_delay = d;
} else {
min_delay_cs = (spl_console_min_delay * 100) / HZ;
- rc = proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
+ rc = spl_proc_dointvec(&dummy,write,filp,buffer,lenp,ppos);
}
RETURN(rc);
}
-static int
-proc_console_backoff(struct ctl_table *table, int write, struct file *filp,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+SPL_PROC_HANDLER(proc_console_backoff)
{
int rc, backoff;
struct ctl_table dummy = *table;
if (write) {
backoff = 0;
- rc = proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
+ rc = spl_proc_dointvec(&dummy,write,filp,buffer,lenp,ppos);
if (rc < 0)
RETURN(rc);
spl_console_backoff = backoff;
} else {
backoff = spl_console_backoff;
- rc = proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
+ rc = spl_proc_dointvec(&dummy,write,filp,buffer,lenp,ppos);
}
RETURN(rc);
}
#ifdef DEBUG_KMEM
-static int
-proc_domemused(struct ctl_table *table, int write, struct file *filp,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+SPL_PROC_HANDLER(proc_domemused)
{
int rc = 0;
unsigned long min = 0, max = ~0, val;
# else
val = atomic_read((atomic_t *)table->data);
# endif /* HAVE_ATOMIC64_T */
- rc = proc_doulongvec_minmax(&dummy, write, filp,
- buffer, lenp, ppos);
+ rc = spl_proc_doulongvec_minmax(&dummy, write, filp,
+ buffer, lenp, ppos);
}
RETURN(rc);
}
#endif /* DEBUG_KMEM */
-static int
-proc_dohostid(struct ctl_table *table, int write, struct file *filp,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+SPL_PROC_HANDLER(proc_dohostid)
{
int len, rc = 0;
int32_t val;
ENTRY;
if (write) {
- /* We can't use proc_doulongvec_minmax() in the write
+ /* We can't use spl_proc_doulongvec_minmax() in the write
* case hear because hostid while a hex value has no
* leading 0x which confuses the helper function. */
rc = proc_copyin_string(str, sizeof(str), buffer, *lenp);
if (*ppos >= len)
rc = 0;
else
- rc = proc_copyout_string(buffer, *lenp, str + *ppos, "\n");
+ rc = proc_copyout_string(buffer,*lenp,str+*ppos,"\n");
if (rc >= 0) {
*lenp = rc;
}
#ifndef HAVE_KALLSYMS_LOOKUP_NAME
-static int
-proc_dokallsyms_lookup_name(struct ctl_table *table, int write,
- struct file *filp, void __user *buffer,
- size_t *lenp, loff_t *ppos) {
+SPL_PROC_HANDLER(proc_dokallsyms_lookup_name)
+{
int len, rc = 0;
char *end, str[32];
ENTRY;
if (spl_kallsyms_lookup_name_fn != SYMBOL_POISON)
RETURN(-EEXIST);
- /* We can't use proc_doulongvec_minmax() in the write
+ /* We can't use spl_proc_doulongvec_minmax() in the write
* case hear because the address while a hex value has no
* leading 0x which confuses the helper function. */
rc = proc_copyin_string(str, sizeof(str), buffer, *lenp);
}
#endif /* HAVE_KALLSYMS_LOOKUP_NAME */
-static int
-proc_doavailrmem(struct ctl_table *table, int write, struct file *filp,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+SPL_PROC_HANDLER(proc_doavailrmem)
{
int len, rc = 0;
char str[32];
if (write) {
*ppos += *lenp;
} else {
- len = snprintf(str, sizeof(str), "%lu", (unsigned long)availrmem);
+ len = snprintf(str, sizeof(str), "%lu",
+ (unsigned long)availrmem);
if (*ppos >= len)
rc = 0;
else
- rc = proc_copyout_string(buffer, *lenp, str + *ppos, "\n");
+ rc = proc_copyout_string(buffer,*lenp,str+*ppos,"\n");
if (rc >= 0) {
*lenp = rc;
RETURN(rc);
}
-static int
-proc_dofreemem(struct ctl_table *table, int write, struct file *filp,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+SPL_PROC_HANDLER(proc_dofreemem)
{
int len, rc = 0;
char str[32];
if (*ppos >= len)
rc = 0;
else
- rc = proc_copyout_string(buffer, *lenp, str + *ppos, "\n");
+ rc = proc_copyout_string(buffer,*lenp,str+*ppos,"\n");
if (rc >= 0) {
*lenp = rc;
static void
slab_seq_show_headers(struct seq_file *f)
{
- seq_printf(f, "%-36s\n", "name");
+ seq_printf(f, "%-36s %-6s - %s %s %s - %s %s %s - "
+ "%s %s %s - %s %s %s\n", "name", "flags",
+ "obj_size", "slab_objs", "slab_size",
+ "slab_fail", "slab_create", "slab_destroy",
+ "slab_total", "slab_alloc", "slab_max",
+ "obj_total", "obj_alloc", "obj_max");
}
static int
slab_seq_show(struct seq_file *f, void *p)
{
- spl_kmem_cache_t *skc = p;
+ spl_kmem_cache_t *skc = p;
- ASSERT(skc->skc_magic == SKC_MAGIC);
+ ASSERT(skc->skc_magic == SKC_MAGIC);
- spin_lock(&skc->skc_lock);
+ spin_lock(&skc->skc_lock);
seq_printf(f, "%-36s ", skc->skc_name);
- seq_printf(f, "%u %u %u - %lu %lu %lu - %lu %lu %lu - %lu %lu %lu\n",
- (unsigned)skc->skc_obj_size,
- (unsigned)skc->skc_slab_objs,
- (unsigned)skc->skc_slab_size,
- (long unsigned)skc->skc_slab_fail,
- (long unsigned)skc->skc_slab_create,
- (long unsigned)skc->skc_slab_destroy,
- (long unsigned)skc->skc_slab_total,
- (long unsigned)skc->skc_slab_alloc,
- (long unsigned)skc->skc_slab_max,
- (long unsigned)skc->skc_obj_total,
- (long unsigned)skc->skc_obj_alloc,
- (long unsigned)skc->skc_obj_max);
-
- spin_unlock(&skc->skc_lock);
+ seq_printf(f, "0x%04lx - %u %u %u - %lu %lu %lu - "
+ "%lu %lu %lu - %lu %lu %lu\n",
+ (long unsigned)skc->skc_flags,
+ (unsigned)skc->skc_obj_size,
+ (unsigned)skc->skc_slab_objs,
+ (unsigned)skc->skc_slab_size,
+ (long unsigned)skc->skc_slab_fail,
+ (long unsigned)skc->skc_slab_create,
+ (long unsigned)skc->skc_slab_destroy,
+ (long unsigned)skc->skc_slab_total,
+ (long unsigned)skc->skc_slab_alloc,
+ (long unsigned)skc->skc_slab_max,
+ (long unsigned)skc->skc_obj_total,
+ (long unsigned)skc->skc_obj_alloc,
+ (long unsigned)skc->skc_obj_max);
+
+ spin_unlock(&skc->skc_lock);
return 0;
}
++*pos;
RETURN((skc->skc_list.next == &spl_kmem_cache_list) ?
- NULL : list_entry(skc->skc_list.next, spl_kmem_cache_t, skc_list));
+ NULL : list_entry(skc->skc_list.next,spl_kmem_cache_t,skc_list));
}
static void