From: "Jan Beulich" Subject: =?utf-8?q?=5BPATCH_1/3_v2=5D_x86/shadow=3A_convert_no?= =?utf-8?q?n=E2=80=91const_statics?= Date: Thu, 29 Jan 2015 13:16:26 +0000 Message-ID: <54CA40BA020000780005ADFA@mail.emea.novell.com> References: <54CA3F19020000780005ADDC@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part7E4BEDBA.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 1YGoxR-0008Rf-D3 for xen-devel@lists.xenproject.org; Thu, 29 Jan 2015 13:16:29 +0000 In-Reply-To: <54CA3F19020000780005ADDC@mail.emea.novell.com> 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. --=__Part7E4BEDBA.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 wouldn't even need to be static, but keep them so upon the maintainer's request. Signed-off-by: Jan Beulich --- v2: Retain static-s, upon Tim's request. --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -2162,7 +2162,7 @@ int sh_remove_write_access(struct vcpu * NULL /* unused */ }; =20 - static unsigned int callback_mask =3D=20 + static const unsigned int callback_mask =3D 1 << SH_type_l1_32_shadow | 1 << SH_type_fl1_32_shadow | 1 << SH_type_l1_pae_shadow @@ -2412,7 +2412,7 @@ int sh_remove_all_mappings(struct vcpu * NULL /* unused */ }; =20 - static unsigned int callback_mask =3D=20 + static const unsigned int callback_mask =3D 1 << SH_type_l1_32_shadow | 1 << SH_type_fl1_32_shadow | 1 << SH_type_l1_pae_shadow @@ -2556,7 +2556,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 */ @@ -2683,7 +2683,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 */ @@ -2701,7 +2701,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 + static const unsigned int callback_mask =3D 1 << SH_type_l3_64_shadow;= =20 hash_foreach(v, callback_mask, callbacks, _mfn(INVALID_MFN)); } --=__Part7E4BEDBA.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 wouldn't even need to be static, but=0Akeep them so upon the = maintainer's request.=0A=0ASigned-off-by: Jan Beulich = =0A---=0Av2: Retain static-s, upon Tim's request.=0A=0A--- a/xen/arch/x86/m= m/shadow/common.c=0A+++ b/xen/arch/x86/mm/shadow/common.c=0A@@ -2162,7 = +2162,7 @@ int sh_remove_write_access(struct vcpu *=0A NULL /* = unused */=0A };=0A =0A- static unsigned int callback_mask =3D =0A+ = static 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@@ -2412,7 +2412,7 @@ int sh_remove_all_mappings(st= ruct vcpu *=0A NULL /* unused */=0A };=0A =0A- static = unsigned int callback_mask =3D =0A+ static const unsigned int callback_m= ask =3D=0A 1 << SH_type_l1_32_shadow=0A | 1 << SH_type_fl= 1_32_shadow=0A | 1 << SH_type_l1_pae_shadow=0A@@ -2556,7 +2556,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@@ = -2683,7 +2683,7 @@ static int sh_clear_up_pointer(struct 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@@ -2701,7 +2701,7 @@ = void sh_reset_l3_up_pointers(struct vcpu=0A NULL, /* p2m */=0A = NULL /* unused */=0A };=0A- static unsigned int callback_m= ask =3D 1 << SH_type_l3_64_shadow; =0A+ static 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 --=__Part7E4BEDBA.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 --=__Part7E4BEDBA.0__=--