diff options
author | Don Mullis <dwm@meer.net> | 2006-12-08 11:39:51 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-08 17:29:03 +0100 |
commit | 08b3df2d16cbebf7d72c09dcbc071696c14d07e3 (patch) | |
tree | 2cc0baeda87e24d9839845c0d34cd068453b1518 /lib/fault-inject.c | |
parent | [PATCH] fault-injection: Correct, disambiguate, and reformat documentation (diff) | |
download | linux-08b3df2d16cbebf7d72c09dcbc071696c14d07e3.tar.xz linux-08b3df2d16cbebf7d72c09dcbc071696c14d07e3.zip |
[PATCH] fault-injection: Use bool-true-false throughout
Use bool-true-false throughout.
Signed-off-by: Don Mullis <dwm@meer.net>
Cc: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'lib/fault-inject.c')
-rw-r--r-- | lib/fault-inject.c | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/lib/fault-inject.c b/lib/fault-inject.c index 361c6e9cd77f..244782940349 100644 --- a/lib/fault-inject.c +++ b/lib/fault-inject.c @@ -48,7 +48,7 @@ static void fail_dump(struct fault_attr *attr) #define atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0) -static int fail_task(struct fault_attr *attr, struct task_struct *task) +static bool fail_task(struct fault_attr *attr, struct task_struct *task) { return !in_interrupt() && task->make_it_fail; } @@ -68,15 +68,15 @@ static asmlinkage int fail_stacktrace_callback(struct unwind_frame_info *info, break; if (attr->reject_start <= UNW_PC(info) && UNW_PC(info) < attr->reject_end) - return 0; + return false; if (attr->require_start <= UNW_PC(info) && UNW_PC(info) < attr->require_end) - found = 1; + found = true; } return found; } -static int fail_stacktrace(struct fault_attr *attr) +static bool fail_stacktrace(struct fault_attr *attr) { struct unwind_frame_info info; @@ -85,9 +85,7 @@ static int fail_stacktrace(struct fault_attr *attr) #elif defined(CONFIG_STACKTRACE) -#define MAX_STACK_TRACE_DEPTH 32 - -static int fail_stacktrace(struct fault_attr *attr) +static bool fail_stacktrace(struct fault_attr *attr) { struct stack_trace trace; int depth = attr->stacktrace_depth; @@ -109,26 +107,26 @@ static int fail_stacktrace(struct fault_attr *attr) for (n = 0; n < trace.nr_entries; n++) { if (attr->reject_start <= entries[n] && entries[n] < attr->reject_end) - return 0; + return false; if (attr->require_start <= entries[n] && entries[n] < attr->require_end) - found = 1; + found = true; } return found; } #else -static inline int fail_stacktrace(struct fault_attr *attr) +static inline bool fail_stacktrace(struct fault_attr *attr) { - static int firsttime = 1; + static bool firsttime = true; if (firsttime) { printk(KERN_WARNING "This architecture does not implement save_stack_trace()\n"); - firsttime = 0; + firsttime = false; } - return 0; + return false; } #endif @@ -138,32 +136,32 @@ static inline int fail_stacktrace(struct fault_attr *attr) * http://www.nongnu.org/failmalloc/ */ -int should_fail(struct fault_attr *attr, ssize_t size) +bool should_fail(struct fault_attr *attr, ssize_t size) { if (attr->task_filter && !fail_task(attr, current)) - return 0; + return false; if (!fail_stacktrace(attr)) - return 0; + return false; if (atomic_read(&attr->times) == 0) - return 0; + return false; if (atomic_read(&attr->space) > size) { atomic_sub(size, &attr->space); - return 0; + return false; } if (attr->interval > 1) { attr->count++; if (attr->count % attr->interval) - return 0; + return false; } if (attr->probability > random32() % 100) goto fail; - return 0; + return false; fail: fail_dump(attr); @@ -171,7 +169,7 @@ fail: if (atomic_read(&attr->times) != -1) atomic_dec_not_zero(&attr->times); - return 1; + return true; } #ifdef CONFIG_FAULT_INJECTION_DEBUG_FS |