From: Brian Gerst <bgerst@quark.didntduck.org>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Linux-Kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] Clean up list head usage in sysrq.c
Date: Fri, 21 Feb 2003 18:24:20 -0500 [thread overview]
Message-ID: <3E56B524.2060201@quark.didntduck.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 68 bytes --]
Use list_for_each_entry() instead of open code.
--
Brian Gerst
[-- Attachment #2: sysrqlist-1 --]
[-- Type: text/plain, Size: 1364 bytes --]
diff -urN linux-2.5.62-bk6/drivers/char/sysrq.c linux/drivers/char/sysrq.c
--- linux-2.5.62-bk6/drivers/char/sysrq.c 2003-01-13 16:20:50.000000000 -0500
+++ linux/drivers/char/sysrq.c 2003-02-21 10:36:41.000000000 -0500
@@ -153,7 +153,7 @@
if (remount_flag) { /* Remount R/O */
int ret, flags;
- struct list_head *p;
+ struct file *file;
if (sb->s_flags & MS_RDONLY) {
printk("R/O\n");
@@ -161,8 +161,7 @@
}
file_list_lock();
- for (p = sb->s_files.next; p != &sb->s_files; p = p->next) {
- struct file *file = list_entry(p, struct file, f_list);
+ list_for_each_entry(file, &sb->s_files, f_list) {
if (file->f_dentry && file_count(file)
&& S_ISREG(file->f_dentry->d_inode->i_mode))
file->f_mode &= ~2;
@@ -205,15 +204,11 @@
remount_flag = (emergency_sync_scheduled == EMERG_REMOUNT);
emergency_sync_scheduled = 0;
- for (sb = sb_entry(super_blocks.next);
- sb != sb_entry(&super_blocks);
- sb = sb_entry(sb->s_list.next))
+ list_for_each_entry(sb, &super_blocks, s_list)
if (sb->s_bdev && is_local_disk(sb->s_bdev))
go_sync(sb, remount_flag);
- for (sb = sb_entry(super_blocks.next);
- sb != sb_entry(&super_blocks);
- sb = sb_entry(sb->s_list.next))
+ list_for_each_entry(sb, &super_blocks, s_list)
if (sb->s_bdev && !is_local_disk(sb->s_bdev))
go_sync(sb, remount_flag);
reply other threads:[~2003-02-21 23:14 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=3E56B524.2060201@quark.didntduck.org \
--to=bgerst@quark.didntduck.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/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
all inboxes | Powered by JetHome®