[patch] v1.02 of /proc/.config

Tigran Aivazian (tigran@aivazian.demon.co.uk)
Sat, 13 Mar 1999 17:15:27 +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-1698399526-921345327=:571
Content-Type: TEXT/PLAIN; charset=US-ASCII

On Sat, 13 Mar 1999, Tigran Aivazian wrote:

> > tmp1=`mktemp -q /tmp/dconfig1_XXXXXX`
> > tmp2=`mktemp -q /tmp/dconfig2_XXXXXX`
>
> The above does not work as is (because there are probably some bugs with
> mktemp(1) - I will get a source and start debugging it as soon as I have
> time. But yes, I totally agree - I will get rid of $$-approach.

Sorry - works now. It did not work not "as is" but "as cut-n-pasted with
some \"creativity\"" (i.e. reducing a few Xs) :)

Attached is the updated version of the patch

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 17:02:28 1999
@@ -0,0 +1,100 @@
+/*
+ * /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.
+ * v1.02
+ * TA : Fixed scripts/mkdconfig.sh
+ * to use mktemp(1)
+ */
+
+#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 16:55:35 1999
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+tmp1=`mktemp -q /tmp/dconfig1_XXXXXX`
+tmp2=`mktemp -q /tmp/dconfig2_XXXXXX`
+
+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-1698399526-921345327=:571
Content-Type: APPLICATION/x-gunzip; name="dconfig-2.2.3.patch.gz"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.3.96.990313171527.571G@perseo.homenet>
Content-Description: Version 1.02 of /proc/.config

H4sICMSc6jYCA2Rjb25maWctMi4yLjMucGF0Y2gAnVl7c9pIEv8bPkUfSTlg
QEL4TdapOH4k3tgmZey6pC5XyiCNYBZJo9VIttm97Ge/ntEDIQRer4sCNNP9
657unn5gmzkOdOPwBlzmx0/6Gbdij/oRiRj39VPuO2wSh1SbUjdISLp9ra/t
dG1L7W1kqHe73b+BWxuRCK5JCMYOGMZg72Bg7IJxdHRUb7fbLxa6hNYf9I4G
Rj9Be/8euvtHO0ZnH9rq09iH9+/rAHA3ZQJ4INHgkbkuUN8l4YTCnMchzGjo
UxfGcyBjHkdgHMLnDxqM6AMNiSv5g5BPQuIJsGlAfRsQJkLIDggOkmrOfQpi
ymPXBkHm8A2mFNWtQ72tI6+la8nBQMRBwMOo3j4d3lxcfjTPks96G2BE5syf
pKyJlh6ZUSAgfBIgeATcSRS2UoMo86TnEhIjoKFHfDSci2d5IMwlY5fCAyOw
rIbDXKrBZQRollhQJ3aBKWwJYnEvwH0Qyfkz8zCPTKhAxaIp2BhVqKUfrVeF
oJkemZhCxBGBBhCFxJrJIzxOmTWVktUXrd6W5C/0UK+LTv/8AZqJQ6ThuC9x
oikqzv6gua30WIS6CC09idMlC6BouLkYqQcxFxH1cgdB6iDcNi9GMgYuFSAQ
dA5i+NSKqC0PJ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qzq0D8rQgk7U3spltTtWoSyiiiQAbVVjLJEELYfJHYjSGbg
aK4CsytZihqpg2FQoMblZZfzGfYiK8vMn60sxn7lcvpjyMo6JhmMwfJq6FWt
ejO0wiotVYP56jKxKyU6GNT80azck0wBmayiqftUuTOW0V1eRKf51pIlk3X5
My8TqtosPF32deJaFprUj7DcqUfVhqaeTR1dHHg6cNCBRlq6ccocmZcXt+cf
4X/y2+39x2EHi1PN6EAve22tBtBCH9VymypD1turfX6SuVb00tTPt8fFvItP
eCj80ixkapkqU246wTJJw+ZWDpZpVgSWDD+XLZVm6oV2q7lavmf5GqVmKRtQ
m0XaDrhIjyNHAfkI74oHwM0azhNRjIOIbOsXZG0JVEGcnLpog64SkzFb2E+Z
ETexiIZNpVfBNIgqaTsSu1WU3T2/OLm/upMgifRjSSIfU4Lk6edKJ1tVzCsb
zsqqv+hoq7Zf3tVWohQ72/3B3t5gZ2+1s91Vje2rf+k4KuqyH6m3Iy8wjn8k
jQh0fwcdF7KG2TC/qr8fiqy/jqy/IMMhwppyaOAtPRvCzfAOzs8u7wZwEkfc
k0Gn/j+Q/MgTJd1lpW239QZGxWupXAaJC6WVNIyT4Cz6/xhWiLs+fF9F+N54
m8npS+WTnzU1verHUOi/Ax0HSd2PXbfexsSUYEE2GSgURKtmz8ATnoR2CfH/
EImU46scAAA=
---1463811583-1698399526-921345327=:571--

-
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/