Messages in this thread Patch in this message | | | From | "Joshua I. James" <> | Subject | [PATCH] staging: kernel: fixed style warnings in acct.c | Date | Fri, 5 Dec 2014 13:47:34 +0900 |
| |
From: "Joshua I. James" <joshua@cybercrimetech.com>
Fixed style errors identified by checkpatch.
Output of checkpatch: WARNING: Missing a blank line after declarations WARNING: line over 80 characters ERROR: spaces required around that '==' (ctx:VxV) +#if ACCT_VERSION==2
Signed-off-by: Joshua I. James <joshua@cybercrimetech.com> --- kernel/acct.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/kernel/acct.c b/kernel/acct.c index 33738ef..322159c 100644 --- a/kernel/acct.c +++ b/kernel/acct.c @@ -105,6 +105,7 @@ static int check_free_space(struct bsd_acct_struct *acct) if (acct->active) { u64 suspend = sbuf.f_blocks * SUSPEND; + do_div(suspend, 100); if (sbuf.f_bavail <= suspend) { acct->active = 0; @@ -112,6 +113,7 @@ static int check_free_space(struct bsd_acct_struct *acct) } } else { u64 resume = sbuf.f_blocks * RESUME; + do_div(resume, 100); if (sbuf.f_bavail >= resume) { acct->active = 1; @@ -152,8 +154,10 @@ again: static void close_work(struct work_struct *work) { - struct bsd_acct_struct *acct = container_of(work, struct bsd_acct_struct, work); + struct bsd_acct_struct *acct = + container_of(work, struct bsd_acct_struct, work); struct file *file = acct->file; + if (file->f_op->flush) file->f_op->flush(file, NULL); __fput_sync(file); @@ -165,6 +169,7 @@ static void acct_kill(struct bsd_acct_struct *acct, { if (acct) { struct pid_namespace *ns = acct->ns; + do_acct_process(acct); INIT_WORK(&acct->work, close_work); init_completion(&acct->done); @@ -182,6 +187,7 @@ static void acct_kill(struct bsd_acct_struct *acct, static void acct_pin_kill(struct fs_pin *pin) { struct bsd_acct_struct *acct; + acct = container_of(pin, struct bsd_acct_struct, pin); mutex_lock(&acct->lock); if (!acct->ns) { @@ -448,15 +454,17 @@ static void fill_ac(acct_t *ac) #endif do_div(elapsed, AHZ); ac->ac_btime = get_seconds() - elapsed; -#if ACCT_VERSION==2 +#if ACCT_VERSION == 2 ac->ac_ahz = AHZ; #endif spin_lock_irq(¤t->sighand->siglock); tty = current->signal->tty; /* Safe as we hold the siglock */ ac->ac_tty = tty ? old_encode_dev(tty_devnum(tty)) : 0; - ac->ac_utime = encode_comp_t(jiffies_to_AHZ(cputime_to_jiffies(pacct->ac_utime))); - ac->ac_stime = encode_comp_t(jiffies_to_AHZ(cputime_to_jiffies(pacct->ac_stime))); + ac->ac_utime = encode_comp_t(jiffies_to_AHZ( + cputime_to_jiffies(pacct->ac_utime))); + ac->ac_stime = encode_comp_t(jiffies_to_AHZ( + cputime_to_jiffies(pacct->ac_stime))); ac->ac_flag = pacct->ac_flag; ac->ac_mem = encode_comp_t(pacct->ac_mem); ac->ac_minflt = encode_comp_t(pacct->ac_minflt); @@ -504,8 +512,8 @@ static void do_acct_process(struct bsd_acct_struct *acct) ac.ac_pid = task_tgid_nr_ns(current, ns); rcu_read_lock(); - ac.ac_ppid = task_tgid_nr_ns(rcu_dereference(current->real_parent), - ns); + ac.ac_ppid = task_tgid_nr_ns(rcu_dereference( + current->real_parent), ns); rcu_read_unlock(); } #endif @@ -516,6 +524,7 @@ static void do_acct_process(struct bsd_acct_struct *acct) if (file_start_write_trylock(file)) { /* it's been opened O_APPEND, so position is irrelevant */ loff_t pos = 0; + __kernel_write(file, (char *)&ac, sizeof(acct_t), &pos); file_end_write(file); } @@ -573,6 +582,7 @@ static void slow_acct_process(struct pid_namespace *ns) { for ( ; ns; ns = ns->parent) { struct bsd_acct_struct *acct = acct_get(ns); + if (acct) { do_acct_process(acct); mutex_unlock(&acct->lock); -- 1.9.1
| |