~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/jfs/jfs_debug.c

Version: ~ [ linux-5.3-rc5 ] ~ [ linux-5.2.9 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.67 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.139 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.189 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.189 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.72 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  *   Copyright (C) International Business Machines Corp., 2000-2004
  3  *   Portions Copyright (C) Christoph Hellwig, 2001-2002
  4  *
  5  *   This program is free software;  you can redistribute it and/or modify
  6  *   it under the terms of the GNU General Public License as published by
  7  *   the Free Software Foundation; either version 2 of the License, or
  8  *   (at your option) any later version.
  9  *
 10  *   This program is distributed in the hope that it will be useful,
 11  *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
 12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
 13  *   the GNU General Public License for more details.
 14  *
 15  *   You should have received a copy of the GNU General Public License
 16  *   along with this program;  if not, write to the Free Software
 17  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 18  */
 19 
 20 #include <linux/fs.h>
 21 #include <linux/ctype.h>
 22 #include <linux/module.h>
 23 #include <linux/proc_fs.h>
 24 #include <linux/seq_file.h>
 25 #include <asm/uaccess.h>
 26 #include "jfs_incore.h"
 27 #include "jfs_filsys.h"
 28 #include "jfs_debug.h"
 29 
 30 #ifdef PROC_FS_JFS /* see jfs_debug.h */
 31 
 32 static struct proc_dir_entry *base;
 33 #ifdef CONFIG_JFS_DEBUG
 34 static int jfs_loglevel_proc_show(struct seq_file *m, void *v)
 35 {
 36         seq_printf(m, "%d\n", jfsloglevel);
 37         return 0;
 38 }
 39 
 40 static int jfs_loglevel_proc_open(struct inode *inode, struct file *file)
 41 {
 42         return single_open(file, jfs_loglevel_proc_show, NULL);
 43 }
 44 
 45 static ssize_t jfs_loglevel_proc_write(struct file *file,
 46                 const char __user *buffer, size_t count, loff_t *ppos)
 47 {
 48         char c;
 49 
 50         if (get_user(c, buffer))
 51                 return -EFAULT;
 52 
 53         /* yes, I know this is an ASCIIism.  --hch */
 54         if (c < '' || c > '9')
 55                 return -EINVAL;
 56         jfsloglevel = c - '';
 57         return count;
 58 }
 59 
 60 static const struct file_operations jfs_loglevel_proc_fops = {
 61         .owner          = THIS_MODULE,
 62         .open           = jfs_loglevel_proc_open,
 63         .read           = seq_read,
 64         .llseek         = seq_lseek,
 65         .release        = single_release,
 66         .write          = jfs_loglevel_proc_write,
 67 };
 68 #endif
 69 
 70 static struct {
 71         const char      *name;
 72         const struct file_operations *proc_fops;
 73 } Entries[] = {
 74 #ifdef CONFIG_JFS_STATISTICS
 75         { "lmstats",    &jfs_lmstats_proc_fops, },
 76         { "txstats",    &jfs_txstats_proc_fops, },
 77         { "xtstat",     &jfs_xtstat_proc_fops, },
 78         { "mpstat",     &jfs_mpstat_proc_fops, },
 79 #endif
 80 #ifdef CONFIG_JFS_DEBUG
 81         { "TxAnchor",   &jfs_txanchor_proc_fops, },
 82         { "loglevel",   &jfs_loglevel_proc_fops }
 83 #endif
 84 };
 85 #define NPROCENT        ARRAY_SIZE(Entries)
 86 
 87 void jfs_proc_init(void)
 88 {
 89         int i;
 90 
 91         if (!(base = proc_mkdir("fs/jfs", NULL)))
 92                 return;
 93 
 94         for (i = 0; i < NPROCENT; i++)
 95                 proc_create(Entries[i].name, 0, base, Entries[i].proc_fops);
 96 }
 97 
 98 void jfs_proc_clean(void)
 99 {
100         int i;
101 
102         if (base) {
103                 for (i = 0; i < NPROCENT; i++)
104                         remove_proc_entry(Entries[i].name, base);
105                 remove_proc_entry("fs/jfs", NULL);
106         }
107 }
108 
109 #endif /* PROC_FS_JFS */
110 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp