From: "Jan Beulich" Subject: [PATCH] x86/shadow: convert non-const statics Date: Wed, 28 Jan 2015 15:25:18 +0000 Message-ID: <54C90D6E020000780005A61A@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part4570D44E.0__=" Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YGUUc-0000gg-Pg for xen-devel@lists.xenproject.org; Wed, 28 Jan 2015 15:25:23 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Tim Deegan List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part4570D44E.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline To make obvious that such statics are safe to use, they should be const. In some of the cases, they don't even need to be static. Signed-off-by: Jan Beulich --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -2164,7 +2164,7 @@ int sh_remove_write_access(struct vcpu * NULL /* unused */ }; =20 - static unsigned int callback_mask =3D=20 + const unsigned int callback_mask =3D 1 << SH_type_l1_32_shadow | 1 << SH_type_fl1_32_shadow | 1 << SH_type_l1_pae_shadow @@ -2414,7 +2414,7 @@ int sh_remove_all_mappings(struct vcpu * NULL /* unused */ }; =20 - static unsigned int callback_mask =3D=20 + const unsigned int callback_mask =3D 1 << SH_type_l1_32_shadow | 1 << SH_type_fl1_32_shadow | 1 << SH_type_l1_pae_shadow @@ -2558,7 +2558,7 @@ void sh_remove_shadows(struct vcpu *v, m }; =20 /* Another lookup table, for choosing which mask to use */ - static unsigned int masks[SH_type_unused] =3D { + static const unsigned int masks[SH_type_unused] =3D { 0, /* none */ 1 << SH_type_l2_32_shadow, /* l1_32 */ 0, /* fl1_32 */ @@ -2685,7 +2685,7 @@ static int sh_clear_up_pointer(struct vc =20 void sh_reset_l3_up_pointers(struct vcpu *v) { - static hash_callback_t callbacks[SH_type_unused] =3D { + static const hash_callback_t callbacks[SH_type_unused] =3D { NULL, /* none */ NULL, /* l1_32 */ NULL, /* fl1_32 */ @@ -2703,7 +2703,7 @@ void sh_reset_l3_up_pointers(struct vcpu NULL, /* p2m */ NULL /* unused */ }; - static unsigned int callback_mask =3D 1 << SH_type_l3_64_shadow; = =20 + const unsigned int callback_mask =3D 1 << SH_type_l3_64_shadow; =20 hash_foreach(v, callback_mask, callbacks, _mfn(INVALID_MFN)); } --=__Part4570D44E.0__= Content-Type: text/plain; name="x86-shadow-static-const.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-shadow-static-const.patch" x86/shadow: convert non-const statics=0A=0ATo make obvious that such = statics are safe to use, they should be=0Aconst. In some of the cases, = they don't even need to be static.=0A=0ASigned-off-by: Jan Beulich = =0A=0A--- a/xen/arch/x86/mm/shadow/common.c=0A+++ = b/xen/arch/x86/mm/shadow/common.c=0A@@ -2164,7 +2164,7 @@ int sh_remove_wri= te_access(struct vcpu *=0A NULL /* unused */=0A };=0A =0A- = static unsigned int callback_mask =3D =0A+ const unsigned int = callback_mask =3D=0A 1 << SH_type_l1_32_shadow=0A | 1 << = SH_type_fl1_32_shadow=0A | 1 << SH_type_l1_pae_shadow=0A@@ -2414,7 = +2414,7 @@ int sh_remove_all_mappings(struct vcpu *=0A NULL /* = unused */=0A };=0A =0A- static unsigned int callback_mask =3D =0A+ = const unsigned int callback_mask =3D=0A 1 << SH_type_l1_32_sha= dow=0A | 1 << SH_type_fl1_32_shadow=0A | 1 << SH_type_l1_pa= e_shadow=0A@@ -2558,7 +2558,7 @@ void sh_remove_shadows(struct vcpu *v, = m=0A };=0A =0A /* Another lookup table, for choosing which mask to = use */=0A- static unsigned int masks[SH_type_unused] =3D {=0A+ = static const unsigned int masks[SH_type_unused] =3D {=0A 0, /* = none */=0A 1 << SH_type_l2_32_shadow, /* l1_32 */=0A = 0, /* fl1_32 */=0A@@ -2685,7 +2685,7 @@ static int sh_clear_up_pointer(str= uct vc=0A =0A void sh_reset_l3_up_pointers(struct vcpu *v)=0A {=0A- = static hash_callback_t callbacks[SH_type_unused] =3D {=0A+ static const = hash_callback_t callbacks[SH_type_unused] =3D {=0A NULL, /* none = */=0A NULL, /* l1_32 */=0A NULL, /* fl1_32 */=0A@@ = -2703,7 +2703,7 @@ void sh_reset_l3_up_pointers(struct vcpu=0A = NULL, /* p2m */=0A NULL /* unused */=0A };=0A- static = unsigned int callback_mask =3D 1 << SH_type_l3_64_shadow; =0A+ const = unsigned int callback_mask =3D 1 << SH_type_l3_64_shadow;=0A =0A = hash_foreach(v, callback_mask, callbacks, _mfn(INVALID_MFN));=0A }=0A --=__Part4570D44E.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part4570D44E.0__=--