[patch] v1.01 of /proc/.config (ready to eat)

Tigran Aivazian (tigran@aivazian.demon.co.uk)
Sat, 13 Mar 1999 13:17:37 +0000 (GMT)


This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.

---1463811583-138252211-921331057=:424
Content-Type: TEXT/PLAIN; charset=US-ASCII

Hello Linus,

I have followed good advice of David Woodhouse and made my patch a
CONFIG_DCONFIG config option. As there are no objections (except hints at
possibility of someone calling it a 'kernel bloat'), perhaps this small
patch has a chance to end up in the mainstream kernel of yours?

Also, attached as .gz (to preserve tabs and other vi-niceties).

I could potentially make it self-decompressing-on-the-fly thingy, looking
from outside as /proc/.config (with the correct size) but I don't think
saving a few K is worth it. Embedded people wouldn't want it compiled in
anyway, but for people who _will_ (and I am pleased to learn that such
exist) extra 10-12K in the kernel won't matter.

Thank you,
Tigran.

diff -urN linux/Documentation/Configure.help linux-2.2.3-dconfig/Documentation/Configure.help
--- linux/Documentation/Configure.help Sat Mar 13 11:57:14 1999
+++ linux-2.2.3-dconfig/Documentation/Configure.help Sat Mar 13 12:09:12 1999
@@ -6931,6 +6931,16 @@
This option will enlarge your kernel by about 18 KB. Several
programs depend on this, so everyone should say Y here.

