From b81d033cceee4ef0b9790a27b0a10dfd8e1e3bcd Mon Sep 17 00:00:00 2001
From: Alessandro Rubini <rubini@gnudd.com>
Date: Tue, 31 Jan 2012 23:26:07 +0100
Subject: [PATCH] core: remove the f_flags argument to buffer->create

The argument is a relic of original design and was used incorrectly.

Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
Acked-by: Federico Vaga <federico.vaga@gmail.com>
---
 Documentation/zio/buffer.txt | 7 ++++---
 buffers/zio-buf-kmalloc.c    | 3 +--
 include/linux/zio-buffer.h   | 3 +--
 zio-cdev.c                   | 2 +-
 zio-sys.c                    | 2 +-
 5 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/Documentation/zio/buffer.txt b/Documentation/zio/buffer.txt
index 08b90fa..aee30d8 100644
--- a/Documentation/zio/buffer.txt
+++ b/Documentation/zio/buffer.txt
@@ -42,8 +42,7 @@ of them are implemented in zio-buf-kmalloc.c, which may be used as
 reference to better understand the role of each method:
 
 	struct zio_bi *(*create)(struct zio_buffer_type *zbuf,
-				 struct zio_channel *ch,
-				 fmode_t f_flags);
+				 struct zio_channel *ch);
 	void (*destroy)(struct zio_bi *bi);
 
 The create() operation allocates and initializes an instance of the
@@ -52,7 +51,9 @@ first time. The operation returns a zio buffer instance (zio_bi),
 which is the generic descriptor of a buffer instance. ZIO handles
 only zio_bi, so complex buffer structures must contain the zio_bi
 structure and use container_of() to access the private enclosing
-structure.
+structure. create() can use default attributes of its buffer type at
+creation time; a copy for this specific instance is created by
+zio-core after the function returns.
 
 destroy() deallocates a buffer instance. ZIO calls destroy() when the
 channel is unregistered from ZIO or when the user assigns a different
diff --git a/buffers/zio-buf-kmalloc.c b/buffers/zio-buf-kmalloc.c
index 8b7009a..0155e29 100644
--- a/buffers/zio-buf-kmalloc.c
+++ b/buffers/zio-buf-kmalloc.c
@@ -16,7 +16,6 @@
 #include <linux/fs.h>
 #include <linux/spinlock.h>
 #include <linux/types.h>
-#include <linux/uaccess.h>
 
 #include <linux/zio.h>
 #include <linux/zio-buffer.h>
@@ -202,7 +201,7 @@ out_unlock:
 
 /* Create is called by zio for each channel electing to use this buffer type */
 static struct zio_bi *zbk_create(struct zio_buffer_type *zbuf,
-	struct zio_channel *chan, fmode_t f_flags)
+				 struct zio_channel *chan)
 {
 	struct zbk_instance *zbki;
 
diff --git a/include/linux/zio-buffer.h b/include/linux/zio-buffer.h
index 98b24e4..df987d1 100644
--- a/include/linux/zio-buffer.h
+++ b/include/linux/zio-buffer.h
@@ -124,8 +124,7 @@ struct zio_buffer_operations {
 	struct zio_block *	(*retr_block) (struct zio_bi *bi);
 
 	struct zio_bi *		(*create)(struct zio_buffer_type *zbuf,
-					  struct zio_channel *chan,
-					  fmode_t f_flags);
+					  struct zio_channel *chan);
 	void			(*destroy)(struct zio_bi *bi);
 };
 
diff --git a/zio-cdev.c b/zio-cdev.c
index b6295ef..ab970d1 100644
--- a/zio-cdev.c
+++ b/zio-cdev.c
@@ -124,7 +124,7 @@ static int zio_f_open(struct inode *ino, struct file *f)
 
 	/* if there is no instance, then create a new one */
 	if (!chan->bi)
-		chan->bi = zbuf->b_op->create(zbuf, chan, FMODE_READ);
+		chan->bi = zbuf->b_op->create(zbuf, chan);
 	priv->chan = chan;
 
 	/* even number is control, odd number is data */
diff --git a/zio-sys.c b/zio-sys.c
index bd0d9ea..398f063 100644
--- a/zio-sys.c
+++ b/zio-sys.c
@@ -1005,7 +1005,7 @@ static struct zio_bi *__bi_create_and_init(struct zio_buffer_type *zbuf,
 
 	pr_debug("%s\n", __func__);
 	/* Create buffer */
-	bi = zbuf->b_op->create(zbuf, chan, FMODE_READ);
+	bi = zbuf->b_op->create(zbuf, chan);
 	if (IS_ERR(bi)) {
 		pr_err("ZIO %s: can't create buffer, error %ld\n",
 		       __func__, PTR_ERR(bi));
-- 
GitLab