ia64/linux-2.6.18-xen.hg

annotate kernel/configs.c @ 912:dd42cdb0ab89

[IA64] Build blktap2 driver by default in x86 builds.

add CONFIG_XEN_BLKDEV_TAP2=y to buildconfigs/linux-defconfig_xen_ia64.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Isaku Yamahata <yamahata@valinux.co.jp>
date Mon Jun 29 12:09:16 2009 +0900 (2009-06-29)
parents 831230e53067
children
rev   line source
ian@0 1 /*
ian@0 2 * kernel/configs.c
ian@0 3 * Echo the kernel .config file used to build the kernel
ian@0 4 *
ian@0 5 * Copyright (C) 2002 Khalid Aziz <khalid_aziz@hp.com>
ian@0 6 * Copyright (C) 2002 Randy Dunlap <rdunlap@xenotime.net>
ian@0 7 * Copyright (C) 2002 Al Stone <ahs3@fc.hp.com>
ian@0 8 * Copyright (C) 2002 Hewlett-Packard Company
ian@0 9 *
ian@0 10 * This program is free software; you can redistribute it and/or modify
ian@0 11 * it under the terms of the GNU General Public License as published by
ian@0 12 * the Free Software Foundation; either version 2 of the License, or (at
ian@0 13 * your option) any later version.
ian@0 14 *
ian@0 15 * This program is distributed in the hope that it will be useful, but
ian@0 16 * WITHOUT ANY WARRANTY; without even the implied warranty of
ian@0 17 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
ian@0 18 * NON INFRINGEMENT. See the GNU General Public License for more
ian@0 19 * details.
ian@0 20 *
ian@0 21 * You should have received a copy of the GNU General Public License
ian@0 22 * along with this program; if not, write to the Free Software
ian@0 23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
ian@0 24 */
ian@0 25
ian@0 26 #include <linux/kernel.h>
ian@0 27 #include <linux/module.h>
ian@0 28 #include <linux/proc_fs.h>
ian@0 29 #include <linux/seq_file.h>
ian@0 30 #include <linux/init.h>
ian@0 31 #include <asm/uaccess.h>
ian@0 32
ian@0 33 /**************************************************/
ian@0 34 /* the actual current config file */
ian@0 35
ian@0 36 /*
ian@0 37 * Define kernel_config_data and kernel_config_data_size, which contains the
ian@0 38 * wrapped and compressed configuration file. The file is first compressed
ian@0 39 * with gzip and then bounded by two eight byte magic numbers to allow
ian@0 40 * extraction from a binary kernel image:
ian@0 41 *
ian@0 42 * IKCFG_ST
ian@0 43 * <image>
ian@0 44 * IKCFG_ED
ian@0 45 */
ian@0 46 #define MAGIC_START "IKCFG_ST"
ian@0 47 #define MAGIC_END "IKCFG_ED"
ian@0 48 #include "config_data.h"
ian@0 49
ian@0 50
ian@0 51 #define MAGIC_SIZE (sizeof(MAGIC_START) - 1)
ian@0 52 #define kernel_config_data_size \
ian@0 53 (sizeof(kernel_config_data) - 1 - MAGIC_SIZE * 2)
ian@0 54
ian@0 55 #ifdef CONFIG_IKCONFIG_PROC
ian@0 56
ian@0 57 /**************************************************/
ian@0 58 /* globals and useful constants */
ian@0 59
ian@0 60 static ssize_t
ian@0 61 ikconfig_read_current(struct file *file, char __user *buf,
ian@0 62 size_t len, loff_t * offset)
ian@0 63 {
ian@0 64 loff_t pos = *offset;
ian@0 65 ssize_t count;
ian@0 66
ian@0 67 if (pos >= kernel_config_data_size)
ian@0 68 return 0;
ian@0 69
ian@0 70 count = min(len, (size_t)(kernel_config_data_size - pos));
ian@0 71 if (copy_to_user(buf, kernel_config_data + MAGIC_SIZE + pos, count))
ian@0 72 return -EFAULT;
ian@0 73
ian@0 74 *offset += count;
ian@0 75 return count;
ian@0 76 }
ian@0 77
ian@0 78 static struct file_operations ikconfig_file_ops = {
ian@0 79 .owner = THIS_MODULE,
ian@0 80 .read = ikconfig_read_current,
ian@0 81 };
ian@0 82
ian@0 83 /***************************************************/
ian@0 84 /* ikconfig_init: start up everything we need to */
ian@0 85
ian@0 86 static int __init ikconfig_init(void)
ian@0 87 {
ian@0 88 struct proc_dir_entry *entry;
ian@0 89
ian@0 90 /* create the current config file */
ian@0 91 entry = create_proc_entry("config.gz", S_IFREG | S_IRUGO,
ian@0 92 &proc_root);
ian@0 93 if (!entry)
ian@0 94 return -ENOMEM;
ian@0 95
ian@0 96 entry->proc_fops = &ikconfig_file_ops;
ian@0 97 entry->size = kernel_config_data_size;
ian@0 98
ian@0 99 return 0;
ian@0 100 }
ian@0 101
ian@0 102 /***************************************************/
ian@0 103 /* ikconfig_cleanup: clean up our mess */
ian@0 104
ian@0 105 static void __exit ikconfig_cleanup(void)
ian@0 106 {
ian@0 107 remove_proc_entry("config.gz", &proc_root);
ian@0 108 }
ian@0 109
ian@0 110 module_init(ikconfig_init);
ian@0 111 module_exit(ikconfig_cleanup);
ian@0 112
ian@0 113 MODULE_LICENSE("GPL");
ian@0 114 MODULE_AUTHOR("Randy Dunlap");
ian@0 115 MODULE_DESCRIPTION("Echo the kernel .config file used to build the kernel");
ian@0 116
ian@0 117 #endif /* CONFIG_IKCONFIG_PROC */