direct-io.hg

changeset 5510:acf30d736a08

bitkeeper revision 1.1718.1.6 (42b5a5f3otSuOxDZ6KTFKrxR1U1m4Q)

Extend the xen_version hypercall to return extraversion and compile
info.
Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Sun Jun 19 17:05:55 2005 +0000 (2005-06-19)
parents dd6990776fcc
children aa52b853c28b
files .rootkeys xen/common/kernel.c xen/include/public/version.h xen/include/xen/string.h
line diff
     1.1 --- a/.rootkeys	Sun Jun 19 16:38:21 2005 +0000
     1.2 +++ b/.rootkeys	Sun Jun 19 17:05:55 2005 +0000
     1.3 @@ -1504,6 +1504,7 @@ 41ee5e8c6mLxIx82KPsbpt_uts_vSA xen/inclu
     1.4  4051db79512nOCGweabrFWO2M2h5ng xen/include/public/physdev.h
     1.5  40589968wmhPmV5-ENbBYmMjnedgKw xen/include/public/sched_ctl.h
     1.6  404f3d2eR2Owk-ZcGOx9ULGHg3nrww xen/include/public/trace.h
     1.7 +42b5a5f2QC1IxeuwCwwsOEhvcJ2BJg xen/include/public/version.h
     1.8  4266bd01Ul-pC01ZVvBkhBnv5eqzvw xen/include/public/vmx_assist.h
     1.9  3ddb79c25UE59iu4JJcbRalx95mvcg xen/include/public/xen.h
    1.10  3e397e66m2tO3s-J8Jnr7Ws_tGoPTg xen/include/xen/ac_timer.h
     2.1 --- a/xen/common/kernel.c	Sun Jun 19 16:38:21 2005 +0000
     2.2 +++ b/xen/common/kernel.c	Sun Jun 19 17:05:55 2005 +0000
     2.3 @@ -1,10 +1,7 @@
     2.4  /******************************************************************************
     2.5   * kernel.c
     2.6   * 
     2.7 - * This file should contain architecture-independent bootstrap and low-level
     2.8 - * help routines. It's a bit x86/PC specific right now!
     2.9 - * 
    2.10 - * Copyright (c) 2002-2003 K A Fraser
    2.11 + * Copyright (c) 2002-2005 K A Fraser
    2.12   */
    2.13  
    2.14  #include <xen/config.h>
    2.15 @@ -14,6 +11,7 @@
    2.16  #include <xen/compile.h>
    2.17  #include <xen/sched.h>
    2.18  #include <asm/current.h>
    2.19 +#include <public/version.h>
    2.20  
    2.21  void cmdline_parse(char *cmdline)
    2.22  {
    2.23 @@ -83,11 +81,38 @@ void cmdline_parse(char *cmdline)
    2.24   * Simple hypercalls.
    2.25   */
    2.26  
    2.27 -long do_xen_version(int cmd)
    2.28 +long do_xen_version(int cmd, void *arg)
    2.29  {
    2.30 -    if ( cmd != 0 )
    2.31 -        return -ENOSYS;
    2.32 -    return (XEN_VERSION<<16) | (XEN_SUBVERSION);
    2.33 +    switch ( cmd )
    2.34 +    {
    2.35 +    case XENVER_version:
    2.36 +    {
    2.37 +        return (XEN_VERSION<<16) | (XEN_SUBVERSION);
    2.38 +    }
    2.39 +
    2.40 +    case XENVER_extraversion:
    2.41 +    {
    2.42 +        char extraversion[16];
    2.43 +        safe_strcpy(extraversion, XEN_EXTRAVERSION);
    2.44 +        if ( copy_to_user(arg, extraversion, sizeof(extraversion)) )
    2.45 +            return -EFAULT;
    2.46 +        return 0;
    2.47 +    }
    2.48 +
    2.49 +    case XENVER_compile_info:
    2.50 +    {
    2.51 +        struct xen_compile_info info;
    2.52 +        safe_strcpy(info.compiler,       XEN_COMPILER);
    2.53 +        safe_strcpy(info.compile_by,     XEN_COMPILE_BY);
    2.54 +        safe_strcpy(info.compile_domain, XEN_COMPILE_DOMAIN);
    2.55 +        safe_strcpy(info.compile_date,   XEN_COMPILE_DATE);
    2.56 +        if ( copy_to_user(arg, &info, sizeof(info)) )
    2.57 +            return -EFAULT;
    2.58 +        return 0;
    2.59 +    }
    2.60 +    }
    2.61 +
    2.62 +    return -ENOSYS;
    2.63  }
    2.64  
    2.65  long do_vm_assist(unsigned int cmd, unsigned int type)
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/xen/include/public/version.h	Sun Jun 19 17:05:55 2005 +0000
     3.3 @@ -0,0 +1,30 @@
     3.4 +/******************************************************************************
     3.5 + * version.h
     3.6 + * 
     3.7 + * Xen version, type, and compile information.
     3.8 + * 
     3.9 + * Copyright (c) 2005, Nguyen Anh Quynh <aquynh@gmail.com>
    3.10 + * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
    3.11 + */
    3.12 +
    3.13 +#ifndef __XEN_PUBLIC_VERSION_H__
    3.14 +#define __XEN_PUBLIC_VERSION_H__
    3.15 +
    3.16 +/* NB. All ops return zero on success, except XENVER_version. */
    3.17 +
    3.18 +/* arg == NULL; returns major:minor (16:16). */
    3.19 +#define XENVER_version      0
    3.20 +
    3.21 +/* arg == 16-char string buffer. */
    3.22 +#define XENVER_extraversion 1
    3.23 +
    3.24 +/* arg == xenversion_compile_info_t. */
    3.25 +#define XENVER_compile_info 2
    3.26 +typedef struct xen_compile_info {
    3.27 +    char compiler[64];
    3.28 +    char compile_by[16];
    3.29 +    char compile_domain[32];
    3.30 +    char compile_date[32];
    3.31 +} xen_compile_info_t;
    3.32 +
    3.33 +#endif /* __XEN_PUBLIC_VERSION_H__ */
     4.1 --- a/xen/include/xen/string.h	Sun Jun 19 16:38:21 2005 +0000
     4.2 +++ b/xen/include/xen/string.h	Sun Jun 19 17:05:55 2005 +0000
     4.3 @@ -81,4 +81,9 @@ extern void * memchr(const void *,int,__
     4.4  }
     4.5  #endif
     4.6  
     4.7 +#define safe_strcpy(d,s)                        \
     4.8 +do { strncpy((d),(s),sizeof((d)));              \
     4.9 +     (d)[sizeof((d))-1] = '\0';                 \
    4.10 +} while (0)
    4.11 +
    4.12  #endif /* _LINUX_STRING_H_ */