xsm: only define XSM_MAGIC in xsm.h
PATCH v2 1/2 xsm: only define XSM_MAGIC in xsm.h
Rather than have XSM_MAGIC set in the global xen/config.h and set in xsm.h if it's unset, just set it once in xsm.h since its only used in files that already include xsm.h
---
CC: Daniel De Graaf <[email protected]>
--- xen/include/xen/config.h | 1 - xen/include/xsm/xsm.h | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-)
xen/include/xen/config.h +0 -1
@@ -79,7 +79,6 @@#define STR (...) __STR(__VA_ARGS__)#ifdef CONFIG_FLASK -#define XSM_MAGIC 0xf97cff8c/* Maintain statistics on the access vector cache */ #define FLASK_AVC_STATS 1#endif
xen/include/xsm/xsm.h +5 -2
@@ -23,8 +23,11 @@ DEFINE_XEN_GUEST_HANDLE(xsm_op_t);/* policy magic number (defined by XSM_MAGIC) */ typedef u32 xsm_magic_t ; -#ifndef XSM_MAGIC -#define XSM_MAGIC 0x00000000 + +#ifdef CONFIG_FLASK +#define XSM_MAGIC 0xf97cff8c +#else +#define XSM_MAGIC 0x0#endif /* These annotations are used by callers and in dummy.h to document the
Signature · 7 lines
2.7.3 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH v2 2/2 xsm: move FLASK_AVC_STATS to Kconfig
Have Kconfig set CONFIG_FLASK_AVC_STATS and prefix all uses with CONFIG_ to use the Kconfig variable.
---
CC: Daniel De Graaf <[email protected]>
--- xen/common/Kconfig | 6 ++++++ xen/include/xen/config.h | 5 ----- xen/xsm/flask/avc.c | 4 ++-- xen/xsm/flask/flask_op.c | 4 ++-- xen/xsm/flask/include/avc.h | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-)
xen/common/Kconfig +6 -0
@@ -23,6 +23,12 @@ config FLASK If unsure, say N. +config FLASK_AVC_STATS + def_bool y + depends on FLASK + ---help--- + Maintain statistics on the access vector cache + # Select HAS_DEVICE_TREE if device tree is supported config HAS_DEVICE_TREE bool
xen/include/xen/config.h +0 -5
@@ -78,11 +78,6 @@#define __STR (...) #__VA_ARGS__#define STR (...) __STR(__VA_ARGS__) -#ifdef CONFIG_FLASK -/* Maintain statistics on the access vector cache */ -#define FLASK_AVC_STATS 1 -#endif -/* allow existing code to work with Kconfig variable */ #define NR_CPUS CONFIG_NR_CPUS
xen/xsm/flask/avc.c +2 -2
@@ -56,7 +56,7 @@ const struct selinux_class_perm selinux_class_perm = {#define AVC_DEF_CACHE_THRESHOLD 512#define AVC_CACHE_RECLAIM 16 -#ifdef FLASK_AVC_STATS +#ifdef CONFIG_FLASK_AVC_STATS #define avc_cache_stats_incr (field) \ do { \ __get_cpu_var(avc_cache_stats).field++; \
@@ -101,7 +101,7 @@ struct avc_callback_node {/* Exported via Flask hypercall */ unsigned int avc_cache_threshold =AVC_DEF_CACHE_THRESHOLD ; -#ifdef FLASK_AVC_STATS +#ifdef CONFIG_FLASK_AVC_STATS DEFINE_PER_CPU(struct avc_cache_stats, avc_cache_stats);#endif
xen/xsm/flask/flask_op.c +2 -2
@@ -469,7 +469,7 @@ static int flask_security_make_bools(void)return ret; } -#ifdef FLASK_AVC_STATS +#ifdef CONFIG_FLASK_AVC_STATS static int flask_security_avc_cachestats (struct xen_flask_cache_stats *arg) {
@@ -761,7 +761,7 @@ ret_t do_flask_op(XEN_GUEST_HANDLE_PARAM(xsm_op_t) u_flask_op) rv =avc_get_hash_stats (&op.u.hash_stats);break ; -#ifdef FLASK_AVC_STATS +#ifdef CONFIG_FLASK_AVC_STATS case FLASK_AVC_CACHESTATS : rv =flask_security_avc_cachestats (&op.u.cache_stats);break ;
xen/xsm/flask/include/avc.h +1 -1
@@ -108,7 +108,7 @@ struct xen_flask_hash_stats;int avc_get_hash_stats (struct xen_flask_hash_stats *arg);extern unsigned int avc_cache_threshold; -#ifdef FLASK_AVC_STATS +#ifdef CONFIG_FLASK_AVC_STATS DECLARE_PER_CPU(struct avc_cache_stats, avc_cache_stats);#endif
Signature · 7 lines
2.7.3 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 33 lines · Doug Goldstein
Rather than have
XSM_MAGICset in the globalxen/config.hand set inxsm.hif it's unset, just set it once inxsm.hsince its only used in files that already includexsm.hSigned-off-by Doug Goldstein <[email protected]>---
CC: Daniel De Graaf <[email protected]>--- xen/include/xen/config.h | 1 - xen/include/xsm/xsm.h | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-)xen/include/xen/config.h +0
-1@@ -79,7 +79,6 @@#define STR (...) __STR(__VA_ARGS__)#ifdef CONFIG_FLASK -#define XSM_MAGIC 0xf97cff8c/* Maintain statistics on the access vector cache */ #define FLASK_AVC_STATS 1#endif xen/include/xsm/xsm.h +0
-0@@ -23,8 +23,11 @@ DEFINE_XEN_GUEST_HANDLE(xsm_op_t);/* policy magic number (defined by XSM_MAGIC) */ typedef u32 xsm_magic_t ;
xen/include/xsm/xsm.h DEFINE_XEN_GUEST_HANDLE(xsm_op_t); · line 33
Quoted 10 lines
xen/include/xsm/xsm.h +5
-2-#ifndef XSM_MAGIC -#define XSM_MAGIC 0x00000000 + +#ifdef CONFIG_FLASK +#define XSM_MAGIC 0xf97cff8c +#else +#define XSM_MAGIC 0x0#endif /* These annotations are used by callers and in dummy.h to document the
ping?
Signature · 1 line
Doug Goldstein
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 5 lines · Doug Goldstein
Rather than have
XSM_MAGICset in the globalxen/config.hand set inxsm.hif it's unset, just set it once inxsm.hsince its only used in files that already includexsm.hSigned-off-by Doug Goldstein <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 8 lines · Daniel De Graaf
Quoted 5 lines · Doug Goldstein
Rather than have
XSM_MAGICset in the globalxen/config.hand set inxsm.hif it's unset, just set it once inxsm.hsince its only used in files that already includexsm.hSigned-off-by Doug Goldstein <[email protected]>Acked-by Daniel De Graaf <[email protected]>
Both patches applied.
Quoted 5 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel