From 97446b3c326efbca9698876c41d2d309ea0f229b Mon Sep 17 00:00:00 2001 From: Andy Whitcroft Date: Thu, 27 Nov 2008 19:12:07 +0000 Subject: [PATCH] UBUNTU: SAUCE: (no-up) version: Implement version_signature proc file. Signed-off-by: Andy Whitcroft Acked-by: Tim Gardener --- fs/proc/Makefile | 2 +- fs/proc/version_signature.c | 31 +++++++++++++++++++++++++++++++ init/Kconfig | 9 +++++++++ init/version-timestamp.c | 6 +++++- 4 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 fs/proc/version_signature.c diff --git a/fs/proc/Makefile b/fs/proc/Makefile index bd08616ed8ba..de9b299be9fc 100644 --- a/fs/proc/Makefile +++ b/fs/proc/Makefile @@ -33,4 +33,4 @@ proc-$(CONFIG_PROC_KCORE) += kcore.o proc-$(CONFIG_PROC_VMCORE) += vmcore.o proc-$(CONFIG_PRINTK) += kmsg.o proc-$(CONFIG_PROC_PAGE_MONITOR) += page.o -proc-$(CONFIG_BOOT_CONFIG) += bootconfig.o +proc-$(CONFIG_BOOT_CONFIG) += bootconfig.o version_signature.o diff --git a/fs/proc/version_signature.c b/fs/proc/version_signature.c new file mode 100644 index 000000000000..27d775d87d9f --- /dev/null +++ b/fs/proc/version_signature.c @@ -0,0 +1,31 @@ +#include +#include +#include +#include +#include +#include + +static int version_signature_proc_show(struct seq_file *m, void *v) +{ + seq_printf(m, "%s\n", CONFIG_VERSION_SIGNATURE); + return 0; +} + +static int version_signature_proc_open(struct inode *inode, struct file *file) +{ + return single_open(file, version_signature_proc_show, NULL); +} + +static const struct proc_ops version_signature_proc_fops = { + .proc_open = version_signature_proc_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_release = single_release, +}; + +static int __init proc_version_signature_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 bee58f7468c3..ec9426c3567d 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -376,6 +376,15 @@ config DEFAULT_HOSTNAME but you may wish to use a different default here to make a minimal system more usable with less configuration. +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 SYSVIPC bool "System V IPC" help diff --git a/init/version-timestamp.c b/init/version-timestamp.c index 043cbf80a766..649275e25ff4 100644 --- a/init/version-timestamp.c +++ b/init/version-timestamp.c @@ -27,4 +27,8 @@ struct uts_namespace 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 "\n"; + LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION +#ifdef CONFIG_VERSION_SIGNATURE + " (" CONFIG_VERSION_SIGNATURE ")" +#endif + "\n";