monitor: switch to plain bool
PATCH 1/1 monitor: switch to plain bool
---
Cc: Razvan Cojocaru <[email protected]>
Cc: Tamas K Lengyel <[email protected]>
--- xen/arch/arm/monitor.c | 4 ++-- xen/arch/x86/hvm/monitor.c | 10 +++++----- xen/common/monitor.c | 8 ++++---- xen/include/asm-x86/hvm/monitor.h | 6 +++--- xen/include/xen/monitor.h | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-)
xen/arch/arm/monitor.c +2 -2
@@ -28,13 +28,13 @@ int arch_monitor_domctl_event(struct domain *d, struct xen_domctl_monitor_op *mop) {struct arch_domain *ad = &d->arch; -bool_t requested_status = (XEN_DOMCTL_MONITOR_OP_ENABLE == mop->op); +bool requested_status = (XEN_DOMCTL_MONITOR_OP_ENABLE == mop->op);switch ( mop->event ) {case XEN_DOMCTL_MONITOR_EVENT_PRIVILEGED_CALL : { -bool_t old_status = ad->monitor.privileged_call_enabled; +bool old_status = ad->monitor.privileged_call_enabled;if (unlikely (old_status == requested_status) )return -EEXIST ;
xen/arch/x86/hvm/monitor.c +5 -5
@@ -30,7 +30,7 @@#include <asm/vm_event.h> #include <public/vm_event.h> -bool_t hvm_monitor_cr (unsigned int index,unsigned long value,unsigned long old) +bool hvm_monitor_cr (unsigned int index,unsigned long value,unsigned long old) {struct vcpu *curr = current;struct arch_domain *ad = &curr->domain->arch;
@@ -41,7 +41,7 @@ bool_t hvm_monitor_cr(unsigned int index, unsigned long value, unsigned long old value != old) && (!((value ^ old) & ad->monitor.write_ctrlreg_mask[index])) ) { -bool_t sync = !!(ad->monitor.write_ctrlreg_sync & ctrlreg_bitmask); +bool sync = !!(ad->monitor.write_ctrlreg_sync & ctrlreg_bitmask);vm_event_request_t req = { .reason =VM_EVENT_REASON_WRITE_CTRLREG ,
@@ -116,7 +116,7 @@ int hvm_monitor_debug(unsigned long rip, enum hvm_monitor_debug_type type,struct vcpu *curr = current;struct arch_domain *ad = &curr->domain->arch;vm_event_request_t req = {}; -bool_t sync; +bool sync;switch ( type ) {
@@ -127,7 +127,7 @@ int hvm_monitor_debug(unsigned long rip, enum hvm_monitor_debug_type type, req.u.software_breakpoint.gfn =gfn_of_rip (rip); req.u.software_breakpoint.type = trap_type; req.u.software_breakpoint.insn_length = insn_length; - sync =1 ; + sync = true;break ;case HVM_MONITOR_SINGLESTEP_BREAKPOINT :
@@ -135,7 +135,7 @@ int hvm_monitor_debug(unsigned long rip, enum hvm_monitor_debug_type type,return 0 ; req.reason =VM_EVENT_REASON_SINGLESTEP ; req.u.singlestep.gfn =gfn_of_rip (rip); - sync =1 ; + sync = true;break ;case HVM_MONITOR_DEBUG_EXCEPTION :
xen/common/monitor.c +4 -4
@@ -31,7 +31,7 @@int monitor_domctl (struct domain *d,struct xen_domctl_monitor_op *mop) {int rc; -bool_t requested_status =0 ; +bool requested_status = false;if (unlikely (current->domain == d) )/* no domain_pause() */ return -EPERM ;
@@ -43,7 +43,7 @@ int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop)switch ( mop->op ) {case XEN_DOMCTL_MONITOR_OP_ENABLE : - requested_status =1 ; + requested_status = true;/* fallthrough */ case XEN_DOMCTL_MONITOR_OP_DISABLE :/* sanity check: avoid left-shift undefined behavior */
@@ -67,7 +67,7 @@ int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop) {case XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST : { -bool_t old_status = d->monitor.guest_request_enabled; +bool old_status = d->monitor.guest_request_enabled;if (unlikely (old_status == requested_status) )return -EEXIST ;
@@ -88,7 +88,7 @@ int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop)return 0 ; } -int monitor_traps (struct vcpu *v,bool_t sync,vm_event_request_t *req) +int monitor_traps (struct vcpu *v,bool sync,vm_event_request_t *req) {int rc;struct domain *d = v->domain;
xen/include/asm-x86/hvm/monitor.h +3 -3
@@ -31,10 +31,10 @@ enum hvm_monitor_debug_type/* * Called for current VCPU on crX/MSR changes by guest. * The event might not fire if the client has subscribed to it in onchangeonly -* mode, hence the bool_t return type for control register write events. +* mode, hence the bool return type for control register write events. */ -bool_t hvm_monitor_cr (unsigned int index,unsigned long value, -unsigned long old); +bool hvm_monitor_cr (unsigned int index,unsigned long value, +unsigned long old);#define hvm_monitor_crX (cr, new, old) \ hvm_monitor_cr(VM_EVENT_X86_##cr, new, old)void hvm_monitor_msr (unsigned int msr,uint64_t value);
xen/include/xen/monitor.h +1 -1
@@ -30,6 +30,6 @@ struct xen_domctl_monitor_op;int monitor_domctl (struct domain *d,struct xen_domctl_monitor_op *op);void monitor_guest_request (void ); -int monitor_traps (struct vcpu *v,bool_t sync,vm_event_request_t *req); +int monitor_traps (struct vcpu *v,bool sync,vm_event_request_t *req);#endif /* __XEN_MONITOR_H__ */
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 14 lines · Wei Liu
xen/arch/x86/hvm/monitor.c +1
-1@@ -30,7 +30,7 @@#include <asm/vm_event.h> #include <public/vm_event.h> -bool_t hvm_monitor_cr (unsigned int index,unsigned long value,unsigned long old) +bool hvm_monitor_cr (unsigned int index,unsigned long value,unsigned long old) {struct vcpu *curr = current;struct arch_domain *ad = &curr->domain->arch;
xen/arch/x86/hvm/monitor.c bool_t hvm_monitor_cr(unsigned int index, unsigned long value, unsigned long old · line 44
Quoted 5 lines
xen/arch/x86/hvm/monitor.c +1
-1@@ -41,7 +41,7 @@ bool_t hvm_monitor_cr(unsigned int index, unsigned long value, unsigned long old value != old) && (!((value ^ old) & ad->monitor.write_ctrlreg_mask[index])) ) { -bool_t sync = !!(ad->monitor.write_ctrlreg_sync & ctrlreg_bitmask); +bool sync = !!(ad->monitor.write_ctrlreg_sync & ctrlreg_bitmask);
You can drop the !! and brackets.
Otherwise, Reviewed-by: Andrew Cooper <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 11 lines · Wei Liu
Signed-off-by Wei Liu<[email protected]>---
Cc: Razvan Cojocaru<[email protected]>
Cc: Tamas K Lengyel<[email protected]>--- xen/arch/arm/monitor.c | 4 ++-- xen/arch/x86/hvm/monitor.c | 10 +++++----- xen/common/monitor.c | 8 ++++---- xen/include/asm-x86/hvm/monitor.h | 6 +++--- xen/include/xen/monitor.h | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-)
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
xen/arch/x86/hvm/monitor.c bool_t hvm_monitor_cr(unsigned int index, unsigned long value, unsigned long old · line 44
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 08.09.17 at 15:44, <[email protected]> wrote:
xen/arch/x86/hvm/monitor.c +1
-1@@ -41,7 +41,7 @@ bool_t hvm_monitor_cr(unsigned int index, unsigned long value, unsigned long old value != old) && (!((value ^ old) & ad->monitor.write_ctrlreg_mask[index])) ) { -bool_t sync = !!(ad->monitor.write_ctrlreg_sync & ctrlreg_bitmask); +bool sync = !!(ad->monitor.write_ctrlreg_sync & ctrlreg_bitmask);
If you do such conversion, please also get rid of any unnecessary !! like is being used here (there are very few cases where these can't be dropped).
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 12 lines · Jan Beulich
xen/arch/x86/hvm/monitor.c bool_t hvm_monitor_cr(unsigned int index, unsigned long value, unsigned long old · line 44
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 08.09.17 at 15:44, <[email protected]> wrote:
xen/arch/x86/hvm/monitor.c +1
-1@@ -41,7 +41,7 @@ bool_t hvm_monitor_cr(unsigned int index, unsigned long value, unsigned long old value != old) && (!((value ^ old) & ad->monitor.write_ctrlreg_mask[index])) ) { -bool_t sync = !!(ad->monitor.write_ctrlreg_sync & ctrlreg_bitmask); +bool sync = !!(ad->monitor.write_ctrlreg_sync & ctrlreg_bitmask);If you do such conversion, please also get rid of any unnecessary !! like is being used here (there are very few cases where these can't be dropped).
Sure. I will keep an eye out in the future.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel