[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] x86: mark certain items static


  • To: Jan Beulich <JBeulich@xxxxxxxx>, xen-devel <xen-devel@xxxxxxxxxxxxx>
  • From: Keir Fraser <keir@xxxxxxx>
  • Date: Thu, 06 Dec 2012 15:54:46 +0000
  • Delivery-date: Thu, 06 Dec 2012 15:56:11 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>
  • Thread-index: Ac3TygOMTv4zeIZf6UahNeCDZuAFrQ==
  • Thread-topic: [Xen-devel] [PATCH] x86: mark certain items static

On 06/12/2012 13:03, "Jan Beulich" <JBeulich@xxxxxxxx> wrote:

> ..., and at once constify the data items among here.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Acked-by: Keir Fraser <keir@xxxxxxx>

> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -4123,10 +4123,10 @@ long do_hvm_op(unsigned long op, XEN_GUE
>          struct domain *d;
>          
>          /* Interface types to internal p2m types */
> -        p2m_type_t memtype[] = {
> -            p2m_ram_rw,        /* HVMMEM_ram_rw  */
> -            p2m_ram_ro,        /* HVMMEM_ram_ro  */
> -            p2m_mmio_dm        /* HVMMEM_mmio_dm */
> +        static const p2m_type_t memtype[] = {
> +            [HVMMEM_ram_rw]  = p2m_ram_rw,
> +            [HVMMEM_ram_ro]  = p2m_ram_ro,
> +            [HVMMEM_mmio_dm] = p2m_mmio_dm
>          };
>  
>          if ( copy_from_guest(&a, arg, 1) )
> --- a/xen/arch/x86/hvm/svm/emulate.c
> +++ b/xen/arch/x86/hvm/svm/emulate.c
> @@ -152,7 +152,7 @@ static int fetch(struct vcpu *v, u8 *buf
>  }
>  
>  int __get_instruction_length_from_list(struct vcpu *v,
> -        enum instruction_index *list, unsigned int list_count)
> +        const enum instruction_index *list, unsigned int list_count)
>  {
>      struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
>      unsigned int i, j, inst_len = 0;
> --- a/xen/arch/x86/hvm/svm/svm.c
> +++ b/xen/arch/x86/hvm/svm/svm.c
> @@ -1931,7 +1931,7 @@ static void svm_wbinvd_intercept(void)
>  
>  static void svm_vmexit_do_invalidate_cache(struct cpu_user_regs *regs)
>  {
> -    enum instruction_index list[] = { INSTR_INVD, INSTR_WBINVD };
> +    static const enum instruction_index list[] = { INSTR_INVD, INSTR_WBINVD
> };
>      int inst_len;
>  
>      inst_len = __get_instruction_length_from_list(
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -2475,9 +2475,11 @@ void vmx_vmexit_handler(struct cpu_user_
>          vmx_update_cpu_exec_control(v);
>          break;
>      case EXIT_REASON_TASK_SWITCH: {
> -        const enum hvm_task_switch_reason reasons[] = {
> -            TSW_call_or_int, TSW_iret, TSW_jmp, TSW_call_or_int };
> +        static const enum hvm_task_switch_reason reasons[] = {
> +            TSW_call_or_int, TSW_iret, TSW_jmp, TSW_call_or_int
> +        };
>          int32_t ecode = -1, source;
> +
>          exit_qualification = __vmread(EXIT_QUALIFICATION);
>          source = (exit_qualification >> 30) & 3;
>          /* Vectored event should fill in interrupt information. */
> --- a/xen/arch/x86/mm/guest_walk.c
> +++ b/xen/arch/x86/mm/guest_walk.c
> @@ -34,7 +34,7 @@
>  /* Flags that are needed in a pagetable entry, with the sense of NX inverted
> */
>  static uint32_t mandatory_flags(struct vcpu *v, uint32_t pfec)
>  {
> -    static uint32_t flags[] = {
> +    static const uint32_t flags[] = {
>          /* I/F -  Usr Wr */
>          /* 0   0   0   0 */ _PAGE_PRESENT,
>          /* 0   0   0   1 */ _PAGE_PRESENT|_PAGE_RW,
> --- a/xen/arch/x86/smpboot.c
> +++ b/xen/arch/x86/smpboot.c
> @@ -179,7 +179,7 @@ static void synchronize_tsc_slave(unsign
>      }
>  }
>  
> -void smp_callin(void)
> +static void smp_callin(void)
>  {
>      unsigned int cpu = smp_processor_id();
>      int i, rc;
> --- a/xen/arch/x86/time.c
> +++ b/xen/arch/x86/time.c
> @@ -1151,7 +1151,7 @@ static void local_time_calibration(void)
>   * The Linux original version of this function is
>   * Copyright (c) 2006, Red Hat, Inc., Ingo Molnar
>   */
> -void check_tsc_warp(unsigned long tsc_khz, unsigned long *max_warp)
> +static void check_tsc_warp(unsigned long tsc_khz, unsigned long *max_warp)
>  {
>  #define rdtsc_barrier() mb()
>      static DEFINE_SPINLOCK(sync_lock);
> --- a/xen/arch/x86/x86_64/traps.c
> +++ b/xen/arch/x86/x86_64/traps.c
> @@ -45,7 +45,7 @@ static void _show_registers(
>      const struct cpu_user_regs *regs, unsigned long crs[8],
>      enum context context, const struct vcpu *v)
>  {
> -    const static char *context_names[] = {
> +    static const char *const context_names[] = {
>          [CTXT_hypervisor] = "hypervisor",
>          [CTXT_pv_guest]   = "pv guest",
>          [CTXT_hvm_guest]  = "hvm guest"
> --- a/xen/include/asm-x86/hvm/svm/emulate.h
> +++ b/xen/include/asm-x86/hvm/svm/emulate.h
> @@ -45,7 +45,7 @@ enum instruction_index {
>  struct vcpu;
>  
>  int __get_instruction_length_from_list(
> -    struct vcpu *v, enum instruction_index *list, unsigned int list_count);
> +    struct vcpu *, const enum instruction_index *, unsigned int list_count);
>  
>  static inline int __get_instruction_length(
>      struct vcpu *v, enum instruction_index instr)
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx
> http://lists.xen.org/xen-devel



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.