lkml.org 
[lkml]   [2003]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] Clean up list head usage in sysrq.c
Use list_for_each_entry() instead of open code.

--
Brian Gerst
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);
\
 
 \ /
  Last update: 2005-03-22 13:33    [W:0.023 / U:1.856 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site