lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20070718182527.GA1827@darkstar.te-china.tietoenator.com>
Date:	Wed, 18 Jul 2007 18:25:27 +0000
From:	Dave Young <hidave.darkstar@...il.com>
To:	gregkh@...e.de
Cc:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] sysfs - use mutex instead of semaphore

Hi,
Sorry,this is the right one. dir.c bin.c and symlink.c use the
mutex.h,should not be deleted.

Signed-off-by: Dave Young <hidave.darkstar@...il.com> 

---

fs/sysfs/bin.c     |    2 +-
fs/sysfs/dir.c     |    2 +-
fs/sysfs/file.c    |   14 +++++++-------
fs/sysfs/group.c   |    1 -
fs/sysfs/inode.c   |    1 -
fs/sysfs/mount.c   |    1 -
fs/sysfs/symlink.c |    2 +-
7 files changed, 10 insertions(+), 13 deletions(-)

diff -upr linux/fs/sysfs/bin.c linux.new/fs/sysfs/bin.c
--- linux/fs/sysfs/bin.c	2007-07-18 17:40:46.000000000 +0000
+++ linux.new/fs/sysfs/bin.c	2007-07-18 18:18:06.000000000 +0000
@@ -14,9 +14,9 @@
 #include <linux/kobject.h>
 #include <linux/module.h>
 #include <linux/slab.h>
+#include <linux/mutex.h>
 
 #include <asm/uaccess.h>
-#include <asm/semaphore.h>
 
 #include "sysfs.h"
 
diff -upr linux/fs/sysfs/dir.c linux.new/fs/sysfs/dir.c
--- linux/fs/sysfs/dir.c	2007-07-18 17:40:46.000000000 +0000
+++ linux.new/fs/sysfs/dir.c	2007-07-18 18:18:26.000000000 +0000
@@ -10,8 +10,8 @@
 #include <linux/kobject.h>
 #include <linux/namei.h>
 #include <linux/idr.h>
+#include <linux/mutex.h>
 #include <linux/completion.h>
-#include <asm/semaphore.h>
 #include "sysfs.h"
 
 DEFINE_MUTEX(sysfs_mutex);
diff -upr linux/fs/sysfs/file.c linux.new/fs/sysfs/file.c
--- linux/fs/sysfs/file.c	2007-07-18 17:40:46.000000000 +0000
+++ linux.new/fs/sysfs/file.c	2007-07-18 17:40:37.000000000 +0000
@@ -8,8 +8,8 @@
 #include <linux/namei.h>
 #include <linux/poll.h>
 #include <linux/list.h>
+#include <linux/mutex.h>
 #include <asm/uaccess.h>
-#include <asm/semaphore.h>
 
 #include "sysfs.h"
 
@@ -55,7 +55,7 @@ struct sysfs_buffer {
 	loff_t			pos;
 	char			* page;
 	struct sysfs_ops	* ops;
-	struct semaphore	sem;
+	struct mutex		lock;
 	int			needs_read_fill;
 	int			event;
 };
@@ -128,7 +128,7 @@ sysfs_read_file(struct file *file, char 
 	struct sysfs_buffer * buffer = file->private_data;
 	ssize_t retval = 0;
 
-	down(&buffer->sem);
+	mutex_lock(&buffer->lock);
 	if (buffer->needs_read_fill) {
 		retval = fill_read_buffer(file->f_path.dentry,buffer);
 		if (retval)
@@ -139,7 +139,7 @@ sysfs_read_file(struct file *file, char 
 	retval = simple_read_from_buffer(buf, count, ppos, buffer->page,
 					 buffer->count);
 out:
-	up(&buffer->sem);
+	mutex_unlock(&buffer->lock);
 	return retval;
 }
 
@@ -228,13 +228,13 @@ sysfs_write_file(struct file *file, cons
 	struct sysfs_buffer * buffer = file->private_data;
 	ssize_t len;
 
-	down(&buffer->sem);
+	mutex_lock(&buffer->lock);
 	len = fill_write_buffer(buffer, buf, count);
 	if (len > 0)
 		len = flush_write_buffer(file->f_path.dentry, buffer, len);
 	if (len > 0)
 		*ppos += len;
-	up(&buffer->sem);
+	mutex_unlock(&buffer->lock);
 	return len;
 }
 
@@ -294,7 +294,7 @@ static int sysfs_open_file(struct inode 
 	if (!buffer)
 		goto err_out;
 
-	init_MUTEX(&buffer->sem);
+	mutex_init(&buffer->lock);
 	buffer->needs_read_fill = 1;
 	buffer->ops = ops;
 	file->private_data = buffer;
diff -upr linux/fs/sysfs/group.c linux.new/fs/sysfs/group.c
--- linux/fs/sysfs/group.c	2007-07-18 17:40:46.000000000 +0000
+++ linux.new/fs/sysfs/group.c	2007-07-18 17:40:37.000000000 +0000
@@ -14,7 +14,6 @@
 #include <linux/namei.h>
 #include <linux/err.h>
 #include <linux/fs.h>
-#include <asm/semaphore.h>
 #include "sysfs.h"
 
 
diff -upr linux/fs/sysfs/inode.c linux.new/fs/sysfs/inode.c
--- linux/fs/sysfs/inode.c	2007-07-18 17:40:46.000000000 +0000
+++ linux.new/fs/sysfs/inode.c	2007-07-18 17:40:37.000000000 +0000
@@ -14,7 +14,6 @@
 #include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
-#include <asm/semaphore.h>
 #include "sysfs.h"
 
 extern struct super_block * sysfs_sb;
diff -upr linux/fs/sysfs/mount.c linux.new/fs/sysfs/mount.c
--- linux/fs/sysfs/mount.c	2007-07-18 17:40:46.000000000 +0000
+++ linux.new/fs/sysfs/mount.c	2007-07-18 17:40:37.000000000 +0000
@@ -8,7 +8,6 @@
 #include <linux/mount.h>
 #include <linux/pagemap.h>
 #include <linux/init.h>
-#include <asm/semaphore.h>
 
 #include "sysfs.h"
 
diff -upr linux/fs/sysfs/symlink.c linux.new/fs/sysfs/symlink.c
--- linux/fs/sysfs/symlink.c	2007-07-18 17:40:46.000000000 +0000
+++ linux.new/fs/sysfs/symlink.c	2007-07-18 18:18:38.000000000 +0000
@@ -7,7 +7,7 @@
 #include <linux/module.h>
 #include <linux/kobject.h>
 #include <linux/namei.h>
-#include <asm/semaphore.h>
+#include <linux/mutex.h>
 
 #include "sysfs.h"
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