diff options
| author | Ionut Alexa <ionut.m.alexa@gmail.com> | 2014-08-08 17:23:42 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-08 18:57:27 -0400 |
| commit | 934fc295b30ea8ce5d5e0ab9024a10fab9b6f200 (patch) | |
| tree | 6737164c1f948c8b95e1d1673042d5c1d6462cbc /kernel | |
| parent | a6c19dfe39941a5d3f4d072121c0a4841e7e26fd (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: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/acct.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/kernel/acct.c b/kernel/acct.c index a1844f14c6d6..51793520566f 100644 --- a/kernel/acct.c +++ b/kernel/acct.c | |||
| @@ -141,12 +141,12 @@ static int check_free_space(struct bsd_acct_struct *acct, struct file *file) | |||
| 141 | if (acct->active) { | 141 | if (acct->active) { |
| 142 | if (act < 0) { | 142 | if (act < 0) { |
| 143 | acct->active = 0; | 143 | acct->active = 0; |
| 144 | printk(KERN_INFO "Process accounting paused\n"); | 144 | pr_info("Process accounting paused\n"); |
| 145 | } | 145 | } |
| 146 | } else { | 146 | } else { |
| 147 | if (act > 0) { | 147 | if (act > 0) { |
| 148 | acct->active = 1; | 148 | acct->active = 1; |
| 149 | printk(KERN_INFO "Process accounting resumed\n"); | 149 | pr_info("Process accounting resumed\n"); |
| 150 | } | 150 | } |
| 151 | } | 151 | } |
| 152 | 152 | ||
| @@ -261,6 +261,7 @@ SYSCALL_DEFINE1(acct, const char __user *, name) | |||
| 261 | 261 | ||
| 262 | if (name) { | 262 | if (name) { |
| 263 | struct filename *tmp = getname(name); | 263 | struct filename *tmp = getname(name); |
| 264 | |||
| 264 | if (IS_ERR(tmp)) | 265 | if (IS_ERR(tmp)) |
| 265 | return PTR_ERR(tmp); | 266 | return PTR_ERR(tmp); |
| 266 | error = acct_on(tmp); | 267 | error = acct_on(tmp); |
| @@ -376,7 +377,7 @@ static comp_t encode_comp_t(unsigned long value) | |||
| 376 | return exp; | 377 | return exp; |
| 377 | } | 378 | } |
| 378 | 379 | ||
| 379 | #if ACCT_VERSION==1 || ACCT_VERSION==2 | 380 | #if ACCT_VERSION == 1 || ACCT_VERSION == 2 |
| 380 | /* | 381 | /* |
| 381 | * encode an u64 into a comp2_t (24 bits) | 382 | * encode an u64 into a comp2_t (24 bits) |
| 382 | * | 383 | * |
| @@ -389,7 +390,7 @@ static comp_t encode_comp_t(unsigned long value) | |||
| 389 | #define MANTSIZE2 20 /* 20 bit mantissa. */ | 390 | #define MANTSIZE2 20 /* 20 bit mantissa. */ |
| 390 | #define EXPSIZE2 5 /* 5 bit base 2 exponent. */ | 391 | #define EXPSIZE2 5 /* 5 bit base 2 exponent. */ |
| 391 | #define MAXFRACT2 ((1ul << MANTSIZE2) - 1) /* Maximum fractional value. */ | 392 | #define MAXFRACT2 ((1ul << MANTSIZE2) - 1) /* Maximum fractional value. */ |
| 392 | #define MAXEXP2 ((1 <<EXPSIZE2) - 1) /* Maximum exponent. */ | 393 | #define MAXEXP2 ((1 << EXPSIZE2) - 1) /* Maximum exponent. */ |
| 393 | 394 | ||
| 394 | static comp2_t encode_comp2_t(u64 value) | 395 | static comp2_t encode_comp2_t(u64 value) |
| 395 | { | 396 | { |
| @@ -420,7 +421,7 @@ static comp2_t encode_comp2_t(u64 value) | |||
| 420 | } | 421 | } |
| 421 | #endif | 422 | #endif |
| 422 | 423 | ||
| 423 | #if ACCT_VERSION==3 | 424 | #if ACCT_VERSION == 3 |
| 424 | /* | 425 | /* |
| 425 | * encode an u64 into a 32 bit IEEE float | 426 | * encode an u64 into a 32 bit IEEE float |
| 426 | */ | 427 | */ |
| @@ -429,8 +430,9 @@ static u32 encode_float(u64 value) | |||
| 429 | unsigned exp = 190; | 430 | unsigned exp = 190; |
| 430 | unsigned u; | 431 | unsigned u; |
| 431 | 432 | ||
| 432 | if (value==0) return 0; | 433 | if (value == 0) |
| 433 | while ((s64)value > 0){ | 434 | return 0; |
| 435 | while ((s64)value > 0) { | ||
| 434 | value <<= 1; | 436 | value <<= 1; |
| 435 | exp--; | 437 | exp--; |
| 436 | } | 438 | } |
| @@ -486,16 +488,17 @@ static void do_acct_process(struct bsd_acct_struct *acct, | |||
| 486 | run_time -= current->group_leader->start_time; | 488 | run_time -= current->group_leader->start_time; |
| 487 | /* convert nsec -> AHZ */ | 489 | /* convert nsec -> AHZ */ |
| 488 | elapsed = nsec_to_AHZ(run_time); | 490 | elapsed = nsec_to_AHZ(run_time); |
| 489 | #if ACCT_VERSION==3 | 491 | #if ACCT_VERSION == 3 |
| 490 | ac.ac_etime = encode_float(elapsed); | 492 | ac.ac_etime = encode_float(elapsed); |
| 491 | #else | 493 | #else |
| 492 | ac.ac_etime = encode_comp_t(elapsed < (unsigned long) -1l ? | 494 | ac.ac_etime = encode_comp_t(elapsed < (unsigned long) -1l ? |
| 493 | (unsigned long) elapsed : (unsigned long) -1l); | 495 | (unsigned long) elapsed : (unsigned long) -1l); |
| 494 | #endif | 496 | #endif |
| 495 | #if ACCT_VERSION==1 || ACCT_VERSION==2 | 497 | #if ACCT_VERSION == 1 || ACCT_VERSION == 2 |
| 496 | { | 498 | { |
| 497 | /* new enlarged etime field */ | 499 | /* new enlarged etime field */ |
| 498 | comp2_t etime = encode_comp2_t(elapsed); | 500 | comp2_t etime = encode_comp2_t(elapsed); |
| 501 | |||
| 499 | ac.ac_etime_hi = etime >> 16; | 502 | ac.ac_etime_hi = etime >> 16; |
| 500 | ac.ac_etime_lo = (u16) etime; | 503 | ac.ac_etime_lo = (u16) etime; |
| 501 | } | 504 | } |
| @@ -505,15 +508,15 @@ static void do_acct_process(struct bsd_acct_struct *acct, | |||
| 505 | /* we really need to bite the bullet and change layout */ | 508 | /* we really need to bite the bullet and change layout */ |
| 506 | ac.ac_uid = from_kuid_munged(file->f_cred->user_ns, orig_cred->uid); | 509 | ac.ac_uid = from_kuid_munged(file->f_cred->user_ns, orig_cred->uid); |
| 507 | ac.ac_gid = from_kgid_munged(file->f_cred->user_ns, orig_cred->gid); | 510 | ac.ac_gid = from_kgid_munged(file->f_cred->user_ns, orig_cred->gid); |
| 508 | #if ACCT_VERSION==2 | 511 | #if ACCT_VERSION == 2 |
| 509 | ac.ac_ahz = AHZ; | 512 | ac.ac_ahz = AHZ; |
| 510 | #endif | 513 | #endif |
| 511 | #if ACCT_VERSION==1 || ACCT_VERSION==2 | 514 | #if ACCT_VERSION == 1 || ACCT_VERSION == 2 |
| 512 | /* backward-compatible 16 bit fields */ | 515 | /* backward-compatible 16 bit fields */ |
| 513 | ac.ac_uid16 = ac.ac_uid; | 516 | ac.ac_uid16 = ac.ac_uid; |
| 514 | ac.ac_gid16 = ac.ac_gid; | 517 | ac.ac_gid16 = ac.ac_gid; |
| 515 | #endif | 518 | #endif |
| 516 | #if ACCT_VERSION==3 | 519 | #if ACCT_VERSION == 3 |
| 517 | ac.ac_pid = task_tgid_nr_ns(current, ns); | 520 | ac.ac_pid = task_tgid_nr_ns(current, ns); |
| 518 | rcu_read_lock(); | 521 | rcu_read_lock(); |
| 519 | ac.ac_ppid = task_tgid_nr_ns(rcu_dereference(current->real_parent), ns); | 522 | ac.ac_ppid = task_tgid_nr_ns(rcu_dereference(current->real_parent), ns); |
| @@ -574,6 +577,7 @@ void acct_collect(long exitcode, int group_dead) | |||
| 574 | 577 | ||
| 575 | if (group_dead && current->mm) { | 578 | if (group_dead && current->mm) { |
| 576 | struct vm_area_struct *vma; | 579 | struct vm_area_struct *vma; |
| 580 | |||
| 577 | down_read(¤t->mm->mmap_sem); | 581 | down_read(¤t->mm->mmap_sem); |
| 578 | vma = current->mm->mmap; | 582 | vma = current->mm->mmap; |
| 579 | while (vma) { | 583 | while (vma) { |
