Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kprobes: Use bool type for functions which returns boolean value

Use the 'bool' type instead of 'int' for the functions which
returns a boolean value, because this makes clear that those
functions don't return any error code.

Link: https://lkml.kernel.org/r/163163041649.489837.17311187321419747536.stgit@devnote2

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

authored by

Masami Hiramatsu and committed by
Steven Rostedt (VMware)
29e8077a c42421e2

+18 -18
+4 -4
include/linux/kprobes.h
··· 104 104 #define KPROBE_FLAG_FTRACE 8 /* probe is using ftrace */ 105 105 106 106 /* Has this kprobe gone ? */ 107 - static inline int kprobe_gone(struct kprobe *p) 107 + static inline bool kprobe_gone(struct kprobe *p) 108 108 { 109 109 return p->flags & KPROBE_FLAG_GONE; 110 110 } 111 111 112 112 /* Is this kprobe disabled ? */ 113 - static inline int kprobe_disabled(struct kprobe *p) 113 + static inline bool kprobe_disabled(struct kprobe *p) 114 114 { 115 115 return p->flags & (KPROBE_FLAG_DISABLED | KPROBE_FLAG_GONE); 116 116 } 117 117 118 118 /* Is this kprobe really running optimized path ? */ 119 - static inline int kprobe_optimized(struct kprobe *p) 119 + static inline bool kprobe_optimized(struct kprobe *p) 120 120 { 121 121 return p->flags & KPROBE_FLAG_OPTIMIZED; 122 122 } 123 123 124 124 /* Is this kprobe uses ftrace ? */ 125 - static inline int kprobe_ftrace(struct kprobe *p) 125 + static inline bool kprobe_ftrace(struct kprobe *p) 126 126 { 127 127 return p->flags & KPROBE_FLAG_FTRACE; 128 128 }
+13 -13
kernel/kprobes.c
··· 198 198 return slot; 199 199 } 200 200 201 - /* Return 1 if all garbages are collected, otherwise 0. */ 202 - static int collect_one_slot(struct kprobe_insn_page *kip, int idx) 201 + /* Return true if all garbages are collected, otherwise false. */ 202 + static bool collect_one_slot(struct kprobe_insn_page *kip, int idx) 203 203 { 204 204 kip->slot_used[idx] = SLOT_CLEAN; 205 205 kip->nused--; ··· 223 223 kip->cache->free(kip->insns); 224 224 kfree(kip); 225 225 } 226 - return 1; 226 + return true; 227 227 } 228 - return 0; 228 + return false; 229 229 } 230 230 231 231 static int collect_garbage_slots(struct kprobe_insn_cache *c) ··· 389 389 static int aggr_pre_handler(struct kprobe *p, struct pt_regs *regs); 390 390 391 391 /* Return true if 'p' is an aggregator */ 392 - static inline int kprobe_aggrprobe(struct kprobe *p) 392 + static inline bool kprobe_aggrprobe(struct kprobe *p) 393 393 { 394 394 return p->pre_handler == aggr_pre_handler; 395 395 } 396 396 397 397 /* Return true if 'p' is unused */ 398 - static inline int kprobe_unused(struct kprobe *p) 398 + static inline bool kprobe_unused(struct kprobe *p) 399 399 { 400 400 return kprobe_aggrprobe(p) && kprobe_disabled(p) && 401 401 list_empty(&p->list); ··· 455 455 } 456 456 457 457 /* Return true if the kprobe is disarmed. Note: p must be on hash list */ 458 - static inline int kprobe_disarmed(struct kprobe *p) 458 + static inline bool kprobe_disarmed(struct kprobe *p) 459 459 { 460 460 struct optimized_kprobe *op; 461 461 ··· 469 469 } 470 470 471 471 /* Return true if the probe is queued on (un)optimizing lists */ 472 - static int kprobe_queued(struct kprobe *p) 472 + static bool kprobe_queued(struct kprobe *p) 473 473 { 474 474 struct optimized_kprobe *op; 475 475 476 476 if (kprobe_aggrprobe(p)) { 477 477 op = container_of(p, struct optimized_kprobe, kp); 478 478 if (!list_empty(&op->list)) 479 - return 1; 479 + return true; 480 480 } 481 - return 0; 481 + return false; 482 482 } 483 483 484 484 /* ··· 1678 1678 EXPORT_SYMBOL_GPL(register_kprobe); 1679 1679 1680 1680 /* Check if all probes on the 'ap' are disabled. */ 1681 - static int aggr_kprobe_disabled(struct kprobe *ap) 1681 + static bool aggr_kprobe_disabled(struct kprobe *ap) 1682 1682 { 1683 1683 struct kprobe *kp; 1684 1684 ··· 1690 1690 * Since there is an active probe on the list, 1691 1691 * we can't disable this 'ap'. 1692 1692 */ 1693 - return 0; 1693 + return false; 1694 1694 1695 - return 1; 1695 + return true; 1696 1696 } 1697 1697 1698 1698 static struct kprobe *__disable_kprobe(struct kprobe *p)
+1 -1
kernel/trace/trace_kprobe.c
··· 97 97 98 98 static nokprobe_inline bool trace_kprobe_has_gone(struct trace_kprobe *tk) 99 99 { 100 - return !!(kprobe_gone(&tk->rp.kp)); 100 + return kprobe_gone(&tk->rp.kp); 101 101 } 102 102 103 103 static nokprobe_inline bool trace_kprobe_within_module(struct trace_kprobe *tk,