diff options
author | Ionut Alexa <ionut.m.alexa@gmail.com> | 2014-07-30 19:28:36 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-08-07 14:40:09 -0400 |
commit | 2577d92ebd28dd9b3dacdfad6dcd81be0d21bbdf (patch) | |
tree | f98886acfbd432820aa40d405458d97895a88c05 /kernel/acct.c | |
parent | 3064c3563ba4c23e2c7a47254ec056ed9ba0098a (diff) |
kernel/acct.c: fix coding style warnings and errors
Signed-off-by: Ionut Alexa <ionut.m.alexa@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel/acct.c')
-rw-r--r-- | kernel/acct.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/kernel/acct.c b/kernel/acct.c index 2e6cf818021d..b4c667d22e79 100644 --- a/kernel/acct.c +++ b/kernel/acct.c | |||
@@ -108,14 +108,14 @@ static int check_free_space(struct bsd_acct_struct *acct) | |||
108 | do_div(suspend, 100); | 108 | do_div(suspend, 100); |
109 | if (sbuf.f_bavail <= suspend) { | 109 | if (sbuf.f_bavail <= suspend) { |
110 | acct->active = 0; | 110 | acct->active = 0; |
111 | printk(KERN_INFO "Process accounting paused\n"); | 111 | pr_info("Process accounting paused\n"); |
112 | } | 112 | } |
113 | } else { | 113 | } else { |
114 | u64 resume = sbuf.f_blocks * RESUME; | 114 | u64 resume = sbuf.f_blocks * RESUME; |
115 | do_div(resume, 100); | 115 | do_div(resume, 100); |
116 | if (sbuf.f_bavail >= resume) { | 116 | if (sbuf.f_bavail >= resume) { |
117 | acct->active = 1; | 117 | acct->active = 1; |
118 | printk(KERN_INFO "Process accounting resumed\n"); | 118 | pr_info("Process accounting resumed\n"); |
119 | } | 119 | } |
120 | } | 120 | } |
121 | 121 | ||
@@ -280,6 +280,7 @@ SYSCALL_DEFINE1(acct, const char __user *, name) | |||
280 | 280 | ||
281 | if (name) { | 281 | if (name) { |
282 | struct filename *tmp = getname(name); | 282 | struct filename *tmp = getname(name); |
283 | |||
283 | if (IS_ERR(tmp)) | 284 | if (IS_ERR(tmp)) |
284 | return PTR_ERR(tmp); | 285 | return PTR_ERR(tmp); |
285 | mutex_lock(&acct_on_mutex); | 286 | mutex_lock(&acct_on_mutex); |
@@ -337,7 +338,7 @@ static comp_t encode_comp_t(unsigned long value) | |||
337 | return exp; | 338 | return exp; |
338 | } | 339 | } |
339 | 340 | ||
340 | #if ACCT_VERSION==1 || ACCT_VERSION==2 | 341 | #if ACCT_VERSION == 1 || ACCT_VERSION == 2 |
341 | /* | 342 | /* |
342 | * encode an u64 into a comp2_t (24 bits) | 343 | * encode an u64 into a comp2_t (24 bits) |
343 | * | 344 | * |
@@ -350,7 +351,7 @@ static comp_t encode_comp_t(unsigned long value) | |||
350 | #define MANTSIZE2 20 /* 20 bit mantissa. */ | 351 | #define MANTSIZE2 20 /* 20 bit mantissa. */ |
351 | #define EXPSIZE2 5 /* 5 bit base 2 exponent. */ | 352 | #define EXPSIZE2 5 /* 5 bit base 2 exponent. */ |
352 | #define MAXFRACT2 ((1ul << MANTSIZE2) - 1) /* Maximum fractional value. */ | 353 | #define MAXFRACT2 ((1ul << MANTSIZE2) - 1) /* Maximum fractional value. */ |
353 | #define MAXEXP2 ((1 <<EXPSIZE2) - 1) /* Maximum exponent. */ | 354 | #define MAXEXP2 ((1 << EXPSIZE2) - 1) /* Maximum exponent. */ |
354 | 355 | ||
355 | static comp2_t encode_comp2_t(u64 value) | 356 | static comp2_t encode_comp2_t(u64 value) |
356 | { | 357 | { |
@@ -381,7 +382,7 @@ static comp2_t encode_comp2_t(u64 value) | |||
381 | } | 382 | } |
382 | #endif | 383 | #endif |
383 | 384 | ||
384 | #if ACCT_VERSION==3 | 385 | #if ACCT_VERSION == 3 |
385 | /* | 386 | /* |
386 | * encode an u64 into a 32 bit IEEE float | 387 | * encode an u64 into a 32 bit IEEE float |
387 | */ | 388 | */ |
@@ -390,8 +391,9 @@ static u32 encode_float(u64 value) | |||
390 | unsigned exp = 190; | 391 | unsigned exp = 190; |
391 | unsigned u; | 392 | unsigned u; |
392 | 393 | ||
393 | if (value==0) return 0; | 394 | if (value == 0) |
394 | while ((s64)value > 0){ | 395 | return 0; |
396 | while ((s64)value > 0) { | ||
395 | value <<= 1; | 397 | value <<= 1; |
396 | exp--; | 398 | exp--; |
397 | } | 399 | } |
@@ -429,16 +431,17 @@ static void fill_ac(acct_t *ac) | |||
429 | run_time -= current->group_leader->start_time; | 431 | run_time -= current->group_leader->start_time; |
430 | /* convert nsec -> AHZ */ | 432 | /* convert nsec -> AHZ */ |
431 | elapsed = nsec_to_AHZ(run_time); | 433 | elapsed = nsec_to_AHZ(run_time); |
432 | #if ACCT_VERSION==3 | 434 | #if ACCT_VERSION == 3 |
433 | ac->ac_etime = encode_float(elapsed); | 435 | ac->ac_etime = encode_float(elapsed); |
434 | #else | 436 | #else |
435 | ac->ac_etime = encode_comp_t(elapsed < (unsigned long) -1l ? | 437 | ac->ac_etime = encode_comp_t(elapsed < (unsigned long) -1l ? |
436 | (unsigned long) elapsed : (unsigned long) -1l); | 438 | (unsigned long) elapsed : (unsigned long) -1l); |
437 | #endif | 439 | #endif |
438 | #if ACCT_VERSION==1 || ACCT_VERSION==2 | 440 | #if ACCT_VERSION == 1 || ACCT_VERSION == 2 |
439 | { | 441 | { |
440 | /* new enlarged etime field */ | 442 | /* new enlarged etime field */ |
441 | comp2_t etime = encode_comp2_t(elapsed); | 443 | comp2_t etime = encode_comp2_t(elapsed); |
444 | |||
442 | ac->ac_etime_hi = etime >> 16; | 445 | ac->ac_etime_hi = etime >> 16; |
443 | ac->ac_etime_lo = (u16) etime; | 446 | ac->ac_etime_lo = (u16) etime; |
444 | } | 447 | } |
@@ -491,12 +494,12 @@ static void do_acct_process(struct bsd_acct_struct *acct) | |||
491 | /* we really need to bite the bullet and change layout */ | 494 | /* we really need to bite the bullet and change layout */ |
492 | ac.ac_uid = from_kuid_munged(file->f_cred->user_ns, orig_cred->uid); | 495 | ac.ac_uid = from_kuid_munged(file->f_cred->user_ns, orig_cred->uid); |
493 | ac.ac_gid = from_kgid_munged(file->f_cred->user_ns, orig_cred->gid); | 496 | ac.ac_gid = from_kgid_munged(file->f_cred->user_ns, orig_cred->gid); |
494 | #if ACCT_VERSION==1 || ACCT_VERSION==2 | 497 | #if ACCT_VERSION == 1 || ACCT_VERSION == 2 |
495 | /* backward-compatible 16 bit fields */ | 498 | /* backward-compatible 16 bit fields */ |
496 | ac.ac_uid16 = ac.ac_uid; | 499 | ac.ac_uid16 = ac.ac_uid; |
497 | ac.ac_gid16 = ac.ac_gid; | 500 | ac.ac_gid16 = ac.ac_gid; |
498 | #endif | 501 | #endif |
499 | #if ACCT_VERSION==3 | 502 | #if ACCT_VERSION == 3 |
500 | ac.ac_pid = task_tgid_nr_ns(current, ns); | 503 | ac.ac_pid = task_tgid_nr_ns(current, ns); |
501 | rcu_read_lock(); | 504 | rcu_read_lock(); |
502 | ac.ac_ppid = task_tgid_nr_ns(rcu_dereference(current->real_parent), ns); | 505 | ac.ac_ppid = task_tgid_nr_ns(rcu_dereference(current->real_parent), ns); |
@@ -530,6 +533,7 @@ void acct_collect(long exitcode, int group_dead) | |||
530 | 533 | ||
531 | if (group_dead && current->mm) { | 534 | if (group_dead && current->mm) { |
532 | struct vm_area_struct *vma; | 535 | struct vm_area_struct *vma; |
536 | |||
533 | down_read(¤t->mm->mmap_sem); | 537 | down_read(¤t->mm->mmap_sem); |
534 | vma = current->mm->mmap; | 538 | vma = current->mm->mmap; |
535 | while (vma) { | 539 | while (vma) { |