public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: sterchelen <sterchelen@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: sterchelen <sterchelen@gmail.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] kernel: Fix acct coding style
Date: Mon, 13 May 2019 20:15:15 +0200	[thread overview]
Message-ID: <20190513181516.11131-1-sterchelen@gmail.com> (raw)

Improve readability by applying coding style

Signed-off-by: Nicolas Sterchele <sterchelen@gmail.com>
---
 kernel/acct.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/kernel/acct.c b/kernel/acct.c
index 81f9831a7859..7369960a9555 100644
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -111,6 +111,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;
@@ -118,6 +119,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;
@@ -170,6 +172,7 @@ static struct bsd_acct_struct *acct_get(struct pid_namespace *ns)
 static void acct_pin_kill(struct fs_pin *pin)
 {
 	struct bsd_acct_struct *acct = to_acct(pin);
+
 	mutex_lock(&acct->lock);
 	do_acct_process(acct);
 	schedule_work(&acct->work);
@@ -182,8 +185,12 @@ static void acct_pin_kill(struct fs_pin *pin)
 
 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);
@@ -389,8 +396,8 @@ static comp2_t encode_comp2_t(u64 value)
  */
 static u32 encode_float(u64 value)
 {
-	unsigned exp = 190;
-	unsigned u;
+	unsigned int exp = 190;
+	unsigned int u;
 
 	if (value == 0)
 		return 0;
@@ -449,7 +456,7 @@ 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
 
@@ -505,8 +512,9 @@ 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
@@ -517,6 +525,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, &ac, sizeof(acct_t), &pos);
 		file_end_write(file);
 	}
@@ -575,6 +584,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);
-- 
2.21.0


                 reply	other threads:[~2019-05-13 18:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190513181516.11131-1-sterchelen@gmail.com \
    --to=sterchelen@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox