[PATCH 1/1] UBUNTU: SAUCE: (no-up) version: Implement version_signature proc file.

Tim Gardner tcanonical at tpi.com
Mon Dec 1 15:37:14 UTC 2008


Andy Whitcroft wrote:
> 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 at 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 "\n";
> +	LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION
> +#ifdef CONFIG_VERSION_SIGNATURE
> +        " (" CONFIG_VERSION_SIGNATURE ")"
> +#endif
> +	"\n";
>  
>  const char linux_proc_banner[] =
>  	"%s version %s"

ACK - looks good to me.

-- 
Tim Gardner tim.gardner at canonical.com




More information about the kernel-team mailing list