[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Extend the xen_version hypercall to return extraversion and compile
ChangeSet 1.1724, 2005/06/19 18:05:55+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx Extend the xen_version hypercall to return extraversion and compile info. Signed-off-by: Nguyen Anh Quynh <aquynh@xxxxxxxxx> Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> common/kernel.c | 41 +++++++++++++++++++++++++++++++++-------- include/public/version.h | 30 ++++++++++++++++++++++++++++++ include/xen/string.h | 5 +++++ 3 files changed, 68 insertions(+), 8 deletions(-) diff -Nru a/xen/common/kernel.c b/xen/common/kernel.c --- a/xen/common/kernel.c 2005-06-19 14:06:59 -04:00 +++ b/xen/common/kernel.c 2005-06-19 14:06:59 -04:00 @@ -1,10 +1,7 @@ /****************************************************************************** * kernel.c * - * This file should contain architecture-independent bootstrap and low-level - * help routines. It's a bit x86/PC specific right now! - * - * Copyright (c) 2002-2003 K A Fraser + * Copyright (c) 2002-2005 K A Fraser */ #include <xen/config.h> @@ -14,6 +11,7 @@ #include <xen/compile.h> #include <xen/sched.h> #include <asm/current.h> +#include <public/version.h> void cmdline_parse(char *cmdline) { @@ -83,11 +81,38 @@ * Simple hypercalls. */ -long do_xen_version(int cmd) +long do_xen_version(int cmd, void *arg) { - if ( cmd != 0 ) - return -ENOSYS; - return (XEN_VERSION<<16) | (XEN_SUBVERSION); + switch ( cmd ) + { + case XENVER_version: + { + return (XEN_VERSION<<16) | (XEN_SUBVERSION); + } + + case XENVER_extraversion: + { + char extraversion[16]; + safe_strcpy(extraversion, XEN_EXTRAVERSION); + if ( copy_to_user(arg, extraversion, sizeof(extraversion)) ) + return -EFAULT; + return 0; + } + + case XENVER_compile_info: + { + struct xen_compile_info info; + safe_strcpy(info.compiler, XEN_COMPILER); + safe_strcpy(info.compile_by, XEN_COMPILE_BY); + safe_strcpy(info.compile_domain, XEN_COMPILE_DOMAIN); + safe_strcpy(info.compile_date, XEN_COMPILE_DATE); + if ( copy_to_user(arg, &info, sizeof(info)) ) + return -EFAULT; + return 0; + } + } + + return -ENOSYS; } long do_vm_assist(unsigned int cmd, unsigned int type) diff -Nru a/xen/include/public/version.h b/xen/include/public/version.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/xen/include/public/version.h 2005-06-19 14:06:59 -04:00 @@ -0,0 +1,30 @@ +/****************************************************************************** + * version.h + * + * Xen version, type, and compile information. + * + * Copyright (c) 2005, Nguyen Anh Quynh <aquynh@xxxxxxxxx> + * Copyright (c) 2005, Keir Fraser <keir@xxxxxxxxxxxxx> + */ + +#ifndef __XEN_PUBLIC_VERSION_H__ +#define __XEN_PUBLIC_VERSION_H__ + +/* NB. All ops return zero on success, except XENVER_version. */ + +/* arg == NULL; returns major:minor (16:16). */ +#define XENVER_version 0 + +/* arg == 16-char string buffer. */ +#define XENVER_extraversion 1 + +/* arg == xenversion_compile_info_t. */ +#define XENVER_compile_info 2 +typedef struct xen_compile_info { + char compiler[64]; + char compile_by[16]; + char compile_domain[32]; + char compile_date[32]; +} xen_compile_info_t; + +#endif /* __XEN_PUBLIC_VERSION_H__ */ diff -Nru a/xen/include/xen/string.h b/xen/include/xen/string.h --- a/xen/include/xen/string.h 2005-06-19 14:06:59 -04:00 +++ b/xen/include/xen/string.h 2005-06-19 14:06:59 -04:00 @@ -81,4 +81,9 @@ } #endif +#define safe_strcpy(d,s) \ +do { strncpy((d),(s),sizeof((d))); \ + (d)[sizeof((d))-1] = '\0'; \ +} while (0) + #endif /* _LINUX_STRING_H_ */ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |