From: Tom Zanussi This patch removes from relayfs the 'klog debugging channel', which is a relayfs 'application' that doesn't belong in the main code. Signed-off-by: Tom Zanussi Signed-off-by: Andrew Morton --- /dev/null | 206 -------------------------------------------- 25-akpm/fs/Kconfig | 34 ------- 25-akpm/fs/relayfs/Makefile | 2 25-akpm/fs/relayfs/inode.c | 7 - 4 files changed, 2 insertions(+), 247 deletions(-) diff -puN fs/Kconfig~relayfs-remove-klog-debugging-channel fs/Kconfig --- 25/fs/Kconfig~relayfs-remove-klog-debugging-channel 2005-01-16 01:12:05.944798800 -0800 +++ 25-akpm/fs/Kconfig 2005-01-16 01:12:05.953797432 -0800 @@ -874,8 +874,7 @@ config RELAYFS_FS an efficient mechanism for tools and facilities to relay large amounts of data from kernel space to user space. It's not useful on its own, and should only be enabled if other facilities that - need it are enabled, such as for example klog or the Linux Trace - Toolkit. + need it are enabled, such as for example the Linux Trace Toolkit. See for further information. @@ -887,37 +886,6 @@ config RELAYFS_FS If unsure, say N. -config KLOG_CHANNEL - bool "Enable klog debugging support" - depends on RELAYFS_FS - default n - help - If you say Y to this, a relayfs channel named klog will be created - in the root of the relayfs file system. You can write to the klog - channel using klog() or klog_raw() from within the kernel or - kernel modules, and read from the klog channel by mounting relayfs - and using read(2) to read from it (or using cat). If you're not - sure, say N. - -config KLOG_CHANNEL_AUTOENABLE - bool "Enable klog logging on startup" - depends on KLOG_CHANNEL - default y - help - If you say Y to this, the klog channel will be automatically enabled - on startup. Otherwise, to turn klog logging on, you need use - sysctl (fs.relayfs.klog_enabled). This option is used in cases where - you don't actually want the channel to be written to until it's - enabled. If you're not sure, say Y. - -config KLOG_CHANNEL_SHIFT - depends on KLOG_CHANNEL - int "klog debugging channel size (14 => 16KB, 22 => 4MB)" - range 14 22 - default 21 - help - Select klog debugging channel size as a power of 2. - endmenu menu "Miscellaneous filesystems" diff -puN fs/relayfs/inode.c~relayfs-remove-klog-debugging-channel fs/relayfs/inode.c --- 25/fs/relayfs/inode.c~relayfs-remove-klog-debugging-channel 2005-01-16 01:12:05.946798496 -0800 +++ 25-akpm/fs/relayfs/inode.c 2005-01-16 01:12:05.954797280 -0800 @@ -604,19 +604,12 @@ static int __init init_relayfs_fs(void) { int err = register_filesystem(&relayfs_fs_type); -#ifdef CONFIG_KLOG_CHANNEL - if (!err) - create_klog_channel(); -#endif return err; } static void __exit exit_relayfs_fs(void) { -#ifdef CONFIG_KLOG_CHANNEL - remove_klog_channel(); -#endif unregister_filesystem(&relayfs_fs_type); } diff -L fs/relayfs/klog.c -puN fs/relayfs/klog.c~relayfs-remove-klog-debugging-channel /dev/null --- 25/fs/relayfs/klog.c +++ /dev/null 2003-09-15 06:40:47.000000000 -0700 @@ -1,206 +0,0 @@ -/* - * KLOG Generic Logging facility built upon the relayfs infrastructure - * - * Authors: Hubertus Franke (frankeh@us.ibm.com) - * Tom Zanussi (zanussi@us.ibm.com) - * - * Please direct all questions/comments to zanussi@us.ibm.com - * - * Copyright (C) 2003, IBM Corp - * - * This program 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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* klog channel id */ -static int klog_channel = -1; - -/* maximum size of klog formatting buffer beyond which truncation will occur */ -#define KLOG_BUF_SIZE (512) -/* per-cpu klog formatting buffer */ -static char buf[NR_CPUS][KLOG_BUF_SIZE]; - -/* - * klog_enabled determines whether klog()/klog_raw() actually do write - * to the klog channel at any given time. If klog_enabled == 1 they do, - * otherwise they don't. Settable using sysctl fs.relayfs.klog_enabled. - */ -#ifdef CONFIG_KLOG_CHANNEL_AUTOENABLE -static int klog_enabled = 1; -#else -static int klog_enabled = 0; -#endif - -/** - * klog - write a formatted string into the klog channel - * @fmt: format string - * - * Returns number of bytes written, negative number on failure. - */ -int klog(const char *fmt, ...) -{ - va_list args; - int len, err; - char *cbuf; - unsigned long flags; - - if (!klog_enabled || klog_channel < 0) - return 0; - - local_irq_save(flags); - cbuf = buf[smp_processor_id()]; - - va_start(args, fmt); - len = vsnprintf(cbuf, KLOG_BUF_SIZE, fmt, args); - va_end(args); - - err = relay_write(klog_channel, cbuf, len, -1, NULL); - local_irq_restore(flags); - - return err; -} - -/** - * klog_raw - directly write into the klog channel - * @buf: buffer containing data to write - * @len: # bytes to write - * - * Returns number of bytes written, negative number on failure. - */ -int klog_raw(const char *buf,int len) -{ - int err = 0; - - if (klog_enabled && klog_channel >= 0) - err = relay_write(klog_channel, buf, len, -1, NULL); - - return err; -} - -/** - * relayfs sysctl data - * - * Only sys/fs/relayfs/klog_enabled for now. - */ -#define CTL_ENABLE_KLOG 100 -#define CTL_RELAYFS 100 - -static struct ctl_table_header *relayfs_ctl_table_header; - -static struct ctl_table relayfs_table[] = -{ - { - .ctl_name = CTL_ENABLE_KLOG, - .procname = "klog_enabled", - .data = &klog_enabled, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec, - }, - { - 0 - } -}; - -static struct ctl_table relayfs_dir_table[] = -{ - { - .ctl_name = CTL_RELAYFS, - .procname = "relayfs", - .data = NULL, - .maxlen = 0, - .mode = 0555, - .child = relayfs_table, - }, - { - 0 - } -}; - -static struct ctl_table relayfs_root_table[] = -{ - { - .ctl_name = CTL_FS, - .procname = "fs", - .data = NULL, - .maxlen = 0, - .mode = 0555, - .child = relayfs_dir_table, - }, - { - 0 - } -}; - -/** - * create_klog_channel - creates channel /mnt/relay/klog - * - * Returns channel id on success, negative otherwise. - */ -int -create_klog_channel(void) -{ - u32 bufsize, nbufs; - u32 channel_flags; - - channel_flags = RELAY_DELIVERY_PACKET | RELAY_USAGE_GLOBAL; - channel_flags |= RELAY_SCHEME_ANY | RELAY_TIMESTAMP_ANY; - - bufsize = 1 << (CONFIG_KLOG_CHANNEL_SHIFT - 2); - nbufs = 4; - - klog_channel = relay_open("klog", - bufsize, - nbufs, - channel_flags, - NULL, - 0, - 0, - 0, - 0, - 0, - 0, - NULL, - 0); - - if (klog_channel < 0) - printk("klog channel creation failed, errcode: %d\n", klog_channel); - else { - printk("klog channel created (%u bytes)\n", 1 << CONFIG_KLOG_CHANNEL_SHIFT); - relayfs_ctl_table_header = register_sysctl_table(relayfs_root_table, 1); - } - - return klog_channel; -} - -/** - * remove_klog_channel - destroys channel /mnt/relay/klog - * - * Returns 0, negative otherwise. - */ -int -remove_klog_channel(void) -{ - if (relayfs_ctl_table_header) - unregister_sysctl_table(relayfs_ctl_table_header); - - return relay_close(klog_channel); -} - -EXPORT_SYMBOL(klog); -EXPORT_SYMBOL(klog_raw); - diff -puN fs/relayfs/Makefile~relayfs-remove-klog-debugging-channel fs/relayfs/Makefile --- 25/fs/relayfs/Makefile~relayfs-remove-klog-debugging-channel 2005-01-16 01:12:05.949798040 -0800 +++ 25-akpm/fs/relayfs/Makefile 2005-01-16 01:12:05.955797128 -0800 @@ -5,4 +5,4 @@ obj-$(CONFIG_RELAYFS_FS) += relayfs.o relayfs-y := relay.o relay_lockless.o relay_locking.o inode.o resize.o -relayfs-$(CONFIG_KLOG_CHANNEL) += klog.o + _