FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu Kernel Team

 
 
LinkBack Thread Tools
 
Old 11-27-2008, 06:26 PM
Andy Whitcroft
 
Default UBUNTU: SAUCE: (no-up) version: Implement version_signature proc file.

It seems that the /proc/version_signature support in Jaunty was miss-merged.
A significant rejig of the fs/proc support has occured and we need to
redo this support basically. The patch below looks like it would do the
job, though I have only compile tested it at this time. This applies once
the miss-merge is reverted, commit 20391c6e76c6992bdb7027f8b6bdbe35845e909a.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
fs/proc/Makefile | 1 +
fs/proc/version_signature.c | 31 +++++++++++++++++++++++++++++++
init/Kconfig | 9 +++++++++
init/version.c | 6 +++++-
4 files changed, 46 insertions(+), 1 deletions(-)
create mode 100644 fs/proc/version_signature.c

diff --git a/fs/proc/Makefile b/fs/proc/Makefile
index 63d9651..8ab67f1 100644
--- a/fs/proc/Makefile
+++ b/fs/proc/Makefile
@@ -25,3 +25,4 @@ proc-$(CONFIG_PROC_VMCORE) += vmcore.o
proc-$(CONFIG_PROC_DEVICETREE) += proc_devtree.o
proc-$(CONFIG_PRINTK) += kmsg.o
proc-$(CONFIG_PROC_PAGE_MONITOR) += page.o
+proc-$(CONFIG_VERSION_SIGNATURE) += version_signature.o
diff --git a/fs/proc/version_signature.c b/fs/proc/version_signature.c
new file mode 100644
index 0000000..534303e
--- /dev/null
+++ b/fs/proc/version_signature.c
@@ -0,0 +1,31 @@
+#include <linux/fs.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
+#include <linux/utsname.h>
+
+static int version_signature_proc_show(struct seq_file *m, void *v)
+{
+ seq_printf(m, "%s", CONFIG_VERSION_SIGNATURE);
+ return 0;
+}
+
+static int version_proc_signature_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, version_signature_proc_show, NULL);
+}
+
+static const struct file_operations version_signature_proc_fops = {
+ .open = version_signature_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+
+static int __init proc_signature_version_init(void)
+{
+ proc_create("version_signature", 0, NULL, &version_signature_proc_fops);
+ return 0;
+}
+module_init(proc_version_signature_init);
diff --git a/init/Kconfig b/init/Kconfig
index f763762..b4e9ae8 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -101,6 +101,15 @@ config LOCALVERSION_AUTO

which is done within the script "scripts/setlocalversion".)

+config VERSION_SIGNATURE
+ string "Arbitrary version signature"
+ help
+ This string will be created in a file, /proc/version_signature. It
+ is useful in determining arbitrary data about your kernel. For instance,
+ if you have several kernels of the same version, but need to keep track
+ of a revision of the same kernel, but not affect it's ability to load
+ compatible modules, this is the easiest way to do that.
+
config SWAP
bool "Support for paging of anonymous memory (swap)"
depends on MMU && BLOCK
diff --git a/init/version.c b/init/version.c
index 52a8b98..9c8a867 100644
--- a/init/version.c
+++ b/init/version.c
@@ -39,7 +39,11 @@ EXPORT_SYMBOL_GPL(init_uts_ns);
/* FIXED STRINGS! Don't touch! */
const char linux_banner[] =
"Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
- LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "
";
+ LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION
+#ifdef CONFIG_VERSION_SIGNATURE
+ " (" CONFIG_VERSION_SIGNATURE ")"
+#endif
+ "
";

const char linux_proc_banner[] =
"%s version %s"
--
1.6.0.4.911.gc990


--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 

Thread Tools




All times are GMT. The time now is 07:04 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org