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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1382629780-10006-17-git-send-email-tj@kernel.org>
Date:	Thu, 24 Oct 2013 11:49:22 -0400
From:	Tejun Heo <tj@...nel.org>
To:	gregkh@...uxfoundation.org
Cc:	kay@...y.org, linux-kernel@...r.kernel.org, ebiederm@...ssion.com,
	bhelgaas@...gle.com, Tejun Heo <tj@...nel.org>
Subject: [PATCH 16/34] sysfs, kernfs: prepare llseek path for kernfs

We're in the process of separating out core sysfs functionality into
kernfs which will deal with sysfs_dirents directly.  This patch
introduces kernfs_file_llseek() which invokes either
generic_file_llseek() or seq_lseek() depending on the file type so
that both regular and bin files eventually can use the same
file_operations, which is necessary to separate out kernfs.

This patch doesn't introduce any behavior changes.

Signed-off-by: Tejun Heo <tj@...nel.org>
---
 fs/sysfs/file.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 2736ea9..4f99da5 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -356,6 +356,16 @@ out_free:
 	return len;
 }
 
+static loff_t kernfs_file_llseek(struct file *file, loff_t off, int whence)
+{
+	struct sysfs_open_file *of = sysfs_of(file);
+
+	if (sysfs_is_bin(of->sd))
+		return generic_file_llseek(file, off, whence);
+	else
+		return seq_lseek(file, off, whence);
+}
+
 static void sysfs_bin_vma_open(struct vm_area_struct *vma)
 {
 	struct file *file = vma->vm_file;
@@ -854,7 +864,7 @@ EXPORT_SYMBOL_GPL(sysfs_notify);
 const struct file_operations sysfs_file_operations = {
 	.read		= kernfs_file_read,
 	.write		= kernfs_file_write,
-	.llseek		= seq_lseek,
+	.llseek		= kernfs_file_llseek,
 	.open		= sysfs_open_file,
 	.release	= sysfs_release,
 	.poll		= sysfs_poll,
@@ -863,7 +873,7 @@ const struct file_operations sysfs_file_operations = {
 const struct file_operations sysfs_bin_operations = {
 	.read		= kernfs_file_read,
 	.write		= kernfs_file_write,
-	.llseek		= generic_file_llseek,
+	.llseek		= kernfs_file_llseek,
 	.mmap		= sysfs_bin_mmap,
 	.open		= sysfs_open_file,
 	.release	= sysfs_release,
-- 
1.8.3.1

--
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