+/proc/.config support
+CONFIG_DCONFIG
+ Saying Y here will make a snapshot of your configuration options
+ permanently available via /proc/.config file. It is useful if you
+ compile several kernel images with different configuration options
+ and wish to keep track of which is which.
+
+ This option will enlarge your kernel by about 10-12 KB (depending on
+ the size of your /usr/src/linux/.config file.
+
NFS filesystem support
CONFIG_NFS_FS
If you are connected to some other (usually local) Unix computer
diff -urN linux/Makefile linux-2.2.3-dconfig/Makefile
--- linux/Makefile Sat Mar 13 11:57:14 1999
+++ linux-2.2.3-dconfig/Makefile Sat Mar 13 11:51:00 1999
@@ -223,17 +223,21 @@

oldconfig: symlinks
$(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
+ scripts/mkdconfig.sh

xconfig: symlinks
$(MAKE) -C scripts kconfig.tk
wish -f scripts/kconfig.tk
+ scripts/mkdconfig.sh

menuconfig: include/linux/version.h symlinks
$(MAKE) -C scripts/lxdialog all
$(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in
+ scripts/mkdconfig.sh

config: symlinks
$(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in
+ scripts/mkdconfig.sh

include/config/MARKER: scripts/split-include include/linux/autoconf.h
scripts/split-include include/linux/autoconf.h include/config
@@ -376,6 +380,7 @@
rm -f $(TOPDIR)/include/linux/modversions.h
rm -rf $(TOPDIR)/include/linux/modules
rm -rf modules
+ rm -f kernel/dconfig_buf.c

distclean: mrproper
rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
diff -urN linux/fs/Config.in linux-2.2.3-dconfig/fs/Config.in
--- linux/fs/Config.in Sat Mar 13 11:57:16 1999
+++ linux-2.2.3-dconfig/fs/Config.in Sat Mar 13 12:05:41 1999
@@ -34,6 +34,9 @@
fi
tristate 'OS/2 HPFS filesystem support (read only)' CONFIG_HPFS_FS
bool '/proc filesystem support' CONFIG_PROC_FS
+if [ "$CONFIG_PROC_FS" = "y" ]; then
+ bool '/proc/.config support' CONFIG_DCONFIG
+fi
if [ "$CONFIG_UNIX98_PTYS" = "y" ]; then
# It compiles as a module for testing only. It should not be used
# as a module in general. If we make this "tristate", a bunch of people
diff -urN linux/include/linux/proc_fs.h linux-2.2.3-dconfig/include/linux/proc_fs.h
--- linux/include/linux/proc_fs.h Sat Mar 13 11:57:17 1999
+++ linux-2.2.3-dconfig/include/linux/proc_fs.h Sat Mar 13 11:52:05 1999
@@ -52,7 +52,8 @@
PROC_STRAM,
PROC_SOUND,
PROC_MTRR, /* whether enabled or not */
- PROC_FS
+ PROC_FS,
+ PROC_DCONFIG /* whether enabled or not */
};

enum pid_directory_inos {
diff -urN linux/init/main.c linux-2.2.3-dconfig/init/main.c
--- linux/init/main.c Sat Mar 13 11:57:17 1999
+++ linux-2.2.3-dconfig/init/main.c Sat Mar 13 11:52:52 1999
@@ -79,6 +79,10 @@
extern void filescache_init(void);
extern void signals_init(void);

+#ifdef CONFIG_DCONFIG
+extern void dconfig_init(void);
+#endif
+
extern void device_setup(void);
extern void binfmt_setup(void);
extern void free_initmem(void);
@@ -1293,6 +1297,10 @@
real_root_mountflags = root_mountflags;
if (initrd_start && mount_initrd) root_mountflags &= ~MS_RDONLY;
else mount_initrd =0;
+#endif
+
+#ifdef CONFIG_DCONFIG
+ dconfig_init();
#endif

/* Set up devices .. */
diff -urN linux/kernel/Makefile linux-2.2.3-dconfig/kernel/Makefile
--- linux/kernel/Makefile Wed May 6 19:01:46 1998
+++ linux-2.2.3-dconfig/kernel/Makefile Sat Mar 13 11:58:27 1999
@@ -21,6 +21,10 @@
O_OBJS += kmod.o
endif

+ifeq ($(CONFIG_DCONFIG),y)
+O_OBJS += dconfig.o
+endif
+
ifeq ($(CONFIG_MODULES),y)
OX_OBJS += ksyms.o
endif
diff -urN linux/kernel/dconfig.c linux-2.2.3-dconfig/kernel/dconfig.c
--- linux/kernel/dconfig.c Thu Jan 1 01:00:00 1970
+++ linux-2.2.3-dconfig/kernel/dconfig.c Sat Mar 13 12:45:16 1999
@@ -0,0 +1,97 @@
+/*
+ * /proc/.config driver - a snapshot of /usr/src/linux/.config
+ *
+ * Copyright (C) 1999 Tigran Aivazian
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * Change History
+ *
+ * v1.0
+ * Tigran Aivazian (TA) <tigran@sco.com> : Initial version
+ *
+ * v1.01
+ * TA : Made it a CONFIG_DCONFIG
+ * compile option.
+ */
+
+#include <linux/proc_fs.h>
+#include <linux/fs.h>
+#include <linux/init.h>
+
+#include <asm/uaccess.h>
+
+#include "dconfig_buf.c"
+
+static int dconfig_len; /* set in dconfig_init() */
+static ssize_t dconfig_read(struct file *, char *, size_t, loff_t *);
+
+static struct file_operations dconfig_fops =
+{
+ NULL, /* llseek */
+ dconfig_read, /* read */
+ NULL, /* write */
+ NULL, /* readdir */
+ NULL, /* poll */
+ NULL, /* ioctl */
+ NULL, /* mmap */
+ NULL, /* open */
+ NULL, /* flush */
+ NULL, /* release */
+ NULL, /* fsync */
+ NULL, /* fasync */
+ NULL, /* check_media_change */
+ NULL, /* revalidate */
+ NULL, /* lock */
+};
+
+static struct inode_operations proc_dconfig_inops = {
+ &dconfig_fops, /* default property file-ops */
+ NULL, /* create */
+ NULL, /* lookup */
+ NULL, /* link */
+ NULL, /* unlink */
+ NULL, /* symlink */
+ NULL, /* mkdir */
+ NULL, /* rmdir */
+ NULL, /* mknod */
+ NULL, /* rename */
+ NULL, /* readlink */
+ NULL, /* follow_link */
+ NULL, /* readpage */
+ NULL, /* writepage */
+ NULL, /* bmap */
+ NULL, /* truncate */
+ NULL /* permission */
+};
+
+
+static struct proc_dir_entry proc_root_dconfig = {
+ PROC_DCONFIG, 7, ".config", S_IFREG | S_IRUGO,
+ 1, 0, 0, 0, &proc_dconfig_inops
+};
+
+
+void __init
+dconfig_init(void)
+{
+ proc_root_dconfig.size = dconfig_len = strlen(dconfig_buf);
+ proc_register(&proc_root, &proc_root_dconfig);
+}
+
+
+static ssize_t
+dconfig_read(struct file *file, char *buf, size_t len, loff_t *pos)
+{
+ if (*pos > dconfig_len)
+ return 0;
+ if (*pos + len > dconfig_len)
+ len = dconfig_len - *pos;
+ if (copy_to_user(buf, dconfig_buf + *pos, len))
+ return -EFAULT;
+ *pos += len;
+ return len;
+}
diff -urN linux/scripts/mkdconfig.sh linux-2.2.3-dconfig/scripts/mkdconfig.sh
--- linux/scripts/mkdconfig.sh Thu Jan 1 01:00:00 1970
+++ linux-2.2.3-dconfig/scripts/mkdconfig.sh Sat Mar 13 11:51:00 1999
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+tmp1=/tmp/dconfig1_$$
+tmp2=/tmp/dconfig2_$$
+
+echo "/* DO NOT EDIT: Automatically generated by scripts/mkdconfig.sh */" > $tmp1
+echo "" >> $tmp1
+echo "static char *dconfig_buf = " >> $tmp1
+echo -n \" >> $tmp1
+echo "\";" > $tmp2
+
+rm -f ./kernel/dconfig_buf.c 2> /dev/null
+cat $tmp1 .config $tmp2 > ./kernel/dconfig_buf.c
+rm -f $tmp1 $tmp2 2> /dev/null

---1463811583-138252211-921331057=:424
Content-Type: APPLICATION/x-gunzip; name="dconfig-2.2.3.patch.gz"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.3.96.990313131737.424B@perseo.homenet>
Content-Description: v1.01 of /proc/.config patch

H4sICG9j6jYCA2Rjb25maWctMi4yLjMucGF0Y2gAnVh7c9pIEv8bPkUfcTlg
QELYiW2yTsXxI/HGNilj1+3W5Uo3SCOYRdLoNJIddi/72a9n9EASAq/X5QI0
0/3rnu6efshmjgP9OLwFl/nxd/2cW7FH/YhEjPv6GfcdNotDqs2pGyQk/aE2
1Pb7tqX2tjI0+/3+X8BtTEgENyQEYx8MY/TmcGQcgHF8fNzsdrsvFlpCG44G
xyNjmKB9+AD9t8f7Ru8tdNW38RY+fGgCwP2cCeCBRIMn5rpAfZeEMwpLHoew
oKFPXZgugUx5HIFxBF8+ajChjzQkruQPQj4LiSfApgH1bUCYCCF7IDhIqiX3
KYg5j10bBFnCrzCnqG4Tml0deS1dSw4GIg4CHkbN7tn49vLqk3mefDe7ABOy
ZP4sZU209MiCAgHhkwDBI+BOorCVGkSZJz2XkBgBDT3io+FcPMsjYS6ZuhQe
GYGyGg5zqQZXEaBZYkGd2AWmsCWIxb0A90Ek58/MwzwyowIVi+ZgY1Shln60
WRWCZnpiYg4RRwQaQBQSayGP8DRn1lxKVj+0ZleSv9BDgz46/ctHaCcOkYbj
vsSJ5qg4+53mttJjEeoitPQkTksWQNFwezlRD2IpIurlDoLUQbhtXk5kDFwp
QCDoHMTwqRVRWx5OcA+lodwQ2rGIiYu2d7lF3A48+Oy7Mmcc0bBpV67iDXpX
Sq69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daveAq2wTkvVLL2+TOxaiQ4GNX8ya/ckU0Bm
62jqPtXuTGV0VxfRab5VsmSyLt/MMqEqxMrTVV8nrmWhSf0IS5R6VJ1j6tnU
0cUZpQeHPWil5RYHw4l5dXl38Qn+J3/dPXwa97CgNIweDLL/3fUAWumjumRT
Zchmd701TzLXml6aeuN6Usy7+ISHwh/tQqaWqTLlpjMsbTRs7+ZgmWZFYMnw
o2ypNFOvtFvP1fIzy9coNUvZgNqs0nbARXoc2b3LR3hfPABuNnAEiGKcHWQn
viLrSqAa4uTURRv0lZiM2cIeyIy4iaN/2FZ6FUyDqJK2J7E7Rdn9i8vTh+t7
CZJIP5Ek8jElSJ5+rDWfdW/8anvE2leDqya0bvvljWgtytbX0WkzahyoZvTV
P3Sc7nTUDGMh8gLjRMfPrLE1zJ0dtTwsLQ/VMvb11pxDC2/h+Rhux/dwcX51
P4LTOOKeDCr1yj557xIlHV+t7fb0Fnp9RwrPIHGhspKGaRJ8Rf+ewBpx34dv
6wjfWu8yOUOpfPKmUdPr3k/C8D3oONvpfuy6zS4mngQLsm5doSBaPXsGnvAk
tCXE/wNzwpDTPhwAAA==
---1463811583-138252211-921331057=:424--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/